:root {
  --coral: #ef6b64;
  --coral-dark: #bb453f;
  --coral-soft: #fff3f1;
  --line: #f2b6b1;
  --ink: #282828;
  --muted: #6f7780;
  --page: #f5f1ef;
  --white: #ffffff;
  --shadow: 0 18px 45px rgba(78, 52, 47, 0.12);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 28px 18px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: radial-gradient(circle at 10% 0%, rgba(239, 107, 100, 0.08), transparent 32rem), var(--page);
  font-family: Arial, Helvetica, sans-serif;
}

a { color: inherit; }

.page-card {
  width: min(960px, 100%);
  overflow: hidden;
  border-top: 8px solid var(--coral);
  border-radius: 18px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.brand-header {
  min-height: 155px;
  padding: 24px 36px 18px;
  display: grid;
  grid-template-columns: 132px 1fr 118px;
  align-items: center;
  gap: 24px;
}

.logo-unit { text-align: center; }

.logo-hmc {
  display: block;
  width: 94px;
  height: 94px;
  margin: 0 auto 7px;
  object-fit: contain;
}

.logo-caption {
  display: block;
  color: #858585;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.logo-itss {
  display: block;
  width: 102px;
  height: 108px;
  margin: 0 auto;
  object-fit: contain;
}

.institution { text-align: center; }

.institution h1 {
  margin: 0 0 8px;
  color: #3b3b3b;
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 600;
  line-height: 1.2;
}

.institution p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.document-title {
  margin: 0;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--coral-dark);
  background: var(--coral-soft);
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.content { padding: 34px 46px 42px; }

.content h2 {
  margin: 0 0 10px;
  color: #252525;
  font-size: clamp(24px, 3.5vw, 34px);
  line-height: 1.2;
}

.lead {
  max-width: 760px;
  margin: 0 0 28px;
  color: #565d64;
  font-size: 16px;
  line-height: 1.55;
}

.landing-content h2 { margin-bottom: 24px; }

.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.option-card {
  min-height: 190px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  border: 1px solid #edd3d0;
  border-radius: 15px;
  background: linear-gradient(145deg, #ffffff, #fff9f8);
}

.option-card h3 {
  margin: 0 0 9px;
  color: #343434;
  font-size: 21px;
}

.option-card p {
  margin: 0 0 22px;
  color: #61676d;
  font-size: 15px;
  line-height: 1.5;
}

.button,
button.button {
  min-height: 48px;
  margin-top: auto;
  padding: 13px 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--coral);
  border-radius: 10px;
  color: var(--white);
  background: var(--coral);
  box-shadow: 0 7px 16px rgba(239, 107, 100, 0.22);
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.button:hover,
.button:focus-visible {
  background: #e85c55;
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
}

.button-secondary {
  color: var(--coral-dark);
  background: var(--white);
  box-shadow: none;
}

.button-secondary:hover,
.button-secondary:focus-visible { color: var(--white); }

.search-panel {
  padding: 28px;
  border: 1px solid #edd3d0;
  border-radius: 15px;
  background: #fffafa;
}

.field-label {
  display: block;
  margin-bottom: 9px;
  color: #333333;
  font-size: 15px;
  font-weight: 700;
}

.field-instruction {
  color: #565d64;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
}

.dni-input {
  width: 100%;
  min-height: 52px;
  padding: 13px 15px;
  border: 1px solid #cdd2d7;
  border-radius: 9px;
  color: #222222;
  background: var(--white);
  font: inherit;
  font-size: 17px;
  outline: none;
}

.dni-input:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 4px rgba(239, 107, 100, 0.13);
}

.form-actions {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.form-actions .button {
  min-width: 190px;
  margin-top: 0;
}

.small-note {
  margin: 18px 0 0;
  color: #777d83;
  font-size: 13px;
  line-height: 1.45;
}

.site-footer {
  padding: 16px 24px 20px;
  color: #8b8b8b;
  text-align: center;
  font-size: 12px;
}

/* Descarga de certificados */
.certificate-page { width: min(980px, 100%); }

.certificate-content { padding-bottom: 34px; }

.section-kicker {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--coral-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro-block { margin-bottom: 24px; }

.certificate-search { padding: 24px; }

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.search-button {
  min-width: 210px;
  margin-top: 0;
}

.form-message {
  margin: 16px 0 0;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #8e302b;
  background: var(--coral-soft);
  font-size: 14px;
  line-height: 1.45;
}

.results-view { scroll-margin-top: 20px; }

.results-topbar {
  margin-bottom: 22px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.student-dni {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.new-search-button {
  min-width: 165px;
  margin: 0;
}

.certificate-list {
  display: grid;
  gap: 14px;
}

.certificate-card {
  padding: 20px 20px 20px 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  align-items: center;
  gap: 24px;
  border: 1px solid #edd3d0;
  border-left: 5px solid var(--coral);
  border-radius: 14px;
  background: linear-gradient(135deg, #ffffff 20%, #fff9f8 100%);
}

.certificate-label {
  display: block;
  margin-bottom: 6px;
  color: #278559;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.certificate-card h3 {
  margin: 0 0 7px;
  color: #303030;
  font-size: 20px;
  line-height: 1.25;
}

.certificate-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.download-button {
  width: 100%;
  min-width: 0;
  margin: 0;
}

.certificate-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.certificate-actions .button {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding-right: 14px;
  padding-left: 14px;
}

.preview-button {
  color: var(--coral-dark);
  background: var(--white);
  box-shadow: none;
}

.validation-quiet-link {
  margin: 26px 0 0;
  text-align: right;
}

.validation-quiet-link a {
  color: #7b7b7b;
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

[hidden] { display: none !important; }

@media (max-width: 700px) {
  body {
    padding: 12px;
    place-items: start center;
  }

  .page-card { border-radius: 14px; }

  .brand-header {
    min-height: auto;
    padding: 22px 18px 16px;
    grid-template-columns: 78px 1fr 72px;
    gap: 10px;
  }

  .logo-hmc {
    width: 66px;
    height: 66px;
    margin-bottom: 5px;
  }

  .logo-itss {
    width: 65px;
    height: 72px;
  }

  .logo-caption { font-size: 7px; }
  .institution h1 { font-size: 17px; }
  .institution p { font-size: 10px; }

  .document-title {
    padding: 12px 14px;
    font-size: 14px;
  }

  .content { padding: 26px 20px 30px; }
  .content h2 { font-size: 25px; }
  .lead { font-size: 15px; }
  .options-grid { grid-template-columns: 1fr; }
  .option-card { min-height: 0; }
  .search-panel { padding: 20px; }

  .form-actions,
  .results-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions .button,
  .new-search-button { width: 100%; }

  .search-row { grid-template-columns: 1fr; }
  .search-button { width: 100%; }

  .certificate-card {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .certificate-actions { flex-direction: column; }
  .validation-quiet-link { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
