/*
 * Mont se toma de las fuentes instaladas en el equipo; no se distribuye con el sitio
 * (falta confirmar su licencia web). Donde no está instalada se usa Montserrat
 * (SIL OFL 1.1), que sí viaja con el sitio en fuentes/. Montserrat solo se descarga
 * si Mont no está disponible.
 */
@font-face { font-family: "Mont Local"; src: local("Mont-Book"), local("Mont Book"); font-weight: 400; font-style: normal; }
@font-face { font-family: "Mont Local"; src: local("Mont-SemiBold"), local("Mont SemiBold"); font-weight: 600; font-style: normal; }
@font-face { font-family: "Mont Local"; src: local("Mont-Black"), local("Mont Black"); font-weight: 900; font-style: normal; }
@font-face { font-family: "Montserrat Web"; src: url("../fuentes/Montserrat-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Montserrat Web"; src: url("../fuentes/Montserrat-SemiBold.ttf") format("truetype"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Montserrat Web"; src: url("../fuentes/Montserrat-Black.ttf") format("truetype"); font-weight: 900; font-style: normal; font-display: swap; }

:root {
  --tinta: #102c3b;
  --tinta-honda: #0b212d;
  --papel: #f2f1e9;
  --reticula: #608ba0;
  --atenuado: #a7bcc7;
  --resina: #f9a825;
  --fuente: "Mont Local", "Montserrat Web", "Montserrat", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --salida: cubic-bezier(.16, 1, .3, 1);
  --margen: clamp(16px, 2.6vw, 48px);
  --alto-tercio: clamp(168px, 23vh, 250px);
}

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

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

body {
  margin: 0;
  background: var(--tinta);
  color: var(--papel);
  font-family: var(--fuente);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

p, h1, h2 { margin: 0; }

button { font: inherit; color: inherit; }

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

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

.salto {
  position: absolute; left: var(--margen); top: -60px; z-index: 10;
  padding: 10px 16px; background: var(--papel); color: var(--tinta);
  font-weight: 600; text-decoration: none; border-radius: 4px;
}
.salto:focus { top: 10px; }

/* ---------- Escenario ---------- */

.lt { position: relative; min-height: 100vh; min-height: 100svh; }

.lt-escenario {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) var(--alto-tercio);
  overflow: hidden;
  background: var(--tinta);
}

/* ---------- Cabecera ---------- */

.cabecera {
  display: flex; align-items: center; gap: clamp(12px, 1.6vw, 28px);
  padding: clamp(10px, 1.6vh, 18px) var(--margen) 0;
}

/* El logotipo horizontal ya trae su propia línea divisoria; el título no lleva otra. */
.cabecera-logo { display: block; height: clamp(24px, 3.4vh, 36px); width: auto; }

.cabecera-titulo {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .9em;
  font-size: clamp(14px, 1.15vw, 20px); font-weight: 600; letter-spacing: .01em;
  padding-left: clamp(4px, .8vw, 16px);
}

.cabecera-lugar { font-weight: 400; color: var(--atenuado); }

.cabecera-acciones { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.idiomas {
  display: flex; padding: 3px;
  border: 1px solid rgba(96, 139, 160, .6); border-radius: 999px;
}
.idiomas button {
  min-width: 44px; padding: 7px 12px;
  background: none; border: 0; border-radius: 999px; cursor: pointer;
  font-size: 13px; font-weight: 600; letter-spacing: .08em; color: var(--atenuado);
}
.idiomas button[aria-pressed="true"] { background: var(--papel); color: var(--tinta); }

.boton-icono {
  display: grid; place-items: center;
  width: 46px; height: 46px; padding: 0;
  background: none; border: 1px solid rgba(96, 139, 160, .6); border-radius: 50%;
  color: var(--papel); cursor: pointer;
  transition: border-color .2s, color .2s, opacity .2s;
}
.boton-icono:hover:not(:disabled) { border-color: var(--resina); color: var(--resina); }
.boton-icono:disabled { opacity: .3; cursor: default; }

/* ---------- Gráfica ---------- */

/* Las escenas (línea del tiempo y modelo) se apilan en la misma celda y se funden entre sí. */
.lt-grafica {
  min-height: 0;
  display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  align-items: center; justify-items: center;
  padding: 0 clamp(0px, .8vw, 16px);
}

.lt-svg {
  grid-area: 1 / 1; display: block; width: 100%; height: 100%;
  transition: opacity .6s ease, visibility 0s linear 0s;
}
.lt[data-escena="modelo"] #lt-svg,
.lt:not([data-escena="modelo"]) .mo-svg {
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .6s ease, visibility 0s linear .6s;
}

.lt-svg text { font-family: var(--fuente); fill: var(--papel); }

/* Retícula */
.lt-linea, .lt-hueco {
  stroke: var(--reticula); stroke-width: 1; opacity: 0;
  transition: opacity .7s ease calc(var(--i, 0) * 30ms);
}
.lt-listo .lt-linea, .lt-listo .lt-hueco { opacity: .5; }
.lt-listo .lt-hueco.es-oculto { opacity: 0; transition-delay: 0ms; }

.lt-eje { stroke: var(--reticula); stroke-width: 1.5; opacity: .75; }

.lt-tramo {
  stroke: var(--resina); stroke-width: 6; stroke-linecap: round;
  opacity: 0; transition: opacity .4s ease;
}
.lt-tramo.es-visible { opacity: 1; }

.lt-anio {
  font-size: 19px; font-weight: 600; text-anchor: middle;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity .6s ease calc(var(--i, 0) * 30ms + 150ms), fill .35s ease;
}
.lt-listo .lt-anio { opacity: .82; }
.lt-listo .lt-anio.es-activo { fill: var(--resina); opacity: 1; }

.lt-carril {
  font-size: 23px; font-weight: 900; text-anchor: end; letter-spacing: .01em;
  opacity: 0; transition: opacity .6s ease, fill .5s ease;
}
.lt-listo .lt-carril { opacity: .5; }
.lt-listo[data-modo="inicio"] .lt-carril,
.lt-listo[data-modo="vista"] .lt-carril { opacity: 1; }
.lt-listo .lt-carril.es-activo { opacity: 1; fill: var(--resina); }

/* Vertical resaltada del año activo */
.lt-activa path {
  fill: none; stroke: var(--resina); stroke-width: 2.5;
  stroke-dasharray: 1; stroke-dashoffset: 1;
  transition: stroke-dashoffset .5s var(--salida);
}
.lt-activa path.es-activa {
  stroke-dashoffset: 0;
  transition-delay: calc(var(--k, 0) * 140ms);
}

/* Escenario y año en curso */
.lt-zona, .lt-hoy, .lt-leyenda { opacity: 0; transition: opacity .7s ease; }
.lt[data-escenario="1"] .lt-zona,
.lt[data-hoy="1"] .lt-hoy,
.lt[data-curva="1"] .lt-leyenda { opacity: 1; }

.lt-zona rect { fill: var(--papel); opacity: .04; }
.lt-zona text {
  font-size: 15px; font-weight: 600; letter-spacing: .2em; text-anchor: end;
  fill: var(--atenuado);
}

.lt-hoy-linea { stroke: var(--resina); stroke-width: 1.5; stroke-dasharray: 2 7; stroke-linecap: round; }
.lt-hoy-logo { pointer-events: none; }
.lt-hoy-caja { fill: var(--tinta); stroke: var(--resina); stroke-width: 1.5; }
.lt-svg .lt-hoy-texto {
  font-size: 15px; font-weight: 900; letter-spacing: .08em; text-anchor: middle;
  fill: var(--resina);
}

.lt-leyenda text { font-size: 16px; font-weight: 400; fill: var(--atenuado); }
.lt-leyenda line { stroke-width: 5; stroke-linecap: round; }
.lt-leyenda .lt-muestra-escenario { stroke: #00b0df; stroke-dasharray: 9 9; }
.lt-leyenda .lt-muestra-registro { stroke: var(--papel); stroke-width: 2.5; opacity: .8; }

/* Curva de acopio */
.lt-curva path, .lt-curva polyline {
  fill: none; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round;
}
.lt-curva .lt-registro { stroke: var(--papel); stroke-width: 2.5; opacity: .8; }
.lt-curva .lt-descenso { stroke: #e50e1f; }
.lt-curva .lt-proyeccion { stroke-dasharray: 12 12; }
.lt-punto {
  fill: var(--papel); stroke: var(--tinta); stroke-width: 2.5;
  opacity: 0; transition: opacity .3s ease;
}
.lt-punto.es-visible { opacity: 1; }

.lt-valor {
  font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums;
  paint-order: stroke; stroke: var(--tinta); stroke-width: 6px; stroke-linejoin: round;
  opacity: 0; transition: opacity .45s ease;
}
.lt-valor.es-visible { opacity: 1; }

/* Hitos */
.lt-hito { cursor: pointer; pointer-events: none; outline: none; }
.lt-hito.es-visible { pointer-events: auto; }

.lt-hito-in {
  opacity: 0;
  transform: translateY(16px) scale(.92);
  transform-box: fill-box; transform-origin: 50% 50%;
  transition: opacity .55s ease var(--d, 0ms), transform .8s var(--salida) var(--d, 0ms);
}
.lt-hito.es-visible .lt-hito-in { opacity: .55; transform: none; }
.lt-hito.es-visible.es-activo .lt-hito-in,
.lt-hito.es-visible:hover .lt-hito-in,
.lt-hito.es-visible:focus-visible .lt-hito-in { opacity: 1; }
.lt-hito.es-visible.es-atenuado .lt-hito-in { opacity: .32; }

.lt-pildora {
  fill: var(--tinta); stroke: var(--papel); stroke-width: 1.5;
  stroke-dasharray: 6 5;
}
.lt-svg .lt-pildora-texto { fill: var(--papel); letter-spacing: .01em; }

.lt-svg .lt-meta { font-size: 21px; font-weight: 900; }

.lt-hito-zona { fill: transparent; stroke: none; pointer-events: all; }
.lt-hito:focus-visible .lt-hito-zona { stroke: var(--resina); stroke-width: 2; }

/* ---------- Modelo RESINA ---------- */

/*
 * Pensado para un auditorio: tamaños en unidades del lienzo de 1920 x 860, que en una
 * pantalla de 1920 x 1080 se ven a 0.87. Ningún texto baja de 26 (unos 23 px).
 * Lo atenuado conserva un contraste de 4.5:1 sobre el fondo.
 */
.mo-pieza {
  opacity: 0;
  transition: opacity .6s ease var(--d, 0ms), transform .8s var(--salida) var(--d, 0ms),
              fill .4s ease, stroke .4s ease;
}
.mo-movil { transform: translateY(14px); }
.mo-pieza.es-visible { opacity: .55; transform: none; }
.mo-pieza.es-visible.es-activo { opacity: 1; }

.mo-svg .mo-columna { font-size: 26px; font-weight: 600; letter-spacing: .16em; fill: var(--atenuado); }

.mo-svg .mo-sigla { font-size: 96px; font-weight: 900; letter-spacing: .02em; fill: var(--resina); }
.mo-svg .mo-nombre { font-size: 34px; font-weight: 400; }
.mo-svg .mo-fuerte { font-weight: 900; }
.mo-svg .mo-traduccion { font-size: 27px; fill: var(--atenuado); }

/* Nodos y enlaces: la misma lógica que tendrá el diagrama de inversión. */
.mo-nodo { fill: var(--papel); }
.mo-nodo-modelo { fill: var(--resina); }
.mo-svg:not(.es-vista) .mo-nodo.es-activo { fill: var(--resina); }

.mo-enlace {
  fill: none; stroke: var(--papel); stroke-width: 4.5; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
  transition: opacity .6s ease var(--d, 0ms), stroke-dashoffset 1.1s var(--salida) var(--d, 0ms), stroke .4s ease;
}
.mo-enlace.es-visible { stroke-dashoffset: 0; }
.mo-svg:not(.es-vista) .mo-enlace.es-activo { stroke: var(--resina); }

.mo-enlace-futuro { fill: none; stroke: var(--resina); stroke-width: 3.5; stroke-dasharray: 10 9; }

.mo-marco { fill: none; stroke: var(--reticula); stroke-width: 2; }
.mo-svg .mo-apoyo-nombre { font-size: 32px; font-weight: 900; letter-spacing: .04em; }

.mo-financiamiento { fill: var(--tinta); stroke: var(--resina); stroke-width: 2.5; stroke-dasharray: 9 8; }
.mo-svg .mo-financiamiento-texto { font-size: 28px; font-weight: 600; text-anchor: middle; }

.mo-svg .mo-frente-nombre { font-size: 42px; font-weight: 900; }
.mo-svg .mo-resultado { font-size: 30px; }
.mo-svg .mo-leyenda { font-size: 26px; font-weight: 600; fill: var(--atenuado); }
.mo-svg .mo-cifra { font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; }
.mo-svg .mo-cifra.es-destacada { fill: var(--resina); }
.mo-svg .mo-barra-rotulo { font-size: 28px; }

.mo-pista { fill: var(--papel); opacity: .14; }
.mo-barra {
  fill: var(--papel); opacity: .6;
  transform: scaleX(0); transform-box: fill-box; transform-origin: 0 50%;
  transition: transform 1.1s var(--salida) .3s;
}
.mo-barra.es-destacada { fill: var(--resina); opacity: 1; }
.mo-pieza.es-visible .mo-barra { transform: none; }

.mo-svg .mo-componente { font-size: 28px; font-weight: 600; }
.mo-futuro { fill: none; stroke: var(--papel); stroke-width: 2; stroke-dasharray: 8 7; }

.mo-fila { stroke: var(--reticula); stroke-width: 1.5; opacity: .6; }
.mo-svg .mo-indicador { font-size: 28px; }
.mo-svg .mo-meta { font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; fill: var(--resina); }

/* ---------- Tercio inferior (ficha del paso) ---------- */

.tercio {
  display: grid;
  grid-template-columns: minmax(0, clamp(190px, 23vw, 440px)) minmax(0, 1fr) auto;
  align-items: center; gap: clamp(16px, 2.4vw, 48px);
  padding: 0 var(--margen);
  background: var(--tinta-honda);
  border-top: 1px solid rgba(96, 139, 160, .45);
  overflow: hidden;
}

.tercio-periodo {
  font-size: clamp(54px, 6.6vw, 124px); font-weight: 900; line-height: .9;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums;
  color: var(--resina); white-space: nowrap;
}
.tercio-periodo.es-rango { font-size: clamp(32px, 3.75vw, 70px); letter-spacing: -.01em; }

.tercio-periodo, .tercio-cuerpo { transition: opacity .18s ease, transform .3s var(--salida); }
.tercio.cambia .tercio-periodo, .tercio.cambia .tercio-cuerpo { opacity: 0; transform: translateY(8px); }

.tercio-cuerpo {
  padding-left: clamp(16px, 2.4vw, 48px);
  border-left: 1px solid rgba(96, 139, 160, .45);
}

.tercio-nivel {
  font-size: clamp(12px, .95vw, 18px); font-weight: 600;
  letter-spacing: .22em; text-transform: uppercase; color: var(--atenuado);
}

.tercio-titulo {
  margin-top: .3em;
  font-size: clamp(20px, 2.15vw, 40px); font-weight: 900; line-height: 1.1;
}

.tercio-texto {
  margin-top: .45em; max-width: 64ch;
  font-size: clamp(15px, 1.32vw, 24px); line-height: 1.35;
}

.tercio-fuente {
  margin-top: .6em;
  font-size: clamp(12px, .9vw, 17px); color: var(--atenuado);
}

.tercio-nav { display: grid; justify-items: end; gap: 12px; }

.contador {
  font-size: 16px; font-weight: 600; letter-spacing: .14em;
  font-variant-numeric: tabular-nums; color: var(--atenuado);
}

.tercio-botones { display: flex; gap: 10px; }

/* ---------- Cierre ---------- */

.cierre {
  background: #fff; padding: clamp(28px, 5vw, 64px) var(--margen);
  display: grid; place-items: center;
}
.cierre img { display: block; width: min(100%, 1180px); height: auto; }

.sin-script { padding: 24px var(--margen); }

/* ---------- Pantallas angostas ---------- */

@media (max-width: 820px) {
  :root { --alto-tercio: clamp(250px, 38vh, 330px); }

  .cabecera-lugar { display: none; }
  .cabecera-titulo { font-size: 13px; }
  #lt-pantalla { display: none; }
  /* En teléfono solo se muestra el isotipo (la parte izquierda del logotipo). */
  .cabecera-logo { width: 30px; height: 30px; object-fit: cover; object-position: left center; }

  .lt-grafica {
    overflow-x: auto; grid-template-columns: 1080px; justify-content: start;
    padding: 0; scrollbar-width: none;
  }
  .lt-grafica::-webkit-scrollbar { display: none; }
  .lt-svg { width: 1080px; height: auto; max-height: 100%; }

  .tercio {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
    align-items: start; gap: 10px 16px;
    padding-top: 16px; padding-bottom: 16px;
  }
  .tercio-periodo { grid-area: 1 / 1; align-self: center; font-size: 46px; }
  .tercio-periodo.es-rango { font-size: 34px; }
  .tercio-nav { grid-area: 1 / 2; align-self: center; }
  .contador { display: none; }
  .tercio-cuerpo { grid-area: 2 / 1 / 3 / -1; padding-left: 0; border-left: 0; }
}

@media (max-height: 560px) and (min-width: 821px) {
  :root { --alto-tercio: 150px; }
  .tercio-fuente { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; transition-delay: 0ms !important; }
}
