/* ==========================================================================
   Harness Lab · motion graphics (b44). The stage, the controls, the captions and the drawing classes of motion.js.
   No colour literal here: every colour is a semantic token (tokens.css). Only transform, opacity and SVG attributes move; the
   engine writes them through the CSSOM, so no inline style attribute exists in the markup. Nothing moves until the user presses Play.
   The markup arrives in its final state, so with Reduce motion (or no script) the diagram is a complete, labelled still.
   ========================================================================== */

.mo { --mo-gap: 12px; display: block; margin: 0 0 24px; max-width: 880px; color: var(--foreground); }
.mo * { box-sizing: border-box; }

/* the stage: one card; the diagram sits inset on the sunken fill */
.mo-stage { position: relative; overflow: hidden; padding: 16px 16px 36px; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface-1); box-shadow: inset 0 1px 0 var(--highlight); }
.mo-sig { position: absolute; inset-block-end: 10px; inset-inline-end: 16px; display: flex; align-items: center; gap: 6px; color: var(--subtle-foreground); pointer-events: none; user-select: none; }
.mo-sig .bm { flex: none; display: block; }
.mo-sig-name { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: -0.01em; }
.mo-head { padding-inline-end: 96px; margin: 0 0 12px; }
.mo-title { margin: 0; font-size: 17px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; color: var(--foreground); }
.mo-sub { margin: 4px 0 0; font-size: 13px; line-height: 1.45; color: var(--muted-foreground); max-width: 62ch; }
.mo-badge { position: absolute; inset-block-start: 14px; inset-inline-end: 14px; padding: 2px 8px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--bg-sunken); color: var(--subtle-foreground); font-size: 12px; line-height: 1.5; }
.mo-diagram { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-sunken); }
.mo-diagram.is-split { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); }
.mo-art { align-self: center; min-width: 0; padding: 10px 0 0; }
.mo-svg { display: block; width: 100%; overflow: visible; }
.mo-detail { display: grid; padding: 12px 14px 14px; min-height: 0; min-width: 0; }
.is-split .mo-detail { align-content: center; padding: 18px 18px; border-inline-start: 1px solid var(--border); background: var(--surface-1); }
.mo-pane .k, .mo-verdict .k { display: block; margin: 0 0 8px; font-size: 12px; color: var(--subtle-foreground); }
.mo-why { font-size: 16px; line-height: 1.55; color: var(--foreground); }
.mo-why .sent { transition: none; }
.mo-ladder { display: grid; justify-items: start; gap: 6px; }
.mo-ladder .mo-chip { font-size: 15px; min-height: 36px; }
.mo-rule { display: grid; grid-template-columns: 78px 1fr auto; align-items: baseline; gap: 4px 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted-foreground); }
.mo-rule b { color: var(--foreground); font-size: 14px; }
.mo-rule .ct { color: var(--destructive-text); font-weight: 600; white-space: nowrap; }
.mo-rule .ct.ok { color: var(--success-text); }
.mo-rulename { margin: 0 0 10px; font-size: 15px; font-weight: 600; line-height: 1.35; color: var(--foreground); }
.mo-quote .k.sp { margin-top: 12px; }
.mo-quote .who { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--foreground); }
.mo-quote blockquote { margin: 0; padding: 0 0 0 12px; border-inline-start: 2px solid var(--border-strong); font-size: 15px; line-height: 1.5; color: var(--foreground); overflow-wrap: anywhere; }
.mo-pane { grid-area: 1 / 1; align-self: start; min-width: 0; opacity: 0; pointer-events: none; }
.mo-line { margin: 0; font-size: 16px; line-height: 1.5; color: var(--foreground); max-width: 60ch; }
.mo-chart { display: grid; gap: 8px; align-content: start; }
.mo-row { display: grid; grid-template-columns: minmax(88px, 160px) 1fr auto; align-items: center; gap: 10px; font-size: 14px; color: var(--muted-foreground); }
.mo-row.is-focus { color: var(--foreground); font-weight: 600; }
.mo-track { position: relative; height: 10px; overflow: hidden; border-radius: 4px; background: var(--surface-3); }
.mo-bar { position: absolute; inset: 0; transform-origin: left center; transform: scaleX(0); background: var(--subtle-foreground); border-radius: 4px; }
.mo-row.is-focus .mo-bar { background: var(--primary); }
.mo-bar.is-warn { background: var(--warning); }
.mo-rv { font-size: 14px; text-align: end; min-width: 3.4em; }
.mo-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mo-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 28px; padding: 3px 10px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface-2); color: var(--foreground); font-size: 13px; line-height: 1.3; }
.mo-chip.is-ai { border-color: color-mix(in oklch, var(--ai) 45%, transparent); background: var(--ai-soft); color: var(--ai-text); }
.mo-chip svg { flex: none; color: var(--subtle-foreground); }
.mo-chip .n { color: var(--subtle-foreground); }
.mo-arrow { color: var(--subtle-foreground); display: inline-grid; }
.mo-hdot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--subtle-foreground); }
.mo-hdot.t0 { background: transparent; border: 1.5px solid var(--subtle-foreground); }
.mo-hdot.t1 { background: var(--tool-1); } .mo-hdot.t2 { background: var(--tool-2); } .mo-hdot.t3 { background: var(--tool-3); }
.mo-hdot.t4 { background: var(--tool-4); } .mo-hdot.t5 { background: var(--tool-5); } .mo-hdot.t6 { background: var(--tool-6); }
.mo-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.mo-chip .w { font-weight: 600; }
.mo-chip .w.ok { color: var(--success-text); } .mo-chip .w.part { color: var(--warning-text); } .mo-chip .w.bad { color: var(--destructive-text); }
.mo-tally { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 13px; color: var(--muted-foreground); }
.mo-dots { display: flex; flex-wrap: wrap; gap: 4px; }
.mo-dot { width: 14px; height: 14px; border-radius: 4px; background: var(--border-strong); }
.mo-dot.ok { background: var(--success); } .mo-dot.part { background: var(--warning); } .mo-dot.bad { background: var(--destructive); } .mo-dot.unk { background: var(--border-strong); }
.mo-key { display: inline-flex; align-items: center; gap: 6px; }
.mo-key i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.mo-key i.ok { background: var(--success); } .mo-key i.part { background: var(--warning); } .mo-key i.bad { background: var(--destructive); } .mo-key i.unk { background: var(--border-strong); }
.mo-verdict { display: grid; align-content: start; gap: 8px; font-size: 13px; color: var(--muted-foreground); }
.mo-verdict .k { font-size: 12px; color: var(--subtle-foreground); }
.mo-verdict .head { margin: 0; font-size: 15px; font-weight: 600; color: var(--foreground); line-height: 1.35; }
.mo-verdict .row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.mo-pill { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-text); font-weight: 600; font-size: 13px; }
.mo-verdict b { color: var(--foreground); font-weight: 600; }

/* controls */
.mo-bar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 12px 0 0; }
.mo-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); background: var(--surface-2); color: var(--foreground); font: inherit; font-size: var(--text-sm); font-weight: 600; cursor: pointer;
  box-shadow: inset 0 1px 0 var(--highlight); user-select: none; -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out-quart), background-color 160ms var(--ease-out-quart), border-color 160ms var(--ease-out-quart); }
.mo-btn:hover { background: var(--surface-3); }
.mo-btn:active { transform: scale(0.97); }
.mo-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.mo-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.mo-btn.primary { border-color: transparent; background: var(--primary); color: var(--primary-foreground); box-shadow: inset 0 1px 0 var(--sheen); }
.mo-btn.primary:hover { background: var(--primary-hover); }
.mo-btn svg { flex: none; }
.mo-track-wrap { flex: 1 1 140px; min-width: 120px; display: flex; align-items: center; gap: 10px; }
.mo-prog { position: relative; flex: 1; height: 8px; border-radius: 4px; background: var(--surface-3); cursor: pointer; }
.mo-prog .fill { position: absolute; inset: 0; border-radius: 4px; background: var(--primary); transform-origin: left center; transform: scaleX(1); }
.mo-prog .tick { position: absolute; inset-block: -3px; width: 2px; margin-inline-start: -1px; background: var(--surface-1); }
.mo-time { font-size: 12px; color: var(--subtle-foreground); min-width: 6.4em; text-align: end; }
.mo-stepper { display: none; align-items: center; gap: 8px; }
.mo-stepper .of { font-size: 13px; color: var(--muted-foreground); }
.mo[data-reduced] .mo-stepper { display: inline-flex; }
.mo[data-reduced] [data-mo="toggle"], .mo[data-reduced] [data-mo="replay"], .mo[data-reduced] .mo-track-wrap { display: none; }
.mo[data-state="idle"] [data-mo="replay"] { display: none; }

/* the beats: captions and chips in one list. The active one is lit; the list is the complete text of the motion. */
.mo-beats { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; counter-reset: beat; }
.mo-beats li { display: flex; align-items: stretch; gap: 6px; }
.mo-beat { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; padding: 7px 10px; border: 1px solid transparent; border-radius: var(--radius-md); background: none;
  color: var(--subtle-foreground); font: inherit; font-size: 15px; line-height: 1.4; text-align: start; cursor: pointer;
  transition: background-color 160ms var(--ease-out-quart), color 160ms var(--ease-out-quart), border-color 160ms var(--ease-out-quart); }
.mo-beat:hover { background: var(--surface-3); color: var(--foreground); }
.mo-beat:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.mo-beat .num { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); color: var(--muted-foreground);
  font-size: 12px; font-weight: 600; }
.mo-beat .cap { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mo-beat[aria-current="step"] { background: var(--primary-soft); color: var(--foreground); border-color: color-mix(in oklch, var(--primary) 30%, transparent); }
.mo-beat[aria-current="step"] .num { background: var(--primary); color: var(--primary-foreground); }
.mo[data-state="idle"] .mo-beat, .mo[data-state="ended"] .mo-beat { color: var(--muted-foreground); }
.mo-evi { flex: none; align-self: center; min-height: 32px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--primary-text);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.mo-evi:hover { background: var(--surface-3); text-decoration: underline; text-underline-offset: 3px; }
.mo-evi:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.mo-evi-box { margin: 6px 0 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-sunken); font-size: 12px; color: var(--muted-foreground); }
.mo-evi-box code { font-family: var(--font-mono); font-size: 12px; color: var(--foreground); overflow-wrap: anywhere; }
.mk-primary { color: var(--primary-text); font-weight: 600; } .mk-ai { color: var(--ai-text); font-weight: 600; }
.mk-success { color: var(--success-text); font-weight: 600; } .mk-warning { color: var(--warning-text); font-weight: 600; }
.mk-destructive { color: var(--destructive-text); font-weight: 600; }
.mk-tool-1 { color: var(--tool-1); font-weight: 600; } .mk-tool-2 { color: var(--tool-2); font-weight: 600; } .mk-tool-3 { color: var(--tool-3); font-weight: 600; }
.mk-tool-4 { color: var(--tool-4); font-weight: 600; } .mk-tool-5 { color: var(--tool-5); font-weight: 600; } .mk-tool-6 { color: var(--tool-6); font-weight: 600; }

/* the drawing classes (SVG): fills, strokes, text. The motifs only name these; they never write a colour. */
.mo-svg text { font-family: var(--font-sans); font-size: 13px; fill: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.mo-svg .t-sm { font-size: 12px; } .mo-svg .t-b { font-weight: 600; fill: var(--foreground); } .mo-svg .t-fg { fill: var(--foreground); }
.mo-svg .t-sub { fill: var(--subtle-foreground); } .mo-svg .t-mono { font-family: var(--font-mono); font-size: 12px; fill: var(--foreground); }
.mo-svg .t-big { font-size: 15px; font-weight: 600; fill: var(--foreground); }
.mo-svg .tx-primary { fill: var(--primary-text); } .mo-svg .tx-ai { fill: var(--ai-text); } .mo-svg .tx-ok { fill: var(--success-text); }
.mo-svg .tx-warn { fill: var(--warning-text); } .mo-svg .tx-inv { fill: var(--primary-foreground); } .mo-svg .tx-bad { fill: var(--destructive-text); }
.mo-svg .f-none { fill: none; } .mo-svg .f-s1 { fill: var(--surface-1); } .mo-svg .f-s2 { fill: var(--surface-2); } .mo-svg .f-s3 { fill: var(--surface-3); }
.mo-svg .f-sunk { fill: var(--bg-sunken); } .mo-svg .f-strong { fill: var(--border-strong); } .mo-svg .f-fg { fill: var(--foreground); } .mo-svg .f-sub { fill: var(--subtle-foreground); }
.mo-svg .f-primary { fill: var(--primary); } .mo-svg .f-primary-soft { fill: var(--primary-soft); }
.mo-svg .f-ai { fill: var(--ai); } .mo-svg .f-ai-soft { fill: var(--ai-soft); }
.mo-svg .f-ok { fill: var(--success); } .mo-svg .f-ok-soft { fill: var(--success-soft); }
.mo-svg .f-warn { fill: var(--warning); } .mo-svg .f-warn-soft { fill: var(--warning-soft); }
.mo-svg .f-bad { fill: var(--destructive); } .mo-svg .f-bad-soft { fill: var(--destructive-soft); }
.mo-svg .f-t1 { fill: var(--tool-1); } .mo-svg .f-t2 { fill: var(--tool-2); } .mo-svg .f-t3 { fill: var(--tool-3); }
.mo-svg .f-t4 { fill: var(--tool-4); } .mo-svg .f-t5 { fill: var(--tool-5); } .mo-svg .f-t6 { fill: var(--tool-6); }
.mo-svg .k-none { stroke: none; } .mo-svg .k-border { stroke: var(--border); } .mo-svg .k-strong { stroke: var(--border-strong); } .mo-svg .k-sub { stroke: var(--subtle-foreground); }
.mo-svg .k-primary { stroke: var(--primary); } .mo-svg .k-ai { stroke: var(--ai); } .mo-svg .k-ok { stroke: var(--success); }
.mo-svg .k-inv { stroke: var(--primary-foreground); } .mo-svg .k-warn { stroke: var(--warning); } .mo-svg .k-bad { stroke: var(--destructive); } .mo-svg .k-fg { stroke: var(--foreground); }
.mo-svg .sw1 { stroke-width: 1; } .mo-svg .sw15 { stroke-width: 1.5; } .mo-svg .sw2 { stroke-width: 2; } .mo-svg .sw3 { stroke-width: 3; }
.mo-svg .rnd { stroke-linecap: round; stroke-linejoin: round; } .mo-svg .dash { stroke-dasharray: 4 4; }
.mo-svg .grp { transform-box: fill-box; transform-origin: center; }

@media (max-width: 560px) {
  .mo-stage { padding: 14px 12px 34px; }
  .mo-sig { inset-inline-end: 12px; }
  .mo-head { padding-inline-end: 0; }
  .mo-badge { position: static; display: inline-block; margin: 0 0 8px; }
  .mo-detail { padding: 6px 10px 12px; }
  .mo-rule { grid-template-columns: 70px 1fr; }
  .mo-rule .ct { grid-column: 2; }
  .mo-row { grid-template-columns: 78px 1fr auto; gap: 8px; }
  .mo-beat { font-size: 13px; padding: 7px 8px; }
  .mo-time { display: none; }
}

/* Reduce motion: the final frame and the numbered steps; nothing tweens, nothing starts. */
@media (prefers-reduced-motion: reduce) {
  .mo-btn, .mo-beat { transition: none; }
}
.is-split .mo-pane { align-self: center; }
.mo-line p { margin: 0; }
.bd { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: var(--primary-foreground); font-size: 12px; font-weight: 600; }
.mo-legend { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 2px; }
.mo-legend li { display: flex; align-items: center; gap: 10px; padding: 4px 8px; margin-inline: -8px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; color: var(--foreground); }
.mo-legend li.on { background: var(--primary-soft); }
.mo-slot { display: grid; }
.mo-slot > * { grid-area: 1 / 1; align-self: start; min-width: 0; }
.mo-svg .t-halo { paint-order: stroke; stroke: var(--surface-1); stroke-width: 4px; stroke-linejoin: round; }
@media (max-width: 330px) { .mo-sig-name { display: none; } }   /* the mark alone when the wordmark does not fit */
