/* Hallmark · v2.0.0 · redesign: restyle (colour only) · theme: studio (by request, chosen from docs/mockups/lesson-palettes.html) · genre: editorial · modes: light+dark · scope: lesson pages (figure-first) · type: the project's system faces, kept */
/* Hallmark · pre-emit critique: P4 H4 E4 S4 R5 V3 · weakest: V, the layout is the existing lesson page by request; the change is the palette (cool proof paper, blue-black ink, one cadmium action, cobalt/cadmium/green/magenta carrying Q/K/V/weight) */
/* Hallmark · waive 24b · spacing is the lesson page's existing system · the request was colour and the figure measure only, so spacing is kept */

/* Lesson kit: figure-first lesson pages (short text + big animated, colour-coded figures).
   The colour vocabulary is shared by every course: a hue always means the same thing.
   Query cobalt · Key cadmium · Value green · weight magenta · input tokens plain stock · output tokens ink. */
:root {
  color-scheme: light dark;
  /* Studio ground */
  --color-paper: oklch(97.2% 0.006 215);
  --color-paper-2: oklch(94% 0.009 215);
  --color-paper-3: oklch(90.5% 0.011 215);
  --color-ink: oklch(16% 0.032 250);
  --color-ink-2: oklch(34% 0.022 245);
  --color-muted: oklch(49% 0.018 240);
  --color-rule: oklch(84% 0.010 225);
  --color-card: oklch(99% 0.004 215);
  --color-card-edge: oklch(86% 0.010 225);
  --color-accent: oklch(64% 0.172 50);
  --color-accent-ink: oklch(16% 0.032 250);
  --color-focus: oklch(52% 0.15 48);
  --color-on-strong: oklch(99% 0.004 215);
  --shadow-card: 1px 2px 0 color-mix(in oklab, var(--color-ink) 6%, transparent);

  /* semantic hues (text-strength; fills use them at a fraction) */
  --q: oklch(48% 0.150 255);
  --k: oklch(58% 0.170 50);
  --v: oklch(52% 0.120 155);
  --attn: oklch(52% 0.200 350);
  --tok-in-bg: var(--color-paper-2); --tok-in: var(--color-ink);
  --tok-out-bg: var(--color-ink); --tok-out: var(--color-paper);
  --h1: oklch(52% 0.200 350); --h2: oklch(50% 0.110 215); --h3: oklch(60% 0.130 85);
  --hbm: oklch(55% 0.070 70); --sram: oklch(50% 0.100 215);

  /* figure stock */
  --fig-bg: var(--color-card); --fig-line: var(--color-card-edge); --fig-ink: var(--color-ink);
  --fig-dim: oklch(74% 0.012 230); --cell: var(--color-paper-2);

  /* the project's own tokens, re-pointed so the answer area matches the page */
  --bg: var(--color-paper); --fg: var(--color-ink); --muted: var(--color-muted); --line: var(--color-rule);
  --card: var(--color-card); --accent: var(--color-accent);
  --ok: oklch(48% 0.120 155); --ok-bg: oklch(94% 0.040 155);
  --bad: oklch(52% 0.190 27); --bad-bg: oklch(94% 0.035 27);
  --part: oklch(52% 0.120 70); --part-bg: oklch(94% 0.050 80);
}
@media (prefers-color-scheme: dark) {
  :root {
    --color-paper: oklch(17% 0.020 250);
    --color-paper-2: oklch(21% 0.022 250);
    --color-paper-3: oklch(24% 0.022 250);
    --color-ink: oklch(95% 0.006 215);
    --color-ink-2: oklch(84% 0.010 220);
    --color-muted: oklch(68% 0.014 230);
    --color-rule: oklch(32% 0.015 245);
    --color-card: oklch(20.5% 0.022 250);
    --color-card-edge: oklch(32% 0.015 245);
    --color-accent: oklch(74% 0.150 52);
    --color-accent-ink: oklch(17% 0.020 250);
    --color-focus: oklch(76% 0.130 52);
    --color-on-strong: oklch(17% 0.020 250);
    --shadow-card: inset 0 0 0 1px var(--color-rule);

    --q: oklch(74% 0.120 252);
    --k: oklch(76% 0.140 52);
    --v: oklch(76% 0.110 155);
    --attn: oklch(72% 0.160 350);
    --h1: oklch(72% 0.160 350); --h2: oklch(74% 0.090 215); --h3: oklch(80% 0.120 85);
    --hbm: oklch(76% 0.060 70); --sram: oklch(74% 0.090 215);
    --fig-dim: oklch(40% 0.015 245);
    --ok: oklch(76% 0.110 155); --ok-bg: oklch(26% 0.040 155);
    --bad: oklch(72% 0.160 27); --bad-bg: oklch(26% 0.050 27);
    --part: oklch(80% 0.120 80); --part-bg: oklch(27% 0.050 80);
  }
}

/* ---------- page ---------- */
html, body { overflow-x: clip; }
body { background: var(--color-paper); color: var(--color-ink-2); caret-color: var(--color-accent); scrollbar-color: var(--color-rule) transparent; }
::selection { background: color-mix(in srgb, var(--q) 22%, transparent); color: var(--color-ink); }
.topbar { background: var(--color-paper); border-bottom-color: var(--color-rule); z-index: 50; }
body.wide .article { margin-inline: auto; }
.article h1, .article h2, .article h3 { color: var(--color-ink); overflow-wrap: break-word; min-width: 0; text-wrap: balance; }
.article h2 { padding-top: 14px; border-top: 1px solid var(--color-rule); }
.article .lead { font-size: 1.08rem; color: var(--color-muted); }
.q-t { color: var(--q); font-weight: 700; } .k-t { color: var(--k); font-weight: 700; }
.v-t { color: var(--v); font-weight: 700; } .a-t { color: var(--attn); font-weight: 700; }
.lk-hl { color: var(--attn); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: .85rem; color: var(--color-muted); }

.lk-note { border-radius: 2px; padding: 12px 16px; margin: 18px 0; border-left: 3px solid var(--note, var(--attn));
  background: color-mix(in srgb, var(--note, var(--attn)) 8%, var(--color-paper)); }
.lk-note > p:first-child strong { color: var(--note, var(--attn)); }
.lk-note p { margin: 4px 0; }

/* ---------- figure shell: same measure as the text ---------- */
.lk-fig { position: relative; width: 100%; margin: 26px 0 34px; background: var(--fig-bg); border: 1px solid var(--fig-line);
  border-radius: 2px; box-shadow: var(--shadow-card); padding: 18px 20px 12px; color: var(--fig-ink); line-height: 1.5; outline: none; }
.lk-fig:focus-visible { box-shadow: 0 0 0 2px var(--color-focus); }
.lk-label { font-size: .85rem; color: var(--color-muted); margin-bottom: 12px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.lk-label b { color: var(--fig-ink); font-size: .95rem; }
.lk-stage { position: relative; }
.lk-overlay { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 0; }
.lk-overlay path { animation: lk-fade .5s ease-out both; }
@keyframes lk-fade { from { opacity: 0; } }
.lk-stage > :not(.lk-overlay) { position: relative; z-index: 1; }
.lk-cap { margin-top: 12px; font-size: .95rem; min-height: 3em; color: var(--color-ink-2); }
.lk-cap .n { font-size: .8rem; color: var(--color-muted); margin-right: 8px; font-variant-numeric: tabular-nums; }
.lk-ctrl { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--fig-line); }
.lk-btn { width: 30px; height: 30px; border-radius: 3px; border: 1px solid var(--color-ink); background: transparent;
  color: var(--color-ink); cursor: pointer; font-size: 13px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
  transition: background-color .15s, color .15s; }
.lk-btn:hover { background: var(--color-ink); color: var(--color-paper); }
.lk-btn:active, .lk-chip:active { transform: translateY(1px); }
.lk-dot:active { transform: scale(.85); }
.lk-dots { display: flex; gap: 6px; align-items: center; }
.lk-dot { width: 9px; height: 9px; padding: 0; border-radius: 50%; border: 1px solid var(--color-muted); background: transparent; cursor: pointer; transition: background-color .3s, transform .3s; }
.lk-dot.on { background: var(--color-accent); border-color: var(--color-accent); transform: scale(1.25); }
.lk-hint { margin-left: auto; font-size: .78rem; color: var(--color-muted); }
.lk-btn:focus-visible, .lk-dot:focus-visible, .lk-chip:focus-visible, .tok:focus-visible, .lk-range input:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; transition: none; }

/* ---------- shared marks ---------- */
.lk-fig .tr { transition: opacity .5s, background-color .5s, color .5s, transform .5s, border-color .5s, box-shadow .5s; }
.tok { display: inline-flex; align-items: center; justify-content: center; font: 600 13px/1 ui-monospace, Menlo, monospace;
  padding: 6px 8px; border-radius: 3px; background: var(--tok-in-bg); color: var(--tok-in); white-space: nowrap;
  box-shadow: inset 0 0 0 1px var(--color-rule);
  transition: opacity .5s, background-color .4s, box-shadow .4s, transform .4s; }
.tok.out { background: var(--tok-out-bg); color: var(--tok-out); box-shadow: none; }
/* links read in cobalt; the cadmium is kept for actions */
a { color: var(--q); }
button.ghost { color: var(--color-ink); border-color: var(--color-ink); }
/* the project's filled controls take the cadmium with ink text */
.primary { color: var(--color-accent-ink); }
.dim.multi { color: var(--color-accent-ink); }
.tok.focus { box-shadow: inset 0 0 0 1px var(--color-ink), 0 0 0 2px var(--attn); transform: translateY(-2px); }
.tag { display: inline-block; font-size: .78rem; font-weight: 600; line-height: 1; padding: 4px 7px; border-radius: 3px; color: var(--color-on-strong); }
.tag.q { background: var(--q); } .tag.k { background: var(--k); } .tag.v { background: var(--v); } .tag.a { background: var(--attn); }
.vec { display: inline-flex; flex-direction: column; gap: 2px; padding: 3px; border-radius: 2px; background: var(--color-card); border: 1px solid var(--fig-line); }
.vec.row { flex-direction: row; }
.vec i { display: block; width: 13px; height: 13px; border-radius: 2px; background: var(--cell); transition: background-color .5s, opacity .5s; }
/* bars grow by transform only: set --w (0..1) */
.bar { height: 10px; border-radius: 2px; background: var(--attn); transform: scaleX(var(--w, 0)); transform-origin: left center; transition: transform .6s; }
.mat { display: inline-grid; gap: 2px; font: 12px/1 ui-monospace, Menlo, monospace; font-variant-numeric: tabular-nums; }
.mat > span { min-width: 36px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 2px;
  background: var(--cell); color: var(--color-ink); transition: background-color .4s, box-shadow .3s, opacity .4s; }
.mat > span.hl { box-shadow: 0 0 0 2px var(--color-ink); }
.mat-name { font-size: 13px; font-weight: 700; line-height: 1.2; margin-bottom: 4px; text-align: center; color: var(--color-ink); }
.mat-dim { font-size: 11px; color: var(--color-muted); font-weight: 400; }
.arrow { color: var(--fig-dim); font-size: 20px; align-self: center; }
.lk-range { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .9rem; }
.lk-range input[type=range] { flex: 1; min-width: 160px; accent-color: var(--color-ink); }
.lk-chip { font: inherit; font-size: .8rem; padding: 3px 10px; border-radius: 3px; border: 1px solid var(--color-rule);
  background: transparent; color: var(--color-ink-2); cursor: pointer; transition: border-color .15s, color .15s; }
.lk-chip.on, .lk-chip:hover { border-color: var(--color-ink); color: var(--color-ink); }
.lk-stat { display: inline-flex; flex-direction: column; padding: 8px 12px; border-radius: 2px; background: var(--color-paper); border: 1px solid var(--fig-line); min-width: 0; }
.lk-stat small { color: var(--color-muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
.lk-stat b { font: 700 1rem/1.3 ui-monospace, Menlo, monospace; font-variant-numeric: tabular-nums; color: var(--color-ink); }

/* ---------- roadmap cards ---------- */
.roadmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin: 20px 0; }
.rm { display: block; padding: 10px 14px; border-radius: 2px; background: var(--color-card); border: 1px solid var(--color-rule); border-left: 3px solid var(--c); color: var(--color-ink); }
.rm:hover { text-decoration: none; }
.rm b { color: var(--c); font-family: ui-monospace, Menlo, monospace; margin-right: 6px; }
.rm small { display: block; color: var(--color-muted); font-size: .8rem; line-height: 1.5; margin-top: 2px; }
.hbm-t { color: var(--hbm); font-weight: 700; } .sram-t { color: var(--sram); font-weight: 700; }

@media (prefers-reduced-motion: reduce) { .lk-fig *, .lk-overlay path { transition: none !important; animation: none !important; } }
@media (max-width: 700px) { .lk-fig { padding: 14px 12px 10px; } .mat > span { min-width: 30px; } }
