:root {
  --brand-primary: #0B5FCC;
  --brand-primary-hover: #0A4CA6;
  --rescue-emergency: #E5352B;
  --rescue-text: #C21F1A;
  --health-green: #34D399;
  --ink: #0B1220;
  --muted: #47536B;
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --surface-soft: #EEF1F6;
  --border: #E4E8EE;
  --primary: var(--brand-primary);
  --primary-dark: var(--brand-primary-hover);
  --warning: var(--rescue-emergency);
  --danger: var(--rescue-text);
  --success: var(--health-green);
  --shadow: 0 18px 45px rgba(11, 18, 32, 0.08);
  --radius: 8px;
  --font-display: "Archivo", sans-serif;
  --font-body: "Public Sans", sans-serif;
  --font-label: "Space Mono", monospace;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-size: 19px;
  line-height: 1.7;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}

.topbar, main, .site-footer {
  width: min(820px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.brand { display: inline-flex; }
.brand img { max-width: 100%; height: auto; }
.topnav { display: flex; gap: 18px; flex-wrap: wrap; font-size: 16px; }

/* ------------------------------ intro ------------------------------ */

.intro { margin: 12px 0 32px; }

h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(28px, 5.2vw, 42px);
  line-height: 1.18;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}

.lead { margin: 0 0 14px; font-size: 20px; }

/* Lo primero que se lee tras el titular. El Test sí pide correo; esto no, y
   hay que decirlo antes de que decidan irse. */
.gratis {
  margin: 0 0 20px;
  padding: 16px 20px;
  background: var(--surface);
  border-left: 5px solid var(--success);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 18px;
  line-height: 1.6;
}
.gratis strong { display: block; margin-bottom: 4px; font-size: 19px; }

.privacidad { margin: 0; font-size: 16px; color: var(--muted); }

/* ------------------------------ pasos ------------------------------ */

.pasos {
  display: flex;
  gap: 6px;
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  counter-reset: paso;
}

.paso-punto {
  flex: 1;
  border-top: 4px solid var(--border);
  padding-top: 10px;
  font-size: 13px;
  color: var(--muted);
  font-family: var(--font-label);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.3;
}
.paso-punto.is-actual, .paso-punto.is-hecho {
  border-top-color: var(--primary);
  color: var(--ink);
}
.paso-punto span { display: block; }

/* ------------------------------ formulario ------------------------------ */

form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 36px);
}

.paso[hidden] { display: none; }

.paso-titulo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  margin: 0 0 24px;
  letter-spacing: -0.01em;
}

.campo { border: 0; padding: 0; margin: 0 0 32px; }
.campo:last-of-type { margin-bottom: 0; }

legend, .etiqueta {
  display: block;
  font-weight: 700;
  font-size: 19px;
  margin-bottom: 8px;
  padding: 0;
  line-height: 1.4;
}

.ayuda {
  margin: 0 0 14px;
  font-size: 16px;
  color: var(--muted);
  line-height: 1.6;
}
.ayuda strong { color: var(--ink); }

/* ------------------------------ tarjetas ------------------------------ */

.tarjetas { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tarjetas-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 620px) {
  .tarjetas, .tarjetas-3 { grid-template-columns: 1fr; }
}

.tarjeta {
  position: relative;
  display: block;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.tarjeta:hover { border-color: var(--primary); }

.tarjeta input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.tarjeta:has(input:checked) {
  border-color: var(--primary);
  background: var(--surface-soft);
}
.tarjeta:has(input:focus-visible) {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.tarjeta-cuerpo { display: block; }
.tarjeta-titulo { display: block; font-weight: 700; font-size: 18px; line-height: 1.35; }
.tarjeta-nota { display: block; font-size: 15px; color: var(--muted); margin-top: 4px; line-height: 1.45; }

/* ------------------------------ entradas ------------------------------ */

.entrada-euros { display: flex; align-items: stretch; max-width: 340px; }

.entrada-euros input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 22px;
  font-weight: 700;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--surface);
  color: var(--ink);
}
.entrada-euros input:focus { outline: none; border-color: var(--primary); }
.entrada-euros:focus-within { outline: 3px solid var(--primary); outline-offset: 3px; border-radius: var(--radius); }

.sufijo {
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: var(--surface-soft);
  border: 2px solid var(--border);
  border-left: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 15px;
  color: var(--muted);
  white-space: nowrap;
}

.campo-revelado { margin-top: 16px; }
.campo-revelado[hidden] { display: none; }

.error {
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 16px;
  font-weight: 600;
  min-height: 0;
}
.error:empty { display: none; }

input[aria-invalid="true"] { border-color: var(--danger); }

/* ------------------------------ sumador ------------------------------ */

.sumador {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 14px 16px;
}
.sumador summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 17px;
  color: var(--primary-dark);
}
.sumador[open] summary { margin-bottom: 12px; }

.sumador-filas { display: grid; gap: 10px; }

.sumador-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.sumador-fila label { font-size: 16px; flex: 1 1 200px; }
.sumador-fila input {
  width: 120px;
  font-size: 17px;
  padding: 8px 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.sumador-total { margin: 14px 0 0; font-size: 17px; }
.sumador-total strong { font-family: var(--font-label); font-size: 19px; }

.enlace-boton {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--primary-dark);
  text-decoration: underline;
  cursor: pointer;
}

/* Enlaces de contexto dentro de las preguntas. Abren en pestaña nueva a
   propósito: no guardamos nada, así que salir de la página pierde el
   formulario entero. */
.saber-mas {
  display: inline-block;
  margin-top: 6px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: underline;
}
.saber-mas::before { content: "→ "; text-decoration: none; }

/* Visible solo para lectores de pantalla. */
.nueva-pestana {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.escape {
  margin: 28px 0 0;
  padding: 14px 16px;
  background: var(--surface-soft);
  border-radius: var(--radius);
  font-size: 16px;
  color: var(--muted);
}

/* ------------------------------ navegación ------------------------------ */

.navegacion { display: flex; gap: 12px; margin-top: 32px; flex-wrap: wrap; }

.boton {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 18px;
  padding: 14px 26px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  text-align: center;
  line-height: 1.3;
}
.boton[hidden] { display: none; }

.boton-primario { background: var(--primary); color: #fff; }
.boton-primario:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }

.boton-secundario { background: transparent; color: var(--primary-dark); border-color: var(--border); }
.boton-secundario:hover { border-color: var(--primary); text-decoration: none; }

/* Reanclan el sujeto cuando dentro de un mismo paso cambia de qué estamos
   hablando. Sin esto, los deícticos («para esto») se pegan a la pregunta
   anterior en vez de a la que toca. */
.subseccion-nota {
  margin: 0 0 22px;
  font-size: 17px;
  color: var(--muted);
}
.subseccion-nota strong { color: var(--ink); }

.subseccion-corte {
  margin-top: 34px;
  padding-top: 22px;
  border-top: 2px solid var(--border);
}

.sin-peaje {
  margin: 14px 0 0;
  font-size: 16px;
  color: var(--muted);
  line-height: 1.55;
}
.sin-peaje[hidden] { display: none; }

/* ------------------------------ resultado ------------------------------ */

.resultado {
  margin: 32px 0 48px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 36px);
}
.resultado[hidden] { display: none; }

.resultado-titulo {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(24px, 4.4vw, 34px);
  margin: 0 0 12px;
  line-height: 1.2;
  letter-spacing: -0.015em;
}
.resultado-explicacion { margin: 0 0 28px; font-size: 19px; }

.tarjeta-hito {
  background: var(--surface-soft);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}

.hito-etiqueta, .horizonte-etiqueta {
  margin: 0 0 6px;
  font-family: var(--font-label);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.hito-cifra {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(36px, 8vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--primary-dark);
}
.hito-nota { margin: 8px 0 0; font-size: 17px; color: var(--muted); }

.barra {
  margin-top: 18px;
  height: 14px;
  background: #D8DEE8;
  border-radius: 999px;
  overflow: hidden;
}
.barra-relleno {
  height: 100%;
  width: 0;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.barra-pie { margin: 8px 0 0; font-size: 16px; color: var(--muted); }

.tarjeta-horizonte {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 28px;
}
.horizonte-cifra {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(24px, 4.5vw, 32px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.horizonte-nota { margin: 8px 0 0; font-size: 16px; color: var(--muted); }

.bloque { margin-bottom: 26px; }
.bloque h3 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 21px;
  margin: 0 0 8px;
}
.bloque p { margin: 0; }
.bloque[hidden] { display: none; }

.aceleradores { margin: 0; padding-left: 22px; }
.aceleradores li { margin-bottom: 6px; }

.cta { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin: 32px 0 24px; }
.cta-secundario { font-size: 17px; }
.cta-secundario[hidden] { display: none; }

.aviso {
  font-size: 15px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin: 0 0 16px;
}

/* ------------------------------ pie ------------------------------ */

.site-footer {
  padding: 28px 0 40px;
  font-size: 15px;
  color: var(--muted);
}

/* ------------------------------ accesibilidad ------------------------------ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
