:root {
  color-scheme: dark;
  background: #0a0a0a;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: #0a0a0a;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Recorrido ampliado: secuencia aprobada (400vh útiles) + cierre cinematográfico (+20.0 % de recorrido útil, 80vh adicionales). */
.scroll-track {
  position: relative;
  height: 580vh;
  height: 580svh;
}

.viewport {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh; /* Fallback */
  height: 100svh; /* Navegadores antiguos */
  height: 100dvh; /* Safari móvil: cubrir el viewport cuando se ocultan sus barras */
  overflow: hidden;
  isolation: isolate;
}

/* Viñeta cinematográfica progresiva para centrar el foco visual en Cerro Unita y el Gigante */
.viewport::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: var(--vignette, 0);
  will-change: opacity;
  background: radial-gradient(
    ellipse 74% 68% at 50% 50%,
    transparent 40%,
    rgba(8, 11, 19, 0.10) 52%,
    rgba(5, 8, 14, var(--vignette-edge, 0.32)) 68%,
    rgba(3, 5, 10, var(--vignette-corner, 0.46)) 100%
  );
}

.sky,
.render-surface {
  position: absolute;
  inset: 0;
}

.sky {
  overflow: hidden;
  z-index: 0;
  isolation: isolate;
  background: linear-gradient(180deg, #040914 0%, #081426 44%, #12223a 74%, #1c324e 100%);
}

/* Capas estáticas: solo varía la opacidad, no se recalculan gradientes en cada frame. */
.sky::before,
.sky::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  will-change: opacity;
}

.sky::before {
  z-index: 1;
  background: linear-gradient(180deg, #0c1626 0%, #1a2238 42%, #683e38 72%, #98563c 100%);
  opacity: var(--twilight, 0);
}

.sky::after {
  z-index: 2;
  background: linear-gradient(180deg, #1b3a62 0%, #365d86 38%, #b87550 72%, #e8a272 100%);
  opacity: var(--daybreak, 0);
}

.horizon-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: var(--night-glow, 1);
  will-change: opacity;
  background:
    /* Resplandor lateral izquierdo (detrás del confín y cadena oeste lejana) */
    radial-gradient(ellipse 65% 26% at 10% 59%, rgba(46, 84, 134, 0.40) 0%, rgba(24, 52, 90, 0.16) 48%, transparent 75%),
    /* Resplandor lateral derecho (detrás de la cadena este lejana) */
    radial-gradient(ellipse 65% 26% at 90% 59%, rgba(46, 84, 134, 0.40) 0%, rgba(24, 52, 90, 0.16) 48%, transparent 75%),
    /* Haze continuo difuso a lo largo de todo el horizonte (centrado a 60 % de altura de pantalla) */
    radial-gradient(ellipse 140% 30% at 50% 60%, rgba(36, 70, 114, 0.35) 0%, rgba(20, 44, 78, 0.18) 42%, rgba(10, 24, 46, 0.05) 68%, transparent 100%);
}

.stars {
  z-index: 4;
  position: absolute;
  inset: 0;
  opacity: var(--stars-opacity, .85);
  background:
    /* Estrellas principales nítidas y brillantes */
    radial-gradient(circle at 14% 22%, rgba(240, 244, 255, .85) 1.1px, transparent 1.8px),
    radial-gradient(circle at 36% 15%, rgba(235, 238, 255, .85) 1.1px, transparent 1.8px),
    radial-gradient(circle at 73% 19%, rgba(235, 242, 255, .90) 1.2px, transparent 1.9px),
    radial-gradient(circle at 88% 37%, rgba(238, 242, 255, .80) 1.1px, transparent 1.8px),
    radial-gradient(circle at 52% 16%, rgba(242, 246, 255, .80) 1.0px, transparent 1.6px),
    /* Estrellas medias de cielo desértico */
    radial-gradient(circle at 18% 16%, rgba(228, 238, 255, .65) 0.9px, transparent 1.4px),
    radial-gradient(circle at 47% 20%, rgba(230, 238, 255, .65) 0.9px, transparent 1.4px),
    radial-gradient(circle at 55% 32%, rgba(232, 240, 255, .70) 1.0px, transparent 1.5px),
    radial-gradient(circle at 81% 27%, rgba(228, 238, 255, .65) 0.9px, transparent 1.4px),
    radial-gradient(circle at 29% 28%, rgba(226, 236, 255, .60) 0.8px, transparent 1.3px),
    /* Micro-estrellas y polvo estelar sutil de fondo */
    radial-gradient(circle at 24% 11%, rgba(220, 232, 255, .50) 0.7px, transparent 1.2px),
    radial-gradient(circle at 43% 9%, rgba(222, 235, 255, .50) 0.7px, transparent 1.2px),
    radial-gradient(circle at 64% 12%, rgba(220, 230, 252, .50) 0.7px, transparent 1.2px),
    radial-gradient(circle at 69% 25%, rgba(218, 230, 252, .45) 0.7px, transparent 1.2px),
    radial-gradient(circle at 92% 18%, rgba(220, 232, 250, .45) 0.7px, transparent 1.2px),
    radial-gradient(circle at 9% 34%, rgba(220, 232, 250, .45) 0.7px, transparent 1.2px),
    radial-gradient(circle at 78% 10%, rgba(218, 230, 255, .45) 0.7px, transparent 1.2px);
  pointer-events: none;
  will-change: opacity;
}

.clouds {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: var(--late-sky, 0);
  will-change: opacity;
  background:
    radial-gradient(ellipse 90% 45% at 52% 58%, rgba(247, 204, 157, 0.15) 0%, rgba(225, 168, 130, 0.07) 40%, transparent 75%),
    linear-gradient(180deg,
      #325479 0%,
      #4a6c90 28%,
      #6e7d98 40%,
      #9a7e8a 48%,
      #ba8274 54%,
      #d09271 60%,
      #dea883 66%,
      #e4b492 100%
    );
}

.render-surface {
  z-index: 1;
}

.render-surface canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
  outline: none;
}

/* Mantener el mismo encuadre 3D cuando Chrome móvil muestra/oculta sus barras.
   El viewport externo sigue en 100dvh, por lo que no reaparece la franja inferior.
   El canvas más alto se recorta naturalmente dentro de .viewport (overflow:hidden). */
@media (max-width: 760px), (pointer: coarse) {
  .render-surface canvas {
    height: 100lvh;
  }
}

.notice,
.no-js {
  position: absolute;
  left: 50%;
  bottom: max(2rem, env(safe-area-inset-bottom));
  z-index: 2;
  width: max-content;
  max-width: calc(100% - 2rem);
  margin: 0;
  padding: .65rem 1.15rem;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 24px;
  background: rgba(10, 17, 27, .86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #f1f3f5;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  transition: opacity 280ms ease, visibility 280ms ease;
}

.notice-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fbbf24;
  margin-right: 8px;
  vertical-align: middle;
  animation: noticePulse 1.4s ease-in-out infinite;
}

@keyframes noticePulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1.0; transform: scale(1.15); box-shadow: 0 0 8px rgba(251, 191, 36, 0.6); }
}

.notice[hidden] {
  display: block;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

*:focus,
*:focus-visible {
  outline: none;
}

/* Presentación alineada con Explorar: mismo encabezado y lenguaje editorial */
.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 62px;
  padding-inline: max(38px, calc((100vw - 1120px) / 2));
  z-index: 50;
  isolation: isolate;
  pointer-events: auto;
}

/* Solo la capa oscura acompaña el inicio y desaparece con el scroll;
   marca y navegación permanecen visibles durante toda la escena. */
.top-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: rgba(10, 10, 10, .76);
  border-bottom: 1px solid rgba(255, 255, 255, .065);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: var(--intro-opacity, 1);
}

.brand-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  gap: 20px;
  pointer-events: auto;
}

.brand-header {
  display: inline-flex;
  align-items: baseline;
  gap: 15px;
  user-select: none;
}

.brand-title {
  font-size: 20px;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: -.045em;
  color: #f4f2ee;
  text-shadow: 0 1px 9px rgba(0, 0, 0, .7);
}

.brand-title::after {
  content: ".";
  color: #ff651e;
}

.brand-subtitle {
  font: 10px/1 ui-monospace, Consolas, monospace;
  letter-spacing: .15em;
  color: #96918e;
}

.top-bar-sep { display: none; }

.nav-investigacion {
  color: #d0cbc7;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  padding: 8px 0;
  background: none;
  border: 0;
  border-radius: 0;
  transition: color .18s ease;
  pointer-events: auto;
  text-shadow: 0 1px 9px rgba(0, 0, 0, .65);
}

.nav-investigacion:hover { color: #fff; }
.nav-investigacion:focus-visible {
  outline: 2px solid #ff9b64;
  outline-offset: 5px;
}

/* La escena sigue siendo protagonista: texto sin tarjeta pesada */
.intro-block {
  position: absolute;
  top: clamp(126px, 21vh, 195px);
  left: max(38px, calc((100vw - 1120px) / 2));
  width: min(530px, calc(100% - 76px));
  max-width: 530px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  z-index: 6;
  pointer-events: none;
  opacity: var(--intro-opacity, 1);
  will-change: opacity;
  isolation: isolate;
}

.intro-block::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -30px -40px;
  pointer-events: none;
  background: radial-gradient(ellipse at 30% 50%, rgba(4, 5, 8, .67), rgba(4, 5, 8, .24) 51%, transparent 79%);
}

.intro-tag {
  color: #ff9b64;
  font: 600 11px/1.5 ui-monospace, Consolas, monospace;
  letter-spacing: .19em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.intro-title {
  font-size: clamp(36px, 3.8vw, 58px);
  font-weight: 750;
  line-height: 1.07;
  letter-spacing: -.065em;
  color: #f4f2ee;
  margin: 0 0 19px;
  text-shadow: 0 2px 23px rgba(0, 0, 0, .43);
}

.intro-title span { color: #d4cfca; }

.intro-desc {
  color: #d2ccc6;
  max-width: 405px;
  margin: 0 0 33px;
  font-size: clamp(14px, 1.5vw, 17px);
  line-height: 1.65;
  text-shadow: 0 1px 14px rgba(0, 0, 0, .63);
}

.intro-scroll-hint {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: rgba(245, 242, 238, .88);
  font-size: 12px;
  letter-spacing: .015em;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .8);
}

.scroll-mouse-track {
  width: 14px;
  height: 22px;
  border: 1.5px solid rgba(245, 242, 238, .65);
  border-radius: 10px;
  position: relative;
  flex-shrink: 0;
}

.scroll-mouse-dot {
  width: 3px;
  height: 5px;
  background: #ff8850;
  border-radius: 2px;
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  animation: scrollMouseAnim 1.8s cubic-bezier(.65, 0, .35, 1) infinite;
}

@keyframes scrollMouseAnim {
  0% { transform: translate(-50%, 0); opacity: 0; }
  35% { opacity: 1; }
  75%, 100% { transform: translate(-50%, 8px); opacity: 0; }
}

/* Línea de progreso discreta del scroll */
.scroll-timeline {
  position: absolute;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: clamp(280px, 26vw, 380px);
  z-index: 10;
  pointer-events: none;
  user-select: none;
}

.timeline-track {
  width: 100%;
  height: 2.5px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.timeline-fill {
  height: 100%;
  width: calc(var(--scroll-p, 0) * 100%);
  background: linear-gradient(90deg, #ff8850 0%, #ff651e 100%);
  border-radius: 9999px;
  will-change: width;
  box-shadow: 0 0 6px rgba(255, 101, 30, .26);
}

/* Llamado a la acción que emerge suavemente al culminar el amanecer (u >= 85%) */
.final-cta-wrap {
  position: absolute;
  bottom: max(2.8rem, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  opacity: var(--explore-cta, 0);
  pointer-events: var(--explore-cta-pointer, none);
  transition: opacity 280ms ease, transform 280ms ease;
  text-align: center;
  width: max-content;
  max-width: calc(100% - 2.5rem);
}

.final-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 1.45rem;
  background: rgba(10, 10, 10, .87);
  border: 1px solid rgba(255, 101, 30, .50);
  box-shadow: 0 0 18px rgba(255, 101, 30, .14);
  border-radius: 9999px;
  color: #f8fafc;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
  transition: all 180ms ease;
}

.final-cta-btn:hover {
  background: rgba(20, 17, 15, .95);
  border-color: #ff8850;
  color: #ff8850;
  box-shadow: 0 0 20px rgba(255, 101, 30, .19);
  transform: translateY(-2px);
}

.cta-arrow {
  color: #fbbf24;
  font-size: 15px;
  transition: transform 160ms ease;
}

.final-cta-btn:hover .cta-arrow {
  transform: translateX(4px);
}

@media (max-width: 640px) {
  /* iOS Safari: el viewport sticky puede dejar una franja descubierta cuando
     sus barras se contraen. En esta página de una sola escena, anclarlo a la
     ventana evita que se despegue del borde inferior durante el scroll. */
  .viewport {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
  }

  .top-bar {
    height: 56px;
    padding-inline: max(20px, env(safe-area-inset-left));
  }

  .brand-group { gap: 12px; }
  .brand-header { gap: 9px; }
  .brand-title { font-size: 19px; }
  .brand-subtitle { font-size: 9px; letter-spacing: .1em; }
  .nav-investigacion { font-size: 12px; }

  .scroll-timeline {
    bottom: max(.85rem, env(safe-area-inset-bottom));
    width: min(290px, calc(100vw - 2.5rem));
  }
  .timeline-track { height: 2px; }

  .intro-block {
    top: clamp(106px, 17vh, 140px);
    left: max(20px, env(safe-area-inset-left));
    width: min(440px, calc(100vw - 40px));
    max-width: calc(100vw - 40px);
  }
  .intro-block::before { inset: -20px -22px; }
  .intro-tag { font-size: 10px; margin-bottom: 15px; }
  .intro-title { font-size: clamp(31px, 7.1vw, 44px); margin-bottom: 14px; }
  .intro-desc {
    max-width: 340px;
    font-size: 13px;
    line-height: 1.55;
    margin-bottom: 23px;
  }
  .intro-scroll-hint { font-size: 11px; }
}
@media (max-width: 360px) {
  .brand-header { gap: 7px; }
  .brand-subtitle { font-size: 8px; letter-spacing: .06em; }
  .nav-investigacion { font-size: 11px; }
  .intro-title { font-size: 30px; }
}
@media (max-height: 560px) {
  .intro-block { top: 83px; }
  .intro-title { font-size: clamp(27px, 4vh, 36px); }
  .intro-desc { margin-bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-mouse-dot {
    animation: none;
    top: 5px;
  }
  .scroll-track {
    height: 100vh;
    height: 100svh;
    height: 100dvh;
  }

  .sky::before,
  .sky::after,
  .stars,
  .clouds,
  .horizon-glow {
    will-change: auto;
  }
}