/* ════════════════════════════════════════════════════════════
   VAULT motion system (all public pages) — pairs with js/motion.js
   Spring easing, compositor-only properties (transform, opacity,
   clip-path), reduced-motion respected. Content is never hidden
   unless js/motion.js is running (html.m-ready).
   ════════════════════════════════════════════════════════════ */

:root {
  --m-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --m-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --m-soft: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --m-accent: var(--sw-red, #E4002B);
}

/* ─── Page transitions (cross-document View Transitions) ──── */
@view-transition { navigation: auto; }

::view-transition-old(root) { animation: m-page-out 180ms var(--m-soft) both; }
::view-transition-new(root) { animation: m-page-in 460ms var(--m-spring) both; }

@keyframes m-page-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes m-page-in { from { opacity: 0; transform: translateY(14px); } }

/* ─── Smooth scrolling (Lenis; rules from lenis/dist/lenis.css, MIT) ─ */
html.lenis, html.lenis body { height: auto; }
html.lenis { scroll-behavior: auto; } /* Lenis animates the scroll itself; native smooth would fight it */
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis [data-lenis-prevent], .lenis .chat-widget { overscroll-behavior: contain; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* ─── Scroll progress hairline ─────────────────────────────── */
.m-progress {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999; height: 2px;
  background: var(--m-accent);
  transform-origin: 0 50%; transform: scaleX(0);
  pointer-events: none;
}
@supports (animation-timeline: scroll()) {
  .m-progress { animation: m-progress linear both; animation-timeline: scroll(root); }
  @keyframes m-progress { to { transform: scaleX(1); } }
}

/* ─── Reveal states (only while motion.js runs) ───────────── */
.m-ready .m-pending { opacity: 0; }
/* Intro items wait for motion.js; the failsafe shows them after 2.5s regardless */
.m-ready [data-m-intro]:not(.m-in) { opacity: 0; animation: m-failsafe 1ms 2.5s forwards; }
@keyframes m-failsafe { to { opacity: 1; } }
.m-ready .m-pending-clip { clip-path: inset(0 100% 0 0); }

/* Word mask for headline intros */
.m-word { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.m-word-inner { display: inline-block; will-change: transform; }

/* Rolling numerals */
.m-roll { display: inline-flex; line-height: 1; }
.m-roll-digit { display: inline-block; height: 1em; overflow: hidden; }
.m-roll-strip { display: flex; flex-direction: column; }
.m-roll-strip > span { height: 1em; line-height: 1; text-align: center; }
.m-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Canvases (3D scenes, liquid logo) settle in when they mount */
.liquid-logo-canvas, #hero3d canvas, #globe3d canvas { animation: m-fade-scale 700ms var(--m-spring) both; }
@keyframes m-fade-scale { from { opacity: 0; transform: scale(0.96); } }

/* ─── Marquee (partners ticker) ────────────────────────────── */
.m-marquee { overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.m-marquee-track { display: flex; width: max-content; animation: m-marquee var(--m-marquee-duration, 40s) linear infinite; }
.m-marquee:hover .m-marquee-track, .m-marquee:focus-within .m-marquee-track { animation-play-state: paused; }
@keyframes m-marquee { to { transform: translateX(-50%); } }

/* ─── Reduced motion: no transitions, no pending states ───── */
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .m-ready .m-pending { opacity: 1; }
  .m-ready .m-pending-clip { clip-path: none; }
  .liquid-logo-canvas, #hero3d canvas, #globe3d canvas { animation: none; }
  .m-marquee-track { animation: none; }
  .m-progress { display: none; }
}
