/* ============================================================
   Scroll Hero Module — Styles v2.1 (E4-S2, ADR-006)
   Frame-by-frame scroll-driven hero (sticky track pattern) with
   static + parallax fallbacks.
   ============================================================ */

.scroll-hero {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: var(--cs-bg, #0a0a0f);
}

/* ---- Frame-mode scroll track: tall container + sticky viewport ----
   In frame mode the section becomes a tall "track" (default 200vh,
   overridable via --scroll-hero-track-vh) with a pinned 100vh inner
   viewport. Scrolling through the track scrubs the frame sequence. */
.scroll-hero--frames {
  display: block;
  align-items: initial;
  justify-content: initial;
  overflow: visible;            /* must not clip the sticky element */
  height: calc(var(--scroll-hero-track-vh, 200) * 1vh);
  min-height: 0;
}

.scroll-hero__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ---- Frame layer ---- */
.scroll-hero__frames {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.scroll-hero__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform;
  opacity: 1;
}

/* ---- Canvas sequencer (E3-S3.4) ---- */
.scroll-hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}

.scroll-hero__canvas--live {
  opacity: 1;
}

.scroll-hero__frame--poster {
  /* <img> demoted to poster after canvas handover; visibility toggled inline
     for zero-layout-shift handover */
  will-change: auto;
}

/* ---- Parallax background layer ---- */
.scroll-hero__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: transform var(--cs-duration-slow, 600ms) var(--cs-ease-out, cubic-bezier(0, 0, 0.2, 1));
  will-change: transform;
}

.scroll-hero__video {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

/* ---- Dark overlay ---- */
.scroll-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, var(--scroll-hero-overlay, 0.5)),
    rgba(0, 0, 0, calc(var(--scroll-hero-overlay, 0.5) + 0.2))
  );
  pointer-events: none;
}

/* ---- Content ---- */
.scroll-hero__content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: var(--cs-space-xl, 2.5rem);
  max-width: 800px;
}

.scroll-hero__heading {
  font-family: var(--cs-font-heading, sans-serif);
  font-size: var(--cs-text-5xl, 3.5rem);
  font-weight: var(--cs-weight-black, 900);
  letter-spacing: var(--cs-tracking-tight, -0.02em);
  line-height: var(--cs-leading-tight, 1.1);
  color: var(--cs-text, #f1f5f9);
  margin-bottom: var(--cs-space-md, 1rem);
  opacity: 0;
  transform: translateY(30px);
  animation: scrollHeroFadeIn var(--cs-duration-slow, 600ms) var(--cs-ease-out, cubic-bezier(0, 0, 0.2, 1)) forwards;
  animation-delay: 200ms;
}

.scroll-hero__subtitle {
  font-family: var(--cs-font-body, sans-serif);
  font-size: var(--cs-text-xl, 1.25rem);
  font-weight: var(--cs-weight-normal, 400);
  color: var(--cs-muted, #cbd5e1);
  line-height: var(--cs-leading-normal, 1.6);
  opacity: 0;
  transform: translateY(20px);
  animation: scrollHeroFadeIn var(--cs-duration-slow, 600ms) var(--cs-ease-out, cubic-bezier(0, 0, 0.2, 1)) forwards;
  animation-delay: 500ms;
}

/* ---- Scroll indicator ---- */
.scroll-hero__scroll-hint {
  position: absolute;
  bottom: var(--cs-space-xl, 2.5rem);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--cs-space-xs, 0.25rem);
  color: var(--cs-muted, #cbd5e1);
  font-size: var(--cs-text-xs, 0.75rem);
  font-family: var(--cs-font-mono, monospace);
  letter-spacing: var(--cs-tracking-wide, 0.05em);
  text-transform: uppercase;
  z-index: 1;
  animation: scrollHeroBounce 2s var(--cs-ease-default, cubic-bezier(0.4, 0, 0.2, 1)) infinite;
}

.scroll-hero__scroll-hint::after {
  content: '';
  width: 2px;
  height: 30px;
  background: linear-gradient(to bottom, var(--cs-muted, #cbd5e1), transparent);
  margin-top: var(--cs-space-xs, 0.25rem);
}

/* ---- Keyframes ---- */
@keyframes scrollHeroFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scrollHeroBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* ---- Responsive: tablet (768px) ---- */
@media (max-width: 768px) {
  .scroll-hero__heading {
    font-size: var(--cs-text-3xl, 2rem);
  }

  .scroll-hero__subtitle {
    font-size: var(--cs-text-base, 1rem);
  }

  .scroll-hero__content {
    padding: var(--cs-space-md, 1rem);
  }
}

/* ---- Responsive: small mobile (375px) ---- */
@media (max-width: 375px) {
  .scroll-hero__heading {
    font-size: var(--cs-text-2xl, 1.5rem);
  }

  .scroll-hero__subtitle {
    font-size: var(--cs-text-sm, 0.875rem);
  }

  .scroll-hero__content {
    padding: var(--cs-space-sm, 0.5rem);
  }
}

/* ---- Accessibility: honour reduced motion ----
   Disables the entry/scroll animations; the module JS also falls back to a
   static hero when the user prefers reduced motion. */
@media (prefers-reduced-motion: reduce) {
  .scroll-hero__heading,
  .scroll-hero__subtitle {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .scroll-hero__scroll-hint {
    animation: none;
  }
}
