/* ─────────────────────────────────────────────────────────────
   Cinematic Landings v4 — overlay UI (estilo activetheory.net)
   ───────────────────────────────────────────────────────────── */

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%;
  margin: 0;
  background: var(--bg, #06040a);
  color: var(--text, #f0eded);
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  overflow-x: hidden;
}
body { min-height: 500vh; }

#webgl {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  z-index: 1; display: block;
}
.bg-fallback {
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at 30% 30%, var(--bg-glow, rgba(240,160,160,0.22)) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 70%, var(--bg-glow-2, rgba(193,163,255,0.15)) 0%, transparent 60%),
    var(--bg, #06040a);
  z-index: 0;
}

.ui-layer {
  position: fixed; inset: 0;
  z-index: 10; pointer-events: none;
}

/* ── Top bar ── */
.ui-top {
  position: absolute;
  top: 38px;
  left: 0; right: 0;
  display: flex; justify-content: space-between;
  padding: 0 56px;
  align-items: flex-start;
}
.brand {
  display: flex; align-items: center; gap: 14px;
  font-weight: 900; letter-spacing: 4px; text-transform: uppercase;
  font-size: 13px; color: var(--text);
  text-shadow: 0 2px 12px rgba(0,0,0,0.6);
}
.brand-mark { width: 26px; height: 26px; }

/* ── Top-right nav (WORK ~ CONTACT) ── */
.top-right { pointer-events: auto; }
.nav-link-row {
  display: flex; align-items: center; gap: 18px;
  background: rgba(8,6,12,0.45);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 10px 24px;
  font-size: 12px; font-weight: 800;
  letter-spacing: 4px; text-transform: uppercase;
  color: var(--text-dim, #aaa);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.nav-link-row .lk { cursor: pointer; transition: color 0.3s; }
.nav-link-row .lk:hover { color: var(--accent); }
.nav-wave { display: inline-block; width: 30px; height: 14px; }
.nav-wave path {
  stroke: var(--accent); fill: none; stroke-width: 1.8;
  stroke-linecap: round;
}

/* ── HERO OVERLAY (texto descriptivo + body copy) — chapter 0 ── */
.hero-overlay {
  position: absolute;
  top: 50%;
  left: 60px;
  transform: translateY(-30%);
  max-width: 460px;
  pointer-events: none;
  transition: opacity 0.6s;
  z-index: 4;
}
.hero-overlay .tag-small {
  font-size: 11px; font-weight: 800;
  letter-spacing: 4px; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.hero-overlay .h2 {
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-size: 56px; font-weight: 900;
  line-height: 0.95; letter-spacing: -2px;
  color: var(--text);
  margin-bottom: 18px;
  text-shadow: 0 4px 20px rgba(0,0,0,0.7);
}
.hero-overlay .h2 em {
  color: var(--accent); font-style: normal;
}
.body-copy {
  font-size: 13px; font-weight: 500;
  line-height: 1.7; color: var(--text-dim);
  letter-spacing: 1px; text-transform: uppercase;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  max-width: 420px;
  transition: opacity 0.6s;
  pointer-events: none;
  text-shadow: 0 2px 10px rgba(0,0,0,0.7);
}
.body-copy p { margin-bottom: 14px; }

/* ── Bottom-left panel ── */
.bottom-left {
  position: absolute;
  bottom: 60px;
  left: 56px;
  display: flex; flex-direction: column;
  gap: 14px;
  pointer-events: auto;
  z-index: 5;
}
.bl-title {
  font-size: 11px; font-weight: 800;
  letter-spacing: 4px; text-transform: uppercase;
  color: var(--text-dim, #aaa);
  margin-bottom: 6px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
.bl-list {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12px; letter-spacing: 3px;
  text-transform: uppercase; font-weight: 700;
}
.bl-list .it {
  cursor: pointer;
  color: var(--text);
  transition: color 0.25s;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
.bl-list .it::before { content: '→ '; color: var(--accent); margin-right: 4px; }
.bl-list .it:hover { color: var(--accent); }
.bl-input {
  margin-top: 8px;
  background: rgba(8,6,12,0.45);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 3px; text-transform: uppercase;
  color: var(--text-dim, #aaa);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: text;
  width: max-content;
}

/* ── Carousel pill (bottom-right como en Active Theory) ── */
.carousel-pill {
  position: absolute;
  bottom: 60px;
  right: 56px;
  display: flex; align-items: center; gap: 14px;
  background: rgba(8,6,12,0.55);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 10px; font-weight: 800;
  letter-spacing: 3px; text-transform: uppercase;
  color: var(--text-dim, #aaa);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  min-width: 240px;
  justify-content: space-between;
  pointer-events: auto;
  z-index: 10;
}
.carousel-pill .arrow {
  font-size: 11px; color: var(--accent);
  cursor: pointer; padding: 2px 6px; letter-spacing: 0;
}
.carousel-pill .center {
  display: flex; gap: 10px; align-items: center;
  flex: 1; justify-content: center;
}
.carousel-pill .center .dash { opacity: 0.5; }
.carousel-label, .carousel-idx { color: var(--text); }

/* ── Chapter title ghosted (top-center, mediano) ── */
.chapter-title {
  position: absolute;
  top: 110px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  pointer-events: none;
  width: 100%;
  height: 1em;
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-weight: 900;
  font-size: clamp(40px, 4.2vw, 72px);
  line-height: 1;
  letter-spacing: -2px;
  color: rgba(255,255,255,0.08);
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
}
.chapter-title .layer {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: max-content;
}
.chapter-title .layer.solid {
  color: rgba(255,255,255,0.85);
  text-shadow: 0 0 30px rgba(0,0,0,0.6), 0 8px 60px rgba(0,0,0,0.5);
  mix-blend-mode: screen;
}
.chapter-title .layer.ghost1 {
  color: var(--accent);
  opacity: 0.32;
  transform: translateX(-50%) translate(-7px, -4px);
  filter: blur(0.5px);
}
.chapter-title .layer.ghost2 {
  color: var(--accent-2, #c1a3ff);
  opacity: 0.22;
  transform: translateX(-50%) translate(8px, 5px);
  filter: blur(0.5px);
}

/* Bottom progress bar */
.progress-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: rgba(255,255,255,0.05);
  z-index: 11;
}
.progress-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.1s linear;
}

/* ─────────────────────────────────────────────────────────────
   INTRO COMPLEJA (estilo Active Theory)
   - Hatched dome central (////)
   - Anillo circular que se dibuja
   - Brackets curvos laterales en capas
   - Radial sun-burst lines
   - Contador /NN
   - Arrow ">>>" al final
   ───────────────────────────────────────────────────────────── */
.intro {
  position: fixed; inset: 0;
  z-index: 100;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 1.0s ease;
  overflow: hidden;
  color: var(--accent);
}
.intro.gone { opacity: 0; pointer-events: none; }
.intro-stage {
  position: relative;
  width: min(720px, 90vw);
  height: min(720px, 90vw);
  max-height: 90vh;
  display: flex; align-items: center; justify-content: center;
}
.intro-stage svg {
  width: 100%; height: 100%;
  overflow: visible;
}

/* Dome hatched (semicircle de líneas diagonales) */
.intro-dome {
  opacity: 0;
  animation: in-fade 0.4s 0.1s ease forwards;
}

/* Contador inside dome */
.intro-count {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, 70%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--accent);
  letter-spacing: 2px;
  opacity: 0;
  animation: in-fade 0.5s 0.3s ease forwards;
}

/* Anillo principal */
.intro-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-dasharray: 880;
  stroke-dashoffset: 880;
  animation: ring-draw 1.1s 0.4s ease-out forwards;
}
@keyframes ring-draw { to { stroke-dashoffset: 0; } }

/* Brackets laterales (3 capas) */
.intro-bracket {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-dasharray: 800;
  stroke-dashoffset: 800;
  opacity: 0.7;
}
.intro-bracket.b1 { animation: ring-draw 1.0s 0.9s ease-out forwards; }
.intro-bracket.b2 { animation: ring-draw 1.1s 1.1s ease-out forwards; opacity: 0.45; }
.intro-bracket.b3 { animation: ring-draw 1.2s 1.3s ease-out forwards; opacity: 0.25; }

/* Sun-burst radial lines (8 líneas que emergen del ring) */
.intro-ray {
  stroke: var(--accent);
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: 220;
  stroke-dashoffset: 220;
  filter: drop-shadow(0 0 6px var(--accent));
  animation: ring-draw 0.8s ease-out forwards;
  animation-delay: var(--rd, 1.5s);
}

/* Arrow al final */
.intro-arrow {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  color: var(--accent);
  opacity: 0;
  letter-spacing: 4px;
  animation: in-arrow 0.6s 2.5s ease forwards;
}
@keyframes in-arrow {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.intro-brand {
  position: absolute;
  left: 50%; bottom: -10%;
  transform: translateX(-50%);
  font-size: 9px;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0;
  animation: in-fade 0.6s 1.8s ease forwards;
  white-space: nowrap;
}

@keyframes in-fade { to { opacity: 1; } }

/* ─────────────────────────────────────────────────────────────
   MOBILE (≤820px) — UI minimal estilo Active Theory mobile
   ───────────────────────────────────────────────────────────── */
@media (max-width: 820px) {
  /* Top: solo nav centrado, sin brand a la izq */
  .ui-top {
    top: 24px;
    padding: 0 20px;
    justify-content: center;
  }
  .brand { display: none; }
  .top-right .nav-link-row {
    padding: 8px 18px;
    font-size: 10px;
    letter-spacing: 3px;
  }

  /* Chapter title más pequeño y arriba */
  .chapter-title {
    top: 80px;
    font-size: clamp(28px, 8vw, 48px);
  }

  /* Hero overlay reposicionado: bajo el chapter title, ancho completo */
  .hero-overlay {
    top: auto;
    bottom: 230px;
    left: 20px;
    right: 20px;
    max-width: none;
    transform: none;
  }
  .hero-overlay .h2 {
    font-size: 36px;
    line-height: 1.0;
    margin-bottom: 12px;
  }
  .hero-overlay .tag-small {
    font-size: 9px;
    margin-bottom: 8px;
  }
  .body-copy {
    font-size: 11px;
    line-height: 1.5;
    max-width: none;
  }
  .body-copy p { margin-bottom: 8px; }

  /* Bottom-left: más compacto */
  .bottom-left {
    bottom: 30px;
    left: 20px;
    gap: 8px;
  }
  .bl-title {
    font-size: 9px;
    letter-spacing: 3px;
  }
  .bl-list {
    gap: 4px;
    font-size: 10px;
    letter-spacing: 2px;
  }
  .bl-input {
    margin-top: 6px;
    padding: 8px 16px;
    font-size: 9px;
  }

  /* Carousel pill: ocultar en móvil (no aparece en Active Theory mobile) */
  .carousel-pill { display: none; }

  /* Intro más pequeña */
  .intro-wrap { width: 160px; height: 160px; }
  .intro-mark { width: 60px; height: 60px; }
  .intro-label {
    font-size: 9px;
    letter-spacing: 6px;
    bottom: -36px;
  }
}

/* MOBILE SMALL (≤480px) */
@media (max-width: 480px) {
  .hero-overlay {
    bottom: 200px;
  }
  .hero-overlay .h2 { font-size: 28px; }
  .bottom-left { bottom: 22px; left: 16px; }
  .ui-top { padding: 0 14px; }
}
