/* =============================================================
   Netley Language Studio — Prueba de nivel online
   Mobile first. Sin frameworks. Fuentes locales de la web.
   ============================================================= */

@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/outfit-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/assets/fonts/inter-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 400 500;
  font-display: swap;
  src: url('/assets/fonts/fraunces-italic-latin.woff2') format('woff2');
}

:root {
  --navy: #004563;
  --navy-deep: #003649;
  --rojo: #b20000;
  --rojo-deep: #8f0000;
  --crema: #f5f1ec;
  --menta: #cfe6dc;
  --menta-deep: #9fcbb8;
  --blanco: #ffffff;
  --tinta: #1f3540;
  --tinta-suave: #4d6470;     /* 5,9:1 sobre crema */
  --linea: rgba(0, 69, 99, .18);
  --linea-fuerte: #6b8794;     /* bordes de campos y opciones: 3,6:1 sobre blanco */
  --display: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --serif: 'Fraunces', Georgia, serif;
  --radio: 14px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  font-size: 1.0625rem;          /* 17 px */
  line-height: 1.55;
  color: var(--tinta);
  background: var(--crema);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
a { color: var(--navy); text-underline-offset: .18em; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }

:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 3px;
  border-radius: 6px;
}
/* Los títulos reciben el foco por código al cambiar de pantalla: sin contorno. */
[tabindex="-1"]:focus { outline: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 10;
  background: var(--navy); color: var(--crema); padding: .7rem 1rem;
  border-radius: 8px; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* ---------- Cabecera ---------- */
.cab { background: var(--crema); border-bottom: 1px solid var(--linea); }
.cab-in {
  max-width: 640px; margin-inline: auto;
  padding: .6rem 1.15rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.logo {
  display: inline-flex; align-items: center; gap: .65rem;
  color: var(--navy); text-decoration: none; min-height: 44px;
}
.logo-circulo { flex: none; }
.logo-texto {
  display: flex; flex-direction: column;
  font-family: var(--display); font-weight: 700; font-size: 1.05rem;
  letter-spacing: .17em; text-transform: uppercase; line-height: 1;
}
.logo-sub {
  font-size: .56rem; font-weight: 500; letter-spacing: .3em;
  color: var(--tinta-suave); margin-top: .32rem;
}
.cab-volver {
  font-family: var(--display); font-weight: 500; font-size: 1rem;
  min-height: 44px; display: inline-flex; align-items: center;
  padding-inline: .25rem;
}

/* ---------- Contenedor ---------- */
.app {
  flex: 1;
  width: 100%; max-width: 640px; margin-inline: auto;
  padding: 1.25rem 1.15rem 3rem;
}
.app:focus { outline: none; }

/* ---------- Progreso ---------- */
.progreso { margin-bottom: 1.5rem; }
.progreso-fila {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-bottom: .55rem;
}
.atras {
  display: inline-flex; align-items: center; gap: .3rem;
  min-height: 44px; padding: 0 .75rem 0 .35rem; margin-left: -.35rem;
  background: none; border: 0; border-radius: 999px;
  font-family: var(--display); font-weight: 500; font-size: 1rem; color: var(--navy);
}
.atras:active { background: rgba(0, 69, 99, .08); }
.progreso-texto {
  font-family: var(--display); font-weight: 500; font-size: 1rem;
  color: var(--tinta-suave); font-variant-numeric: tabular-nums;
}
.progreso-barra {
  height: 6px; border-radius: 999px; overflow: hidden;
  background: rgba(0, 69, 99, .12);
}
.progreso-barra span {
  display: block; height: 100%; width: 0;
  background: var(--navy); border-radius: inherit;
}

/* ---------- Tipografía de pantallas ---------- */
.antetitulo {
  font-family: var(--display); font-weight: 600; font-size: 1rem;
  letter-spacing: .02em; color: var(--rojo); margin-bottom: .6rem;
}
.titulo {
  font-family: var(--display); font-weight: 700; color: var(--navy);
  font-size: clamp(2.1rem, 9vw, 2.9rem); line-height: 1.04; letter-spacing: -.025em;
  text-wrap: balance;
}
.titulo-2 { display: block; font-weight: 500; color: var(--tinta); margin-top: .2rem; font-size: .62em; letter-spacing: -.015em; }
.titulo-paso {
  font-family: var(--display); font-weight: 700; color: var(--navy);
  font-size: clamp(1.6rem, 6.5vw, 2rem); line-height: 1.12; letter-spacing: -.02em;
  text-wrap: balance;
}
.entradilla { font-size: 1.0625rem; margin-top: 1rem; }
[data-paso="listo"] .entradilla { margin-bottom: 1.75rem; }
.ayuda { color: var(--tinta-suave); font-size: 1rem; margin-top: .45rem; }
.ayuda-centro { text-align: center; }

.puntos { list-style: none; padding: 0; margin: 1.4rem 0 1.8rem; display: grid; gap: .7rem; }
.puntos li { position: relative; padding-left: 1.6rem; }
.puntos li::before {
  /* triángulo rojo del anagrama */
  content: ""; position: absolute; left: 0; top: .42em;
  width: .72rem; height: .72rem; background: var(--rojo);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.firma { margin-top: 1rem; text-align: center; color: var(--tinta-suave); font-size: 1rem; }
.firma strong { color: var(--navy); font-weight: 600; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 56px; padding: .9rem 1.5rem;
  border-radius: 999px; border: 2px solid transparent;
  font-family: var(--display); font-weight: 600; font-size: 1.125rem; line-height: 1.2;
  text-align: center; text-decoration: none;
  transition: background-color .2s var(--ease), transform .12s var(--ease);
}
.btn:active { transform: scale(.98); }
.btn-ancho { width: 100%; }
.btn-primario { background: var(--rojo); color: #fff; }
.btn-primario:hover { background: var(--rojo-deep); }
.btn-primario[disabled] { background: var(--tinta-suave); cursor: default; }
.btn-secundario { background: transparent; color: var(--navy); border-color: var(--linea-fuerte); margin-top: 1rem; }
.btn-secundario:hover { border-color: var(--navy); }

/* ---------- Opciones (respuestas y grupos) ---------- */
.opciones { display: grid; gap: .75rem; margin-top: 1.5rem; }
.opcion {
  width: 100%; min-height: 64px;
  display: flex; align-items: center; gap: .9rem;
  padding: .9rem 1.1rem;
  background: var(--blanco); color: var(--navy);
  border: 2px solid var(--linea-fuerte); border-radius: var(--radio);
  font-family: var(--display); font-weight: 500; font-size: 1.2rem; line-height: 1.25;
  text-align: left;
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.opcion:hover { border-color: var(--navy); }
.opcion:active { background: var(--menta); }
.opcion[aria-pressed="true"] { background: var(--menta); border-color: var(--navy); }
.opcion-letra {
  flex: none; width: 2rem; height: 2rem; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid var(--linea-fuerte);
  font-size: .95rem; font-weight: 600; color: var(--tinta-suave);
}
.opcion[aria-pressed="true"] .opcion-letra { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- Pregunta ---------- */
.pregunta {
  font-family: var(--display); font-weight: 600; color: var(--navy);
  font-size: clamp(1.55rem, 6.4vw, 2rem); line-height: 1.25; letter-spacing: -.015em;
}
.hueco {
  display: inline-block; min-width: 3.2em; margin-inline: .1em;
  border-bottom: 3px solid var(--rojo); transform: translateY(-.12em);
}
.pista { margin-top: .5rem; color: var(--tinta-suave); font-size: 1rem; }

/* ---------- Formulario ---------- */
.form { margin-top: 1.4rem; display: grid; gap: 1.1rem; }
.campo { display: grid; gap: .35rem; }
.campo label, .menor legend { font-weight: 600; font-size: 1rem; color: var(--tinta); }
.req, .opc { font-weight: 400; color: var(--tinta-suave); }
input[type="text"], input[type="tel"], input[type="email"], select {
  width: 100%; min-height: 52px; padding: .7rem .9rem;
  font-size: 1.0625rem;
  background: var(--blanco); border: 2px solid var(--linea-fuerte); border-radius: 10px;
}
select { appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23004563' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center; background-size: 1.25rem;
  padding-right: 2.6rem;
}
input:focus-visible, select:focus-visible { border-color: var(--navy); outline-offset: 1px; }
[aria-invalid="true"] { border-color: var(--rojo) !important; }
.campo-error { color: var(--rojo); font-size: 1rem; font-weight: 500; }
.campo-error:empty { display: none; }

.menor {
  border: 0; padding: 1rem; margin: 0;
  background: var(--blanco); border-radius: var(--radio);
  display: grid; gap: 1rem;
}
.menor legend { float: left; width: 100%; padding: 0; font-family: var(--display); font-size: 1.1rem; color: var(--navy); }

.check { display: flex; gap: .75rem; align-items: flex-start; }
.check input {
  flex: none; width: 26px; height: 26px; margin: .1rem 0 0;
  accent-color: var(--navy);
}
.check label { font-size: 1rem; cursor: pointer; padding-block: .1rem; }

.rgpd {
  font-size: 1rem; color: var(--tinta);
  background: var(--blanco); border-radius: var(--radio);
  padding: 1rem;
}
.rgpd-titulo { font-family: var(--display); font-weight: 600; color: var(--navy); margin-bottom: .5rem; }
.rgpd dl { display: grid; gap: .45rem; margin-bottom: .6rem; }
.rgpd dt { font-weight: 600; }
.rgpd dd { margin: 0; color: var(--tinta-suave); }
.rgpd a { font-weight: 500; }

.trampa { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Avisos ---------- */
.aviso { border-radius: var(--radio); padding: 1rem 1.1rem; margin-top: 1.25rem; font-size: 1rem; }
.aviso-familia { background: var(--menta); color: var(--navy-deep); margin-bottom: 1.5rem; }
.aviso-error { background: #fbe9e9; color: #6e0000; border: 2px solid var(--rojo); }
.aviso-error a { color: #6e0000; font-weight: 700; }
.aviso-ok { background: var(--menta); color: var(--navy-deep); }
.estado { margin-top: .75rem; color: var(--tinta-suave); font-size: 1rem; text-align: center; }
.estado:empty { display: none; }

/* ---------- Resultado ---------- */
.resultado { text-align: left; }
.nivel {
  font-family: var(--display); font-weight: 700; color: var(--navy);
  font-size: clamp(5rem, 30vw, 8rem); line-height: .9; letter-spacing: -.04em;
}
.nivel-largo { font-size: clamp(3.4rem, 19vw, 6rem); letter-spacing: -.03em; }
.nivel-frase { font-size: 1.15rem; margin-top: .9rem; max-width: 34ch; }
.aciertos { color: var(--tinta-suave); font-size: 1rem; margin-top: .6rem; }

/* Escalera de niveles: el elemento propio de la página */
.escalera {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  align-items: end; gap: 6px;
  height: 132px; margin-top: 1.6rem;
  border-bottom: 2px solid var(--navy);
}
.peldano { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.peldano-bloque {
  border-radius: 6px 6px 0 0;
  background: rgba(0, 69, 99, .12);
  transform-origin: bottom;
}
.peldano.es-pasado .peldano-bloque { background: var(--menta-deep); }
.peldano.es-actual .peldano-bloque { background: var(--rojo); }
.peldano-et {
  font-family: var(--display); font-weight: 600; font-size: 1rem;
  color: var(--tinta-suave); text-align: center; padding-bottom: .3rem;
}
.peldano.es-actual .peldano-et { color: var(--rojo); }

@media (prefers-reduced-motion: no-preference) {
  .escalera.anima .peldano.es-actual .peldano-bloque {
    animation: subir .7s var(--ease) .15s both;
  }
}
@keyframes subir { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.curso {
  margin-top: 1.75rem; padding: 1.2rem 1.15rem;
  background: var(--navy); color: var(--crema); border-radius: var(--radio);
}
.curso-ante { font-family: var(--display); font-weight: 500; font-size: 1rem; color: var(--menta); }
.curso-nombre { font-family: var(--display); font-weight: 700; font-size: 1.6rem; line-height: 1.15; color: #fff; margin-top: .15rem; }
.curso-nombre-2 { font-size: 1.35rem; }
.curso-y { font-weight: 500; font-size: 1rem; color: var(--menta); }
.curso-texto { margin-top: .4rem; font-size: 1rem; color: rgba(245, 241, 236, .9); }
.curso-extra { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid rgba(245, 241, 236, .25); }

.confirmar {
  margin: 1.25rem 0 1.5rem; padding-left: .9rem;
  border-left: 3px solid var(--rojo); font-size: 1rem;
}
.telefono {
  margin: 2rem 0 0; padding: 1.1rem; text-align: center;
  background: var(--blanco); border-radius: var(--radio);
}
.telefono-num { font-family: var(--display); font-weight: 600; font-size: 1.35rem; color: var(--navy); margin-top: .2rem; }
.telefono-num a { font-weight: 700; }

/* ---------- Pie ---------- */
.pie { background: var(--navy); color: var(--crema); padding: 2.2rem 0 1.5rem; }
.pie-in { max-width: 640px; margin-inline: auto; padding-inline: 1.15rem; display: grid; gap: 1.4rem; }
.pie a { color: var(--crema); }
.logo-pie { color: var(--crema); min-height: 0; }
.logo-pie .logo-sub { color: rgba(245, 241, 236, .78); }
.pie-claim { margin-top: .7rem; font-family: var(--serif); font-style: italic; font-size: 1.05rem; color: rgba(245, 241, 236, .85); }
.pie-contacto p { font-size: 1rem; margin-bottom: .35rem; }
.pie-contacto a, .pie-legal a { display: inline-block; padding-block: .3rem; }
.pie-legal { display: flex; flex-wrap: wrap; gap: .2rem 1.2rem; font-size: 1rem; border-top: 1px solid rgba(245, 241, 236, .2); padding-top: 1rem; }
.pie-copy { font-size: 1rem; color: rgba(245, 241, 236, .78); }

/* ---------- Pantallas más anchas ---------- */
@media (min-width: 700px) {
  .app { padding-top: 2.5rem; }
  .btn-ancho { width: auto; min-width: 280px; }
  .cta-prueba .btn-ancho, .resultado > .btn-ancho { width: 100%; }
}

/* Sin animaciones si el sistema lo pide */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
