@font-face { font-family: "Epilogue"; src: url("../fonts/Epilogue-Light.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Epilogue"; src: url("../fonts/Epilogue-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Epilogue"; src: url("../fonts/Epilogue-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Epilogue"; src: url("../fonts/Epilogue-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --navy: #122649;
  --night: #050b1c;
  --blue: #0087ff;
  --sky: #9cd9f7;
  --on-dark: #f2f6fc;
  --on-dark-soft: #b9c9e2;
  --gutter: clamp(20px, 5vw, 72px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html { scrollbar-width: none; background: var(--night); }
html::-webkit-scrollbar { display: none; }
body {
  margin: 0; background: var(--night); color: var(--on-dark);
  font-family: "Epilogue", system-ui, sans-serif; font-weight: 300; line-height: 1.55;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
::selection { background: var(--blue); color: #fff; }
a { color: inherit; text-underline-offset: 0.2em; }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 5px; border-radius: 2px; }
h1, h2 { font-weight: 700; line-height: 1.04; letter-spacing: -0.025em; margin: 0; text-wrap: balance; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }

/* Cursor propio, solo con mouse */
.cursor-dot, .cursor-ring { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 100; border-radius: 50%; opacity: 0; }
.cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: #fff; }
.cursor-ring {
  width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border: 1px solid rgb(156 217 247 / 0.75);
  transition: width 0.45s var(--ease), height 0.45s var(--ease), margin 0.45s var(--ease), background 0.45s var(--ease), border-color 0.45s var(--ease);
}
.has-cursor, .has-cursor a, .has-cursor button { cursor: none; }
.has-cursor .cursor-dot, .has-cursor .cursor-ring { opacity: 1; }
.cursor-ring.is-hover { width: 84px; height: 84px; margin: -42px 0 0 -42px; background: rgb(0 135 255 / 0.16); border-color: var(--blue); }
.cursor-ring.is-down { width: 30px; height: 30px; margin: -15px 0 0 -15px; }

/* Entrada */
.gate {
  position: fixed; inset: 0; z-index: 60; display: grid; place-content: center; justify-items: center; gap: 34px;
  background: radial-gradient(ellipse at 50% 60%, #0d1d3d, var(--night) 70%);
  transition: opacity 1.2s var(--ease), visibility 1.2s;
}
.gate.is-open { opacity: 0; visibility: hidden; }
.gate-logo { width: min(64vw, 300px); height: auto; }
.gate-enter {
  background: none; border: 1px solid rgb(156 217 247 / 0.6); border-radius: 999px;
  padding: 16px 44px; font-weight: 500; font-size: 1.05rem; letter-spacing: 0.02em;
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease);
}
.gate-enter:hover { background: #fff; border-color: #fff; color: var(--navy); }
.gate-mute { background: none; border: 0; font-size: 0.9rem; color: var(--on-dark-soft); text-decoration: underline; text-underline-offset: 0.25em; padding: 8px; }

/* Encabezado */
.top { position: fixed; inset: 0 0 auto 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; padding: 20px var(--gutter); }
.top-brand img { display: block; height: 38px; width: auto; }
.sound {
  display: inline-flex; align-items: center; gap: 8px; font-size: 0.92rem; font-weight: 400;
  background: rgb(5 11 28 / 0.4); border: 1px solid rgb(185 201 226 / 0.35); padding: 9px 14px; border-radius: 999px;
  transition: border-color 0.3s var(--ease);
}
.sound:hover { border-color: var(--sky); }
.sound .sound-waves { opacity: 0.3; transition: opacity 0.3s; }
.sound[aria-pressed="true"] .sound-waves { opacity: 1; }

/* Recorrido */
.journey { height: 600vh; position: relative; }
/* En pantallas táctiles el recorrido es más corto: se necesita menos deslizamiento para avanzar */
@media (pointer: coarse) { .journey { height: 480vh; } }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: var(--night); }
.scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.beat {
  position: absolute; left: var(--gutter); bottom: clamp(64px, 13vh, 140px);
  width: min(34rem, calc(100% - 2 * var(--gutter)));
  opacity: 0; visibility: hidden; pointer-events: none;
  text-shadow: 0 1px 28px rgb(5 11 28 / 0.8);
}
.beat h1, .beat h2 { font-size: clamp(2.2rem, 1.3rem + 3.4vw, 4.4rem); }
.beat--hero { width: min(46rem, calc(100% - 2 * var(--gutter))); }
.beat--hero h1 { font-size: clamp(2.6rem, 1.4rem + 4.8vw, 5.6rem); }
.beat--right { left: auto; right: calc(var(--gutter) + 72px); text-align: right; width: min(40rem, calc(100% - 2 * var(--gutter) - 72px)); }
.beat--right p { margin-left: auto; }
.w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: 0.14em; margin-bottom: -0.14em; }
.w > span { display: inline-block; transform: translateY(112%); transition: transform 1s var(--ease); transition-delay: calc(var(--i) * 55ms); }
.beat.is-on .w > span { transform: none; }
.beat p { opacity: 0; transform: translateY(14px); transition: opacity 0.9s var(--ease) 0.35s, transform 0.9s var(--ease) 0.35s; }
.beat.is-on p { opacity: 1; transform: none; }
.beat:not(.is-on) .w > span, .beat:not(.is-on) p { transition-duration: 0.45s; transition-delay: 0s; }
.beat { transition: visibility 0s 0.5s; }
.beat.is-on { transition: none; }
.beat p { margin-top: 1.1rem; font-size: clamp(1.05rem, 1rem + 0.3vw, 1.25rem); max-width: 31rem; }
.beat .motto { font-weight: 500; color: var(--sky); }
.beat .hint { margin-top: 2rem; font-size: 0.92rem; font-weight: 400; color: var(--on-dark-soft); letter-spacing: 0.02em; }

.crisp { position: absolute; left: 0; top: 0; object-fit: contain; opacity: 0; pointer-events: none; will-change: transform, opacity; }
.leaders { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; }
.leaders path { fill: none; stroke: var(--sky); stroke-width: 1; transition: opacity 0.4s var(--ease); }
.leaders circle { fill: none; stroke: var(--sky); stroke-width: 1; transition: opacity 0.4s var(--ease); }
.index {
  position: absolute; z-index: 3; right: calc(var(--gutter) + 84px); top: 50%; translate: 0 -50%;
  width: min(40vw, 640px); display: grid; visibility: hidden;
}
.unit {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: clamp(18px, 3.2vh, 34px) 0; border-top: 1px solid rgb(185 201 226 / 0.28);
  font-weight: 700; font-size: clamp(2rem, 1rem + 3.4vw, 4.6rem); letter-spacing: -0.03em; line-height: 1;
  text-decoration: none; white-space: nowrap;
  opacity: 0; transform: translateY(26px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease), color 0.4s var(--ease), padding 0.5s var(--ease);
}
.unit:last-child { border-bottom: 1px solid rgb(185 201 226 / 0.28); }
.index.is-on .unit { opacity: 1; transform: none; transition-duration: 0.9s, 0.9s, 0.4s, 0.5s; }
.index.is-on .unit:nth-child(2) { transition-delay: 0.12s, 0.12s, 0s, 0s; }
.unit svg { width: 0.62em; height: 0.62em; flex: none; opacity: 0; transform: translateX(-18px); transition: opacity 0.4s var(--ease), transform 0.6s var(--ease); }
.unit:hover, .unit:focus-visible { color: var(--sky); padding-left: 14px; }
.unit:hover svg, .unit:focus-visible svg { opacity: 1; transform: none; }
.stage.has-focus .unit:not(:hover):not(:focus-visible) { color: rgb(242 246 252 / 0.36); }
.is-narrow .index { right: var(--gutter); left: var(--gutter); width: auto; top: auto; bottom: 64px; translate: none; }
.is-narrow .unit { font-size: clamp(1.7rem, 8vw, 2.4rem); padding: 16px 0; }

.flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(circle at 50% 50%, #fff, #9cd9f7 30%, #0087ff 70%); z-index: 5; }
.dest {
  position: absolute; inset: 0; z-index: 6; display: grid; place-content: center; justify-items: center; gap: 18px; text-align: center;
  background: var(--navy); opacity: 0; visibility: hidden; transition: opacity 0.8s var(--ease), visibility 0.8s;
}
.dest.is-on { opacity: 1; visibility: visible; }
.dest h2 { font-size: clamp(2.6rem, 1.4rem + 5vw, 6rem); }
.dest p { color: var(--on-dark-soft); }
.dest button { margin-top: 14px; background: none; border: 1px solid rgb(156 217 247 / 0.6); border-radius: 999px; padding: 12px 28px; font-weight: 500; }
.dest button:hover { border-color: #fff; }

.ascent { position: absolute; right: var(--gutter); top: 50%; translate: 0 -50%; display: grid; justify-items: center; gap: 12px; color: var(--on-dark-soft); }
.ascent img { width: 18px; height: 18px; object-fit: contain; }
.ascent-rail { display: block; width: 1px; height: min(34vh, 280px); background: rgb(242 246 252 / 0.2); position: relative; }
.ascent-rail i { position: absolute; left: 0; bottom: 0; width: 1px; height: 0; background: linear-gradient(to top, rgb(156 217 247 / 0.2), var(--sky)); }
.ascent-rail b { position: absolute; left: -3px; bottom: 0; width: 7px; height: 7px; margin-bottom: -3px; border-radius: 50%; background: #fff; box-shadow: 0 0 12px 2px rgb(0 135 255 / 0.9); }
.vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 50%, transparent 55%, rgb(3 7 18 / 0.7) 100%); }

.credits { position: absolute; left: var(--gutter); right: var(--gutter); bottom: 16px; font-size: 0.74rem; font-weight: 400; color: rgb(185 201 226 / 0.6); }

/* Sin WebGL o con movimiento reducido */
.is-static .journey { height: auto; }
.is-static .stage { position: relative; height: auto; min-height: 100vh; overflow: visible; padding: 130px 0 90px; background: linear-gradient(var(--night), #0d1d3d); }
.is-static .scene, .is-static .ascent, .is-static .vignette, .is-static .hint { display: none; }
.is-static .beat p, .is-static .w > span { opacity: 1; transform: none; }
.is-static .beat--right { text-align: left; }
.is-static .beat { position: static; opacity: 1; visibility: visible; margin: 0 var(--gutter) 64px; }
.is-static .index { position: static; translate: none; visibility: visible; width: auto; margin: 0 var(--gutter); }
.is-static .unit { opacity: 1; transform: none; }
.is-static .crisp, .is-static .leaders, .is-static .flash, .is-static .dest { display: none; }
.is-static .credits { position: static; margin: 48px var(--gutter) 0; }

@media (max-width: 640px) {
  .sound span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .sound { padding: 10px; }
  .top-brand img { height: 30px; }
  .ascent { right: 10px; } .ascent-rail { height: 26vh; }
  .beat--right { right: auto; left: var(--gutter); text-align: left; } .beat--right p { margin-left: 0; }
  .beat { bottom: 84px; width: calc(100% - 2 * var(--gutter) - 36px); }
  .credits { font-size: 0.7rem; bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .gate, .cursor-ring { transition: none; }
}
.is-narrow .leaders path { display: none; }
.is-narrow .index { bottom: 96px; }

/* ---- v2e ---- */
.gate-status { font-size: 0.86rem; color: var(--on-dark-soft); letter-spacing: 0.04em; min-height: 1.4em; margin-top: -14px; }
.gate-enter[disabled] { opacity: 0.35; cursor: progress; }
.gate-enter[disabled]:hover { background: none; border-color: rgb(156 217 247 / 0.6); color: inherit; }
.top-actions { display: flex; align-items: center; gap: clamp(10px, 2vw, 22px); }
.contact-open { background: none; border: 0; padding: 9px 4px; font-size: 0.92rem; font-weight: 400; color: var(--on-dark); text-underline-offset: 0.3em; }
.contact-open:hover { text-decoration: underline; }
.contact {
  width: min(560px, calc(100% - 32px)); padding: clamp(28px, 5vw, 52px); border: 1px solid rgb(185 201 226 / 0.2); border-radius: 4px;
  background: #081430; color: var(--on-dark); box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.7);
}
.contact::backdrop { background: rgb(3 7 18 / 0.72); backdrop-filter: blur(6px); }
.contact[open] { animation: subir 0.6s var(--ease); }
@keyframes subir { from { opacity: 0; transform: translateY(16px); } }
.contact h2 { font-size: clamp(2rem, 1.5rem + 2vw, 3rem); margin-bottom: 26px; }
.contact-close { position: absolute; right: 14px; top: 14px; background: none; border: 0; padding: 8px; color: var(--on-dark-soft); }
.contact-close:hover { color: #fff; }
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 12px; padding: 14px 0; border-top: 1px solid rgb(185 201 226 / 0.16); }
.contact-list span { font-size: 0.86rem; color: var(--on-dark-soft); padding-top: 2px; }
.contact-list a { text-decoration: none; font-weight: 500; word-break: break-word; }
.contact-list a:hover { color: var(--sky); text-decoration: underline; }
.contact-legal { margin-top: 26px; font-size: 0.84rem; color: var(--on-dark-soft); }
.grain {
  position: fixed; inset: -50%; z-index: 30; pointer-events: none; opacity: 0.07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grano 0.9s steps(4) infinite;
}
@keyframes grano { 0% { transform: translate(0, 0); } 25% { transform: translate(-3%, 2%); } 50% { transform: translate(2%, -3%); } 75% { transform: translate(-2%, -1%); } }
.beat--hero .w > span { color: var(--word, #f2f6fc); transition-property: transform, color; }
.noscript { padding: 120px var(--gutter); max-width: 40rem; }
.noscript h1 { margin-bottom: 1rem; }
.noscript p { margin-top: 0.8rem; }
@media (max-width: 640px) {
  .contact-list li { grid-template-columns: 1fr; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) { .grain { animation: none; } .contact[open] { animation: none; } }

/* ---- Fase 1 ---- */
.skip { position: absolute; left: -999px; top: 8px; z-index: 80; background: #fff; color: var(--navy); padding: 10px 14px; font-weight: 500; }
.skip:focus { left: 8px; }
.gate { pointer-events: none; }
.wa { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; background: var(--on-dark); color: var(--navy); font-size: 0.92rem; font-weight: 500; text-decoration: none; transition: background 0.3s var(--ease); }
.wa:hover { background: #fff; }
.intro-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.6rem !important; }
.beat.is-on .intro-actions { pointer-events: auto; }
.intro-actions button { min-height: 46px; padding: 0 22px; border-radius: 999px; background: none; border: 1px solid rgb(185 201 226 / 0.45); font-size: 0.95rem; font-weight: 500; transition: background 0.3s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease); }
.intro-actions button:first-child { background: var(--on-dark); border-color: var(--on-dark); color: var(--navy); }
.intro-actions button:hover { border-color: #fff; }
.intro-actions button:first-child:hover { background: #fff; }
.facts { margin: 1.6rem 0 0 auto; max-width: 34rem; text-align: left; opacity: 0; transform: translateY(14px); transition: opacity 0.9s var(--ease) 0.35s, transform 0.9s var(--ease) 0.35s; }
.beat.is-on .facts { opacity: 1; transform: none; }
.facts div { display: grid; grid-template-columns: 9rem 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid rgb(185 201 226 / 0.28); }
.facts div:last-child { border-bottom: 1px solid rgb(185 201 226 / 0.28); }
.facts dt { font-size: 0.86rem; color: var(--on-dark-soft); padding-top: 3px; }
.facts dd { margin: 0; font-weight: 400; font-size: 1.05rem; }
.beat--facts h2 { font-size: clamp(1.9rem, 1.2rem + 2.4vw, 3.4rem); }
.index-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; margin-top: 26px; opacity: 0; transition: opacity 0.9s var(--ease) 0.3s; }
.index.is-on .index-actions { opacity: 1; }
.wa-cta { display: inline-flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 24px; border-radius: 999px; background: var(--on-dark); color: var(--navy); font-weight: 500; text-decoration: none; }
.wa-cta:hover { background: #fff; }
.index-actions button { background: none; border: 0; min-height: 44px; padding: 0 4px; font-size: 0.92rem; color: var(--on-dark-soft); text-decoration: underline; text-underline-offset: 0.3em; }
.index-actions button:hover { color: #fff; }
.is-static .intro-actions [data-to-units], .is-static [data-to-top] { display: none; }
.is-static .facts, .is-static .index-actions { opacity: 1; transform: none; }
@media (max-width: 640px) {
  .wa span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .wa { padding: 0; width: 46px; justify-content: center; }
  .sound { min-width: 46px; min-height: 46px; justify-content: center; }
  .contact-open { min-height: 46px; }
  .facts div { grid-template-columns: 1fr; gap: 2px; }
  .is-narrow .index { bottom: 70px; }
  .is-narrow .unit { padding: 12px 0; }
  .index-actions { margin-top: 16px; }
}

/* ---- Fase 2a ---- */
.beat.is-on .facts a { pointer-events: auto; }
.facts a { color: var(--sky); white-space: nowrap; }
.facts a:hover { color: #fff; }
.facts div { padding: 11px 0; }
.crisp { display: none; }
@media (max-width: 640px) {
  .beat--facts h2 { font-size: 1.6rem; }
  .facts { margin-top: 1rem; }
  .facts div { padding: 8px 0; }
  .facts dd { font-size: 0.98rem; }
}

/* Legibilidad sobre la Vía Láctea: sombra suave detrás de cada bloque de texto */
.beat::before, .index::before {
  content: ""; position: absolute; inset: -14% -18%; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgb(4 9 24 / 0.72), rgb(4 9 24 / 0.38) 60%, transparent);
  opacity: 0; transition: opacity 0.6s var(--ease);
}
.beat.is-on::before, .index.is-on::before { opacity: 1; }
.beat p, .facts dt { color: #dfe8f6; }
.facts dt { color: #c6d4ea; }
.is-static .beat::before, .is-static .index::before { display: none; }
.beat, .index { z-index: 2; }
@media (max-width: 640px) { .is-narrow .index { bottom: 108px; } }

/* ---- Cierre v3: índice limpio con vista previa ---- */
.unit { position: relative; }
.unit::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--sky);
  transform: scaleX(0); transform-origin: left; transition: transform 0.7s var(--ease);
}
.unit:hover::after, .unit:focus-visible::after { transform: scaleX(1); }
