:root {
  --navy: #0b1220; --navy-2: #111a2b; --ink: #eef2f9; --ink-2: #c3cbd8; --muted: #8a95a6;
  --azul: #1e4fd8; --azul-2: #3b82f6; --oro: #d9a92f;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
html { background: var(--navy); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; scroll-behavior: auto; }
body { margin: 0; overflow-x: hidden; }
#scroller { height: 2300vh; pointer-events: none; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
.no-webgl #scene { display: none; }

/* viñeta y grano suaves sobre la escena */
#blackout { position: fixed; inset: 0; z-index: 2; pointer-events: none; background: #000; opacity: 0; }
#vignette { position: fixed; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(4, 7, 14, 0.55) 100%); }
#grain { position: fixed; inset: -50%; width: 200%; height: 200%; z-index: 1; pointer-events: none; opacity: 0.06; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>"); animation: grain 1.2s steps(6) infinite; }
@keyframes grain { 0% { transform: translate(0, 0) } 20% { transform: translate(-4%, 3%) } 40% { transform: translate(3%, -5%) } 60% { transform: translate(-2%, 6%) } 80% { transform: translate(5%, -2%) } 100% { transform: translate(0, 0) } }

/* header */
header { position: fixed; top: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: 22px 32px; pointer-events: none; }
header a, header button { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; transition: opacity .5s; }
.brand.hide { opacity: 0; pointer-events: none; }
.brand svg { height: 30px; width: auto; }
.brand .iso { color: var(--azul-2); }
.brand .word { font-weight: 700; letter-spacing: 0.32em; font-size: 14px; }
.top-link { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); text-decoration: none; border: 1px solid rgba(255,255,255,0.25); padding: 9px 14px; border-radius: 2px; transition: border-color .3s, color .3s; }
.top-link:hover { border-color: var(--azul-2); color: #fff; }
.top-right { display: flex; align-items: center; gap: 12px; pointer-events: auto; }
.lang-menu { position: relative; }
.lang-menu summary { list-style: none; cursor: pointer; font-size: 12px; letter-spacing: 0.14em; color: var(--ink-2); border: 1px solid rgba(255,255,255,0.25); padding: 9px 12px; border-radius: 2px; }
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu ul { position: absolute; right: 0; top: calc(100% + 8px); margin: 0; padding: 6px; list-style: none; background: var(--navy-2); border: 1px solid rgba(255,255,255,0.12); border-radius: 2px; min-width: 150px; z-index: 7; }
.lang-menu li a { display: block; padding: 8px 10px; font-size: 13px; color: var(--ink-2); text-decoration: none; border-radius: 2px; }
.lang-menu li a:hover, .lang-menu li a[aria-current] { background: rgba(255,255,255,0.08); color: #fff; }

/* barra de progreso */
#progress { position: fixed; left: 0; top: 0; height: 2px; width: 100%; background: var(--azul-2); transform-origin: left; transform: scaleX(0); z-index: 6; }

/* navegación lateral */
nav.chapters { position: fixed; right: 26px; top: 50%; transform: translateY(-50%); z-index: 5; display: flex; flex-direction: column; gap: 10px; }
.nav-dot { display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; color: var(--muted); font: 500 11px/1 var(--font); letter-spacing: 0.12em; text-transform: uppercase; padding: 4px 0; justify-content: flex-end; }
.nav-dot span.l { opacity: 0; transform: translateX(6px); transition: opacity .3s, transform .3s; }
.nav-dot:hover span.l, .nav-dot.active span.l { opacity: 1; transform: none; }
.nav-dot i { display: block; width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.35); transition: background .3s, transform .3s; }
.nav-dot.active i { background: var(--azul-2); transform: scale(1.5); }

/* capítulos */
.chapter { position: fixed; z-index: 4; top: 0; bottom: 0; display: flex; flex-direction: column; justify-content: center; width: min(560px, 92vw); padding: 0 40px; opacity: 0; visibility: hidden; will-change: opacity, transform; pointer-events: none; }
.chapter a, .chapter button { pointer-events: auto; }
.chapter.left { left: 5vw; }
.chapter.right { right: 7vw; }
.chapter.center { left: 50%; transform: translateX(-50%) !important; text-align: center; align-items: center; justify-content: flex-end; padding-bottom: 9vh; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--azul-2); margin: 0 0 16px; }
.chapter h1, .chapter h2 { font-size: clamp(30px, 4.2vw, 52px); line-height: 1.06; letter-spacing: -0.015em; margin: 0; font-weight: 700; color: #fff; text-wrap: balance; text-shadow: 0 2px 24px rgba(0,0,0,0.45); }
.chapter p { font-size: clamp(16px, 1.25vw, 19px); line-height: 1.55; color: var(--ink-2); margin: 20px 0 0; max-width: 46ch; text-shadow: 0 1px 12px rgba(0,0,0,0.5); }
.hint { margin-top: 44px; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; }
.hint i { display: block; width: 1px; height: 46px; background: linear-gradient(var(--azul-2), transparent); animation: drop 1.8s ease-in-out infinite; }
@keyframes drop { 0% { transform: scaleY(0); transform-origin: top } 50% { transform: scaleY(1); transform-origin: top } 51% { transform-origin: bottom } 100% { transform: scaleY(0); transform-origin: bottom } }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 28px; margin-top: 30px; }
.stats b { display: block; font-size: 26px; color: #fff; letter-spacing: -0.01em; }
.stats span { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.list { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 12px; }
.list li { display: flex; gap: 14px; color: var(--ink-2); font-size: 16px; line-height: 1.45; }
.list li::before { content: ""; flex: 0 0 8px; height: 8px; margin-top: 8px; border-radius: 50%; background: var(--azul-2); }
.ctas { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 34px; }
.btn { display: inline-flex; align-items: center; padding: 14px 22px; border-radius: 2px; font-weight: 600; font-size: 14px; letter-spacing: 0.04em; text-decoration: none; transition: background .3s, border-color .3s, color .3s; }
.btn-primary { background: var(--azul); color: #fff; } .btn-primary:hover { background: var(--azul-2); }
.btn-outline { border: 1px solid rgba(255,255,255,0.35); color: #fff; } .btn-outline:hover { border-color: var(--azul-2); color: var(--azul-2); }
.intro-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.intro-iso { height: 54px; width: auto; color: var(--azul-2); }
.intro-word { font-weight: 700; letter-spacing: 0.42em; font-size: 20px; color: #fff; }
.cierre-logo { color: var(--azul-2); height: 64px; width: auto; margin-bottom: 26px; }
.footnote { position: fixed; bottom: 18px; left: 32px; z-index: 5; font-size: 11px; color: var(--muted); letter-spacing: 0.06em; }
.footnote.r { left: auto; right: 32px; }

/* preloader animado: el isotipo se traza, se rellena, entra la palabra y el telón se abre */
#preloader { display: none; }
html.preload { overflow: hidden; }
html.preload #preloader { display: grid; place-items: center; position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.pl-panel { position: absolute; left: 0; right: 0; height: 50.5%; background: var(--navy); transition: transform 1.1s cubic-bezier(.76,0,.24,1); }
.pl-top { top: 0; } .pl-bottom { bottom: 0; }
html.preload-done .pl-top { transform: translateY(-100%); }
html.preload-done .pl-bottom { transform: translateY(100%); }
.pl-inner { position: relative; display: flex; flex-direction: column; align-items: center; transition: opacity .5s ease, transform .9s cubic-bezier(.76,0,.24,1); }
html.preload-done .pl-inner { opacity: 0; transform: scale(1.2); }
.pl-logo { width: 104px; height: auto; color: var(--azul-2); overflow: visible; }
.pl-logo path { fill: var(--azul-2); fill-opacity: 0; stroke: #6ea8ff; stroke-width: 600; stroke-linejoin: round; stroke-dasharray: var(--len, 200000); stroke-dashoffset: var(--len, 200000); animation: pl-draw 1.5s cubic-bezier(.4,0,.2,1) .1s forwards, pl-fill .7s ease 1.35s forwards; }
.pl-word { margin-top: 20px; font-weight: 700; letter-spacing: .42em; font-size: 15px; color: #fff; opacity: 0; animation: pl-up .8s cubic-bezier(.2,.6,.2,1) 1.2s forwards; }
.pl-bar { display: block; margin-top: 26px; height: 1px; width: 160px; background: rgba(255,255,255,.14); position: relative; overflow: hidden; }
.pl-bar::after { content: ""; position: absolute; inset: 0; background: var(--azul-2); transform: scaleX(0); transform-origin: left; animation: pl-bar 1.9s cubic-bezier(.4,0,.2,1) .2s forwards; }
.pl-tag { position: absolute; top: calc(100% + 40px); white-space: nowrap; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); opacity: 0; animation: pl-up .8s ease 1.4s forwards; }
@keyframes pl-draw { to { stroke-dashoffset: 0; } }
@keyframes pl-fill { to { fill-opacity: 1; stroke-width: 0; } }
@keyframes pl-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pl-bar { to { transform: scaleX(1); } }

/* sin WebGL / movimiento reducido: contenido apilado y legible */
.no-webgl #scroller { height: auto; pointer-events: auto; padding: 120px 0 80px; }
.no-webgl .chapter { position: relative; opacity: 1 !important; visibility: visible !important; transform: none !important; width: min(720px, 92vw); margin: 0 auto 80px; left: auto; right: auto; pointer-events: auto; }
.no-webgl nav.chapters, .no-webgl #progress, .no-webgl .footnote { display: none; }

@media (max-width: 720px) {
  header { padding: 16px 18px; }
  .brand .word { display: none; }
  nav.chapters { right: 12px; }
  .nav-dot span.l { display: none; }
  .chapter { width: 100vw; padding: 0 22px 96px; justify-content: flex-end; }
  .chapter.left, .chapter.right { left: 0; right: 0; }
  .chapter.center { left: 0; transform: none !important; }
  .chapter h1, .chapter h2 { font-size: 30px; }
  .intro-iso { height: 40px; } .intro-word { font-size: 16px; }
  .chapter p { font-size: 15px; }
  .stats b { font-size: 22px; }
  .footnote { display: none; }
}
@media (prefers-reduced-motion: reduce) { #grain, .hint i { animation: none; } }
