/* ══════════════════════════════════════════════════════════════════════════
   ib-models.css — the interactive-model skin.

   WHY THIS FILE EXISTS
   --------------------
   The 80 models in ib-sehs-models.js were styled by three separate copies of
   the same 1 000-line block (inline in ib-sehs-learn.html, inline in
   ib-sehs.html, copied verbatim into ib-sehs-lesson.css). That block supplies
   the *drawings* — fills, strokes, keyframes — and it still does. What it
   never supplied was a container: .ib-model had no background, no border, no
   padding and no radius, so every model rendered as loose text and an
   unframed SVG floating on the page, with its Concise/Full switch stranded
   above the content and 10px labels sitting directly on the drawing.

   This sheet is loaded AFTER those blocks on every page that renders a model,
   so it only has to describe the frame, typography and controls. It changes
   no drawing geometry and no model logic: a model that looks wrong because
   its labels collide (see the Venn in B.3.1) still needs its own fix, and
   that fix belongs in ib-sehs-models.js, not here.

   BRAND
   -----
   design/tokens.css sets the direction: navy ink on warm ivory, one teal
   accent, hairlines, no gradients and no glow. So the model is built out of
   three flat surfaces — card, plate, chip — separated by 1px rules and
   space, not by colour or shadow tricks.

   Sizes are deliberately larger than the old block's: 10px axis labels and
   .82rem notes were unreadable at arm's length on a laptop, which is how
   these models are actually read.
   ══════════════════════════════════════════════════════════════════════════ */

.ib-model {
  /* the three surfaces, named once so dark mode flips them in one place */
  --ibm-card: var(--surface, #fff);
  --ibm-plate: var(--canvas, #F6F4EE);
  --ibm-rule: var(--line, #DCDDD6);
  --ibm-rule-2: var(--line-2, #C7CBC3);
  --ibm-ink: var(--ink, #172B3A);
  --ibm-ink-2: var(--ink-2, #3E5566);
  --ibm-ink-3: var(--ink-3, #56697A);
  --ibm-accent: var(--accent, #2E6F66);
  --ibm-on-accent: var(--on-accent, #fff);

  position: relative;
  width: 100%;
  max-width: 680px;
  margin: 1.1rem auto 1.35rem;
  padding: 18px 22px 16px;
  background: var(--ibm-card);
  border: 1px solid var(--ibm-rule);
  border-radius: 18px;
  box-shadow: var(--shadow-1, 0 1px 2px rgba(23, 43, 58, .05));
  font-size: 15px;
  line-height: 1.6;
  color: var(--ibm-ink);
}

body.dark .ib-model {
  --ibm-card: var(--surface, #172632);
  --ibm-plate: var(--surface-sunk, #0F1A23);
  --ibm-rule: var(--line, #2A3D4A);
  --ibm-rule-2: var(--line-2, #35505F);
}

/* ── toolbar: identity on the left, weight switch on the right ─────────── */
/* .ib-head used to be a bare flex-end div, so the only thing above a model
   was a floating Concise/Full control with nothing to attach it to. It now
   carries the block's label as well, which is what tells a reader the thing
   below is interactive rather than a printed figure. */
.ib-model .ib-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  padding: 0 0 11px;
  border-bottom: 1px solid var(--ibm-rule);
}
.ib-model .ib-head::before {
  content: 'Interactive model';
  flex: 1 1 auto;
  font-family: var(--font-ui, -apple-system, sans-serif);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ibm-ink-3);
}
body.lang-zh .ib-model .ib-head::before { content: '互动模型'; letter-spacing: .1em; }

.ib-model .kv-seg {
  flex: none;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--ibm-plate);
  border: 1px solid var(--ibm-rule);
}
.ib-model .kv-seg button {
  font-family: var(--font-ui, -apple-system, sans-serif);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--ibm-ink-3);
  padding: .3rem .72rem;
  border-radius: 999px;
  transition: background .16s, color .16s;
}
.ib-model .kv-seg button[aria-pressed="true"] {
  background: var(--ibm-accent);
  color: var(--ibm-on-accent);
  box-shadow: none;
}

/* ── the control question ──────────────────────────────────────────────── */
.ib-model .kv-q {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 9px;
  font-family: var(--font-ui, -apple-system, sans-serif);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: .005em;
  color: var(--ibm-ink-2);
}
.ib-model .kv-q::before {
  content: '';
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--ibm-accent);
  transform: translateY(-2px);
}

/* ── segmented choices ─────────────────────────────────────────────────── */
.ib-model .kv-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 4px;
}
.ib-model .kv-tools button {
  font-family: var(--font-ui, -apple-system, sans-serif);
  font-size: 12.8px;
  font-weight: 550;
  line-height: 1.25;
  padding: .46rem .8rem;
  border-radius: 999px;
  color: var(--ibm-ink-2);
  background: transparent;
  border: 1px solid var(--ibm-rule-2);
  cursor: pointer;
  transition: background .16s, border-color .16s, color .16s;
}
.ib-model .kv-tools button:hover {
  border-color: var(--ibm-accent);
  color: var(--ibm-accent);
}
.ib-model .kv-tools button.on,
.ib-model .kv-tools button[aria-pressed="true"] {
  background: var(--ibm-accent);
  border-color: var(--ibm-accent);
  color: var(--ibm-on-accent);
  font-weight: 700;
}

/* ── the plate: title, drawing, key ────────────────────────────────────── */
.ib-model .a11-panel {
  margin: 12px 0 0;
  padding: 15px 16px 13px;
  border: 1px solid var(--ibm-rule);
  border-radius: 14px;
  background: var(--ibm-plate);
}
.ib-model .a11-hd {
  display: block;
  margin: 0 0 2px;
  padding: 0;
}
.ib-model .a11-hd b {
  display: block;
  font-family: var(--font-display, var(--serif, Georgia, serif));
  font-size: 1.06rem;
  font-weight: 500;
  line-height: 1.28;
  letter-spacing: -.012em;
  color: var(--ibm-ink);
}
.ib-model .a11-hd span {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ibm-ink-3);
}

/* the drawing itself */
.ib-model .kv-svg {
  display: block;
  width: 100%;
  height: auto;
  margin: 10px 0 2px;
  overflow: visible;
}
.ib-model .kv-svg text {
  font-family: var(--font-ui, -apple-system, sans-serif);
  font-size: 12.5px;
  font-weight: 550;
  letter-spacing: .002em;
  fill: var(--ibm-ink-2);
  /* a halo in the plate colour, so a label crossing a stroke stays legible
     instead of colliding with it — the cheapest fix for the label spaghetti
     the hand-drawn models produce */
  paint-order: stroke;
  stroke: var(--ibm-plate);
  stroke-width: 3.5px;
  stroke-linejoin: round;
}
.ib-model .kv-svg text.small { font-size: 11.5px; }

/* the key under the drawing */
.ib-model .kv-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--ibm-ink-2);
}
.ib-model .kv-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px 4px 7px;
  border-radius: 999px;
  background: var(--ibm-card);
  border: 1px solid var(--ibm-rule);
  line-height: 1.3;
}
.ib-model .kv-legend > span > i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  margin: 0;
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}
.ib-model .kv-legend b {
  color: var(--ibm-ink);
  font-variant-numeric: tabular-nums;
}

/* ── sliders ───────────────────────────────────────────────────────────── */
.ib-model .kv-lab {
  display: block;
  margin-top: 14px;
}
.ib-model .ibm-q {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
  font-family: var(--font-ui, -apple-system, sans-serif);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ibm-ink-2);
}
.ib-model .kv-lab b,
.ib-model .kv-v {
  flex: none;
  font-size: 13px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: var(--ibm-accent);
}
.ib-model input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 22px;
  margin: 2px 0 0;
  background: transparent;
  cursor: pointer;
}
.ib-model input[type=range]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: var(--ibm-rule-2);
}
.ib-model input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--ibm-accent);
  border: 3px solid var(--ibm-card);
  box-shadow: 0 0 0 1px var(--ibm-accent), 0 1px 3px rgba(23, 43, 58, .28);
}
.ib-model input[type=range]::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: var(--ibm-rule-2);
}
.ib-model input[type=range]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--ibm-accent);
  border: 3px solid var(--ibm-card);
  box-shadow: 0 0 0 1px var(--ibm-accent);
}
.ib-model input[type=range]:focus-visible { outline: none; }
.ib-model input[type=range]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 1px var(--ibm-accent), var(--focus-ring, 0 0 0 4px rgba(46,111,102,.35));
}

/* ── live readouts ─────────────────────────────────────────────────────── */
/* .kv-frow and .kv-meter carry THREE children — label, bar, value — and were
   defined nowhere, so the bar collapsed to zero height and the value fell onto
   its own line. Both are a 1fr / bar / auto row. */
.ib-model .kv-meters { margin-top: 12px; display: grid; gap: 8px; }
.ib-model .kv-frow,
.ib-model .kv-meter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(80px, 1.15fr) auto;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  color: var(--ibm-ink-2);
}
.ib-model .kv-frow > span,
.ib-model .kv-meter > span { min-width: 0; }
.ib-model .kv-frow > b,
.ib-model .kv-meter > b,
.ib-model .kv-bar + b,
.ib-model .kv-val,
.ib-model .kv-p0,
.ib-model .kv-p1,
.ib-model .kv-p2 {
  font-family: var(--font-ui, -apple-system, sans-serif);
  font-size: 13px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: var(--ibm-accent);
  white-space: nowrap;
}
.ib-model .kv-fbar,
.ib-model .kv-bar {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: var(--ibm-rule);
  overflow: hidden;
}
.ib-model .kv-fbar > i,
.ib-model .kv-bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--ibm-accent);
  transition: width .25s var(--ease, ease);
}

/* ── drawing primitives the models emit but nothing ever defined ─────────
   These four classes are referenced hundreds of times and were absent from
   every stylesheet: an SVG line with no stroke is invisible, and a rect or
   path with no fill falls back to BLACK. The baseline under every weekly
   chart, and the outer two layers of every artery section, were rendering
   as a missing line and a black blob respectively. */
.ib-model .an-axis { fill: none; stroke: var(--ibm-rule-2); stroke-width: 1.25; }
.ib-model .an-grid { fill: none; stroke: var(--ibm-rule); stroke-width: 1; }
.ib-model .an-adventitia {
  fill: color-mix(in srgb, var(--c0) 16%, var(--ibm-plate));
  stroke: color-mix(in srgb, var(--c0) 38%, var(--ibm-plate));
  stroke-width: 1;
}
.ib-model .an-media { fill: color-mix(in srgb, var(--c0) 34%, var(--ibm-plate)); }

/* ── chart marks ─────────────────────────────────────────────────────────
   A training day is a solid column with rounded shoulders; a recovery day is
   the same column left empty, so "no load" is a shape the eye can see instead
   of a 10px stub that reads as a very short session. */
.ib-model .an-wkbar { fill: var(--c2); }
.ib-model .an-restday {
  fill: none;
  stroke: var(--ibm-rule-2);
  stroke-width: 1.5;
  stroke-dasharray: 5 5;
}
.ib-model .an-runline {
  fill: none;
  stroke: var(--c1);
  stroke-width: 2;
  stroke-dasharray: 3 5;
  stroke-linecap: round;
  opacity: .85;
}
.ib-model .an-rundot { fill: var(--c1); stroke: var(--ibm-plate); stroke-width: 1.5; }
/* text rules need one more class than `.kv-svg text`, or the generic label
   colour wins on specificity and these come out grey */
.ib-model .kv-svg .an-runlab { fill: var(--c1); font-weight: 700; }

/* ── set diagrams (the Venn family) ─────────────────────────────────────── */
.ib-model .an-risk.i {
  fill: color-mix(in srgb, var(--c2) 13%, transparent);
  stroke: color-mix(in srgb, var(--c2) 55%, transparent);
  stroke-width: 1.25;
  opacity: 1;
}
.ib-model .an-risk.e {
  fill: color-mix(in srgb, var(--c1) 15%, transparent);
  stroke: color-mix(in srgb, var(--c1) 60%, transparent);
  stroke-width: 1.25;
  opacity: 1;
}
/* the intersection is one solid tint, not two translucent circles multiplied
   into an olive smear — and it must not pulse, because the old keyframes
   scaled the lens and made it drift off the two circles it belongs to */
.ib-model .an-overlap {
  fill: color-mix(in srgb, var(--c0) 30%, transparent);
  stroke: color-mix(in srgb, var(--c0) 72%, transparent);
  stroke-width: 1.5;
  opacity: 1;
  animation: none;
  transform: none;
}
.ib-model .an-set-i { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; }
.ib-model .an-set-e { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; }
.ib-model .kv-svg .an-set-i { fill: var(--c2); }
.ib-model .kv-svg .an-set-e { fill: var(--c1); }
.ib-model .an-athlete > * {
  fill: var(--ibm-ink);
  stroke: var(--ibm-plate);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.ib-model .an-athlete > path { fill: none; }

/* the numbered step ribbon above the synapse */
.ib-model .ns-step { fill: var(--ibm-accent); }
.ib-model .kv-svg .ns-stepn {
  fill: var(--ibm-on-accent);
  stroke: none;
  font-size: 11px;
  font-weight: 800;
}
.ib-model .kv-svg .ns-stepl { fill: var(--ibm-ink-2); font-weight: 600; }

/* ── tissue fills ────────────────────────────────────────────────────────
   The fibre was a saturated red slab with a 2.4px outline and 7px stripes on
   an 18px pitch, which reads as a comb rather than muscle. Tinting from the
   plate instead of from the surface keeps it quiet against the card, and thin
   stripes on a 26px pitch let the fibre read as one tissue. */
.ib-model .ns-fibre {
  fill: color-mix(in srgb, var(--c0) 14%, var(--ibm-plate));
  stroke: color-mix(in srgb, var(--c0) 55%, var(--ibm-plate));
  stroke-width: 2;
}
.ib-model .ns-stria { fill: color-mix(in srgb, var(--c0) 30%, var(--ibm-plate)); }
.ib-model .ns-nuc {
  fill: var(--ibm-plate);
  stroke: color-mix(in srgb, var(--c0) 55%, var(--ibm-plate));
  stroke-width: 1.5;
}
.ib-model .ns-cleft {
  fill: color-mix(in srgb, var(--ibm-ink) 7%, var(--ibm-plate));
  stroke: var(--ibm-rule-2);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

/* legend swatches the models reference but that were never defined */
.ib-model .an-l-train { background: var(--c2); }
.ib-model .an-l-prog { background: var(--c1); }
.ib-model .an-l-ri { background: var(--c2); }
.ib-model .an-l-re { background: var(--c1); }
.ib-model .an-l-risky { background: var(--c0); }

/* ── the "so what" line ────────────────────────────────────────────────── */
.ib-model .kv-callout {
  margin: 14px 0 0;
  padding: 11px 14px;
  border-radius: 11px;
  border-left: 3px solid var(--ibm-accent);
  background: var(--accent-wash, #E9F1EF);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ibm-ink);
}
body.dark .ib-model .kv-callout { background: var(--accent-wash, #1B302F); }

/* ── the footnote ──────────────────────────────────────────────────────── */
.ib-model .kv-note {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--ibm-rule);
  max-width: 68ch;
  font-size: 12.8px;
  line-height: 1.68;
  color: var(--ibm-ink-3);
  overflow-wrap: anywhere;
}

/* ── choice grids (practices, characteristics, categories) ─────────────── */
.ib-model .ib-practices,
.ib-model .ib-ch,
.ib-model .ib-cats { gap: 6px; margin-top: 10px; }
.ib-model .ib-practices button,
.ib-model .ib-ch button,
.ib-model .ib-cats button {
  border-radius: 12px;
  border: 1px solid var(--ibm-rule-2);
  background: var(--ibm-card);
  padding: .6rem .8rem;
  font-size: 13px;
  line-height: 1.35;
  color: var(--ibm-ink);
  transition: border-color .16s, background .16s;
}
.ib-model .ib-practices button:hover,
.ib-model .ib-ch button:hover,
.ib-model .ib-cats button:hover { border-color: var(--ibm-accent); }
.ib-model .ib-practices button.on,
.ib-model .ib-ch button.on,
.ib-model .ib-cats button.on {
  border-color: var(--ibm-accent);
  background: var(--accent-wash, #E9F1EF);
}
.ib-model .ib-ch button b,
.ib-model .ib-cats button b { font-size: 13.5px; font-weight: 700; }
.ib-model .ib-ch button span,
.ib-model .ib-cats button span { font-size: 12px; color: var(--ibm-ink-3); line-height: 1.4; }

/* ── scales and keys ───────────────────────────────────────────────────── */
.ib-model .ibm-band {
  height: 10px;
  border-radius: 999px;
  margin: 12px 0 6px;
  background: var(--ibm-rule);
}
.ib-model .ibm-scale {
  font-family: var(--font-ui, -apple-system, sans-serif);
  font-size: 11.5px;
  color: var(--ibm-ink-3);
}
.ib-model .ibm-key { font-size: 12px; color: var(--ibm-ink-2); gap: 6px 14px; }
.ib-model .ibm-key i { width: 9px; height: 9px; border-radius: 3px; }

/* ── the chart frame ───────────────────────────────────────────────────────
   Twenty-odd models draw a plot, and each one used to invent its own frame:
   a dashed grid, an axis in a hard-coded grey (#C6D1DD, which is a light-mode
   colour painted over a dark plate), tick numbers with no unit and no tick
   mark at all. These rules are the single frame they all share now. They are
   scoped to .ib-model .kv-svg, so nothing else on the site moves.

   The colours are --text at low opacity rather than a fixed grey: the frame
   is structure, not ink, and it has to hold up in both themes. The grid is a
   solid hairline — a dashed grid reads as a construction line, and next to a
   dashed cursor the drawing starts to look like a sketch. */
.ib-model .kv-svg .axis { stroke: var(--text); stroke-width: 1; opacity: .32; }
.ib-model .kv-svg .tk { stroke: var(--text); stroke-width: 1; opacity: .32; }
.ib-model .kv-svg .gl {
  stroke: var(--text);
  stroke-width: 1;
  stroke-dasharray: none;
  opacity: .09;
}
.ib-model .kv-svg .num {
  fill: var(--text2);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}
.ib-model .kv-svg .cap {
  fill: var(--text3);
  font-size: 10px;
  letter-spacing: .07em;
}
/* a third series had no colour at all, so every "c" curve in the file drew
   nothing while its label stayed on the plate */
.ib-model .kv-svg .curve.c { stroke: var(--c1); }
/* the read-out dot takes its colour from the line it sits on */
.ib-model .kv-svg .mst-dot { stroke: var(--surface); stroke-width: 2; }
.ib-model .kv-svg .mst-dot.a { fill: var(--c2); }
.ib-model .kv-svg .mst-dot.b { fill: var(--c0); }
.ib-model .kv-svg .mst-dot.c { fill: var(--c1); }
/* the key sits under the plate and carries the live value, so a reader never
   has to chase a label across three nearly parallel lines */
.ib-model .mst-key span { font-variant-numeric: tabular-nums; }
.ib-model .mst-key b { color: var(--text); font-weight: 700; margin-left: .3em; }
.ib-model .mst-k { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.ib-model .mst-k.a { background: var(--c2); }
.ib-model .mst-k.b { background: var(--c0); }
.ib-model .mst-k.c { background: var(--c1); }

/* ── the 2 × 2 plate ────────────────────────────────────────────────────
   Eight models are a four-cell grid. Tinting all four cells with different
   colours turns the plate into a smudge, so the default is one neutral
   plate and the only colour is the cell you are actually in. */
.ib-model .kv-svg .mx-plate {
  fill: var(--text);
  fill-opacity: .035;
  stroke: var(--text);
  stroke-opacity: .13;
  stroke-width: 1;
}
.ib-model .kv-svg .mx-div { stroke: var(--text); stroke-width: 1; opacity: .18; }
.ib-model .kv-svg .mx-live {
  fill: var(--accent);
  fill-opacity: .10;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-opacity: .55;
}
.ib-model .kv-svg .mx-t { fill: var(--text); font-size: 12px; font-weight: 700; }
.ib-model .kv-svg .mx-s { fill: var(--text3); font-size: 10.5px; }
.ib-model .kv-svg .mx-ax { fill: var(--text2); font-size: 10.5px; letter-spacing: .04em; }
.ib-model .kv-svg .mx-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2.5; }
.ib-model .kv-svg .mx-cross {
  stroke: var(--accent);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: .55;
}

/* ── the eustress corridor, friction's two areas ───────────────────────── */
.ib-model .kv-svg .st-band { fill: var(--accent); opacity: .17; }
.ib-model .kv-svg .st-edge { fill: none; stroke: var(--accent); stroke-width: 1; stroke-opacity: .45; }
/* the work area is amber because the "Work done" bar below it is amber —
   one colour, one quantity, wherever it appears */
.ib-model .kv-svg .w-area { fill: var(--c1); opacity: .18; }
/* the cursor marks a "now", so it is one hairline, not a 2px dashed ruler
   competing with the series it is pointing at */
.ib-model .kv-svg .kv-cursor { stroke-width: 1; opacity: .75; }

/* ── periodization: weekly bars, phase bands, the ratio strip ─────────────
   `class="bar"` on an SVG rect picked up the HTML meter rule
   (.bar{height:4px;background:...}), which is a <div> progress bar — so every
   weekly load was forced to four pixels tall and read as a floating dash with
   no baseline. The plot gets its own name. */
.ib-model .kv-svg .pbar { fill: var(--c2); opacity: .26; }
.ib-model .kv-svg .pbar.on { opacity: .9; }
.ib-model .kv-svg .ph-band { fill: var(--text); fill-opacity: .022; }
.ib-model .kv-svg .ph-band.alt { fill-opacity: .05; }
.ib-model .kv-svg .ph-lab {
  fill: var(--text3);
  font-size: 9.5px;
  letter-spacing: .11em;
  text-transform: uppercase;
}
/* one cell per week; the fill is the ratio's verdict, so the strip is the
   only place risk can appear as a shape rather than a sentence */
.ib-model .kv-svg .rc { fill: var(--text3); opacity: .6; }
.ib-model .kv-svg .rc.ok { fill: var(--green); opacity: .8; }
.ib-model .kv-svg .rc.warn { fill: var(--c1); opacity: .85; }
.ib-model .kv-svg .rc.risk { fill: var(--red); opacity: .9; }

/* a smoothed mean is a measurement, not a forecast: solid, and one step
   brighter than the bars it sits on */
.ib-model .kv-svg .chron {
  stroke: var(--text2);
  stroke-width: 2;
  stroke-dasharray: none;
}

/* ── where two lines swap ───────────────────────────────────────────────── */
.ib-model .kv-svg .cross-dot { fill: var(--text); opacity: .5; }
.ib-model .kv-svg .goal-mark {
  stroke: var(--text3);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

/* ── the ghost series ────────────────────────────────────────────────────
   Three strategies plotted, one chosen: the other two stay as grey ghosts so
   the choice is visible as a gap, not as a legend entry. At 1.5px and 55 %
   they vanished against the plate, which left the chosen curve looking like
   the only line — and therefore like no choice had been made. */
.ib-model .kv-svg .curve.ghost {
  stroke: var(--text2);
  stroke-width: 1.6;
  opacity: .75;
}
/* the critical-window band: a zone, not a quantity, so it stays quieter than
   the series drawn over it */
.ib-model .kv-svg .window { fill: var(--c1); opacity: .11; }
.ib-model .kv-svg .win-edge {
  stroke: var(--c1);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: .6;
}
/* the vertical run between the two dots in the learning chart */
.ib-model .kv-svg .gap { stroke: var(--text3); stroke-width: 1; stroke-dasharray: 2 3; }
/* a unit shared by every row of a key belongs at the end of the key, once */
.ib-model .kv-legend .lg-note { color: var(--text3); font-weight: 400; }

/* ── bodies, tracks and forces ───────────────────────────────────────────
   Four models draw an object rather than a chart, and all four had been drawn
   with a five-line stick figure. A stick figure has no front surface to be
   anterior to (the old drawing put an "anterior" arrow above the head, i.e.
   pointing superior), no limb to be proximal along, and no mass to resist a
   force. So: one mannequin in two views, one block, one ground band. */
.ib-model { --mn-fill: color-mix(in srgb, var(--text) 9%, var(--surface)); }

.ib-model .kv-svg .mn-s { fill: var(--mn-fill); stroke: var(--text3); stroke-width: 1.5; stroke-linejoin: round; }
.ib-model .kv-svg .mn-o { fill: none; stroke: var(--text3); stroke-linejoin: round; stroke-linecap: round; }
.ib-model .kv-svg .mn-i { fill: none; stroke: var(--mn-fill); stroke-linejoin: round; stroke-linecap: round; }
.ib-model .kv-svg .mn-dim { opacity: .42; }
.ib-model .kv-svg .mn-mid { stroke: var(--text3); stroke-width: 1; stroke-dasharray: 5 5; opacity: .55; }

/* the term, and where it sits among the four pairs */
.ib-model .kv-svg .tm-arrow { fill: none; stroke: var(--accent); stroke-width: 2.6; stroke-linecap: round; }
.ib-model .kv-svg .tm-head { fill: var(--accent); }
.ib-model .kv-svg .tm-term { fill: var(--accent); font-size: 17px; font-weight: 700; }
.ib-model .kv-svg .tm-gloss { fill: var(--text2); font-size: 11.5px; }
.ib-model .kv-svg .tm-hd { fill: var(--text3); font-size: 9px; font-weight: 700; letter-spacing: .12em; }
.ib-model .kv-svg .tm-row { fill: var(--text3); font-size: 11px; }
.ib-model .kv-svg .tm-row.on { fill: var(--text); font-weight: 700; }
.ib-model .kv-svg .tm-on { fill: var(--accent); }

/* a track: the strobe marks make equal spacing mean constant speed */
.ib-model .kv-svg .tk-base { stroke: var(--text3); stroke-width: 1.4; opacity: .6; }
.ib-model .kv-svg .tk-tick { stroke: var(--text3); stroke-width: 1; opacity: .5; }
.ib-model .kv-svg .blk { fill: color-mix(in srgb, var(--c2) 30%, var(--surface)); stroke: var(--c2); stroke-width: 1.6; }
.ib-model .kv-svg .blk-ghost { fill: none; stroke: var(--c2); stroke-width: 1.4; stroke-dasharray: 4 3; opacity: .45; }
.ib-model .kv-svg .f-arrow { fill: none; stroke: var(--c0); stroke-width: 3; stroke-linecap: round; }
.ib-model .kv-svg .a-arrow { fill: none; stroke: var(--c1); stroke-width: 3; stroke-linecap: round; }
/* a velocity is not a force: it must not borrow the force colour */
.ib-model .kv-svg .v-arrow { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.ib-model .kv-svg .lk-v { fill: var(--accent); font-size: 12px; font-weight: 700; }
.ib-model .kv-svg .lk-h-v { fill: var(--accent); }
.ib-model .kv-svg .lk-h-f { fill: var(--c0); }
.ib-model .kv-svg .lk-h-a { fill: var(--c1); }
.ib-model .kv-svg .lk-head { fill: var(--accent); font-size: 15px; font-weight: 700; }
.ib-model .kv-svg .lk-lab { fill: var(--text2); font-size: 12px; font-weight: 700; }
.ib-model .kv-svg .lk-f { fill: var(--c0); font-size: 12px; font-weight: 700; }
.ib-model .kv-svg .lk-a { fill: var(--c1); font-size: 12px; font-weight: 700; }
.ib-model .kv-svg .lk-f2 { fill: var(--c0); font-size: 10.5px; }
.ib-model .kv-svg .lk-a2 { fill: var(--c1); font-size: 10.5px; }
.ib-model .kv-svg .lk-contact { fill: var(--text); }
.ib-model .kv-legend .lk-l-f { background: var(--c0); }
.ib-model .kv-legend .lk-l-a { background: var(--c1); }

/* ground, drawn as a section: a surface line and the hatch marks under it */
.ib-model .kv-svg .gr-band { fill: color-mix(in srgb, var(--text) 6%, var(--surface)); }
.ib-model .kv-svg .gr-top { stroke: var(--text3); stroke-width: 2; }
.ib-model .kv-svg .hatch { stroke: var(--text3); stroke-width: 1; opacity: .4; }

/* a measured length on the plate: dimension line, end ticks, value */
.ib-model .kv-svg .dim { stroke: var(--text3); stroke-width: 1; }
.ib-model .kv-svg .dim-t { fill: var(--text2); font-size: 10.5px; font-weight: 600; }
.ib-model .kv-svg .land { fill: var(--text3); }
.ib-model .kv-svg .th-wedge { fill: var(--accent); opacity: .14; }
.ib-model .kv-svg .th-lab { fill: var(--accent); font-size: 12px; font-weight: 700; }

/* the planes plate drew its bounding box in `--border2`, which is defined
   nowhere, so the fallback light grey leaked into dark mode */
.ib-model .kv-svg .plane { stroke: var(--text3); stroke-opacity: .45; }

/* ── phones ────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .ib-model {
    margin: .9rem auto 1.1rem;
    padding: 14px 15px 13px;
    border-radius: 16px;
  }
  .ib-model .a11-panel { padding: 13px 12px 11px; }
  /* An SVG scales as one object: at 353px wide a 560-unit viewBox renders
     12.5px labels at ~7.9px, which is unreadable. Bumping the user-space size
     to 15px lands at ~9.5px on a phone — still small, but legible, and it is
     the only lever a fixed viewBox gives without re-laying-out 80 drawings. */
  .ib-model .kv-svg text { font-size: 15px; stroke-width: 3px; }
  .ib-model .kv-svg text.small { font-size: 13.5px; }
  /* the frame's own labels are set by class, so they do not inherit the
     `text` bump above — they need the same lever or they land at 7px */
  .ib-model .kv-svg .num { font-size: 14px; }
  .ib-model .kv-svg .cap { font-size: 12px; }
  .ib-model .kv-svg .ph-lab { font-size: 12.5px; letter-spacing: .06em; }
  /* a 560-unit plate on a 390px phone is 0.6× — two lines per cell cannot
     both stay legible, so the gloss goes and the name gets the whole cell */
  .ib-model .kv-svg .mx-s { display: none; }
  .ib-model .kv-svg .mx-t { font-size: 18px; }
  .ib-model .kv-svg .mx-ax { font-size: 13.5px; }
  /* the term card and the track labels are set by class, so they miss the
     `text` bump and would land at 6-7px at 353px wide */
  .ib-model .kv-svg .tm-term { font-size: 22px; }
  .ib-model .kv-svg .tm-gloss { font-size: 14px; }
  .ib-model .kv-svg .tm-row { font-size: 15px; }
  .ib-model .kv-svg .tm-hd { font-size: 11px; }
  .ib-model .kv-svg .lk-head { font-size: 18px; }
  .ib-model .kv-svg .lk-lab { font-size: 15px; }
  .ib-model .kv-svg .lk-f,
  .ib-model .kv-svg .lk-a { font-size: 15px; }
  .ib-model .kv-svg .lk-f2,
  .ib-model .kv-svg .lk-a2 { font-size: 13px; }
  .ib-model .kv-svg .dim-t { font-size: 13px; }
  .ib-model .kv-svg .th-lab { font-size: 15px; }
  .ib-model .a11-hd b { font-size: 1rem; }
  .ib-model .kv-note { font-size: 12.4px; }
  .ib-model .kv-callout { font-size: 13.4px; }
  .ib-model .kv-tools button { font-size: 12.5px; padding: .5rem .75rem; }
  /* on a phone the label, bar and value cannot share one row without the
     label wrapping to two lines; put the bar underneath instead */
  .ib-model .kv-frow,
  .ib-model .kv-meter { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
  .ib-model .kv-frow > .kv-fbar,
  .ib-model .kv-meter > .kv-bar { grid-column: 1 / -1; order: 3; }
  .ib-model .kv-frow > b,
  .ib-model .kv-meter > b { order: 2; }
}

/* ── print ─────────────────────────────────────────────────────────────── */
@media print {
  .ib-model {
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
