/* ============================================================
   MOTION LAYER — scroll reveals, parallax, hovers, marquees
   Pure CSS primitives. The JS toggles classes / sets vars.
   ============================================================ */

/* -- scroll-progress bar at the very top of the viewport ------ */
.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 2px; z-index: 200;
  background: transparent;
  pointer-events: none;
}
.scroll-progress::before {
  content: ""; display: block; height: 100%;
  width: var(--sp, 0%);
  background: linear-gradient(90deg,
    color-mix(in oklab, var(--accent) 80%, transparent) 0%,
    var(--accent) 50%,
    color-mix(in oklab, var(--accent-2) 90%, transparent) 100%);
  box-shadow: 0 0 18px color-mix(in oklab, var(--accent) 60%, transparent);
  transition: width 0.06s linear;
}

/* -- reveal primitives ---------------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.9s cubic-bezier(.16,.84,.28,1),
    transform 0.9s cubic-bezier(.16,.84,.28,1),
    filter 0.9s cubic-bezier(.16,.84,.28,1);
  will-change: transform, opacity;
}
[data-reveal="up"]    { transform: translateY(34px); }
[data-reveal="down"]  { transform: translateY(-34px); }
[data-reveal="left"]  { transform: translateX(34px); }
[data-reveal="right"] { transform: translateX(-34px); }
[data-reveal="scale"] { transform: scale(0.94); filter: blur(6px); }
[data-reveal="blur"]  { transform: translateY(20px); filter: blur(10px); }
[data-reveal="rise"]  { transform: translateY(60px); filter: blur(4px); }
[data-reveal].is-in {
  opacity: 1;
  transform: none;
  filter: none;
}

/* stagger children — uses --i set by JS */
[data-reveal-stagger] > * {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 0.85s cubic-bezier(.16,.84,.28,1),
    transform 0.85s cubic-bezier(.16,.84,.28,1);
  transition-delay: calc(var(--i, 0) * 80ms);
}
[data-reveal-stagger].is-in > * { opacity: 1; transform: none; }

/* -- word-by-word hero reveal --------------------------------- */
.word-reveal .w {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.5em) rotate(2deg);
  filter: blur(8px);
  transition:
    opacity 0.9s cubic-bezier(.2,.8,.2,1),
    transform 0.9s cubic-bezier(.2,.8,.2,1),
    filter 0.9s cubic-bezier(.2,.8,.2,1);
}
.word-reveal.is-in .w {
  opacity: 1; transform: none; filter: none;
  transition-delay: calc(var(--i, 0) * 90ms + 250ms);
}

/* -- parallax helpers ---------------------------------------- */
[data-parallax] { will-change: transform; transition: transform 0.05s linear; }

/* -- hero ambient gold orb that follows the cursor ----------- */
.hero-cursor-glow {
  position: absolute; pointer-events: none;
  width: 520px; height: 520px;
  left: var(--mx, 50%); top: var(--my, 50%);
  transform: translate(-50%, -50%);
  background: radial-gradient(circle,
    color-mix(in oklab, var(--accent) 28%, transparent) 0%,
    transparent 65%);
  filter: blur(40px);
  opacity: 0;
  transition: opacity 0.6s ease;
  z-index: 0;
  mix-blend-mode: screen;
}
.hero:hover .hero-cursor-glow { opacity: 1; }

/* -- floating ambient particles in hero ---------------------- */
.hero-floaters {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  overflow: hidden;
}
.hero-floaters span {
  position: absolute;
  width: 3px; height: 3px; border-radius: 50%;
  background: color-mix(in oklab, var(--accent) 60%, transparent);
  box-shadow: 0 0 12px color-mix(in oklab, var(--accent) 70%, transparent);
  opacity: 0;
  animation: float-up var(--d, 14s) linear infinite;
  animation-delay: var(--del, 0s);
  left: var(--lx, 50%);
  bottom: -20px;
}
@keyframes float-up {
  0%   { transform: translate(0, 0) scale(0.6); opacity: 0; }
  10%  { opacity: 0.9; }
  50%  { transform: translate(var(--dx, 20px), -50vh) scale(1); }
  90%  { opacity: 0.6; }
  100% { transform: translate(calc(var(--dx, 20px) * 2), -100vh) scale(0.4); opacity: 0; }
}

/* -- aurora that drifts behind the hero ---------------------- */
.hero-aurora-2 {
  position: absolute; inset: -10% -10% -20% -10%; pointer-events: none; z-index: 0;
  background:
    radial-gradient(36% 28% at 18% 30%, color-mix(in oklab, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(30% 24% at 82% 60%, color-mix(in oklab, var(--accent-2) 20%, transparent), transparent 70%),
    radial-gradient(40% 30% at 50% 110%, color-mix(in oklab, var(--accent) 14%, transparent), transparent 70%);
  filter: blur(30px);
  animation: aurora-drift 22s ease-in-out infinite alternate;
  opacity: 0.85;
}
@keyframes aurora-drift {
  0%   { transform: translate3d(-2%, 0, 0) scale(1); }
  50%  { transform: translate3d(3%, -2%, 0) scale(1.06); }
  100% { transform: translate3d(-1%, 2%, 0) scale(1.02); }
}

/* -- shimmer accent on em words ------------------------------ */
.hero h1 em {
  background: linear-gradient(110deg,
    oklch(0.78 0.12 70) 0%,
    oklch(0.92 0.13 80) 45%,
    oklch(0.78 0.12 70) 55%,
    oklch(0.92 0.13 80) 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 7s linear infinite;
}
@keyframes shimmer {
  0%   { background-position: 0% 50%; }
  100% { background-position: 220% 50%; }
}

/* -- animated gradient on big-number ------------------------- */
.big-number {
  background-size: 220% 220% !important;
  animation: bn-drift 8s ease-in-out infinite alternate;
  position: relative;
}
@keyframes bn-drift {
  0%   { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}
.big-number.is-pop {
  animation: bn-drift 8s ease-in-out infinite alternate, bn-pop 1.4s cubic-bezier(.2,.8,.2,1);
}
@keyframes bn-pop {
  0%   { transform: scale(0.6) rotate(-3deg); opacity: 0; filter: blur(20px); }
  60%  { transform: scale(1.05) rotate(0.5deg); opacity: 1; filter: blur(0); }
  100% { transform: scale(1) rotate(0); }
}

/* -- problem cards : tilt + cursor light --------------------- */
.problem-card, .feature-card {
  transform-style: preserve-3d;
}
.problem-card::after, .feature-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--cx, 50%) var(--cy, 50%),
    color-mix(in oklab, var(--accent) 14%, transparent), transparent 50%);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.problem-card:hover::after, .feature-card:hover::after { opacity: 1; }

/* -- step number reveal animation ---------------------------- */
.step .step-num {
  position: relative;
  display: inline-block;
}
.step.is-in .step-num::after {
  content: ""; position: absolute; left: 0; bottom: -6px;
  height: 1px; width: 0;
  background: var(--accent);
  animation: line-grow 1.2s 0.4s cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes line-grow { to { width: 60px; } }

/* -- magnetic buttons ---------------------------------------- */
.magnetic { transition: transform 0.25s cubic-bezier(.2,.8,.2,1); }

/* -- marquee for trust strip --------------------------------- */
.marquee {
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
}
.marquee-track {
  display: flex;
  gap: 64px;
  width: max-content;
  animation: marquee 35s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--fg-muted);
  font-family: var(--font-mono); font-size: 13px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.marquee-track span::before {
  content: ""; width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent-2); opacity: 0.7;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* -- count-up flip-y "drop" cue ------------------------------ */
.count-flash {
  display: inline-block;
  animation: count-flash 0.45s cubic-bezier(.2,.8,.2,1);
}
@keyframes count-flash {
  0%   { transform: translateY(-3px); opacity: 0.5; }
  100% { transform: none; opacity: 1; }
}

/* -- ROI-out hero pulse on slider change --------------------- */
.roi-out-hero { transition: transform 0.25s cubic-bezier(.2,.8,.2,1), box-shadow 0.25s; }
.roi-out-hero.bump {
  transform: scale(1.03);
  box-shadow: 0 24px 50px -16px color-mix(in oklab, var(--accent) 70%, transparent);
}
.roi-out-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%);
  transform: translateX(-100%);
}
.roi-out-hero.bump::after { animation: sweep 0.7s ease-out; }
@keyframes sweep { to { transform: translateX(100%); } }

/* -- compare table row reveal -------------------------------- */
.compare tbody tr {
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.6s cubic-bezier(.2,.8,.2,1), transform 0.6s cubic-bezier(.2,.8,.2,1), background 0.2s;
}
.compare-wrap.is-in tbody tr {
  opacity: 1; transform: none;
  transition-delay: calc(var(--i, 0) * 60ms);
}
.compare tbody tr:hover {
  background: color-mix(in oklab, var(--accent) 4%, transparent);
}
.compare td.us {
  position: relative;
}
.compare-wrap.is-in td.us {
  animation: us-glow 2.4s 1s ease-in-out;
}
@keyframes us-glow {
  0%, 100% { box-shadow: inset 0 0 0 0 transparent; }
  50%      { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 60%, transparent); }
}

/* -- nav: tightens & gets a shadow on scroll ----------------- */
.nav {
  transition: background 0.3s, border-color 0.3s, height 0.3s, box-shadow 0.3s;
}
.nav.is-scrolled {
  box-shadow: 0 8px 28px -16px rgba(14, 26, 46, .18);
  background: color-mix(in oklab, var(--bg) 92%, transparent);
}
.nav.on-dark.is-scrolled {
  background: #0A1426;
  box-shadow: 0 8px 28px -16px rgba(0, 0, 0, .5);
}

/* -- satellite scan line gets a pulse ring on activate ------ */
.sat-stage.is-in::before {
  animation: sat-breathe 6s ease-in-out infinite;
}
@keyframes sat-breathe {
  0%, 100% { filter: saturate(1) brightness(1); }
  50%      { filter: saturate(1.15) brightness(1.08); }
}
.sat-house {
  transition: transform 1.2s cubic-bezier(.2,.8,.2,1);
  transform: rotate(-12deg) scale(0.7);
  opacity: 0;
}
.sat-stage.is-in .sat-house { transform: rotate(-12deg) scale(1); opacity: 1; }

/* CTA banner — animated gradient shine */
.cta-banner {
  position: relative;
  overflow: hidden;
}
.cta-banner::after {
  content: ""; position: absolute; inset: -50%;
  background: conic-gradient(from var(--ang, 0deg),
    transparent 0deg, transparent 280deg,
    color-mix(in oklab, var(--accent) 40%, transparent) 320deg,
    transparent 360deg);
  animation: spin 14s linear infinite;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}
.cta-banner > * { position: relative; z-index: 1; }
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* -- prefers-reduced-motion: kill it all --------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  [data-reveal], [data-reveal-stagger] > *, .word-reveal .w {
    opacity: 1 !important; transform: none !important; filter: none !important;
  }
}
