/* The `matter` figure kit (ui/figures/matter.js): thermometer, particles, state cycle and heating curve (P0i).
   Linked from index.html; the kit's rules live here and nowhere else (never in styles.css). Rules are `.cx-figure--<kind>` and `.mt-*`
   classes; colour tokens are declared three times, as in geo.css (:root, the dark preference and data-theme="dark"). See docs/figures/README.md.
   Builds on the shared .cx, .cx-figure rules in styles.css and on its tokens (--surface, --text, --wire, --muted, --accent, --grid, --user-line).
   The heating-curve figure's chart is the widget's, drawn by ui/figures/heating-chart.js, so it takes the `.hc-*` chart rules of
   styles/widgets/heating-curve.css (as the climate graph figure takes the `.cg-*` rules of the climate-graph widget). */

/* ---- Colours -----------------------------------------------------------------------------------------------------
   Every fill or stroke that carries meaning is at least 3:1 against the card (--surface) in both themes (tests/ui-figures-matter-browser.test.js
   measures it), and none is the only cue: the liquid of a thermometer is read against the scale and its numbers. The pale tints are only a
   background. */
:root {
  --mt-hot: #d9480f;
  --mt-glass: color-mix(in srgb, var(--muted) 12%, var(--surface));
  --mt-box: color-mix(in srgb, var(--muted) 8%, var(--surface));
  --mt-particle: color-mix(in srgb, var(--accent) 18%, var(--surface)); /* 18%: the motion ticks stay 3:1 on it with the light theme's deeper accent */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --mt-hot: #ff922b;
  }
}
:root[data-theme="dark"] {
  --mt-hot: #ff922b;
}

/* ---- The picture ------------------------------------------------------------------------------------------------- */
.cx-figure--particles { max-width: 420px; }
.cx-figure--state-cycle { max-width: 420px; }
.cx-figure--thermometer { max-width: 360px; }
.cx-figure--heating-curve { max-width: 460px; }
/* Text is at least 12 units of a 320-unit picture, bold: the width estimate (textWidth in data-chart.js) is for bold text. */
.mt-text { font-size: 13px; font-weight: 600; fill: var(--text); font-family: inherit; font-variant-numeric: tabular-nums; }
.mt-text--muted { fill: var(--muted); }
.mt-text--strong { font-weight: 800; }
/* A text that crosses a gridline or a line keeps a ring of the card's colour round it. */
.mt-text--halo { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }

/* ---- particles -------------------------------------------------------------------------------------------------------
   A particle is a pale disc with a dark outline. In a solid and a liquid the motion marks are ticks across the particles, in a gas they are
   streaks behind them; both are drawn in the warm colour and grow with the temperature, so the colour never says it alone. */
.mt-box { fill: var(--mt-box); stroke: var(--wire); stroke-width: 2; }
.mt-particle { fill: var(--mt-particle); stroke: var(--wire); stroke-width: 1.5; }
.mt-mark, .mt-streak { fill: none; stroke: var(--mt-hot); stroke-width: 2.5; stroke-linecap: round; }
.mt-flame { fill: var(--mt-hot); stroke: var(--wire); stroke-width: 2; stroke-linejoin: round; }
.mt-flame-core { fill: var(--surface); stroke: none; }

/* ---- state-cycle -------------------------------------------------------------------------------------------------------
   An arrow that takes energy in is a solid line, one that gives energy out is dashed (and the key says so), so the two never differ by colour alone. */
.mt-arrow { fill: none; stroke: var(--wire); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: butt; }
.mt-arrow--out { stroke-dasharray: 7 5; }
.mt-arrow-head { fill: var(--wire); stroke: none; }
.mt-badge { fill: var(--surface); stroke: var(--wire); stroke-width: 2; }

/* ---- thermometer --------------------------------------------------------------------------------------------------- */
.mt-grid { stroke: var(--grid); stroke-width: 1; }
.mt-scale { stroke: var(--wire); stroke-width: 2; }
.mt-tick { stroke: var(--wire); stroke-width: 2; stroke-linecap: round; }
.mt-glass { fill: var(--mt-glass); stroke: var(--wire); stroke-width: 2.5; stroke-linejoin: round; }
.mt-liquid { fill: var(--mt-hot); stroke: none; }
/* The heat arrow is solid and drawn in the liquid's colour, with its name beside it. */
.mt-flow { fill: none; stroke: var(--mt-hot); stroke-width: 3.5; stroke-linecap: round; }
.mt-flow-head { fill: var(--mt-hot); stroke: none; }
