/* motion-system · motion.css
 * A small, themeable motion kit. Everything is driven by custom properties, uses logical
 * properties (RTL mirrors for free) and switches off for reduced motion.
 * Theme it by setting --mx-accent / --mx-accent-soft / --mx-surface / --mx-line on :root or any scope.
 * Classes ending in -a / -b are restart pairs: motion.js `flash()` alternates them so a second
 * change right after the first still plays.
 */

@property --mx-angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }

:root {
  /* tempo: press is instant, hover is quick, things enter in a quarter second, markers glide */
  --mx-press: .1s;
  --mx-hover: .16s;
  --mx-enter: .24s;
  --mx-glide: .36s;
  --mx-settle: .6s;
  /* easing: out = arriving, glide = travelling between two places, spring = small overshoot, in = leaving */
  --mx-ease-out: cubic-bezier(.2, .8, .2, 1);
  --mx-ease-glide: cubic-bezier(.65, 0, .25, 1);
  --mx-ease-spring: cubic-bezier(.34, 1.4, .64, 1);
  --mx-ease-in: cubic-bezier(.4, 0, 1, 1);
  /* colour hooks (override per project) */
  --mx-accent: #3b6cf6;
  --mx-accent-soft: color-mix(in oklab, var(--mx-accent) 16%, transparent);
  --mx-accent-glow: color-mix(in oklab, var(--mx-accent) 45%, transparent);
  --mx-surface: #fff;
  --mx-line: color-mix(in oklab, currentColor 14%, transparent);
  --mx-skel: color-mix(in oklab, currentColor 8%, transparent);
  --mx-sheen-peak: rgb(255 255 255 / .30);
  --mx-sheen-mid: rgb(255 255 255 / .12);
  --mx-stagger: 40ms;
}

/* Hosts of a pseudo-element need a positioning context. Zero specificity (:where), so a project
   class or .mx-marker (absolute) always wins. */
:where(.mx-sheen, .mx-drop, .mx-drop-x, .mx-orbit, .mx-spotlight, .mx-beam, .mx-toast, .mx-row-hover) { position: relative; }

/* ───────── kill switch ───────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
:root[data-motion='reduce'] *, :root[data-motion='reduce'] *::before, :root[data-motion='reduce'] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
:root[data-motion='reduce'] ::view-transition-group(*), :root[data-motion='reduce'] ::view-transition-old(*), :root[data-motion='reduce'] ::view-transition-new(*) { animation: none !important; }

/* ───────── 1 · arriving ───────── */
@keyframes mx-fade { from { opacity: 0; } }
@keyframes mx-rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes mx-drop-in { from { opacity: 0; transform: translateY(-6px) scale(.985); } }
@keyframes mx-pop { 0% { opacity: 0; transform: scale(.9); } 60% { transform: scale(1.04); } }
@keyframes mx-fade-out { to { opacity: 0; } }
@keyframes mx-sink { to { opacity: 0; transform: translateY(4px) scale(.985); } }

.mx-fade { animation: mx-fade var(--mx-enter) var(--mx-ease-out) both; }
.mx-rise { animation: mx-rise .28s var(--mx-ease-out) both; }
.mx-pop { animation: mx-pop .42s var(--mx-ease-out) both; }
.mx-page { animation: mx-rise .28s var(--mx-ease-out) both; }

/* children arrive one after another; set --i per child, or let the first twelve count themselves */
.mx-stagger > * { animation: mx-rise .32s var(--mx-ease-out) both; animation-delay: calc(var(--i, 0) * var(--mx-stagger)); }
.mx-stagger > :nth-child(2) { --i: 1; } .mx-stagger > :nth-child(3) { --i: 2; } .mx-stagger > :nth-child(4) { --i: 3; }
.mx-stagger > :nth-child(5) { --i: 4; } .mx-stagger > :nth-child(6) { --i: 5; } .mx-stagger > :nth-child(7) { --i: 6; }
.mx-stagger > :nth-child(8) { --i: 7; } .mx-stagger > :nth-child(9) { --i: 8; } .mx-stagger > :nth-child(10) { --i: 9; }
.mx-stagger > :nth-child(11) { --i: 10; } .mx-stagger > :nth-child(n + 12) { --i: 11; }

/* ───────── 2 · live data ───────── */
/* a figure that just changed: soft tint for a moment */
.mx-tick { border-radius: 4px; box-decoration-break: clone; }
.mx-tick.is-moving { font-variant-numeric: tabular-nums; }
.mx-tick.is-ticked-a { animation: mx-tick-a 1.3s var(--mx-ease-out); }
.mx-tick.is-ticked-b { animation: mx-tick-b 1.3s var(--mx-ease-out); }
@keyframes mx-tick-a { 0%, 12% { background-color: var(--mx-accent-soft); color: var(--mx-accent); } 100% { background-color: transparent; } }
@keyframes mx-tick-b { 0%, 12% { background-color: var(--mx-accent-soft); color: var(--mx-accent); } 100% { background-color: transparent; } }

/* a status that flipped: the new value squeezes in */
.mx-swap.is-swapped-a > * { animation: mx-swap-a .55s var(--mx-ease-out); }
.mx-swap.is-swapped-b > * { animation: mx-swap-b .55s var(--mx-ease-out); }
@keyframes mx-swap-a { 0% { transform: scale(.88); opacity: .4; } 55% { transform: scale(1.06); opacity: 1; } 100% { transform: none; } }
@keyframes mx-swap-b { 0% { transform: scale(.88); opacity: .4; } 55% { transform: scale(1.06); opacity: 1; } 100% { transform: none; } }

/* a row that is new / a row whose data changed */
.mx-row-arrive { animation: mx-row-new 2.4s var(--mx-ease-out) both; }
@keyframes mx-row-new { 0% { opacity: 0; transform: translateY(-4px); background-color: var(--mx-accent-soft); } 15% { opacity: 1; transform: none; background-color: var(--mx-accent-soft); } 100% { background-color: transparent; } }
.mx-row-pulse-a { animation: mx-row-pulse-a 1.6s var(--mx-ease-out); }
.mx-row-pulse-b { animation: mx-row-pulse-b 1.6s var(--mx-ease-out); }
@keyframes mx-row-pulse-a { 0%, 10% { background-color: var(--mx-accent-soft); } 100% { background-color: transparent; } }
@keyframes mx-row-pulse-b { 0%, 10% { background-color: var(--mx-accent-soft); } 100% { background-color: transparent; } }

/* a status dot: one ring when its state changes */
.mx-dot { inline-size: 8px; block-size: 8px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }
.mx-dot.is-ring-a { animation: mx-ring-a .8s var(--mx-ease-out); }
.mx-dot.is-ring-b { animation: mx-ring-b .8s var(--mx-ease-out); }
@keyframes mx-ring-a { 0% { box-shadow: 0 0 0 0 currentColor; } 100% { box-shadow: 0 0 0 9px transparent; } }
@keyframes mx-ring-b { 0% { box-shadow: 0 0 0 0 currentColor; } 100% { box-shadow: 0 0 0 9px transparent; } }
/* the one allowed loop: something is live *right now* (a call, a recording, a stream) */
.mx-dot.is-live { animation: mx-breathe 2.4s ease-in-out infinite; }
.mx-dot.is-live.is-ring-a { animation: mx-ring-a .8s var(--mx-ease-out), mx-breathe 2.4s .8s ease-in-out infinite; }
.mx-dot.is-live.is-ring-b { animation: mx-ring-b .8s var(--mx-ease-out), mx-breathe 2.4s .8s ease-in-out infinite; }
@keyframes mx-breathe { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in oklab, currentColor 55%, transparent); } 50% { box-shadow: 0 0 0 6px transparent; } }

/* voice / activity bars – loop only while .is-live; at rest they sit low and still */
.mx-waves { display: inline-flex; align-items: center; gap: 2px; block-size: 16px; color: var(--mx-accent); }
.mx-waves > i { inline-size: 3px; block-size: 100%; border-radius: 2px; background: currentColor; transform: scaleY(.25); transform-origin: center; opacity: .55; transition: transform .3s var(--mx-ease-out), opacity .3s; }
.mx-waves.is-live > i { opacity: 1; animation: mx-wave .9s ease-in-out infinite; animation-delay: calc(var(--i, 0) * -.13s); }
.mx-waves > i:nth-child(2) { --i: 1; } .mx-waves > i:nth-child(3) { --i: 2; } .mx-waves > i:nth-child(4) { --i: 3; } .mx-waves > i:nth-child(5) { --i: 4; }
@keyframes mx-wave { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
/* driven by a real level instead: set --level (0–1) from JS and add .is-metered */
.mx-waves.is-metered > i { animation: none; opacity: 1; transform: scaleY(calc(.2 + var(--level, 0) * (.8 - var(--i, 0) * .08))); transition: transform .09s linear; }

/* ───────── 3 · navigation ───────── */
/* a marker that glides to the active item; position comes from motion.js (--mx-x/-y/-w/-h) */
/* physical left/top on purpose: offsetLeft is measured from the left edge in RTL too */
.mx-marker { position: absolute; top: 0; left: 0; inline-size: var(--mx-w, 0); block-size: var(--mx-h, 0); transform: translate(var(--mx-x, 0), var(--mx-y, 0)); border-radius: inherit; pointer-events: none; overflow: hidden; opacity: 0; }
.mx-marker.is-placed { opacity: 1; }
.mx-marker.is-ready { transition: transform var(--mx-glide) var(--mx-ease-glide), inline-size var(--mx-glide) var(--mx-ease-glide), block-size var(--mx-glide) var(--mx-ease-glide); }

/* a light that runs once along an accent bar when the marker arrives (.mx-drop = vertical, .mx-drop-x = horizontal) */
.mx-drop, .mx-drop-x { overflow: hidden; }
.mx-drop::before, .mx-drop-x::before { content: ''; position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.mx-drop::before { background: linear-gradient(to bottom, transparent, var(--mx-sheen-peak) 50%, transparent); block-size: 70%; }
.mx-drop-x::before { background: linear-gradient(to right, transparent, var(--mx-sheen-peak) 50%, transparent); inline-size: 45%; }
.mx-drop.is-drop-a::before { animation: mx-drop-a 1s var(--mx-ease-glide); }
.mx-drop.is-drop-b::before { animation: mx-drop-b 1s var(--mx-ease-glide); }
.mx-drop-x.is-drop-a::before { animation: mx-drop-x-a .6s var(--mx-ease-glide); }
.mx-drop-x.is-drop-b::before { animation: mx-drop-x-b .6s var(--mx-ease-glide); }
@keyframes mx-drop-a { from { opacity: 1; transform: translateY(-100%); } to { opacity: 1; transform: translateY(143%); } }
@keyframes mx-drop-b { from { opacity: 1; transform: translateY(-100%); } to { opacity: 1; transform: translateY(143%); } }
@keyframes mx-drop-x-a { from { opacity: 1; transform: translateX(-100%); } to { opacity: 1; transform: translateX(225%); } }
@keyframes mx-drop-x-b { from { opacity: 1; transform: translateX(-100%); } to { opacity: 1; transform: translateX(225%); } }

/* the rare sheen: a soft band of light crossing an active surface now and then (clock in motion.js) */
.mx-sheen { overflow: hidden; isolation: isolate; }
.mx-sheen::after { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; inline-size: 60%; pointer-events: none; opacity: 0; z-index: 1;
  background: linear-gradient(105deg, transparent 0%, var(--mx-sheen-mid) 35%, var(--mx-sheen-peak) 50%, var(--mx-sheen-mid) 65%, transparent 100%); }
.mx-sheen.is-sheen-a::after { animation: mx-sheen-a 1.1s var(--mx-ease-glide); }
.mx-sheen.is-sheen-b::after { animation: mx-sheen-b 1.1s var(--mx-ease-glide); }
@keyframes mx-sheen-a { from { opacity: 1; transform: translateX(-130%); } to { opacity: 1; transform: translateX(230%); } }
@keyframes mx-sheen-b { from { opacity: 1; transform: translateX(-130%); } to { opacity: 1; transform: translateX(230%); } }

/* page change through the View Transitions API (motion.js withTransition(update, 'nav')) */
html:active-view-transition-type(nav)::view-transition-old(root) { animation: mx-fade-out .14s var(--mx-ease-in) both; }
html:active-view-transition-type(nav)::view-transition-new(root) { animation: mx-rise .26s .04s var(--mx-ease-out) both; }
html:active-view-transition-type(theme)::view-transition-old(root),
html:active-view-transition-type(theme)::view-transition-new(root) { animation-duration: .3s; }

/* ───────── 4 · feedback for what you do ───────── */
/* press goes down at once and eases back – the UI must feel like it heard you */
.mx-press { transition: transform var(--mx-hover) var(--mx-ease-out), background-color var(--mx-hover), border-color var(--mx-hover), box-shadow var(--mx-hover); }
.mx-press:active { transform: translateY(1px) scale(.985); transition-duration: 0s; }

.mx-spin { inline-size: 14px; block-size: 14px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; display: inline-block; flex: none; animation: mx-spin .7s linear infinite, mx-fade .12s both; }
/* show a spinner only after a beat, so quick actions never flicker */
.mx-spin.is-late { animation: mx-spin .7s linear infinite, mx-fade .15s .25s both; }
@keyframes mx-spin { to { transform: rotate(1turn); } }

/* a check mark that draws itself: <svg class="mx-check"><path pathLength="1" d="M5 12.5l4.5 4.5L19 7.5"/></svg> */
.mx-check path { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: mx-draw .4s .05s var(--mx-ease-out) forwards; }
@keyframes mx-draw { to { stroke-dashoffset: 0; } }

.mx-nudge { animation: mx-nudge .34s var(--mx-ease-out); }
@keyframes mx-nudge { 20% { transform: translateX(-3px); } 45% { transform: translateX(3px); } 70% { transform: translateX(-1.5px); } }

/* the focus ring settles in from a little further out */
.mx-focus :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible,
.mx-focus:focus-visible { outline: 2px solid var(--mx-accent); outline-offset: 2px; animation: mx-focus-in .2s var(--mx-ease-out); }
@keyframes mx-focus-in { from { outline-offset: 6px; outline-color: transparent; } }

/* hover that only exists where hovering exists */
@media (hover: hover) {
  .mx-lift { transition: transform .2s var(--mx-ease-out), border-color .2s, box-shadow .2s; }
  .mx-lift:hover { transform: translateY(-2px); border-color: color-mix(in oklab, var(--mx-accent) 45%, var(--mx-line)); }
  .mx-underline { text-underline-offset: 2px; transition: text-underline-offset .18s var(--mx-ease-out); }
  .mx-underline:hover { text-underline-offset: 5px; }
  /* a table row grows a small accent from the middle of its leading edge */
  .mx-row-hover { transition: background-color .15s; }
  /* on a <tr> the accent lives in the first cell: a ::before on the row itself would become a phantom table cell */
  :not(tr).mx-row-hover::before, tr.mx-row-hover > :first-child::before { content: ''; position: absolute; inset-inline-start: 0; inset-block: 50%; inline-size: 2px; background: var(--mx-accent); transition: inset-block .2s var(--mx-ease-out); }
  :not(tr).mx-row-hover:hover::before, tr.mx-row-hover:hover > :first-child::before { inset-block: 15%; }
  tr.mx-row-hover > :first-child { position: relative; }
}

/* a switch whose knob lands with a small spring: <input type="checkbox" class="mx-switch"> */
.mx-switch { appearance: none; inline-size: 38px; block-size: 22px; border-radius: 999px; background: var(--mx-line); position: relative; cursor: pointer; transition: background-color .2s; flex: none; }
.mx-switch::after { content: ''; position: absolute; inset-block-start: 3px; inset-inline-start: 3px; inline-size: 16px; block-size: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: translate .28s var(--mx-ease-spring); }
.mx-switch:checked { background: var(--mx-accent); }
.mx-switch:checked::after { translate: 16px 0; }
[dir='rtl'] .mx-switch:checked::after { translate: -16px 0; }

/* ───────── 5 · waiting ───────── */
.mx-skel { border-radius: 6px; background: linear-gradient(100deg, var(--mx-skel) 30%, color-mix(in oklab, var(--mx-skel) 40%, transparent) 50%, var(--mx-skel) 70%) 0 0 / 200% 100%; animation: mx-skel 1.4s linear infinite; color: transparent !important; user-select: none; }
@keyframes mx-skel { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* a running progress bar: light flows through the filled part */
.mx-progress { block-size: 6px; border-radius: 999px; background: var(--mx-line); overflow: hidden; }
.mx-progress > span { display: block; block-size: 100%; inline-size: var(--value, 0%); border-radius: inherit; background-color: var(--mx-accent); transition: inline-size var(--mx-settle) var(--mx-ease-out); }
.mx-progress.is-running > span { background-image: linear-gradient(110deg, transparent 25%, rgb(255 255 255 / .3) 50%, transparent 75%); background-size: 200% 100%; animation: mx-flow 1.6s linear infinite; }
@keyframes mx-flow { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* busy border: a light orbits the edge while .is-busy (a request, a call being placed) */
.mx-orbit::before { content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; pointer-events: none; opacity: 0; transition: opacity .25s;
  background: conic-gradient(from var(--mx-angle), transparent 0 62%, var(--mx-accent) 82%, color-mix(in oklab, var(--mx-accent) 30%, #fff) 92%, transparent 100%);
  -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); }
.mx-orbit.is-busy::before { opacity: 1; animation: mx-orbit 1.6s linear infinite; }
/* one lap, then gone (page open, a card that became "yours") */
.mx-orbit.is-lap-a::before { animation: mx-lap-a 2.4s linear both; }
.mx-orbit.is-lap-b::before { animation: mx-lap-b 2.4s linear both; }
@keyframes mx-orbit { to { --mx-angle: 360deg; } }
@keyframes mx-lap-a { 0% { --mx-angle: 0deg; opacity: 0; } 12%, 85% { opacity: .9; } 100% { --mx-angle: 360deg; opacity: 0; } }
@keyframes mx-lap-b { 0% { --mx-angle: 0deg; opacity: 0; } 12%, 85% { opacity: .9; } 100% { --mx-angle: 360deg; opacity: 0; } }

/* ───────── 6 · charts ───────── */
.mx-bar { transform-origin: bottom; animation: mx-grow .55s var(--mx-ease-out) both; animation-delay: calc(var(--i, 0) * 14ms); transition: block-size var(--mx-settle) var(--mx-ease-out), background-color .2s; }
@keyframes mx-grow { from { transform: scaleY(0); } }
.mx-spark-line { fill: none; stroke: var(--mx-accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; animation: mx-uncover 1.1s .2s var(--mx-ease-out) both; }
/* revealed with a clip, not a dash: dash lengths go wrong on stretched SVGs with non-scaling strokes */
@keyframes mx-uncover { from { clip-path: inset(-10% 100% -10% 0); } to { clip-path: inset(-10% -1% -10% 0); } }
[dir='rtl'] .mx-spark-line { animation-name: mx-uncover-rtl; }
@keyframes mx-uncover-rtl { from { clip-path: inset(-10% 0 -10% 100%); } to { clip-path: inset(-10% 0 -10% -1%); } }
.mx-spark-area { fill: var(--mx-accent-soft); animation: mx-fade .6s .5s both; }
.mx-spark-dot { animation: mx-pop .4s 1.1s var(--mx-ease-out) both; }
/* ring gauge: <circle pathLength="100" style="--value:72"> */
.mx-gauge-fill { fill: none; stroke: var(--mx-accent); stroke-linecap: round; stroke-dasharray: var(--value, 0) 100; animation: mx-gauge 1.1s var(--mx-ease-out) both; transition: stroke-dasharray var(--mx-settle) var(--mx-ease-out); }
@keyframes mx-gauge { from { stroke-dasharray: 0 100; } }
.mx-meter > span { display: block; inline-size: var(--value, 0%); transition: inline-size var(--mx-settle) var(--mx-ease-out), background-color .4s; animation: mx-meter-in 1s var(--mx-ease-out); }
@keyframes mx-meter-in { from { inline-size: 0; } }

/* ───────── 7 · overlays ───────── */
.mx-dialog[open] { animation: mx-drop-in .22s var(--mx-ease-out) both; }
.mx-dialog[open]::backdrop { animation: mx-fade .22s var(--mx-ease-out) both; }
.mx-dialog.is-closing { animation: mx-sink .17s var(--mx-ease-in) forwards; }
.mx-dialog.is-closing::backdrop { animation: mx-fade-out .17s var(--mx-ease-in) forwards; }
.mx-sheet[open] { animation: mx-sheet-in .28s var(--mx-ease-out) both; }
.mx-sheet.is-closing { animation: mx-sheet-out .17s var(--mx-ease-in) forwards; }
@keyframes mx-sheet-in { from { opacity: 0; translate: 40px 0; } }
@keyframes mx-sheet-out { to { opacity: 0; translate: 40px 0; } }
[dir='rtl'] .mx-sheet[open] { animation-name: mx-sheet-in-rtl; } [dir='rtl'] .mx-sheet.is-closing { animation-name: mx-sheet-out-rtl; }
@keyframes mx-sheet-in-rtl { from { opacity: 0; translate: -40px 0; } }
@keyframes mx-sheet-out-rtl { to { opacity: 0; translate: -40px 0; } }
@media (max-width: 640px) {
  .mx-dialog[open], .mx-sheet[open] { animation: mx-sheet-up .28s var(--mx-ease-out) both; }
  .mx-dialog.is-closing, .mx-sheet.is-closing { animation: mx-sheet-down .17s var(--mx-ease-in) forwards; }
}
@keyframes mx-sheet-up { from { opacity: 0; translate: 0 40px; } }
@keyframes mx-sheet-down { to { opacity: 0; translate: 0 40px; } }

/* a toast rises in; a thin bar shows how long it stays (pauses on hover) */
.mx-toast { overflow: hidden; animation: mx-toast-in .32s var(--mx-ease-out) both; }
.mx-toast::after { content: ''; position: absolute; inset-inline: 0; inset-block-end: 0; block-size: 2px; background: currentColor; opacity: .25; transform-origin: left; animation: mx-life var(--life, 4.5s) linear forwards; }
[dir='rtl'] .mx-toast::after { transform-origin: right; }
.mx-toast:hover::after { animation-play-state: paused; }
.mx-toast.is-leaving { animation: mx-toast-out .2s var(--mx-ease-in) forwards; }
@keyframes mx-toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes mx-toast-out { to { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes mx-life { to { transform: scaleX(0); } }

/* disclosure that opens smoothly where the browser can */
@supports (interpolate-size: allow-keywords) {
  .mx-details { interpolate-size: allow-keywords; }
  .mx-details::details-content { block-size: 0; overflow-y: clip; transition: block-size .28s var(--mx-ease-out), content-visibility .28s allow-discrete; }
  .mx-details[open]::details-content { block-size: auto; }
}

/* ───────── 8 · showpiece (intensity 3: one or two per screen, never on data tables) ───────── */
/* spotlight: a soft light follows the pointer across a card and lights its border (motion.js sets --mx-px/--mx-py) */
.mx-spotlight { isolation: isolate; }
.mx-spotlight::before, .mx-spotlight::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .35s var(--mx-ease-out); }
.mx-spotlight::before { z-index: -1; background: radial-gradient(260px circle at var(--mx-px, 50%) var(--mx-py, 50%), var(--mx-accent-soft), transparent 70%); }
.mx-spotlight::after { padding: 1px; background: radial-gradient(180px circle at var(--mx-px, 50%) var(--mx-py, 50%), var(--mx-accent), transparent 70%);
  -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); }
.mx-spotlight.is-lit::before, .mx-spotlight.is-lit::after { opacity: 1; }

/* tilt: the card leans a few degrees toward the pointer (motion.js sets --mx-rx/--mx-ry) */
.mx-tilt { transform: perspective(900px) rotateX(var(--mx-rx, 0deg)) rotateY(var(--mx-ry, 0deg)); transition: transform .5s var(--mx-ease-out); transform-style: preserve-3d; will-change: transform; }
.mx-tilt.is-tilting { transition-duration: .08s; }

/* magnetic: a primary button drifts a few px toward the pointer (motion.js sets --mx-mx/--mx-my) */
.mx-magnetic { translate: var(--mx-mx, 0) var(--mx-my, 0); transition: translate .45s var(--mx-ease-spring); }
.mx-magnetic.is-pulled { transition-duration: .12s; transition-timing-function: var(--mx-ease-out); }

/* beam: one light travels round the border when the element enters, or on demand (.is-lap-*) – it is .mx-orbit with a glow */
.mx-beam::before { content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; pointer-events: none; opacity: 0; filter: drop-shadow(0 0 6px var(--mx-accent-glow));
  background: conic-gradient(from var(--mx-angle), transparent 0 70%, var(--mx-accent) 88%, #fff 96%, transparent 100%);
  -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: mx-lap-a 2.4s .3s linear both; }
.mx-beam.is-lap-a::before { animation: mx-lap-a 2s linear both; } .mx-beam.is-lap-b::before { animation: mx-lap-b 2s linear both; }

/* glow: one pulse of light behind something that just succeeded */
.mx-glow.is-glow-a { animation: mx-glow-a 1.2s var(--mx-ease-out); } .mx-glow.is-glow-b { animation: mx-glow-b 1.2s var(--mx-ease-out); }
@keyframes mx-glow-a { 0% { box-shadow: 0 0 0 0 var(--mx-accent-glow); } 40% { box-shadow: 0 0 28px 4px var(--mx-accent-glow); } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes mx-glow-b { 0% { box-shadow: 0 0 0 0 var(--mx-accent-glow); } 40% { box-shadow: 0 0 28px 4px var(--mx-accent-glow); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* shine: a headline whose letters catch the light once */
.mx-shine { background: linear-gradient(100deg, currentColor 40%, color-mix(in oklab, var(--mx-accent) 70%, #fff) 50%, currentColor 60%) 100% 0 / 250% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: mx-shine 1.6s .3s var(--mx-ease-glide) both; }
@keyframes mx-shine { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* aurora: a slow, blurred colour field behind a hero or login – ambient, one per page, stops when off screen via content-visibility */
.mx-aurora { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; contain: strict; }
.mx-aurora::before, .mx-aurora::after { content: ''; position: absolute; inline-size: 55%; aspect-ratio: 1; border-radius: 50%; filter: blur(70px); opacity: .45; will-change: transform; }
.mx-aurora::before { background: var(--mx-accent); inset-block-start: -20%; inset-inline-start: -10%; animation: mx-drift-a 26s ease-in-out infinite alternate; }
.mx-aurora::after { background: var(--mx-aurora-2, color-mix(in oklab, var(--mx-accent) 40%, #f0a)); inset-block-end: -25%; inset-inline-end: -10%; animation: mx-drift-b 32s ease-in-out infinite alternate; }
@keyframes mx-drift-a { to { transform: translate(30%, 20%) scale(1.15); } }
@keyframes mx-drift-b { to { transform: translate(-25%, -15%) scale(.9); } }

/* reveal on scroll, driven by the scroll position itself (no JS); falls back to visible */
@supports (animation-timeline: view()) {
  .mx-reveal { animation: mx-rise linear both; animation-timeline: view(); animation-range: entry 0% entry 55%; }
  /* a top bar whose shadow grows as the page scrolls */
  .mx-scroll-shadow { animation: mx-shadow linear both; animation-timeline: scroll(root); animation-range: 0 80px; }
  @keyframes mx-shadow { to { box-shadow: 0 6px 24px -12px rgb(0 0 0 / .35); } }
}

/* numbers that roll like an odometer: motion.js odometer(el, value) builds the digit columns */
.mx-odo { display: inline-flex; overflow: hidden; line-height: 1.1; font-variant-numeric: tabular-nums; direction: ltr; }
.mx-odo > span { display: inline-block; block-size: 1.1em; white-space: pre; }
.mx-odo > span > i { display: flex; flex-direction: column; font-style: normal; transform: translateY(calc(var(--d, 0) * -1.1em)); transition: transform .8s var(--mx-ease-glide); transition-delay: calc(var(--i, 0) * 40ms); }
.mx-odo > span > i > b { block-size: 1.1em; font-weight: inherit; }
