/* ═════════════════════════════════════════════════════════════════════
   PULSE Motion System — utilities + reduced-motion + scroll patterns
   ═════════════════════════════════════════════════════════════════════ */

/* ── Reveal patterns (CSS-only baseline) ───────────────────────────── */
.fx-fade { opacity: 0; transition: opacity var(--dur-4) var(--ease-out-expo); }
.fx-fade.is-visible { opacity: 1; }

.fx-rise {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity var(--dur-4) var(--ease-out-expo),
              transform var(--dur-4) var(--ease-out-expo);
}
.fx-rise.is-visible { opacity: 1; transform: translateY(0); }

.fx-mask-up { overflow: hidden; }
.fx-mask-up > .fx-mask-inner {
  display: inline-block;
  transform: translateY(110%);
  transition: transform var(--dur-5) var(--ease-out-expo);
}
.fx-mask-up.is-visible > .fx-mask-inner { transform: translateY(0); }

.fx-clip-x {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 1.2s var(--ease-in-out-quart);
}
.fx-clip-x.is-visible { clip-path: inset(0 0 0 0); }

/* Stagger delay helpers (use sparingly — prefer JS stagger) */
.fx-d1 { transition-delay: 80ms; }
.fx-d2 { transition-delay: 160ms; }
.fx-d3 { transition-delay: 240ms; }
.fx-d4 { transition-delay: 320ms; }
.fx-d5 { transition-delay: 400ms; }
.fx-d6 { transition-delay: 480ms; }

/* ── Cursor-follow spotlight (Linear/Resend pattern) ───────────────── */
[data-spotlight] {
  position: relative;
  isolation: isolate;
  --mx: 50%;
  --my: 50%;
}
[data-spotlight]::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    420px circle at var(--mx) var(--my),
    oklch(0.78 0.16 184 / 0.14),
    transparent 45%
  );
  opacity: 0;
  transition: opacity var(--dur-3) var(--ease-out-quart);
  pointer-events: none;
  z-index: 1;
}
[data-spotlight]:hover::before { opacity: 1; }
[data-spotlight] > * { position: relative; z-index: 2; }

/* ── Conic-border halo (Vercel/Linear pattern) ─────────────────────── */
@property --halo-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}
.fx-halo {
  position: relative;
  isolation: isolate;
}
.fx-halo::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(
    from var(--halo-angle, 0deg),
    transparent 0deg,
    oklch(0.78 0.16 184) 90deg,
    oklch(0.94 0.13 170) 150deg,
    transparent 210deg,
    transparent 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--dur-3) var(--ease-out-quart);
  pointer-events: none;
  z-index: 0;
}
.fx-halo:hover::after,
.fx-halo[data-halo-active]::after {
  opacity: 1;
  animation: halo-spin 4s linear infinite;
}
@keyframes halo-spin { to { --halo-angle: 360deg; } }

/* ── Scroll progress bar (page top) ────────────────────────────────── */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 2px;
  background: var(--grad-cta);
  transform-origin: 0 50%;
  transform: scaleX(var(--scroll-p, 0));
  z-index: var(--z-nav);
  pointer-events: none;
  box-shadow: 0 0 12px oklch(0.78 0.16 184 / 0.6);
}

/* ── Magnetic CTA wrapper ──────────────────────────────────────────── */
[data-magnetic] {
  display: inline-block;
  will-change: transform;
}
[data-magnetic-inner] {
  display: inline-block;
  will-change: transform;
}

/* ── Marquee (CSS-driven, paused on hover) ─────────────────────────── */
.marquee {
  position: relative;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee-scroll 38s linear infinite;
  will-change: transform;
}
.marquee:hover .marquee-track,
.marquee[data-paused] .marquee-track {
  animation-play-state: paused;
}
@keyframes marquee-scroll { to { transform: translateX(-50%); } }

/* ── Number ticker styling ─────────────────────────────────────────── */
.fx-counter {
  font-family: 'Space Mono', 'Consolas', monospace;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

/* ── Live indicator dot ────────────────────────────────────────────── */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-500);
  box-shadow: 0 0 0 0 var(--c-500);
  animation: live-pulse 1.8s var(--ease-out-quart) infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 oklch(0.78 0.16 184 / 0.55); }
  70%  { box-shadow: 0 0 0 12px oklch(0.78 0.16 184 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(0.78 0.16 184 / 0); }
}

/* ── Sticky pinned section helper ──────────────────────────────────── */
.pin-stage { position: relative; }
.pin-inner {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

/* ── Reduced motion — kill movement, keep visibility ───────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* Kill ambient/decorative motion entirely */
  .beam, .hex-float, .grid-floor-inner,
  .hero-orb-ring, .hero-orb-ring-2, .hero-orb-ring-3, .hero-orb-core,
  .live-dot { animation: none !important; }

  /* Force final state on reveals */
  .fx-fade, .fx-rise, .fx-mask-up > .fx-mask-inner, .fx-clip-x {
    opacity: 1 !important;
    transform: none !important;
    clip-path: inset(0) !important;
  }
  /* Collapse pinned sections to natural flow */
  .pin-stage { height: auto !important; }
  .pin-inner { position: static !important; height: auto !important; }
}
