/* Motion layer (js/motion.js). Hidden start states apply only under html.m-on, which motion.js sets
   when the visitor allows motion; without JavaScript or under reduced motion every element shows its
   final state. Animations use transform, opacity, clip-path and stroke-dashoffset only. */

/* M1 scroll progress: a 2px bar at the top that shows how far down a long page the visitor is. */
.m-progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; background: #1E4ED8; transform: scaleX(0); transform-origin: 0 50%; z-index: 60; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: scroll()) {
    .m-progress.m-css { animation: m-progress linear both; animation-timeline: scroll(root block); }
  }
}
@keyframes m-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* M3 Flight Record: the three stat cards deal out from one stack while their numbers count up. */
[data-m-deal] h3 { font-variant-numeric: tabular-nums; }
.m-on .m-wait { opacity: 0; }
.m-on .m-deal { animation: m-stack-in .15s linear both, m-deal-out .65s cubic-bezier(.22, 1, .36, 1) var(--d, 0ms) both; }
@keyframes m-stack-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes m-deal-out { from { translate: var(--dx) var(--dy); rotate: var(--r); } to { translate: 0 0; rotate: 0deg; } }

/* M8 heading sweep: one left-to-right light pass over a section heading's blue italic word on entry. */
.m-on .m-sweep { position: relative; }
.m-on .m-sweep::after { content: attr(data-m-text); content: attr(data-m-text) / ""; position: absolute; left: 0; top: 0; white-space: pre; pointer-events: none; -webkit-text-fill-color: rgba(255, 255, 255, .6); clip-path: inset(-20% 100% -20% -35%); }
.m-on .m-sweep.m-go::after { animation: m-sweep .8s cubic-bezier(.45, 0, .25, 1) .35s both; }
@keyframes m-sweep { from { clip-path: inset(-20% 100% -20% -35%); } to { clip-path: inset(-20% -35% -20% 100%); } }

/* M2 process graphic: nodes wait dimmed until the drawing line reaches them, pulse once, and their card settles. */
.m-on .m-node { opacity: .35; transition: opacity .2s ease; transform-box: fill-box; transform-origin: center; }
.m-on .m-node.m-hit { opacity: 1; }
.m-on .m-node.m-pulse { animation: m-pulse .65s cubic-bezier(.22, 1, .36, 1) both; }
.m-on .sf-s { transform-box: view-box; }
@keyframes m-pulse { 0% { transform: scale(1); } 30% { transform: scale(1.45); } 100% { transform: scale(1); } }
.m-on .m-settle { animation: m-rise .65s cubic-bezier(.22, 1, .36, 1) var(--d, 0ms) both; }
@keyframes m-rise { from { opacity: 0; translate: 0 14px; } to { opacity: 1; translate: 0 0; } }

/* M4 "How it runs": a rail through the four bullets fills as the visitor scrolls past; passed bullets turn solid. */
.m-on .m-rail { position: relative; z-index: 0; }
.m-on .m-rail::before, .m-on .m-rail::after { content: ""; position: absolute; left: 2.5px; width: 1px; top: var(--m-top, 0); height: var(--m-h, 0); z-index: -1; transform-origin: 50% 0; }
.m-on .m-rail::before { background: #E5E5E5; }
.m-on .m-rail::after { background: #1E4ED8; transform: scaleY(var(--m-fill, 0)); }
.m-on .m-rail > li > div { transition: opacity .2s ease; }
.m-on .m-rail > li > div.m-pass { opacity: 1; }

/* M5 project cards: on hover the cover eases to 1.04 inside its frame and the round arrow nudges 4px. */
@media (hover: hover) {
  #projects .group img { transition: transform .2s cubic-bezier(.22, 1, .36, 1); }
  #projects .group:hover img { transform: scale(1.04); }
  #projects .group .rounded-full > svg { transition: transform .18s cubic-bezier(.22, 1, .36, 1); }
  #projects .group:hover .rounded-full > svg { transform: translateX(4px); }
}
/* M5 Batara card (no cover image): its word draws in left to right. */
.m-on .m-clip-wait { clip-path: inset(-15% 100% -15% -4%); }
.m-on .m-clip-go { animation: m-clip .65s cubic-bezier(.22, 1, .36, 1) var(--d, 0ms) both; }
@keyframes m-clip { from { clip-path: inset(-15% 100% -15% -4%); } to { clip-path: inset(-15% -4% -15% -4%); } }

/* M6 platform previews: the window frame lands first, then its rows fill in from top to bottom. */
.m-on .m-row { animation: m-rise-sm .65s cubic-bezier(.22, 1, .36, 1) var(--d, 0ms) both; }
@keyframes m-rise-sm { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }

/* M7 closing band: the rocket lifts off along a short curve with a gold trail that fades, then rests;
   the headline words rise in sequence. The rocket sits in the band's top-right corner, clear of the text. */
.m-launch { position: absolute; top: 20px; right: 22px; width: 34px; height: 34px; pointer-events: none; }
@media (min-width: 1024px) { .m-launch { top: 28px; right: 36px; width: 44px; height: 44px; } }
.m-launch img { position: relative; display: block; width: 100%; height: 100%; }
.m-launch svg { position: absolute; left: calc(50% - 44px); top: calc(50% - 4px); width: 48px; height: 48px; overflow: visible; }
.m-launch path { fill: none; stroke: #F9B918; stroke-width: 1.25; stroke-linecap: round; stroke-dasharray: 1 2; opacity: 0; }
.m-on .m-launch.m-go img { animation: m-lift 1.1s linear .15s both; }
.m-on .m-launch.m-go path { animation: m-trail 1.1s linear .15s both, m-trail-fade 1.25s linear .15s both; }
@keyframes m-lift {
  0% { opacity: 0; translate: -40px 40px; rotate: -14deg; } 10% { opacity: 1; translate: -39.7px 39px; rotate: -13.8deg; }
  20% { translate: -38.1px 34.7px; rotate: -12.8deg; } 30% { translate: -32.8px 23.9px; rotate: -10.1deg; }
  40% { translate: -21.3px 10.6px; rotate: -5.8deg; } 50% { translate: -12.3px 4.7px; rotate: -3.1deg; }
  60% { translate: -6.7px 2.2px; rotate: -1.6deg; } 70% { translate: -3.3px 1px; rotate: -.8deg; }
  80% { translate: -1.3px .4px; rotate: -.3deg; } 90% { translate: -.3px .1px; rotate: -.1deg; }
  100% { opacity: 1; translate: 0 0; rotate: 0deg; } }
@keyframes m-trail {
  0% { stroke-dashoffset: 1; } 10% { stroke-dashoffset: .984; } 20% { stroke-dashoffset: .914; } 30% { stroke-dashoffset: .72; }
  40% { stroke-dashoffset: .411; } 50% { stroke-dashoffset: .221; } 60% { stroke-dashoffset: .117; } 70% { stroke-dashoffset: .057; }
  80% { stroke-dashoffset: .022; } 90% { stroke-dashoffset: .005; } 100% { stroke-dashoffset: 0; } }
@keyframes m-trail-fade { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
.m-wsplit { display: inline-block; -webkit-background-clip: text; background-clip: text; }
.m-on .m-word { animation: m-rise-word .65s cubic-bezier(.22, 1, .36, 1) var(--d, 0ms) both; }
@keyframes m-rise-word { from { opacity: 0; translate: 0 .35em; } to { opacity: 1; translate: 0 0; } }

/* Why us, "shine": one soft band of light crosses the mascot, masked to its shape, in step with the heading's M8 sweep. */
.m-on .why-glint.m-go::before { animation: m-glint .8s cubic-bezier(.45, 0, .25, 1) .35s both; }
@keyframes m-glint { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
/* Why us list: the three problems land one by one, each hairline drawing left to right; the closing line follows. */
.m-on .m-why-in { animation: m-rise-why .65s cubic-bezier(.22, 1, .36, 1) var(--d, 0ms) both; }
.m-on .why-row.m-why-in::after { animation: m-draw .65s cubic-bezier(.22, 1, .36, 1) var(--d, 0ms) both; }
@keyframes m-rise-why { from { opacity: 0; translate: 0 12px; } to { opacity: 1; translate: 0 0; } }
@keyframes m-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }

