/* Motion graphics on the public pages (markup: views/partials/motion.php; player: static/motion.js). Prefix mo-.
   Every figure is complete without motion: the finished frame is the default. motion.js adds .mo-play while a figure is on
   screen and restarts it each cycle; only then do the keyframes below run, and only if the reader allows motion.
   Colours come from the page tokens (app.css, site.css), so light and dark both work. */
.mo { --mo-a: var(--accent, var(--bar)); --mo-b: var(--accent-2, var(--good)); --mo-line: var(--line); --mo-bg: var(--panel); --mo-sunk: var(--sunk); --mo-mute: var(--muted);
  margin: 22px 0 26px; padding: 14px 16px 16px; border: 1px solid var(--mo-line); border-radius: 14px; min-width: 0; max-width: 100%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--mo-sunk) 55%, var(--mo-bg)), var(--mo-bg)); font-size: 14px; line-height: 1.45; color: var(--text); }
.mo code, .mo pre { font-family: var(--mono); font-size: 12.5px; }
.mo-cap { display: flex; flex-direction: column; gap: 2px; margin: 0 0 12px; }
.mo-k { display: block; font: 500 10.5px/1.35 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--mo-mute); }
.mo-cap .mo-k { color: var(--mo-a); font-size: 11px; }
.mo-cap b { font-weight: 600; font-size: 15px; }
.mo-foot { margin: 12px 0 0; font-size: 12.5px; color: var(--mo-mute); }
.mo-key { color: var(--mo-a); font-family: var(--mono); font-size: 12.5px; }
.mo-grid { display: grid; grid-template-columns: minmax(0, 1fr) 128px minmax(0, 1fr); gap: 10px; align-items: stretch; }
.mo-grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.mo-panel { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 10px 12px; border: 1px solid var(--mo-line); border-radius: 10px; background: var(--mo-bg); overflow: hidden; }
.mo-panel-out { border-color: color-mix(in srgb, var(--mo-a) 45%, var(--mo-line)); }
.mo-line { display: block; overflow-wrap: anywhere; white-space: normal; background: none; padding: 0; }
.mo-mid { display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: 6px; position: relative; }
.mo-wire { position: relative; display: block; height: 2px; margin: 4px 0 8px; background: color-mix(in srgb, var(--mo-mute) 40%, var(--mo-line)); border-radius: 2px; }
.mo-wire i { position: absolute; top: -3px; left: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--mo-a); opacity: 0; }
.mo-chip { display: inline-block; align-self: center; padding: 2px 8px; border: 1px solid var(--mo-line); border-radius: 999px; font: 500 11px/1.5 var(--mono); color: var(--mo-mute); background: var(--mo-bg); text-align: center; }
.mo-mid .mo-chip { border-color: color-mix(in srgb, var(--mo-a) 50%, var(--mo-line)); color: var(--mo-a); }
.mo-ans { display: grid; grid-template-columns: auto auto 1fr; grid-template-areas: "k t v" "r r r"; gap: 2px 8px; align-items: center; padding: 4px 0; border-top: 1px dashed var(--mo-line); }
.mo-ans:first-of-type { border-top: 0; }
.mo-ans .mo-key { grid-area: k; } .mo-type { grid-area: t; font: 10.5px/1.3 var(--mono); color: var(--mo-mute); }
.mo-ans b { grid-area: v; justify-self: end; font-family: var(--mono); font-weight: 600; }
.mo-ans .mo-meter { grid-area: r; } .mo-rule { grid-area: r; color: var(--mo-mute); font-size: 11.5px; background: none; padding: 0; }
.mo-ans .mo-meter + .mo-rule { grid-row: 3; }
.mo-meter { position: relative; display: block; height: 6px; border-radius: 6px; background: color-mix(in srgb, var(--mo-mute) 18%, transparent); overflow: visible; min-width: 48px; }
.mo-meter i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--mo-a); transform-origin: 0 50%; }
.mo-meter i.mo-no { background: color-mix(in srgb, var(--mo-mute) 55%, transparent); }
.mo-meter-lg { height: 10px; margin: 8px 0 4px; }
.mo-th { position: absolute; left: 0; top: -4px; bottom: -4px; border-right: 2px dashed var(--text); text-decoration: none; }

/* watchlist */
.mo-wtable { display: grid; gap: 4px; }
.mo-wrow { display: grid; grid-template-columns: 70px repeat(3, minmax(0, 1fr)); gap: 10px; align-items: center; padding: 5px 8px; border-radius: 8px; background: var(--mo-bg); border: 1px solid var(--mo-line); }
.mo-whead { background: none; border-color: transparent; padding-top: 0; padding-bottom: 0; }
.mo-whead span { font: 500 10.5px/1.3 var(--mono); color: var(--mo-mute); text-transform: none; }
.mo-whead code { font-size: 11px; background: none; padding: 0; }
.mo-sym { font: 600 12.5px/1.3 var(--mono); }
.mo-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mo-cell .mo-meter { flex: 1; }
.mo-cell b { font: 600 12.5px/1.3 var(--mono); }
.mo-digest { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-size: 13px; }
.mo-digest .mo-chip { color: var(--mo-a); border-color: color-mix(in srgb, var(--mo-a) 50%, var(--mo-line)); }

/* rules -> actions */
.mo-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .8fr) minmax(0, 1.2fr); gap: 10px; }
.mo-step { position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 10px 12px; border: 1px solid var(--mo-line); border-radius: 10px; background: var(--mo-bg); }
.mo-step + .mo-step::before { content: ""; position: absolute; left: -10px; top: 50%; width: 10px; height: 2px; background: color-mix(in srgb, var(--mo-mute) 40%, var(--mo-line)); }
.mo-step code { background: none; padding: 0; overflow-wrap: anywhere; }
.mo-step b { font-family: var(--mono); }
.mo-when { font-size: 13px !important; }
.mo-true { align-self: flex-start; padding: 1px 8px; border-radius: 999px; font: 600 11px/1.6 var(--mono); color: var(--mo-bg); background: var(--mo-a); }
.mo-body { margin: 0; padding: 8px; border-radius: 8px; background: var(--mo-sunk); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11.5px !important; }
.mo-skip { font-size: 12px; color: var(--mo-mute); }
.mo-skip code { color: var(--mo-mute); }

/* prose or a number */
.mo-para { margin: 0; font-size: 14px; line-height: 1.55; color: var(--text); }
.mo-scan { position: absolute; top: 28px; bottom: 34px; left: 0; width: 34%; opacity: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--mo-a) 20%, transparent), transparent); }
.mo-miss { align-self: flex-start; font: 500 11.5px/1.5 var(--mono); color: var(--bad, #c0392b); padding: 1px 8px; border: 1px dashed currentColor; border-radius: 999px; }
.mo-ok { align-self: flex-start; font: 500 11.5px/1.5 var(--mono); color: var(--mo-a); padding: 1px 8px; border: 1px solid currentColor; border-radius: 999px; }

/* cost */
.mo-costrow { display: grid; grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr) 24px minmax(0, 1fr); gap: 6px; align-items: center; }
.mo-tok { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px solid var(--mo-line); border-radius: 10px; background: var(--mo-bg); min-width: 0; }
.mo-tok b { font: 600 18px/1.3 var(--mono); }
.mo-tok-out { border-color: color-mix(in srgb, var(--mo-a) 55%, var(--mo-line)); }
.mo-tok-out b { color: var(--mo-a); }
.mo-op { text-align: center; font: 600 18px/1 var(--mono); color: var(--mo-mute); }
.mo-scale { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 10px; font-size: 13px; }
.mo-scale b { font-family: var(--mono); }

@media (max-width: 760px) {
  .mo-grid, .mo-grid-2, .mo-steps { grid-template-columns: minmax(0, 1fr); }
  .mo-mid { flex-direction: row; flex-wrap: wrap; justify-content: center; padding: 2px 0; }
  .mo-wire { display: none; }
  .mo-step + .mo-step::before { left: 50%; top: -10px; width: 2px; height: 10px; }
  .mo-costrow { grid-template-columns: minmax(0, 1fr); }
  .mo-op { padding: 0; }
  .mo-wrow { grid-template-columns: 54px repeat(3, minmax(0, 1fr)); gap: 6px; padding: 5px 6px; }
  .mo-cell { flex-direction: column; align-items: stretch; gap: 2px; }
  .mo-cell .mo-meter { min-width: 0; }
}

/* ---------------------------------------------------------------- motion: only while playing, only if allowed */
@media (prefers-reduced-motion: no-preference) {
  /* :where() keeps this at the specificity of .mo-play alone, so the delay rules below always win over its shorthand */
  .mo-play :where([class*="mo-d"]:not(.mo-step):not(.mo-digest .mo-chip)) { animation: mo-in .55s cubic-bezier(.2, .7, .2, 1) both; }
  .mo-play .mo-step { animation: mo-lit 1.6s ease-out both; }
  .mo-play .mo-meter i { animation: mo-grow .9s cubic-bezier(.3, .7, .2, 1) both; }
  .mo-play .mo-th { animation: mo-in .4s ease-out both; animation-delay: .3s; }
  .mo-play .mo-wire i { animation: mo-run 1.5s cubic-bezier(.45, 0, .3, 1) 3 both; animation-delay: 1.4s; }
  .mo-play .mo-true { animation: mo-pop .5s cubic-bezier(.2, 1.6, .4, 1) both; animation-delay: 2.4s; }
  .mo-play .mo-scan { animation: mo-scan 1.6s ease-in-out both; animation-delay: .8s; }
  .mo-play .mo-miss { animation: mo-pop .45s cubic-bezier(.2, 1.6, .4, 1) both; animation-delay: 2.4s; }
  .mo-play .mo-ok { animation: mo-pop .45s cubic-bezier(.2, 1.6, .4, 1) both; animation-delay: 4.4s; }
  .mo-play .mo-tok-out b { animation: mo-pop .5s cubic-bezier(.2, 1.6, .4, 1) both; animation-delay: 2.6s; }
  .mo-play .mo-d1 { animation-delay: .2s; } .mo-play .mo-d2 { animation-delay: .6s; } .mo-play .mo-d3 { animation-delay: 1s; } .mo-play .mo-d4 { animation-delay: 1.4s; }
  .mo-play .mo-d5 { animation-delay: 1.9s; } .mo-play .mo-d6 { animation-delay: 2.4s; } .mo-play .mo-d7 { animation-delay: 2.9s; } .mo-play .mo-d8 { animation-delay: 3.4s; }
  .mo-play .mo-d1 .mo-meter i { animation-delay: .5s; } .mo-play .mo-d2 .mo-meter i { animation-delay: .9s; } .mo-play .mo-d3 .mo-meter i { animation-delay: 1.3s; }
  .mo-play .mo-d4 .mo-meter i { animation-delay: 1.7s; } .mo-play .mo-d5 .mo-meter i { animation-delay: 2.2s; } .mo-play .mo-d6 .mo-meter i { animation-delay: 2.7s; }
  .mo-play .mo-d7 .mo-meter i { animation-delay: 3.2s; }
  .mo-flow.mo-play .mo-d5, .mo-flow.mo-play .mo-d6, .mo-flow.mo-play .mo-d7 { animation-delay: 3.6s; }
  .mo-flow.mo-play .mo-d6 { animation-delay: 4s; } .mo-flow.mo-play .mo-d7 { animation-delay: 4.4s; }
  .mo-flow.mo-play .mo-d5 .mo-meter i { animation-delay: 3.9s; }
  .mo-prose.mo-play .mo-d4 { animation-delay: 3.2s; } .mo-prose.mo-play .mo-d5 { animation-delay: 3.5s; } .mo-prose.mo-play .mo-d6 { animation-delay: 3.8s; }
  .mo-off, .mo-off * { animation-play-state: paused !important; }
}
@keyframes mo-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@keyframes mo-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes mo-run { 0% { left: 0; opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { left: calc(100% - 8px); opacity: 0; } }
@keyframes mo-pop { 0% { opacity: 0; transform: scale(.6); } 100% { opacity: 1; transform: none; } }
@keyframes mo-scan { 0% { left: -34%; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { left: 100%; opacity: 0; } }
@keyframes mo-lit { 0% { opacity: 0; transform: translateY(5px); border-color: var(--mo-line); } 25% { opacity: 1; transform: none; border-color: var(--mo-a); box-shadow: 0 0 0 4px color-mix(in srgb, var(--mo-a) 18%, transparent); } 100% { opacity: 1; border-color: var(--mo-line); box-shadow: none; } }
.mo-w0{width:0%} .mo-w1{width:1%} .mo-w2{width:2%} .mo-w3{width:3%} .mo-w4{width:4%} .mo-w5{width:5%} .mo-w6{width:6%} .mo-w7{width:7%} .mo-w8{width:8%} .mo-w9{width:9%} .mo-w10{width:10%} .mo-w11{width:11%} .mo-w12{width:12%} .mo-w13{width:13%} .mo-w14{width:14%} .mo-w15{width:15%} .mo-w16{width:16%} .mo-w17{width:17%} .mo-w18{width:18%} .mo-w19{width:19%} .mo-w20{width:20%} .mo-w21{width:21%} .mo-w22{width:22%} .mo-w23{width:23%} .mo-w24{width:24%} .mo-w25{width:25%} .mo-w26{width:26%} .mo-w27{width:27%} .mo-w28{width:28%} .mo-w29{width:29%} .mo-w30{width:30%} .mo-w31{width:31%} .mo-w32{width:32%} .mo-w33{width:33%} .mo-w34{width:34%} .mo-w35{width:35%} .mo-w36{width:36%} .mo-w37{width:37%} .mo-w38{width:38%} .mo-w39{width:39%} .mo-w40{width:40%} .mo-w41{width:41%} .mo-w42{width:42%} .mo-w43{width:43%} .mo-w44{width:44%} .mo-w45{width:45%} .mo-w46{width:46%} .mo-w47{width:47%} .mo-w48{width:48%} .mo-w49{width:49%} .mo-w50{width:50%} .mo-w51{width:51%} .mo-w52{width:52%} .mo-w53{width:53%} .mo-w54{width:54%} .mo-w55{width:55%} .mo-w56{width:56%} .mo-w57{width:57%} .mo-w58{width:58%} .mo-w59{width:59%} .mo-w60{width:60%} .mo-w61{width:61%} .mo-w62{width:62%} .mo-w63{width:63%} .mo-w64{width:64%} .mo-w65{width:65%} .mo-w66{width:66%} .mo-w67{width:67%} .mo-w68{width:68%} .mo-w69{width:69%} .mo-w70{width:70%} .mo-w71{width:71%} .mo-w72{width:72%} .mo-w73{width:73%} .mo-w74{width:74%} .mo-w75{width:75%} .mo-w76{width:76%} .mo-w77{width:77%} .mo-w78{width:78%} .mo-w79{width:79%} .mo-w80{width:80%} .mo-w81{width:81%} .mo-w82{width:82%} .mo-w83{width:83%} .mo-w84{width:84%} .mo-w85{width:85%} .mo-w86{width:86%} .mo-w87{width:87%} .mo-w88{width:88%} .mo-w89{width:89%} .mo-w90{width:90%} .mo-w91{width:91%} .mo-w92{width:92%} .mo-w93{width:93%} .mo-w94{width:94%} .mo-w95{width:95%} .mo-w96{width:96%} .mo-w97{width:97%} .mo-w98{width:98%} .mo-w99{width:99%} .mo-w100{width:100%}

/* two figures side by side on wide screens */
.mo-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 8px; }
.mo-pair .mo { margin: 0; }
@media (max-width: 1100px) { .mo-pair { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------- home hero: tabs over four real calls */
@media (min-width: 1001px) { .sx-hero-grid { grid-template-columns: minmax(0, 1fr) minmax(320px, 500px); } }   /* site.css stacks it at 1000px and below */
@media (max-width: 1000px) { .sx-hero .mo-hero { max-width: 620px; } }
.mo-hero { margin: 0; padding: 12px; }
.mo-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; margin: 0 0 12px; border: 1px solid var(--mo-line); border-radius: 12px; background: var(--mo-sunk); }
.mo-tabs button { font: 600 12.5px/1.25 inherit; font-family: inherit; min-height: 40px; padding: 6px 8px; border: 1px solid transparent; border-radius: 9px; background: none; color: var(--muted); cursor: pointer; text-align: center; }
.mo-tabs button:hover { color: var(--text); background: color-mix(in srgb, var(--mo-a) 8%, transparent); }
.mo-tabs button[aria-selected="true"] { color: var(--mo-bg); background: var(--mo-a); border-color: var(--mo-a); box-shadow: 0 1px 4px rgb(0 0 0 / .18); }
.mo-tabs button:focus-visible { outline: 2px solid var(--mo-a); outline-offset: 2px; }
.mo-scenes { display: grid; }
.js .mo-scene { grid-area: 1 / 1; visibility: hidden; opacity: 0; transition: opacity .3s, visibility 0s .3s; min-width: 0; }
.js .mo-scene.on { visibility: visible; opacity: 1; transition: opacity .3s; }
.mo-tabs { display: none; } .js .mo-tabs { display: grid; }
.mo-scene + .mo-scene { margin-top: 14px; } .js .mo-scene + .mo-scene { margin-top: 0; }
.mo-down { display: flex; align-items: center; justify-content: center; gap: 8px; height: 30px; position: relative; }
.mo-wire-v { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; height: auto; margin: 0; }
.mo-wire-v i { left: -3px; top: 0; }
.mo-down .mo-chip { position: relative; color: var(--mo-a); border-color: color-mix(in srgb, var(--mo-a) 50%, var(--mo-line)); }
.mo-hero .mo-ans { grid-template-areas: "k t v" "r r r"; }
.mo-hero .mo-ans .mo-meter { grid-area: r; }
.mo-bool { color: var(--mo-a); }
.mo-fired { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding-top: 6px; border-top: 1px dashed var(--mo-line); }
.mo-fired .mo-body { flex: 1 1 100%; }
.mo-hero .mo-body { max-height: 15em; overflow: auto; }
.mo-hero .mo-foot { margin-top: 10px; }
.mo-hero .mo-wrow { grid-template-columns: 58px repeat(3, minmax(0, 1fr)); gap: 6px; padding: 4px 6px; }
@media (prefers-reduced-motion: no-preference) {
  .mo-hero.mo-play .mo-wire-v i { animation-name: mo-run-v; animation-delay: 1.3s; }
  .mo-hero.mo-play .mo-fired { animation-delay: 3.3s; }
  .mo-hero.mo-play .mo-fired .mo-true { animation-delay: 3.5s; }
}
@keyframes mo-run-v { 0% { top: 0; opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { top: calc(100% - 8px); opacity: 0; } }
@media (max-width: 560px) {
  .mo-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mo-tabs button { min-height: 44px; font-size: 13px; }
}

/* ---------------------------------------------------------------- real buttons (home hero and closing call to action) */
.sx .mo-btns { gap: 12px; }
.sx .mo-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 10px; border: 1.5px solid var(--mo-a, var(--accent));
  font-size: 15.5px; font-weight: 600; text-decoration: none !important; transition: background .15s, transform .15s, box-shadow .15s; }
.sx .mo-btn-primary { background: var(--accent); border-color: var(--accent); color: var(--panel) !important; box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 30%, transparent); }
.sx .mo-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 38%, transparent); }
.sx .mo-btn-secondary { background: transparent; border-color: color-mix(in srgb, var(--text) 35%, var(--line)); color: var(--text) !important; }
.sx .mo-btn-secondary:hover { border-color: var(--text); background: color-mix(in srgb, var(--text) 5%, transparent); }
.sx .mo-btn-secondary::after { content: none; }
.sx .mo-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 560px) { .sx .mo-btns { flex-direction: column; align-items: stretch; } .sx .mo-btn { min-height: 50px; width: 100%; } }
@media (prefers-reduced-motion: reduce) { .sx .mo-btn { transition: none; } .sx .mo-btn-primary:hover { transform: none; } }
.sx .mo-btn-primary::after { content: "→"; transition: transform .2s; } .sx .mo-btn-primary:hover::after { transform: translateX(3px); }
