/* ==========================================================================
   MediaAtlas Motion (mo) — site-wide motion system
   Pairs with /js/mo.js. Everything is additive: without html.mo (no JS, or
   prefers-reduced-motion) pages render complete and static.

   Automatic on every page:  hero cascade + word-rise H1 + token field,
   staggered scroll reveals (grids detected), H2 word-rise, eyebrow decode,
   card spotlight, magnetic buttons, cursor aura, scroll progress, header
   hide-on-scroll, CTA orbit, logo draw, cross-page view transitions.
   Opt-in attributes:  data-mo-seq[="rail"], data-mo-fill, data-mo-loop,
   data-mo-draw, data-mo-tilt, data-mo-words, data-mo-target, data-mo="off".
   ========================================================================== */

:root {
  --mo-accent: #f79c1f;
  --mo-accent-rgb: 247, 156, 31;
  --mo-hot: #ffd79c;
  --mo-ease: cubic-bezier(.2, .7, .1, 1);
  --mo-ease-io: cubic-bezier(.6, 0, .2, 1);
}

@keyframes moUp { from { opacity: 0; translate: 0 24px; } to { opacity: 1; translate: 0 0; } }
@keyframes moPanel { from { opacity: 0; translate: 56px 0; scale: 0.95; filter: blur(6px); } to { opacity: 1; translate: 0 0; scale: 1; filter: blur(0); } }
@keyframes moRise { from { translate: 0 110%; rotate: 4deg; } to { translate: 0 0; rotate: 0deg; } }
@keyframes moShine { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes moDraw { from { scale: 0 1; } to { scale: 1 1; } }
@keyframes moSpin { to { rotate: 360deg; } }
@keyframes moScan { 0% { translate: 0 -10%; opacity: 0; } 10%, 90% { opacity: 1; } 100% { translate: 0 1100%; opacity: 0; } }
@keyframes moPulseOk { 0%, 100% { box-shadow: 0 0 0 0 rgba(63, 217, 164, 0.5); } 60% { box-shadow: 0 0 0 5px rgba(63, 217, 164, 0); } }
@keyframes moBreathe { 0%, 100% { box-shadow: inset 0 0 0 1px rgba(var(--mo-accent-rgb), 0.25); } 50% { box-shadow: inset 0 0 0 1px rgba(var(--mo-accent-rgb), 0.6), inset 0 0 40px rgba(var(--mo-accent-rgb), 0.07); } }
@keyframes moLogoDraw { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
@keyframes moPop { from { opacity: 0; scale: 0; } to { opacity: 1; scale: 1; } }

/* ---------- hero cascade (pure CSS, starts before JS; only when arriving from outside,
   so moving between our own pages never hides and re-shows content) ---------- */
.mo.mo-first :where(main > section:first-of-type) :is(h1, h1 ~ *, :has(+ h1)) { animation: moUp 0.9s var(--mo-ease) both; animation-delay: calc(0.08s + var(--k, 1) * 0.11s); }
.mo.mo-first :where(main > section:first-of-type) :is(h1, h1 ~ *, :has(+ h1)):nth-child(1) { --k: 0; }
.mo.mo-first :where(main > section:first-of-type) :is(h1, h1 ~ *, :has(+ h1)):nth-child(2) { --k: 1; }
.mo.mo-first :where(main > section:first-of-type) :is(h1, h1 ~ *, :has(+ h1)):nth-child(3) { --k: 5; }
.mo.mo-first :where(main > section:first-of-type) :is(h1, h1 ~ *, :has(+ h1)):nth-child(4) { --k: 6; }
.mo.mo-first :where(main > section:first-of-type) :is(h1, h1 ~ *, :has(+ h1)):nth-child(5) { --k: 7; }
.mo.mo-first :where(main > section:first-of-type) :is(h1, h1 ~ *, :has(+ h1)):nth-child(6) { --k: 8; }
.mo.mo-first :where(main > section:first-of-type) :is(h1, h1 ~ *, :has(+ h1)):nth-child(n+7) { --k: 9; }
.mo.mo-first :where(main > section:first-of-type) h1.mo-split { animation: none; }
.mo.mo-first :where(main > section:first-of-type) :is(.ag-hero__grid, .tp-hero__grid) > :nth-child(2) { animation: moPanel 1.2s var(--mo-ease) 0.5s both; }

/* legacy .animate-* classes hide the hero until main.js runs, which blinks on every page
   change; the hero is always shown at once (first arrival gets the mo cascade instead) */
.mo main > section:first-of-type :is(.animate-on-scroll, .animate-from-left, .animate-from-right, .animate-scale),
.mo main > section:first-of-type:is(.animate-on-scroll, .animate-from-left, .animate-from-right, .animate-scale) { opacity: 1; transform: none; transition: none; }

/* ---------- word split (H1 on load, H2 on reveal) ---------- */
.mo-w { display: inline-block; overflow: hidden; vertical-align: bottom; padding: 0 0.03em 0.13em; margin: 0 -0.03em -0.13em; }
.mo-w > span { display: inline-block; }
:is(h1, h2).mo-split span:not(.mo-acc > span) { background: none; } /* legacy '.hero__title span' paints clipped gradients on every span */
h1.mo-split .mo-w > span { animation: moRise 0.95s cubic-bezier(.2, .8, .1, 1) calc(0.12s + var(--i) * 60ms) both; }
h1.mo-split .mo-acc > span, h2.mo-split.is-in .mo-acc > span {
  background: linear-gradient(100deg, var(--mo-accent) 38%, #ffe2b8 50%, var(--mo-accent) 62%);
  background-size: 260% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
}
h1.mo-split .mo-acc > span { animation: moRise 0.95s cubic-bezier(.2, .8, .1, 1) calc(0.12s + var(--i) * 60ms) both, moShine 1.5s ease-in-out calc(1.2s + var(--i) * 90ms) both; }
h2.mo-split .mo-w > span { translate: 0 110%; }
h2.mo-split.is-in .mo-w > span { animation: moRise 0.85s cubic-bezier(.2, .8, .1, 1) calc(var(--i) * 45ms) both; }
h2.mo-split.is-in .mo-acc > span { animation: moRise 0.85s cubic-bezier(.2, .8, .1, 1) calc(var(--i) * 45ms) both, moShine 1.4s ease-in-out calc(0.6s + var(--i) * 80ms) both; }

/* underline draw on accent phrases in hero claim + CTA */
.mo .ma-claim em, .mo .tp-cta h2 em { position: relative; display: inline-block; }
.mo .ma-claim em::after, .mo .tp-cta h2 em::after { content: ""; position: absolute; left: 0; right: 0; bottom: -0.1em; height: 2px; border-radius: 2px; background: var(--mo-accent); transform-origin: left; box-shadow: 0 0 12px rgba(var(--mo-accent-rgb), 0.6); }
.mo.mo-first .ma-claim em::after { animation: moDraw 0.7s var(--mo-ease-io) 1.5s both; }
.mo .tp-cta h2 em::after { height: 3px; bottom: 0; scale: 0 1; transition: scale 0.9s var(--mo-ease-io) 0.5s; }
.mo .tp-cta.is-in h2 em::after { scale: 1 1; }

/* ---------- token field ---------- */
.mo-hero { position: relative; isolation: isolate; }
.mo-field { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; opacity: 0; transition: opacity 1.6s ease 0.3s; }
.mo-field.is-on { opacity: 1; }
.mo:not(.mo-first) .mo-field { transition: none; }
.mo:not(.mo-first) .mo-scan > .mo-scanline { animation: moScan 2.6s cubic-bezier(.5, 0, .5, 1) 9s infinite; }
.mo-hero > :not(.mo-field) { position: relative; z-index: 1; }

/* ---------- panels: tilt, spotlight, scan ---------- */
.mo-tilt { position: relative; transform: perspective(1400px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform 0.45s var(--mo-ease); }
.mo-tilt::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3; border-radius: inherit; opacity: 0; transition: opacity 0.4s; background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--mo-accent-rgb), 0.11), transparent 60%); }
.mo-tilt:hover::before { opacity: 1; }
.mo-scan { position: relative; overflow: hidden; }
.mo-scan > .mo-scanline { position: absolute; left: 0; right: 0; top: 0; height: 9%; pointer-events: none; z-index: 3;
  background: linear-gradient(180deg, transparent, rgba(var(--mo-accent-rgb), 0.1) 70%, rgba(var(--mo-accent-rgb), 0.45) 98%, transparent);
  animation: moScan 2.2s cubic-bezier(.5, 0, .5, 1) 1.4s both, moScan 2.6s cubic-bezier(.5, 0, .5, 1) 11s infinite; }

/* ---------- scroll reveal ---------- */
/* cards lift on hover with their own transform (translate is owned by the reveal) */
.mo-spot { transition: transform 0.35s var(--mo-ease), border-color 0.3s; }
.mo-rv { opacity: 0; translate: 0 26px; transition: opacity 0.85s var(--mo-ease), translate 0.85s var(--mo-ease), transform 0.35s var(--mo-ease), border-color 0.3s;
  transition-delay: calc(var(--d, 0) * 75ms), calc(var(--d, 0) * 75ms), 0s, 0s; }
/* 'none' (not '0 0') so revealed blocks don't become containing blocks for sticky/fixed children */
.mo-rv.is-in { opacity: 1; translate: none; }
.mo-rv[data-mo-from="left"] { translate: -30px 0; }
.mo-rv[data-mo-from="left"].is-in { translate: none; }
.mo-rv[data-mo-from="scale"] { translate: none; scale: 0.94; transition-property: opacity, scale; }
.mo-rv[data-mo-from="scale"].is-in { scale: none; }

/* section hairline: draws out from the centre as the section arrives, then settles */
.mo-secline { position: absolute; left: 0; right: 0; top: -1px; height: 1px; pointer-events: none; z-index: 2;
  background: linear-gradient(90deg, transparent, rgba(var(--mo-accent-rgb), 0.9) 50%, transparent);
  scale: 0 1; opacity: 1; transition: scale 1.3s var(--mo-ease-io), opacity 1.6s ease 1.4s; }
.mo-secline.is-in { scale: 1 1; opacity: 0.35; }

/* featured cards: a light travels around the border */
@property --mo-a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes moOrbitBorder { to { --mo-a: 360deg; } }
.mo-glowring { position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; z-index: 2; padding: 1px;
  background: conic-gradient(from var(--mo-a), transparent 0 70%, rgba(var(--mo-accent-rgb), 0.95) 85%, transparent 95%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: moOrbitBorder 5s linear infinite; }

/* eyebrow line draws in */
.mo .tp-eyebrow::before { transform-origin: left; transition: scale 0.7s var(--mo-ease-io) 0.15s; }
.mo .tp-eyebrow.mo-rv:not(.is-in)::before { scale: 0 1; }

/* ---------- card spotlight ---------- */
.mo-spot { position: relative; }
.mo-spot:hover { transform: translateY(-3px); }
.mo-spot::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity 0.35s; z-index: 2;
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--mo-accent-rgb), 0.12), transparent 65%); }
.mo-spot:hover::after { opacity: 1; }

/* ---------- sequences: children light up in order, optional rail ---------- */
[data-mo-seq] { position: relative; }
.mo-seq > * { transition: box-shadow 0.5s, border-color 0.5s; }
.mo-seq > *::before { transition: color 0.4s, text-shadow 0.4s; }
.mo-seq:not(.is-run) > *::before { color: var(--tp-ink-3, #7c7c85); }
.mo-seq > .is-lit::before { text-shadow: 0 0 12px rgba(var(--mo-accent-rgb), 0.7); }
.mo-seq > .is-lit:first-child { animation: moBreathe 3.6s ease-in-out 2.8s infinite; }
.mo-rail { display: none; }
@media (min-width: 900px) {
  .mo-rail { display: block; position: absolute; left: 1.3rem; right: 1.3rem; top: 0; height: 2px; pointer-events: none; z-index: 2; }
  .mo-rail::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--mo-accent), rgba(var(--mo-accent-rgb), 0.3)); transform-origin: left; scale: 0 1; transition: scale 2.6s cubic-bezier(.5, 0, .3, 1); }
  .mo-rail i { position: absolute; top: -3px; left: 0; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--mo-hot); box-shadow: 0 0 14px 3px rgba(var(--mo-accent-rgb), 0.8); opacity: 0; transition: left 2.6s cubic-bezier(.5, 0, .3, 1), opacity 0.3s; }
  .mo-seq.is-run .mo-rail::before { scale: 1 1; }
  .mo-seq.is-run .mo-rail i { left: 100%; opacity: 1; }
  .mo-rail--v { left: 0; right: auto; top: 0; bottom: 0; width: 2px; height: auto; }
  .mo-rail--v::before { transform-origin: top; scale: 1 0; }
  .mo-seq.is-run .mo-rail--v::before { scale: 1 1; }
  .mo-rail--v i { left: -3px; top: 0; margin: -4px 0 0; transition: top 2.6s cubic-bezier(.5, 0, .3, 1), opacity 0.3s; }
  .mo-seq.is-run .mo-rail--v i { left: -3px; top: 100%; }
}

/* ---------- fills: [data-mo-fill="0.72"] bar grows to value ---------- */
.mo-fill { transform-origin: left; scale: 0 1; transition: scale 1.6s var(--mo-ease-io) var(--mo-delay, 0.4s); }
.mo-fill.is-in { scale: var(--mo-to, 1) 1; }
.mo-fade-late { transition: opacity 0.6s ease 2.1s; }
.mo-filled > .mo-fade-late { opacity: 0; }

/* ---------- loops: [data-mo-loop] animate only while visible ---------- */
.mo-loop *, .mo-loop *::before, .mo-loop *::after { animation-play-state: paused !important; }
.mo-loop.is-run *, .mo-loop.is-run *::before, .mo-loop.is-run *::after { animation-play-state: running !important; }

/* ---------- SVG draw: [data-mo-draw] ---------- */
.mo-draw.mo-armed :is(path, line, polyline) { stroke-dasharray: 1; stroke-dashoffset: 1; }
.mo-draw.mo-armed circle.mo-dot { opacity: 0; transform-box: fill-box; transform-origin: center; }
.mo-draw.is-in :is(path, line, polyline) { transition: stroke-dashoffset 1.4s var(--mo-ease-io); transition-delay: calc(var(--i, 0) * 180ms); stroke-dashoffset: 0; }
.mo-draw.is-in circle.mo-dot { animation: moPop 0.5s ease-out both; animation-delay: calc(0.6s + var(--i, 0) * 70ms); }

/* count-up spans must not pick up label styles like ".stat span { display: block }" */
:is(.mo-count, [data-count]) { display: inline !important; font: inherit !important; margin: 0 !important; padding: 0 !important; color: inherit !important; letter-spacing: inherit !important; }

/* ---------- live dots (things that are running) ---------- */
.mo-live::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 0.55rem; border-radius: 50%; background: var(--tp-ok, #3fd9a4); vertical-align: 0.12em; }
.mo .mo-live::before { animation: moPulseOk 2.4s ease-out infinite; animation-delay: calc(var(--d, 0) * 0.4s); }

/* ---------- CTA orbit (inserted into .tp-cta) ---------- */
.mo-orbit { position: absolute; left: 50%; top: 50%; width: min(900px, 140vw); aspect-ratio: 1; translate: -50% -50%; pointer-events: none; z-index: 0; opacity: 0.55;
  background: conic-gradient(from 0deg, transparent 0 62%, rgba(var(--mo-accent-rgb), 0.35) 78%, transparent 92%);
  -webkit-mask: radial-gradient(circle, transparent 54%, #000 55%, #000 56%, transparent 57%, transparent 66%, #000 67%, #000 67.4%, transparent 68%);
          mask: radial-gradient(circle, transparent 54%, #000 55%, #000 56%, transparent 57%, transparent 66%, #000 67%, #000 67.4%, transparent 68%);
  animation: moSpin 24s linear infinite; }
.tp-cta > .tp-wrap { position: relative; z-index: 1; }

/* ---------- buttons: magnet + shine ---------- */
.mo-magnet { transition: translate 0.35s var(--mo-ease), box-shadow 0.3s, transform 0.3s; translate: var(--tx, 0) var(--ty, 0); }
.mo .btn-primary { position: relative; overflow: hidden; }
.mo .btn-primary::after { content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; pointer-events: none; transform: skewX(-20deg); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent); transition: left 0.7s var(--mo-ease); }
.mo .btn-primary:hover::after { left: 130%; }

/* ---------- cursor aura + scroll progress ---------- */
.mo-aura { position: fixed; left: 0; top: 0; width: 640px; height: 640px; margin: -320px 0 0 -320px; border-radius: 50%; pointer-events: none; z-index: 1; opacity: 0; transition: opacity 0.6s;
  background: radial-gradient(circle, rgba(var(--mo-accent-rgb), 0.055), transparent 62%); will-change: transform; }
.mo-aura.is-on { opacity: 1; }
.mo-progress { position: fixed; left: 0; right: 0; top: 0; height: 2px; z-index: 1100; pointer-events: none; transform-origin: left; transform: scaleX(0);
  background: linear-gradient(90deg, var(--mo-accent), #ff5a4d); box-shadow: 0 0 10px rgba(var(--mo-accent-rgb), 0.6); }

/* ---------- header: hide on scroll down, return on scroll up ---------- */
.mo .header { transition: translate 0.45s var(--mo-ease), background-color 0.3s, border-color 0.3s; }
.mo .header.mo-hide { translate: 0 -100%; }
.mo .header.mo-hide:focus-within { translate: none; }
/* sticky bars that sit under the header move up while it is hidden */
.mo :is(.tp-subnav) { transition: top 0.45s var(--mo-ease); }
.mo.mo-head-off :is(.tp-subnav) { top: 0; }

/* ---------- menus ---------- */
.mo .nav-dropdown__item { transition: color 0.2s, background-color 0.2s, translate 0.25s var(--mo-ease); }
.mo .nav-dropdown__item:hover { translate: 3px 0; }
.mo .nav-dropdown:is(:hover, :focus-within) .nav-dropdown__item { animation: moUp 0.35s var(--mo-ease) both; }
.mo .nav-dropdown:is(:hover, :focus-within) .nav-dropdown__item:nth-child(2) { animation-delay: 0.03s; }
.mo .nav-dropdown:is(:hover, :focus-within) .nav-dropdown__item:nth-child(3) { animation-delay: 0.06s; }
.mo .nav-dropdown:is(:hover, :focus-within) .nav-dropdown__item:nth-child(4) { animation-delay: 0.09s; }
.mo .nav-dropdown:is(:hover, :focus-within) .nav-dropdown__item:nth-child(5) { animation-delay: 0.12s; }
.mo .nav-item { position: relative; }
.mo .header__nav > .nav-item::after, .mo .header__nav > .nav-dropdown > .nav-item::after { content: ""; position: absolute; left: 0.75rem; right: 0.75rem; bottom: 0.3rem; height: 1px; background: var(--mo-accent); transform-origin: left; scale: 0 1; transition: scale 0.35s var(--mo-ease-io); }
.mo .header__nav > .nav-item:is(:hover, .active)::after, .mo .header__nav > .nav-dropdown:hover > .nav-item::after { scale: 1 1; }
.mo .mobile-menu.active .nav-item { animation: moUp 0.45s var(--mo-ease) both; }
.mo .mobile-menu.active .nav-item:nth-child(1) { animation-delay: 0.05s; } .mo .mobile-menu.active .nav-item:nth-child(2) { animation-delay: 0.08s; }
.mo .mobile-menu.active .nav-item:nth-child(3) { animation-delay: 0.11s; } .mo .mobile-menu.active .nav-item:nth-child(4) { animation-delay: 0.14s; }
.mo .mobile-menu.active .nav-item:nth-child(5) { animation-delay: 0.17s; } .mo .mobile-menu.active .nav-item:nth-child(6) { animation-delay: 0.2s; }
.mo .mobile-menu.active .nav-item:nth-child(7) { animation-delay: 0.23s; } .mo .mobile-menu.active .nav-item:nth-child(n+8) { animation-delay: 0.26s; }

/* ---------- forms: focus glow ---------- */
.mo main :is(input, textarea, select) { transition: border-color 0.25s, box-shadow 0.35s var(--mo-ease); }
.mo main :is(input, textarea, select):focus { box-shadow: 0 0 0 3px rgba(var(--mo-accent-rgb), 0.18), 0 0 24px rgba(var(--mo-accent-rgb), 0.12); }

/* ---------- hero drifts up and dims as you scroll past it (scroll-driven, no JS) ---------- */
@supports (animation-timeline: scroll()) {
  @keyframes moHeroOut { to { translate: 0 -60px; opacity: 0.25; } }
  .mo .mo-hero > :not(.mo-field) { animation: moHeroOut linear both; animation-timeline: view(); animation-range: exit 0% exit 80%; }
}

/* ---------- logo draws on first arrival ---------- */
.mo.mo-first .logo__icon circle:first-child { --len: 114; stroke-dasharray: 114; animation: moLogoDraw 1.4s var(--mo-ease-io) 0.1s both; }
.mo.mo-first .logo__icon path { --len: 36; stroke-dasharray: 36; animation: moLogoDraw 0.9s var(--mo-ease-io) 0.7s both; }
.mo.mo-first .logo__icon circle:last-child { animation: moPop 0.5s ease-out 1.3s both; transform-box: fill-box; transform-origin: center; }

/* ---------- cross-page transitions: short crossfade, header stays put ---------- */
html { background: #0a0a0a; }
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .header { view-transition-name: mo-header; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.18s; animation-timing-function: ease-out; }
  ::view-transition-group(mo-header) { animation: none; }
}

@media (prefers-reduced-motion: reduce) {
  .mo-field, .mo-orbit, .mo-aura, .mo-progress { display: none !important; }
}
@media print {
  .mo-rv, .mo-w > span { opacity: 1 !important; translate: none !important; }
  .mo-field, .mo-orbit, .mo-aura, .mo-progress, .mo-secline, .mo-glowring, .mo-scanline { display: none !important; }
}
