/* Manrope (licencia OFL-1.1, ver fonts/OFL.txt), alojada en el propio sitio para no cargar nada de Google. */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("fonts/manrope-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("fonts/manrope-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* Web B (listas de interinos). Estetica "marcador de progreso", ver SD14 seccion 3.4.
   Tokens de color en :root; modo oscuro con prefers-color-scheme.
   Fuente: Manrope alojada en fonts/. */

:root {
  color-scheme: light dark;
  --fondo: #f2f5fa;
  --superficie: #ffffff;
  --borde: #d9e0ee;
  --texto: #14213d;
  --texto-suave: #4a5876;
  --marca: #3b4fd8;
  --marca-fuerte: #2a3bb0;
  --lima: #b6f23a;
  --lima-texto: #1c2a00;
  --ambar: #f5a524;
  --ambar-texto: #8a4b00;
  --error: #b42318;
  --error-fondo: #fdecea;
  --sombra: 0 1px 2px rgba(20, 33, 61, 0.06), 0 4px 16px rgba(20, 33, 61, 0.06);
  --radio: 14px;
  --sobre-marca: #ffffff;
  --borde-control: #7c89a8;
  --fuente: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

:root[data-tema="claro"] { color-scheme: light; }

:root[data-tema="oscuro"] {
  color-scheme: dark;
  --fondo: #0f1626;
  --superficie: #18213a;
  --borde: #2b3656;
  --texto: #eaf0ff;
  --texto-suave: #a9b6d6;
  --marca: #8c9bff;
  --marca-fuerte: #aab5ff;
  --lima-texto: #1c2a00;
  --ambar-texto: #ffcf7a;
  --error: #ff9f94;
  --error-fondo: #3a1d1b;
  --sombra: none;
  --sobre-marca: #0f1626;
  --borde-control: #7584ad;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    --fondo: #0f1626;
    --superficie: #18213a;
    --borde: #2b3656;
    --texto: #eaf0ff;
    --texto-suave: #a9b6d6;
    --marca: #8c9bff;
    --marca-fuerte: #aab5ff;
    --ambar-texto: #ffcf7a;
    --error: #ff9f94;
    --error-fondo: #3a1d1b;
    --sombra: none;
    --sobre-marca: #0f1626;
    --borde-control: #7584ad;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: var(--fuente);
  font-size: 1rem;
  line-height: 1.55;
}

a { color: var(--marca); text-underline-offset: 0.18em; }
a:hover { color: var(--marca-fuerte); }

:focus-visible {
  outline: 3px solid var(--marca);
  outline-offset: 2px;
}

.salto {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--marca);
  color: var(--sobre-marca);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  z-index: 10;
}
.salto:focus { top: 1rem; }

.contenedor { width: min(1080px, 100% - 2rem); margin-inline: auto; }

/* Cabecera */
.cabecera { padding: 1rem 0; }
.cabecera .contenedor { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.marca { font-weight: 800; letter-spacing: -0.01em; color: var(--texto); text-decoration: none; display: inline-flex; align-items: center; gap: 0.5rem; }
.marca-icono { width: 1.6rem; height: 1.6rem; border-radius: 8px; background: var(--marca); display: inline-block; position: relative; }
.marca-icono::after { content: ""; position: absolute; inset: 0.45rem; border-radius: 50%; background: var(--lima); }
.nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.nav a { color: var(--texto-suave); text-decoration: none; font-weight: 600; padding: 0.6rem 0; border-bottom: 2px solid transparent; }
.nav a[aria-current="page"], .nav a:hover { color: var(--texto); border-bottom-color: var(--marca); }

/* Portada */
.portada { padding: 1.5rem 0 1rem; }
.portada h1 { font-size: clamp(1.7rem, 4.2vw, 2.6rem); line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 0.6rem; max-width: 20ch; text-wrap: balance; }
.verificado { margin: 0 0 1rem; color: var(--texto-suave); font-size: 0.95rem; }
.verificado strong { color: var(--texto); }
.aviso {
  background: color-mix(in srgb, var(--ambar) 14%, var(--superficie));
  border: 1px solid color-mix(in srgb, var(--ambar) 55%, var(--borde));
  border-radius: 10px;
  padding: 0.8rem 1rem;
  max-width: 62ch;
  margin: 0;
}

/* Rejilla principal */
.rejilla { display: grid; gap: 1.25rem; padding-bottom: 3rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) {
  .rejilla { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 1.75rem; }
}

/* Tarjetas de formulario */
.tarjeta {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  margin-bottom: 1rem;
}
.tarjeta > summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 800;
  font-size: 1.1rem;
}
.tarjeta > summary::-webkit-details-marker { display: none; }
.tarjeta > summary::after {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--texto-suave);
  border-bottom: 2px solid var(--texto-suave);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  flex: none;
}
.tarjeta[open] > summary::after { transform: rotate(-135deg); }
.tarjeta .parcial { margin-left: auto; white-space: nowrap; font-weight: 700; font-size: 0.9rem; color: var(--texto-suave); font-variant-numeric: tabular-nums; }
.tarjeta .cuerpo { padding: 0 1.25rem 1.25rem; display: grid; gap: 1rem; }

.campo { display: grid; gap: 0.3rem; }
.campo label, .campo .etiqueta { font-weight: 700; }
.campo .ayuda { color: var(--texto-suave); font-size: 0.9rem; margin: 0; }
.campo .ayuda strong { color: var(--texto); }
.campo input[type="text"] {
  font: inherit;
  font-variant-numeric: tabular-nums;
  width: 100%;
  max-width: 14rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1.5px solid var(--borde-control);
  background: var(--fondo);
  color: var(--texto);
  min-height: 2.75rem;
}
.campo input[type="text"]:hover { border-color: var(--texto-suave); }
.campo input[aria-invalid="true"] { border-color: var(--error); background: var(--error-fondo); }
.campo .error { color: var(--error); font-weight: 600; font-size: 0.92rem; margin: 0; }

.opcion { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.6rem 0; cursor: pointer; }
.opcion input { width: 1.25rem; height: 1.25rem; margin-top: 0.2rem; accent-color: var(--marca); flex: none; }
.opcion[hidden] { display: none; }
.grupo { border: 0; margin: 0; padding: 0; display: grid; gap: 0.1rem; }
.grupo legend { font-weight: 700; padding: 0; margin-bottom: 0.3rem; }
.nota-reglas {
  background: var(--fondo);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  color: var(--texto-suave);
  font-size: 0.92rem;
  margin: 0;
}

.paso { display: inline-flex; align-items: center; gap: 0.5rem; }
.paso button {
  width: 2.75rem; height: 2.75rem; border-radius: 10px; border: 1.5px solid var(--borde-control);
  background: var(--superficie); color: var(--texto); font: inherit; font-size: 1.3rem; font-weight: 700; cursor: pointer;
}
.paso button:hover { border-color: var(--marca); color: var(--marca); }
.paso input { text-align: center; max-width: 5rem !important; }

/* Marcador */
.marcador-caja { position: sticky; top: 0.75rem; z-index: 5; }
@media (min-width: 900px) { .marcador { max-height: calc(100vh - 1.5rem); overflow: auto; } }
.marcador {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
}
.anillo { position: relative; width: 11rem; aspect-ratio: 1; margin-inline: auto; }
.anillo svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.anillo .pista { stroke: var(--borde); }
.anillo .avance { stroke: var(--marca); transition: stroke-dashoffset 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
.anillo .centro { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.total { font-size: 2.6rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.etiqueta-total { font-size: 0.85rem; color: var(--texto-suave); font-weight: 600; }
.faltan { text-align: center; margin: 0; font-weight: 700; color: var(--ambar-texto); }
.faltan span { font-variant-numeric: tabular-nums; }

.barras { display: grid; gap: 0.6rem; margin: 0; padding: 0; list-style: none; }
.barras li { display: grid; gap: 0.25rem; font-size: 0.88rem; }
.barras .fila { display: flex; justify-content: space-between; gap: 0.5rem; font-weight: 600; }
.barras .valor { font-variant-numeric: tabular-nums; color: var(--texto-suave); }
.pista-barra { height: 0.7rem; background: var(--borde); border: 1.5px solid var(--borde-control); border-radius: 999px; overflow: hidden; }
.relleno { display: block; height: 100%; width: 100%; background: var(--lima); border-radius: 999px; transform: scaleX(0); transform-origin: left center; transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
.adicional { margin: 0; padding-top: 0.6rem; border-top: 1px solid var(--borde); font-size: 0.9rem; color: var(--texto-suave); display: flex; justify-content: space-between; gap: 0.5rem; }
.adicional strong { color: var(--texto); font-variant-numeric: tabular-nums; }

.estado-error { margin: 0; text-align: center; font-weight: 700; color: var(--error); }

.acciones { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.boton {
  font: inherit; font-weight: 700; cursor: pointer; border-radius: 10px; padding: 0.7rem 1rem; min-height: 2.75rem;
  border: 1.5px solid var(--marca); background: var(--marca); color: var(--sobre-marca);
}
.boton:hover { background: var(--marca-fuerte); border-color: var(--marca-fuerte); }
.boton.secundario { background: transparent; color: var(--marca); }
.boton.secundario:hover { background: var(--fondo); color: var(--marca-fuerte); }
.copiado { margin: 0; color: var(--texto-suave); font-size: 0.9rem; min-height: 1.4em; }

/* Movil: el marcador pasa a una barra fija superior compacta */
@media (max-width: 899px) {
  html { scroll-padding-top: 6rem; }
  .rejilla { display: flex; flex-direction: column; }
  .marcador-caja { order: -1; top: 0; margin-inline: -1rem; align-self: stretch; }
  .marcador { border-radius: 0 0 var(--radio) var(--radio); padding: 0.6rem 1rem; grid-template-columns: auto 1fr; align-items: center; gap: 0.2rem 1rem; }
  .anillo { width: 4.2rem; margin: 0; }
  .total { font-size: 1.3rem; }
  .etiqueta-total { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .barras, .adicional { display: none; }
  .faltan { text-align: left; font-size: 0.9rem; }
  .estado-error { grid-column: 1 / -1; }
}

/* Detalle y texto de apoyo */
.detalle { margin: 0 0 1rem; }
.detalle ol { margin: 0.5rem 0 0; padding-left: 1.2rem; display: grid; gap: 0.35rem; }
.detalle li span { font-variant-numeric: tabular-nums; font-weight: 700; }
.texto { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.25rem 1.5rem; box-shadow: var(--sombra); max-width: 70ch; }
.texto h2 { font-size: 1.25rem; margin: 1.5rem 0 0.4rem; letter-spacing: -0.01em; }
.texto h2:first-child { margin-top: 0; }
.texto p, .texto li { max-width: 65ch; }
.texto table { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1rem; font-size: 0.95rem; }
.texto th, .texto td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--borde); vertical-align: top; }
.texto th { color: var(--texto-suave); font-weight: 700; }
.texto td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sello { display: inline-block; background: var(--lima); color: var(--lima-texto); font-weight: 800; font-size: 0.8rem; padding: 0.2rem 0.6rem; border-radius: 999px; }

.pie { border-top: 1px solid var(--borde); padding: 1.5rem 0 3rem; color: var(--texto-suave); font-size: 0.9rem; }
.pie p { max-width: 70ch; margin: 0 0 0.6rem; }

/* Movimiento reducido: sin transiciones */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Texto solo para lector de pantalla */
.solo-lector { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Titulos de tarjeta (h2 dentro de summary) */
.titulo-tarjeta { font-size: inherit; font-weight: inherit; margin: 0; }

/* Tabla con desplazamiento horizontal en pantallas estrechas */
.tabla-scroll { overflow-x: auto; }

/* Contraste alto y colores forzados */
@media (prefers-contrast: more) {
  :root { --borde: var(--texto-suave); --borde-control: var(--texto); }
}
@media (forced-colors: active) {
  .relleno { background: Highlight; forced-color-adjust: none; }
  .pista-barra { border: 1px solid CanvasText; }
  .anillo .avance { stroke: Highlight; }
  .anillo .pista { stroke: CanvasText; }
  .sello { border: 1px solid CanvasText; }
}

/* Glosario */
.glosario dt { font-weight: 800; margin-top: 1rem; }
.glosario dt:first-child { margin-top: 0; }
.glosario dd { margin: 0.2rem 0 0; max-width: 65ch; }
