/* An inline, viewport-aware walkthrough that follows the site palette. */
.model-walkthrough {
  --mw-cnn: var(--teal);
  --mw-board: var(--amber);
  --mw-accent: var(--mw-cnn);
  margin-block: 28px 36px;
  padding: 16px 0;
  border-block: 1px solid var(--line);
  color: var(--body);
  font: 14px/1.6 var(--sans, Arial, Helvetica, sans-serif);
}
.model-walkthrough *, .model-walkthrough *::before, .model-walkthrough *::after { box-sizing: border-box; }
.model-walkthrough [hidden] { display: none !important; }
.model-walkthrough[data-step='project'], .model-walkthrough[data-step='learn'] { --mw-accent: var(--mw-board); }
.model-walkthrough[data-step='return'] { --mw-accent: var(--focus); }
.mw-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.mw-heading h3 { margin: 0; color: var(--text); font: 500 16px/1.4 var(--sans); }
.model-walkthrough button { color: var(--body); background: transparent; font: inherit; cursor: pointer; touch-action: manipulation; }
.model-walkthrough button:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.model-walkthrough button:disabled { opacity: 0.3; cursor: default; }
.mw-actions { display: flex; align-items: center; gap: 2px; }
.mw-actions button { display: grid; place-items: center; width: 36px; height: 36px; padding: 9px; border: 1px solid transparent; border-radius: 4px; color: var(--muted); transition: color 160ms, background 160ms; }
.mw-actions button:hover { color: var(--text); background: var(--soft); }
.mw-actions svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.mw-controls { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.mw-controls button { position: relative; border: 0; padding: 10px 0 11px; text-align: left; color: var(--muted); font-size: 12px; }
.mw-controls button::after, .mw-controls button > i { content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--line); }
.mw-controls button > i { z-index: 1; width: var(--progress, 0%); background: var(--mw-accent); }
.mw-controls button[aria-pressed='true'] { color: var(--text); }
.mw-controls button:hover { color: var(--text); }
.mw-scene-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; min-height: 42px; margin: 14px 0 0; }
.mw-scene-heading h4 { margin: 0; color: var(--text); font: 500 14px/1.5 var(--sans); }
.mw-scene-heading > span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.mw-stage { height: 264px; display: grid; align-items: center; border-radius: 4px; background: color-mix(in srgb, var(--soft) 45%, transparent); overflow: hidden; }
.mw-scene { min-width: 0; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 14px 20px; animation: mw-enter 280ms ease-out both; }
.mw-label { display: block; color: var(--body); font-size: 12px; line-height: 1.5; }
.mw-detail { display: block; color: var(--muted); font-size: 11px; line-height: 1.5; }
.mw-scene-note, .mw-local-note { display: block; color: var(--muted); text-align: center; font-size: 11px; line-height: 1.6; }
.mw-local-note { color: var(--mw-accent); }
.mw-scan-pair { width: min(100%, 470px); display: grid; grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr); align-items: center; gap: 20px; }
.mw-visual-block { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; text-align: center; }
.mw-visual-block svg { display: block; width: 100%; max-width: 162px; height: 162px; overflow: visible; }
.mw-visual-block:last-child svg { max-width: 126px; }
.mw-pixel { fill: color-mix(in srgb, var(--mw-cnn) calc(12% + var(--value) * 64%), var(--page)); }
.mw-output { fill: var(--soft); transition: fill 150ms ease; }
.mw-output.is-revealed { fill: color-mix(in srgb, var(--mw-cnn) calc(12% + var(--value) * 74%), var(--page)); }
.mw-filter { fill: color-mix(in srgb, var(--mw-cnn) 20%, transparent); stroke: var(--mw-cnn); stroke-width: 2; }
.mw-output-focus { fill: none; stroke: var(--mw-cnn); stroke-width: 2; }
.mw-flow-arrow { color: var(--muted); font-size: 22px; text-align: center; }
.mw-feature-stages { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.mw-map-stage { display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; min-width: 0; }
.mw-map-stage svg, .mw-map-stage .mw-vector { opacity: calc(0.2 + var(--reveal, 0) * 0.8); transform: translateY(calc((1 - var(--reveal, 0)) * 5px)); }
.mw-map-stage:not(:last-child)::after { content: '→'; position: absolute; top: 52px; right: -14px; color: var(--muted); }
.mw-map-stage svg { width: 100%; max-width: 108px; height: 112px; overflow: visible; }
.mw-map { fill: var(--page); stroke: var(--mw-cnn); stroke-width: 1.1; }
.mw-map-dot { fill: var(--mw-cnn); }
.mw-skip { fill: none; stroke: var(--muted); stroke-width: 0.8; stroke-linecap: round; stroke-linejoin: round; }
.mw-map-stage strong { font-size: 12px; font-weight: 500; }
.mw-map-stage > span, .mw-map-stage small { font-size: 10px; color: var(--muted); }
.mw-map-stage .mw-vector { margin-block: 15px 18px; width: 79px; height: 79px; }
.mw-vector { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; width: 96px; height: 96px; flex: 0 0 auto; }
.mw-vector i { display: block; border-radius: 1px; background: var(--mw-accent); opacity: calc(0.18 + var(--value) * 0.72); }
.mw-transfer-pair { display: grid; grid-template-columns: 140px minmax(55px, 1fr) 140px; align-items: center; gap: 24px; width: min(100%, 540px); }
.mw-endpoint, .mw-saved-output, .mw-aux-head { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; min-width: 0; }
.mw-endpoint > .mw-label { font-weight: 600; }
.mw-on-board { --mw-accent: var(--mw-board); }
.mw-final { --mw-accent: var(--focus); }
.mw-transfer { position: relative; align-self: center; text-align: center; padding-block: 12px; }
.mw-transfer-label { display: block; color: var(--muted); font-size: 10px; margin-bottom: 14px; }
.mw-wire { position: relative; height: 1px; background: var(--line); }
.mw-wire i { position: absolute; top: -3px; width: 7px; height: 7px; background: var(--mw-accent); border-radius: 1px; transform: translateX(-50%); }
.mw-transfer-arrow { display: block; color: var(--muted); margin-top: 4px; font-size: 18px; }
.mw-arriving, .mw-saved-output .mw-vector, .mw-final .mw-scores { opacity: calc(0.2 + var(--arrival, 0) * 0.8); }
.mw-projection-flow { display: grid; grid-template-columns: minmax(0, 1.6fr) 30px minmax(0, 1fr); align-items: center; gap: 20px; width: min(100%, 480px); }
.mw-network { min-width: 0; text-align: center; }
.mw-network svg { width: 100%; max-width: 200px; display: block; margin: 6px auto 0; }
.mw-synapse { fill: none; stroke: var(--mw-board); stroke-width: 0.7; opacity: calc(0.08 + var(--reveal, 0) * 0.42); }
.mw-neuron { fill: color-mix(in srgb, var(--mw-board) calc(var(--reveal, 0) * 100%), var(--page)); stroke: var(--mw-board); opacity: calc(0.4 + var(--reveal, 0) * 0.6); }
.mw-layer-labels { display: flex; justify-content: space-around; color: var(--muted); font-size: 10px; }
.mw-head-loop { width: min(100%, 460px); text-align: center; }
.mw-head-pair { display: grid; grid-template-columns: minmax(0, 1fr) 30px minmax(0, 1fr); gap: 20px; align-items: center; }
.mw-head-pair .mw-endpoint { align-self: start; }
.mw-scores { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; width: 110px; height: 48px; align-content: center; }
.mw-scores i { aspect-ratio: 1; background: color-mix(in srgb, var(--mw-accent) calc(var(--score) * 100%), var(--page)); border-radius: 2px; }
.mw-scores .mw-target-score { outline: 1px solid var(--mw-accent); outline-offset: 2px; }
.mw-aux-head { gap: 12px; }
.mw-aux-head .mw-scores { margin-block: 7px; opacity: calc(0.2 + var(--arrival, 0) * 0.8); }
.mw-target { font-size: 10px; color: var(--mw-board); border-bottom: 1px dashed var(--mw-board); }
.mw-feedback-loop { display: block; width: 100%; height: 38px; margin-top: 8px; }
.mw-feedback-loop path { stroke: var(--mw-board); fill: none; stroke-width: 1; }
.mw-feedback-loop circle { fill: var(--mw-board); }
.story-body .mw-caption { min-height: 78px; margin: 16px 0 8px; font: 14px/1.75 var(--sans); color: var(--body); }
.mw-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: 12px; }
.mw-footer > a { color: var(--muted); }
.mw-footer > a:hover { color: var(--focus); }
.mw-footer > span { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.story-body .mw-scope { margin: 14px 0 0; font: 11px/1.6 var(--sans); color: var(--muted); }
@keyframes mw-enter { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 480px) {
  .mw-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 12px; }
  .mw-controls button { font-size: 12px; padding-block: 10px; min-height: 44px; }
  .mw-actions button { width: 44px; height: 44px; padding: 13px; }
  .mw-scene-heading { align-items: flex-start; flex-direction: column; gap: 3px; min-height: 62px; margin-top: 14px; }
  .mw-stage { height: auto; min-height: 320px; }
  .mw-scene { padding-inline: 10px; gap: 16px; }
  .mw-scan-pair { gap: 10px; grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr); }
  .mw-visual-block svg { height: 132px; }
  .mw-visual-block:last-child svg { max-width: 103px; }
  .mw-feature-stages { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 28px; }
  .mw-map-stage svg { height: 56px; }
  .mw-map-stage .mw-vector { width: 40px; height: 40px; margin-block: 8px; gap: 2px; }
  .mw-map-stage:not(:last-child)::after { top: 27px; right: -18px; }
  .mw-map-stage:nth-child(2)::after { content: '↓'; top: auto; right: calc(50% - 5px); bottom: -18px; }
  .mw-map-stage:nth-child(3) { grid-column: 2; grid-row: 2; }
  .mw-map-stage:nth-child(4) { grid-column: 1; grid-row: 2; }
  .mw-map-stage:nth-child(3)::after { content: '←'; right: auto; left: -19px; }
  .mw-transfer-pair { grid-template-columns: minmax(0, 1fr) 65px minmax(0, 1fr); gap: 10px; }
  .mw-vector { width: 72px; height: 72px; gap: 2px; }
  .mw-projection-flow, .mw-head-pair { gap: 8px; grid-template-columns: minmax(0, 1.3fr) 20px minmax(0, 1fr); }
  .mw-scores { width: 88px; height: 40px; gap: 5px; }
  .mw-saved-output .mw-label, .mw-head-pair .mw-label { font-size: 11px; }
  .mw-target { font-size: 10px; }
  .mw-detail { font-size: 11px; }
  .mw-scene-note, .mw-local-note { font-size: 11px; }
  .story-body .mw-caption { min-height: 120px; font-size: 14px; }
  .mw-footer { gap: 12px; font-size: 12px; }

}
@media (prefers-reduced-motion: reduce) {
  .mw-scene { animation: none; }
  .mw-output, .mw-actions button { transition: none; }
}
@media print {
  .mw-controls, .mw-actions { display: none; }
  .model-walkthrough { break-inside: avoid; }
}
