/*
 * Guide: parallax-scroll-effects
 * Retrieved via: npx modern-web-guidance retrieve "parallax-scroll-effects"
 *
 * Key guidance applied:
 *  - The wrapper MUST use overflow: clip (not overflow: hidden). The guide
 *    specifies clip to avoid creating an unintended BFC that can interfere
 *    with sticky or fixed descendants
 *  - The guide recommends view-timeline for mid-page sections. However, for
 *    a 100vh hero at the top of the page the cover range starts at scrollY = -100vh
 *    (before the page begins), so view-timeline would only run during exit.
 *    For this use case, scroll() with animation-range: 0px 100vh is the correct
 *    choice — the guide's explanation of when to use each timeline type led here
 *  - Decorative layers extend beyond bounds via inset: -100px so parallax
 *    movement never reveals empty space (parent's overflow: clip hides the excess)
 *  - animation-timeline declared AFTER animation shorthand
 *  - Fallback: not provided for decorative parallax — the guide supports
 *    progressive enhancement for purely visual effects
 */

/* ─── Hero wrapper ───────────────────────────────────────────── */

.hero {
  position: relative;
  height: 130vh;
  overflow: clip; /* clip, not hidden — see guide note above */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Layer stack ────────────────────────────────────────────── */

.hero .layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Decorative layers extend 220px beyond all edges so parallax
   movement never shows a gap. The hero's overflow: clip hides the excess. */
.layer-bg,
.layer-accents {
  inset: -220px;
}

/* ─── Layer: background gradient ────────────────────────────── */

.layer-bg {
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 60% at 15% 55%, rgba(109, 40, 217, 0.35) 0%, transparent 65%),
    radial-gradient(ellipse 55% 50% at 85% 25%, rgba(8, 145, 178, 0.22) 0%, transparent 60%),
    radial-gradient(ellipse 40% 70% at 60% 85%, rgba(109, 40, 217, 0.18) 0%, transparent 55%);
}

/* Subtle dot grid pattern */
.layer-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* ─── Layer: floating accent shapes ─────────────────────────── */

.layer-accents {
  z-index: 1;
  pointer-events: none;
}

.accent-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.35;
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: var(--color-accent);
  top: -80px;
  right: -80px;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: var(--color-cyan);
  bottom: -40px;
  left: -60px;
}

.orb-3 {
  width: 350px;
  height: 350px;
  background: var(--color-accent-light);
  top: 30%;
  left: 50%;
  opacity: 0.25;
  filter: blur(40px);
}

/* ─── Layer: hero content ────────────────────────────────────── */

.layer-content {
  z-index: 2;
  flex-direction: column;
  text-align: center;
  padding-inline: var(--space-lg);
  padding-top: var(--header-height); /* clear the fixed header */
  max-width: 840px;
}

.hero-eyebrow {
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.hero-built-by {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.hero h1 {
  font-size: var(--font-display);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-lg);
  background: linear-gradient(
    140deg,
    var(--color-text) 0%,
    var(--color-text) 30%,
    var(--color-accent-light) 60%,
    var(--color-cyan-light) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-lead {
  font-size: var(--font-lead);
  color: var(--color-text-muted);
  max-width: 52ch;
  margin-inline: auto;
  margin-bottom: var(--space-xl);
  line-height: 1.85;
}

.scroll-cta {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  opacity: 0.65;
  transition: opacity var(--transition-fast);
}

.scroll-cta:hover {
  opacity: 1;
  color: var(--color-text-muted);
}

.scroll-cta-arrow {
  animation: bounce 2.2s ease-in-out infinite;
  font-size: 1.1rem;
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(7px);
  }
}

/* ─── Parallax scroll-driven animation ──────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  @supports ((animation-timeline: scroll()) and (animation-range: 0% 100%)) {
    @keyframes parallax-bg {
      /*
       * Positive translateY: the layer is pushed DOWN relative to natural position
       * as the page scrolls UP. Net visual effect: background appears to move
       * slower than the content above it — classic "distant object" parallax.
       */
      to {
        transform: translateY(320px);
      }
    }

    @keyframes parallax-accents {
      /*
       * Negative translateY: the layer moves UP faster than the natural scroll.
       * Net visual effect: accent shapes appear to rush past — "close object" parallax.
       */
      to {
        transform: translateY(700px);
      }
    }

    .layer-bg {
      animation: parallax-bg linear both;
      animation-timeline: scroll(root);
      animation-range: 0px 130vh;
    }

    .layer-accents {
      animation: parallax-accents linear both;
      animation-timeline: scroll(root);
      animation-range: 0px 130vh;
    }
  }
}
