/* The `electricity` figure kit (ui/figures/electricity.js): formula triangle, meters, wire, cable, unit steps and mark (P0f).
   Linked from index.html; the kit's rules live here and nowhere else (never in styles.css). Rules are `.cx-figure--<kind>` and `.el-*`
   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, --user-line). */

/* ---- Colours -----------------------------------------------------------------------------------------------------
   Every fill or stroke that carries meaning is at least 3:1 against the card (--surface) in both themes (tests/ui-figures-electricity.test.js
   and the kit's browser test measure it), and none is the only cue: the ions and electrons differ in size and carry + and −; a hot wire has
   a hatching and a cold one dots; the cores of the cable have a pattern and a letter; a step that is marked has a heavy outline and a dashed
   frame. The yellow of the earth core and of the warning sign is not 3:1 on a white card (like white and yellow in the maths kit), so both
   have a dark outline that is, and the green stripes are. The pale tints (the triangle, the wire body, the dial) are only a background. */
:root {
  --el-hatch: #3b5bdb;
  --el-ion: #e8590c;
  --el-ion-mark: #ffffff;
  --el-electron: #3b5bdb;
  --el-electron-mark: #ffffff;
  --el-hot: #d9480f;
  --el-cold: #1c7ed6;
  --el-brown: #7b4a1e;
  --el-blue: #1c7ed6;
  --el-green: #2b8a3e;
  --el-yellow: #fcc419;
  --el-copper: #c8741f;
  --el-copper-line: #5c3207;
  --el-warn: #fcc419;
  --el-warn-ink: #1c2033;
  --el-tri: color-mix(in srgb, var(--accent) 10%, var(--surface));
  --el-body: color-mix(in srgb, var(--muted) 14%, var(--surface));
  --el-body-hot: color-mix(in srgb, var(--el-hot) 13%, var(--surface));
  --el-body-cold: color-mix(in srgb, var(--el-cold) 13%, var(--surface));
  --el-sheath: color-mix(in srgb, var(--muted) 22%, var(--surface));
  --el-step: color-mix(in srgb, var(--accent) 12%, var(--surface));
  --el-step-marked: color-mix(in srgb, var(--accent) 28%, var(--surface));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --el-hatch: #7c95ff;
    --el-ion: #ff922b;
    --el-ion-mark: #12141c;
    --el-electron: #8ea2ff;
    --el-electron-mark: #12141c;
    --el-hot: #ff922b;
    --el-cold: #74c0fc;
    --el-brown: #a9633d;
    --el-blue: #74c0fc;
    --el-green: #69db7c;
    --el-yellow: #ffd43b;
    --el-copper: #e8943a;
    --el-copper-line: #4a2a08;
    --el-warn: #ffd43b;
    --el-warn-ink: #12141c;
  }
}
:root[data-theme="dark"] {
  --el-hatch: #7c95ff;
  --el-ion: #ff922b;
  --el-ion-mark: #12141c;
  --el-electron: #8ea2ff;
  --el-electron-mark: #12141c;
  --el-hot: #ff922b;
  --el-cold: #74c0fc;
  --el-brown: #a9633d;
  --el-blue: #74c0fc;
  --el-green: #69db7c;
  --el-yellow: #ffd43b;
  --el-copper: #e8943a;
  --el-copper-line: #4a2a08;
  --el-warn: #ffd43b;
  --el-warn-ink: #12141c;
}

/* ---- The picture ------------------------------------------------------------------------------------------------- */
.cx-figure--formula-triangle { max-width: 320px; }
.cx-figure--mark { max-width: 220px; }
/* Text is at least 12 units of a 320-unit picture, bold: the width estimate (textWidth in data-chart.js) is for bold text. The symbols and the
   unit of a dial are larger (26 to 34 units: set in the drawing). */
.el-text { font-size: 13px; font-weight: 600; fill: var(--text); font-family: inherit; font-variant-numeric: tabular-nums; }
.el-text--muted { fill: var(--muted); }
.el-text--strong { font-weight: 800; }
/* A covered symbol of the formula triangle stays readable under the hatching: muted, with a ring of the card's colour round it. */
.el-text--covered { font-weight: 800; fill: var(--muted); paint-order: stroke; stroke: var(--surface); stroke-width: 5px; stroke-linejoin: round; }
.el-hatch-line { stroke: var(--el-hatch); stroke-width: 2.2; }
.el-fig--wire .el-hatch-line { stroke: var(--el-hot); stroke-width: 2; }
.el-fig--wire .el-dot { fill: var(--el-cold); }
.el-fig--cable .el-dot { fill: var(--surface); }
.el-stripe { fill: var(--el-green); }

/* ---- formula-triangle ---------------------------------------------------------------------------------------------- */
.el-tri { fill: var(--el-tri); stroke: none; }
.el-cover { stroke: none; }
.el-tri-line { stroke: var(--wire); stroke-width: 3; stroke-linecap: round; }
.el-tri-outline { fill: none; stroke: var(--wire); stroke-width: 4; stroke-linejoin: round; }

/* ---- meter --------------------------------------------------------------------------------------------------------- */
.el-meter-housing { fill: var(--surface-2); stroke: var(--wire); stroke-width: 3; }
.el-meter-arc { fill: none; stroke: var(--wire); stroke-width: 3; }
.el-meter-tick { stroke: var(--wire); stroke-width: 2; stroke-linecap: round; }
.el-meter-tick.is-numbered { stroke-width: 3; }
.el-needle { stroke: var(--user-line); stroke-width: 4; stroke-linecap: round; }
.el-hub { fill: var(--text); stroke: var(--surface-2); stroke-width: 2; }

/* ---- wire ---------------------------------------------------------------------------------------------------------- */
.el-wire { fill: var(--el-body); stroke: var(--wire); stroke-width: 2.5; }
.el-wire--hot { fill: var(--el-body-hot); stroke: var(--el-hot); }
.el-wire--cold { fill: var(--el-body-cold); stroke: var(--el-cold); }
.el-wire-pattern { stroke: none; opacity: 0.6; }
.el-wire-pattern.is-model { opacity: 0.3; }
.el-ion { fill: var(--el-ion); stroke: var(--surface); stroke-width: 1.5; }
.el-ion-mark { fill: none; stroke: var(--el-ion-mark); stroke-width: 2.2; stroke-linecap: round; }
.el-electron { fill: var(--el-electron); stroke: var(--surface); stroke-width: 1.5; }
.el-electron-mark { fill: none; stroke: var(--el-electron-mark); stroke-width: 2; stroke-linecap: round; }
.el-vibe { fill: none; stroke: var(--el-hot); stroke-width: 2; stroke-linecap: round; }
/* The electron drift is a solid arrow and the conventional current a dashed one, so they differ by more than colour. */
.el-arrow { fill: none; stroke-width: 3; stroke-linecap: round; }
.el-arrow--electron { stroke: var(--el-electron); }
.el-arrow--conventional { stroke: var(--user-line); stroke-dasharray: 8 5; }
.el-arrow-head--electron { fill: var(--el-electron); }
.el-arrow-head--conventional { fill: var(--user-line); }

/* ---- cable --------------------------------------------------------------------------------------------------------- */
.el-sheath { fill: var(--el-sheath); stroke: var(--wire); stroke-width: 3; stroke-linejoin: round; }
.el-core { stroke: var(--wire); stroke-width: 2; }
.el-core--brown { fill: var(--el-brown); }
.el-core--blue { fill: var(--el-blue); }
.el-core--green-yellow { fill: var(--el-yellow); }
.el-core-pattern { stroke: none; }
.el-copper { fill: var(--el-copper); stroke: var(--wire); stroke-width: 1.5; }
.el-strand { stroke: var(--el-copper-line); stroke-width: 1.2; stroke-linecap: round; }
.el-badge { fill: var(--surface); stroke: var(--wire); stroke-width: 2; }

/* ---- unit-steps ---------------------------------------------------------------------------------------------------- */
.el-step-block { fill: var(--el-step); stroke: var(--wire); stroke-width: 2.5; stroke-linejoin: round; }
.el-step-block.is-marked { fill: var(--el-step-marked); stroke: var(--accent); stroke-width: 4; }
.el-step-arrow { fill: none; stroke: var(--wire); stroke-width: 2.5; stroke-linecap: round; }
.el-step-arrow--down { stroke-dasharray: 6 4; }
.el-step-head { fill: var(--wire); stroke: none; }
.el-step-arrow.is-marked { stroke: var(--accent); stroke-width: 3.5; }
.el-step-head.is-marked { fill: var(--accent); }
.el-step-frame { fill: color-mix(in srgb, var(--accent) 10%, var(--surface)); stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 4; }

/* ---- mark ---------------------------------------------------------------------------------------------------------- */
.el-sign { fill: none; stroke: var(--text); stroke-width: 7; stroke-linejoin: round; stroke-linecap: butt; }
.el-sign--warning { fill: var(--el-warn); }
.el-bolt { fill: var(--el-warn-ink); stroke: none; }
