/* The `schematics` figure kit (ui/figures/schematics.js): circuit diagrams, voltage-time traces and the symbol sheet (P0e).
   Builds on the shared .cx, .cx-wire, .cx-stroke, .cx-fill, .cx-mask, .cx-junction, .cx-axis and .cx-figure rules in styles.css, which the
   symbols of ui/circuit.js are drawn with. Today's two-bulb `circuit` and `trace` data keep their old pictures and their old rules there.
   Rules here are `.cx-figure--<kind>` and kit-prefixed (`.sch-`); colour tokens are declared three times, as in geo.css
   (:root, the dark preference and data-theme="dark"). See docs/figures/README.md. */

/* ---- Colours -----------------------------------------------------------------------------------------------------
   Each is at least 3:1 against the card (--surface) in both themes (tests/ui-figures-schematics.test.js measures the hex ones, and
   tests/ui-figures-schematics-browser.test.js the rest in a browser). Meaning is never in the colour alone: trace B is dashed, trace A
   solid and both have a letter in the key; a lit lamp has rays and a dark lamp a grey tint over its cross; the arrows are shapes. */
:root {
  --sch-trace-b: #1d4ed8;
  --sch-badge: #3b5bdb;
  --sch-badge-text: #ffffff;
  --sch-lamp-off: #858ba0;
  --sch-grid: #6b7288;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sch-trace-b: #8cc4f8;
    --sch-badge: #7c95ff;
    --sch-badge-text: #0f1220;
    --sch-lamp-off: #6b6f84;
    --sch-grid: #8a91a8;
  }
}
:root[data-theme="dark"] {
  --sch-trace-b: #8cc4f8;
  --sch-badge: #7c95ff;
  --sch-badge-text: #0f1220;
  --sch-lamp-off: #6b6f84;
  --sch-grid: #8a91a8;
}

/* ---- The pictures ------------------------------------------------------------------------------------------------- */
/* The new circuit and trace are 320 units wide (the old ones were 340 and 200 and keep their sizes from styles.css), so they may be as wide as a phone. */
.cx-figure--circuit:has(.sch-circuit) { max-width: 420px; }
.cx-figure--trace:has(.sch-trace) { max-width: 420px; }
.cx-figure--symbols { max-width: 420px; }
/* Text is at least 12 units of a 320-unit picture, bold: the width estimate (textWidth in data-chart.js) is for bold text. */
.sch-text { font-size: 13px; font-weight: 700; fill: var(--text); font-family: inherit; font-variant-numeric: tabular-nums; }
.sch-text--muted { fill: var(--muted); font-weight: 600; }
.sch-text--sign { fill: var(--wire); font-size: 14px; }
.sch-text--strong { fill: var(--text); }

/* ---- circuit ----------------------------------------------------------------------------------------------------- */
.sch-arrow { fill: var(--user-line); stroke: none; }
.sch-ray { fill: none; stroke: var(--wire); stroke-width: 2; stroke-linecap: round; }
.sch-lamp-off { fill: var(--sch-lamp-off); stroke: none; }

/* ---- trace ------------------------------------------------------------------------------------------------------- */
.sch-trace-a { fill: none; stroke: var(--user-line); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.sch-trace-b { fill: none; stroke: var(--sch-trace-b); stroke-width: 2.5; stroke-dasharray: 7 4; stroke-linejoin: round; }
.sch-grid { stroke: var(--sch-grid); stroke-width: 1; stroke-dasharray: 2 4; opacity: 0.6; }
.sch-guide { stroke: var(--axis); stroke-width: 1; stroke-dasharray: 5 4; }

/* ---- symbols ----------------------------------------------------------------------------------------------------- */
.sch-badge { fill: var(--sch-badge); stroke: none; }
.sch-symbols .sch-text--badge { fill: var(--sch-badge-text); font-weight: 800; }
