/* Motion layer support styles. Pairs with motion.js and shader.js. */
:root {
  /* The signature curve: leaves fast, settles slowly. motion.js uses the same one. */
  --ease-out-expo: cubic-bezier(0.12, 1, 0.72, 1);
  --ease-in-out: cubic-bezier(0.72, 0, 0.24, 1);
}

/* Hovers and focus share the curve, so small interactions match the scroll reveals */
.btn, .card, .nav-links a, .nav { transition-timing-function: var(--ease-out-expo); }

/* Page to page transitions (View Transitions API, no JS). Works between pages on the
   same domain in Chrome, Edge and Safari 18.2+; other browsers just load the page. */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out 0.28s var(--ease-in-out) both; }
::view-transition-new(root) { animation: vt-in 0.5s var(--ease-out-expo) both; }
@keyframes vt-out { to { opacity: 0; filter: blur(6px); transform: translateY(-8px); } }
@keyframes vt-in { from { opacity: 0; filter: blur(6px); transform: translateY(12px); } }
/* The nav stays put across pages instead of fading with the content */
.nav { view-transition-name: site-nav; }

/* Shader background (shader.js). The section's own gradient shows until WebGL is ready
   and stays as the fallback when WebGL is missing. */
canvas[data-shader] {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none;
  opacity: 0; transition: opacity 1.2s var(--ease-out-expo);
  /* fade the bottom edge into the page so the hero has no hard line */
  mask-image: linear-gradient(to bottom, #000 60%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent);
}
canvas[data-shader].is-ready { opacity: 1; }
.hero:has(> canvas[data-shader]) {
  background: radial-gradient(120% 80% at 70% 0%, color-mix(in srgb, var(--color-accent) 35%, transparent), transparent 60%),
              radial-gradient(80% 60% at 10% 10%, color-mix(in srgb, var(--color-accent-2) 20%, transparent), transparent 60%);
}
canvas[data-shader] ~ * { position: relative; z-index: 1; }
.motion-on html, .motion-on body { overscroll-behavior: none; }
/* Side reveals start 48px off their resting spot; on a phone that would add a sideways
   scroll. clip (not hidden) keeps position: sticky and ScrollTrigger pins working. */
.motion-on body { overflow-x: clip; }
.motion-on { scroll-behavior: auto; } /* Lenis handles smoothing */

/* Split headlines: clip each word so it can rise in */
.split-word { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.split-word > span { display: inline-block; will-change: transform; }
/* Gradient headlines (background-clip: text) must repaint per word, or the words render transparent
   once GSAP promotes them to their own layer. */
.split-word, .split-word > span { background: inherit; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: inherit; }

/* Marquee */
[data-marquee] { overflow: hidden; white-space: nowrap; mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.marquee-track { display: inline-flex; gap: var(--space-5, 3rem); will-change: transform; }
.marquee-track > * { flex: none; }

/* Reading progress bar */
[data-progress] { position: fixed; top: 0; left: 0; height: 3px; width: 100%; background: var(--color-accent, #0066ff); z-index: 1000; pointer-events: none; }

/* Nav after scrolling past the hero */
.nav.is-scrolled { backdrop-filter: blur(12px); background: color-mix(in srgb, var(--color-bg, #0a0e1a) 80%, transparent); box-shadow: 0 1px 0 var(--color-border, rgba(255,255,255,.08)); }

/* Parallax children must be allowed to move without clipping the layout */
[data-parallax] { will-change: transform; }

/* Reduced motion: nothing hidden, nothing moving */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .split-word > span { transform: none !important; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
