/* ─────────────────────────────────────────────────────────────
   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 ──
   Posicionado ABAJO-IZQUIERDA, encima de los filtros pero claramente
   POR DEBAJO del área central donde rotan las cards. */
.hero-overlay {
  position: fixed;
  top: auto;
  bottom: 320px;
  left: 56px;
  transform: none;
  max-width: 380px;
  pointer-events: none;
  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 — OCULTO por petición del usuario ── */
.chapter-title {
  display: none !important;
  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;
  /* Transición suave cinematográfica: 2s ease-out + zoom-out sutil + blur */
  transition:
    opacity 2.0s cubic-bezier(0.4, 0, 0.2, 1),
    transform 2.0s cubic-bezier(0.4, 0, 0.2, 1),
    filter   2.0s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  color: var(--accent);
  transform: scale(1);
  filter: blur(0);
}
.intro.gone {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.15);
  filter: blur(18px);
}
.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: FIJO ABAJO DEL TODO, just sobre los filtros */
  .hero-overlay {
    position: fixed !important;
    top: auto !important;
    bottom: 175px !important;
    left: 18px !important;
    right: 18px !important;
    max-width: none !important;
    transform: none !important;
    text-align: left !important;
  }
  .hero-overlay .h2 {
    font-size: 22px !important;
    line-height: 1.0 !important;
    margin-bottom: 5px !important;
  }
  .hero-overlay .tag-small {
    font-size: 9px !important;
    margin-bottom: 4px !important;
  }
  .body-copy {
    font-size: 9.5px !important;
    line-height: 1.35 !important;
    max-width: none !important;
    max-height: 38px !important;
    overflow: hidden !important;
  }
  .body-copy p { margin-bottom: 3px !important; }
  .body-copy p + p { display: none !important; }

  /* Bottom-left: compacto en 2 columnas */
  .bottom-left {
    bottom: 18px;
    left: 16px;
    right: 16px;
    gap: 6px;
  }
  .bl-title {
    font-size: 8px;
    letter-spacing: 3px;
    margin-bottom: 2px;
  }
  .bl-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px 14px;
    font-size: 9px;
    letter-spacing: 2px;
  }
  .bl-input {
    margin-top: 6px;
    padding: 7px 14px;
    font-size: 8.5px;
    width: 100%;
    text-align: center;
  }

  /* 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;
  }
}

/* ─────────────────────────────────────────────────────────────
   DETAIL PANEL (al pulsar una card)
   ───────────────────────────────────────────────────────────── */
.detail-panel {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 4, 10, 0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  padding: 60px 40px;
  overflow-y: auto;
}
.detail-panel.open { opacity: 1; pointer-events: auto; }
.detail-panel-card {
  position: relative;
  width: 100%;
  max-width: 880px;
  background: linear-gradient(180deg, rgba(20,16,22,0.95), rgba(8,6,12,0.95));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 28px;
  padding: 64px 64px 56px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 30px 80px rgba(0,0,0,0.7),
    0 0 80px var(--bg-glow, rgba(240,160,160,0.18));
  transform: translateY(40px) scale(0.96);
  transition: transform 0.4s cubic-bezier(0.22, 0.94, 0.36, 1);
}
.detail-panel.open .detail-panel-card {
  transform: translateY(0) scale(1);
}
.dp-close {
  position: absolute;
  top: 22px; right: 22px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  cursor: pointer;
  transition: background 0.25s, transform 0.25s;
}
.dp-close:hover {
  background: var(--accent);
  color: var(--bg);
  transform: rotate(90deg);
}
.dp-tag {
  display: inline-block;
  font-size: 11px; font-weight: 800;
  letter-spacing: 4px; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
  padding: 8px 16px;
  background: rgba(240,160,160,0.10);
  border-radius: 999px;
}
.dp-title {
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-size: clamp(36px, 4vw, 56px);
  font-weight: 900;
  line-height: 1.0;
  letter-spacing: -1.5px;
  margin-bottom: 22px;
}
.dp-title em { color: var(--accent); font-style: normal; }
.dp-body {
  font-size: 17px;
  line-height: 1.65;
  color: var(--text-dim);
  margin-bottom: 22px;
}
.dp-body strong { color: var(--text); font-weight: 700; }
.dp-bullets {
  list-style: none;
  margin-bottom: 30px;
}
.dp-bullets li {
  font-size: 15px;
  color: var(--text);
  padding: 8px 0 8px 26px;
  position: relative;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.dp-bullets li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 800;
}
.dp-cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--accent);
  color: var(--bg);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 16px 32px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.25s;
  text-decoration: none;
}
.dp-cta:hover { transform: translateY(-2px); }
.dp-swipe-hint {
  position: absolute;
  bottom: -36px;
  left: 50%; transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  white-space: nowrap;
}

@media (max-width: 820px) {
  .detail-panel { padding: 40px 20px; }
  .detail-panel-card { padding: 50px 28px 36px; border-radius: 22px; }
  .dp-title { font-size: 32px; }
  .dp-body  { font-size: 15px; }
  .dp-bullets li { font-size: 14px; }
  .dp-close { width: 38px; height: 38px; top: 14px; right: 14px; }
}

/* 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; }
}
