/* ============================================================
   HERO 3D — Scroll-Scrubbed Video (Apple iPhone-style)
   ============================================================ */

.hero-3d {
  position: relative;
  /* Tall = long scroll = smooth scrub */
  height: 320vh;
  background: #050505;
}

.hero-3d__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

.hero-3d__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 70% at 50% 50%, rgba(34, 197, 94, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(34, 197, 94, 0.10) 0%, transparent 50%),
    #050505;
  pointer-events: none;
  z-index: 0;
}

.hero-3d__bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, #000 30%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, #000 30%, transparent 85%);
}

/* ---- Video Stage ---- */
.hero-3d__stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.hero-3d__video {
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 30px 80px rgba(34, 197, 94, 0.2));
}

/* ---- Text Overlay ---- */
.hero-3d__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  z-index: 2;
  padding-bottom: clamp(4rem, 12vh, 8rem);
  pointer-events: none;
  background: linear-gradient(
    180deg,
    transparent 0%,
    transparent 50%,
    rgba(5, 5, 5, 0.7) 85%,
    rgba(5, 5, 5, 0.95) 100%
  );
}

.hero-3d__overlay .container {
  width: 100%;
  text-align: center;
}

.hero-3d__eyebrow {
  font-family: 'ClashGrotesk-Variable', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #22c55e;
  margin: 0 0 var(--space-4);
}

/* The headline container is a stack of states */
.hero-3d__headline {
  font-family: 'ClashGrotesk-Variable', sans-serif;
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin: 0 auto var(--space-5);
  position: relative;
  min-height: 5em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.8);
  max-width: 900px;
}

.hero-3d__state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  width: 100%;
}

.hero-3d__state br {
  /* br as line break in flex column: force full-width break */
  flex-basis: 100%;
  height: 0;
}

.hero-3d__state em {
  font-style: italic;
  font-weight: 500;
  color: #22c55e;
  display: block;
  margin-top: 0.25em;
}

.hero-3d__state.is-active {
  opacity: 1;
  transform: translateY(0);
}

.hero-3d__caption {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
  letter-spacing: 0.05em;
}

/* Hide hint after first scroll */
.hero-3d.is-scrolled .hero-3d__caption {
  opacity: 0;
  transition: opacity 0.4s;
}

/* ---- Progress Bar ---- */
.hero-3d__progress {
  position: absolute;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  height: 3px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  z-index: 3;
}

.hero-3d__progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  border-radius: 999px;
  transition: width 0.1s linear;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.6);
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
  .hero-3d {
    height: 280vh;
  }
  .hero-3d__overlay {
    padding-bottom: clamp(3rem, 8vh, 5rem);
    background: linear-gradient(
      180deg,
      rgba(5, 5, 5, 0.4) 0%,
      transparent 25%,
      transparent 45%,
      rgba(5, 5, 5, 0.85) 78%,
      rgba(5, 5, 5, 0.98) 100%
    );
  }
  .hero-3d__headline {
    font-size: clamp(1.6rem, 7vw, 2.4rem);
    min-height: 4.2em;
  }
  .hero-3d__caption {
    font-size: 0.75rem;
  }
  .hero-3d__progress {
    width: 160px;
    bottom: var(--space-4);
  }
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  .hero-3d {
    height: auto;
  }
  .hero-3d__sticky {
    position: relative;
    height: auto;
    padding: var(--space-10) 0;
  }
  .hero-3d__video {
    height: auto;
    max-height: 70vh;
  }
  .hero-3d__state.hero-3d__state--1 {
    opacity: 1;
    transform: none;
  }
  .hero-3d__state:not(.hero-3d__state--1) {
    display: none;
  }
}

/* ---- Light theme ---- */
[data-theme="light"] .hero-3d {
  background: #f5f5f5;
}
[data-theme="light"] .hero-3d__bg {
  background:
    radial-gradient(ellipse 90% 70% at 50% 50%, rgba(34, 197, 94, 0.06) 0%, transparent 60%),
    #f5f5f5;
}
[data-theme="light"] .hero-3d__overlay {
  background: linear-gradient(
    180deg,
    transparent 0%,
    transparent 50%,
    rgba(245, 245, 245, 0.7) 85%,
    rgba(245, 245, 245, 0.95) 100%
  );
}
[data-theme="light"] .hero-3d__headline {
  color: #0a0a0a;
  text-shadow: 0 2px 20px rgba(255, 255, 255, 0.8);
}
[data-theme="light"] .hero-3d__video {
  filter: invert(0.95) hue-rotate(180deg) saturate(0.8);
}
[data-theme="light"] .hero-3d__caption {
  color: rgba(10, 10, 10, 0.5);
}
