/* ════════════════════════════════════════════════════════════════
   HERO — Lumina Interactive Slider
   z0: Three.js WebGL canvas (full-bleed image transitions)
   z3: Slider overlay (logo, title, description, navigation)
   z4: Bottom gradient fade
════════════════════════════════════════════════════════════════ */

/* Creates scroll depth for the cosmos parallax transition.
   Height = 100vh (hero) + featuresSection height (set by JS) */
#heroWrapper {
  position: relative;
  height: 200vh;
}

/* Hero sticks to top while user scrolls through the heroWrapper */
.hero {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  z-index: 5;
  /* NOTE: scroll-snap-align doesn't work on sticky elements —
     the browser can't resolve a snap position for a stuck box.
     A .snap-marker at the top of heroWrapper handles this. */
}

/* Fade in once Three.js + GSAP are loaded */
.slider-wrapper          { opacity: 0; transition: opacity 1s ease; }
.slider-wrapper.loaded   { opacity: 1; }

/* ─ Layer 0: Three.js WebGL canvas ─ */
.webgl-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* ─ Layer 1: Full-bleed bottom gradient — behind overlay, in front of canvas ─ */
/* Anchored at the bottom and stretches the full viewport height so the dark
   overlay covers everything behind the slider-navigator up to the very top.  */
/* sparkles float above the gradient, below the overlay */
#sparkles-wrap {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

/* gradient sits just above canvas — sparkles float on top of it */
.hero-image-gradient {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100vh;
  z-index: 1;
  background: linear-gradient(       /* zinc-950 with opacity steps */
    to top,
    rgba(9,9,11,1.0)  0%,
    rgba(9,9,11,0.98) 10%,
    rgba(9,9,11,0.96) 20%,
    rgba(9,9,11,0.93) 30%,
    rgba(9,9,11,0.88) 40%,
    rgba(9,9,11,0.82) 50%,
    rgba(9,9,11,0.74) 60%,
    rgba(9,9,11,0.64) 70%,
    rgba(9,9,11,0.52) 80%,
    rgba(9,9,11,0.38) 90%
  );
  pointer-events: none;
  transition: opacity 0.8s ease;
}

/* ─ Layer 4: Slider overlay — above sparkles (z=2) ─ */
.slider-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 72px 0 0;
  will-change: transform, opacity;
  pointer-events: none;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Hero entrance — staggered fade-in + rise, triggered by JS ── */
.hero-entrance .slider-logo,
.hero-entrance .hero-vanilla-title,
.hero-entrance .hero-tagline,
.hero-entrance .slider-cta,
.hero-entrance .slider-nav-wrap {
  opacity: 0;
}
.hero-entrance.is-animating .slider-logo        { animation: fadeUp 0.8s var(--ease-spring) 0s both; }
.hero-entrance.is-animating .hero-vanilla-title  { animation: fadeUp 0.8s var(--ease-spring) 0.12s both; }
.hero-entrance.is-animating .hero-tagline        { animation: fadeUp 0.8s var(--ease-spring) 0.24s both; }
.hero-entrance.is-animating .slider-cta          { animation: fadeUp 0.7s var(--ease-spring) 0.36s both; }
.hero-entrance.is-animating .slider-nav-wrap     { animation: fadeUp 0.6s var(--ease-spring) 0.50s both; }

.slider-logo {
  width: min(220px, 20vw);
  mix-blend-mode: screen;
  filter: drop-shadow(0 0 40px rgba(201,160,72,0.22));
  margin-bottom: var(--space-5);
}

.hero-vanilla-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5.5vw, 4.5rem);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  line-height: 1.1;
  text-align: center;
  margin-bottom: var(--space-6);
  /* Animation handled by .hero-entrance system */
}

/* ── Slide content — fills remaining height, centres logo+tagline+CTAs ── */
.slide-content-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-7);
  text-align: center;
  padding: 0 48px;
}

.slide-content {
  display: none; /* Titles / descriptions hidden — logo replaces them */
}

/* Fixed tagline shown between logo and CTA buttons */
.hero-tagline {
  font-family: var(--font-sans);
  font-size: clamp(17px, 2.1vw, 22px);
  font-weight: 400;
  color: rgba(255,255,255,0.92);
  text-align: center;
  max-width: 100%;
  width: fit-content;
  letter-spacing: -0.01em;
  line-height: 1.55;
  margin: 0;
}

.slide-title {
  font-family: var(--font-display);
  font-size: clamp(42px, 6.5vw, 84px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.0;
  color: var(--base-white);
  margin: 0;
  overflow: hidden;
}

.slide-title .char {
  display: inline-block;
  will-change: transform, opacity, filter;
}

.slide-description {
  font-family: var(--font-sans);
  font-size: clamp(14px, 1.6vw, 17px);
  font-weight: 500;
  color: rgba(255,255,255,0.72);
  max-width: 480px;
  text-align: center;
  margin: 0;
}

/* CTA buttons — re-enable pointer events inside the pointer-events:none overlay */
.slider-cta {
  display: flex;
  gap: var(--space-5);
  flex-wrap: wrap;
  justify-content: center;
  pointer-events: all;
}

/* ── Slide navigation bar — full screen width ── */
.slider-nav-wrap {
  display: flex;
  align-items: flex-end;
  gap: var(--space-7);
  width: 100%;
  pointer-events: all;
  padding: 0 32px 40px;
}

.slides-navigation {
  flex: 1;
  display: flex;
  gap: var(--space-7);
  min-width: 0;
}

.slide-nav-item {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  opacity: 0.45;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  transition: opacity 0.3s ease;
}

.slide-nav-item.active       { opacity: 1; }
.slide-nav-item:hover        { opacity: 0.72; }
.slide-nav-item.active:hover { opacity: 1; }

.slide-progress-line {
  height: 2px;
  background: rgba(255,255,255,0.22);
  overflow: hidden;
  margin-bottom: var(--space-4);
  position: relative;
  border-radius: var(--radius-xs);
}

.slide-progress-fill {
  height: 100%;
  width: 0%;
  background: rgba(255,255,255,0.90);
  position: absolute;
  top: 0;
  left: 0;
  border-radius: var(--radius-xs);
}

.slide-nav-title {
  font-family: var(--font-sans);
  font-size: var(--body-xs);
  font-weight: 700;
  color: rgba(255,255,255,0.60);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.slide-nav-item.active .slide-nav-title { color: rgba(255,255,255,0.90); }

@media (max-width: 640px) {
  .slide-content-wrap { padding: 0 20px; }
  .slider-nav-wrap { padding: 0 16px 28px; gap: var(--space-5); }
  .slides-navigation { gap: var(--space-5); }
  .slide-nav-title { display: none; }
}

/* ─ Character container — wraps canvas + balloon, sits ABOVE gradient ─ */
#characterContainer {
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  z-index: 5;           /* above gradient (1), sparkles (2), overlay text (4) */
  pointer-events: none;
  transition: opacity 0.8s ease;
}

#characterCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* When character loads: shift hero text left on desktop */
@media (min-width: 769px) {
  .slide-content-wrap.has-character {
    align-items: flex-start;
    text-align: left;
    padding-left: 8vw;
    padding-right: 52%;
    max-width: 100%;
  }
  .slide-content-wrap.has-character .hero-tagline {
    text-align: left;
  }
  .slide-content-wrap.has-character .slider-cta {
    justify-content: flex-start;
  }
  .slide-content-wrap.has-character .hero-vanilla-title {
    text-align: left;
  }
}

/* Hide character on mobile */
@media (max-width: 768px) {
  #characterContainer { display: none !important; }
}

/* ─ Character speech balloon (positioned inside container, relative to model) ─ */
#characterBalloon {
  position: absolute;
  left: 50%;
  top: 22%;
  transform-origin: center bottom;
  translate: -50% 0;
  max-width: 240px;
  padding: var(--space-6) var(--space-7);
  background: rgba(255,255,255,0.95);
  color: var(--zinc-900);
  font-family: var(--font-sans);
  font-size: var(--body-xs);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -0.01em;
  border-radius: var(--radius-xl);
  box-shadow:
    0 2px 8px rgba(0,0,0,0.18),
    0 0 0 1px rgba(255,255,255,0.08),
    0 8px 24px rgba(0,0,0,0.12);
  pointer-events: none;
  opacity: 0;
  scale: 0.92;
  transition: opacity 0.35s var(--ease-spring), scale 0.45s var(--ease-bounce);
  will-change: scale, opacity;
}
#characterBalloon.visible {
  opacity: 1;
  scale: 1;
}
/* Tail pointing down toward character's head */
#characterBalloon::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  margin-left: -6px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 4px solid transparent;
  border-top: 9px solid rgba(255,255,255,0.95);
}

