/* Bloctric colour tokens, shared by the app, the website and the account pages.
   data-theme selects the mode (dark or light). data-scheme selects the palette:
   Cobalt (no attribute or "cobalt") or Copper. Status, wire, plot and icon colours
   carry meaning, so both schemes share them; each has its own dark and light value.
   Every value is checked for WCAG contrast and colour-blind separation; see
   frontend/src/lib/theme-tokens.test.js before changing one. */

:root, :root[data-theme='dark'] {
  color-scheme: dark;
  /* Status */
  --info: #9bc8e7;
  --info-muted: #1d3240;
  --success: #82db9b;
  --success-muted: #17331f;
  --success-strong: #2a874d;
  --warning: #f9c261;
  --warning-muted: #3d2a0e;
  --warning-border: #966d3b;
  --danger: #f39794;
  --danger-muted: #451d1d;
  --danger-strong: #c73836;
  --violet: #c6a8f5;
  --violet-muted: #322446;
  /* Wires and ports by domain (keys match the domain registry) */
  --domain-signal: #8979ee;
  --domain-signal-text: #b5a8ff;
  --domain-electrical: #f08441;
  --domain-electrical-1ph: #f5ac69;
  --domain-busbar: #cd600d;
  --domain-thermal: #df445f;
  --domain-networking: #68d1e3;
  /* LAN B of a PRP network: blue, well round the hue circle from the
     network cyan and short of the signal violet; its labels take the
     lighter text shade. */
  --domain-networking-lan-b: #2f7bff;
  --domain-networking-lan-b-text: #5b9cff;
  --domain-c3794: #ce5aad;
  --domain-sdh: #f4cd6b;
  --fault: #fa524d;
  /* Three-phase plots: A red, B yellow, C blue, neutral green */
  --phase-a: #f25852;
  --phase-b: #e0c049;
  --phase-c: #4597ec;
  --phase-n: #5ab99d;
  /* Plot series in assignment order; adjacent pairs stay apart for colour-blind readers */
  --series-1: #4b92ea; /* blue */
  --series-2: #d26b46; /* vermilion */
  --series-3: #23a28c; /* teal */
  --series-4: #b58a33; /* ochre */
  --series-5: #d15aa3; /* magenta */
  --series-6: #46993f; /* green */
  --series-7: #9675de; /* violet */
  --series-8: #d25456; /* red */
  /* Library category and panel icon hues */
  --hue-red: #fc9285;
  --hue-rose: #fa90a1;
  --hue-orange: #f59b62;
  --hue-amber: #f4b34b;
  --hue-yellow: #e8d170;
  --hue-green: #73cb87;
  --hue-teal: #1ec8b4;
  --hue-cyan: #38c9dc;
  --hue-sky: #58c4ff;
  --hue-blue: #84b6ff;
  --hue-indigo: #9fa9ff;
  --hue-violet: #bea1fc;
  --hue-purple: #d799ea;
  --hue-pink: #f390bd;
  /* Logo artwork */
  --logo-primary: #fc843b;
  --logo-secondary: #fed662;
  --logo-text: #fff3df;
  /* Cobalt */
  /* Surfaces */
  --canvas: #0d1014;
  --panel: #12151a;
  --raised: #191d22;
  --block: #1e2328;
  --hover: #272c32;
  --border: #30353b;
  --border-strong: #6a6f76;
  --quiet-block-outline: #4b5057;
  --routing-tag-outline: #6a6f76;
  /* Text */
  --text: #eaedf2;
  --text-secondary: #cacfd4;
  --text-muted: #acb2ba;
  --text-dim: #92989f;
  /* Accent */
  --accent: #5599f3;
  --accent-control: #3267ce;
  --accent-control-hover: #3867d7;
  --accent-text: #a6ccff;
  --accent-muted: #203256;
  --accent-border: #38558a;
  --on-accent: #ffffff;
  --toolbar-active: #203256;
  --toolbar-active-text: #a6ccff;
  /* Canvas selection: the colour farthest from every wire colour */
  --selection: #e3eefc;
  /* Channel triplets for rgb(var(--name-rgb) / alpha) */
  --canvas-rgb: 13 16 20;
  --panel-rgb: 18 21 26;
  --raised-rgb: 25 29 34;
  --border-rgb: 48 53 59;
  --muted-rgb: 172 178 186;
  --accent-rgb: 85 153 243;
}

:root[data-theme='light'] {
  color-scheme: light;
  /* Status */
  --info: #055e9f;
  --info-muted: #d2e8f8;
  --success: #246e3f;
  --success-muted: #d4f1da;
  --success-strong: #367e4e;
  --warning: #925303;
  --warning-muted: #fde9c5;
  --warning-border: #cb923f;
  --danger: #ac312f;
  --danger-muted: #ffdcd9;
  --danger-strong: #c52b2d;
  --violet: #6d3ea4;
  --violet-muted: #ece1fe;
  /* Wires and ports by domain (keys match the domain registry) */
  --domain-signal: #6346c7;
  --domain-signal-text: #5837b7;
  --domain-electrical: #ca5500;
  --domain-electrical-1ph: #c6701e;
  --domain-busbar: #ac4300;
  --domain-thermal: #ac0e45;
  --domain-networking: #1488a2;
  --domain-networking-lan-b: #0b4fbf;
  --domain-networking-lan-b-text: #0b4fbf;
  --domain-c3794: #971664;
  --domain-sdh: #764c00;
  --fault: #c91a23;
  /* Three-phase plots: A red, B yellow, C blue, neutral green */
  --phase-a: #c90015;
  --phase-b: #af850e;
  --phase-c: #0a62c2;
  --phase-n: #006c49;
  /* Plot series in assignment order; adjacent pairs stay apart for colour-blind readers */
  --series-1: #136ed0; /* blue */
  --series-2: #cf4d16; /* vermilion */
  --series-3: #008976; /* teal */
  --series-4: #b48300; /* ochre */
  --series-5: #c34294; /* magenta */
  --series-6: #33862c; /* green */
  --series-7: #7144c0; /* violet */
  --series-8: #c52a38; /* red */
  /* Library category and panel icon hues */
  --hue-red: #b0463d;
  --hue-rose: #ae445a;
  --hue-orange: #a54f00;
  --hue-amber: #a36e00;
  --hue-yellow: #917a01;
  --hue-green: #0a8a3f;
  --hue-teal: #008677;
  --hue-cyan: #008492;
  --hue-sky: #007ba3;
  --hue-blue: #346cbd;
  --hue-indigo: #5c61bc;
  --hue-violet: #7858b3;
  --hue-purple: #8e4fa1;
  --hue-pink: #a74576;
  /* Logo artwork */
  --logo-primary: #a84b08;
  --logo-secondary: #e8a317;
  --logo-text: #2b2620;
  /* Cobalt */
  /* Surfaces */
  --canvas: #ecf0f4;
  --panel: #fefeff;
  --raised: #ffffff;
  --block: #ffffff;
  --hover: #e7ecf1;
  --border: #d8dde3;
  --border-strong: #82878d;
  --quiet-block-outline: #acb2b8;
  --routing-tag-outline: #82878d;
  /* Text */
  --text: #1d2126;
  --text-secondary: #353a3f;
  --text-muted: #4b5055;
  --text-dim: #606469;
  /* Accent */
  --accent: #2c64d0;
  --accent-control: #2c5fcd;
  --accent-control-hover: #2251b9;
  --accent-text: #2252b9;
  --accent-muted: #d3e3ff;
  --accent-border: #7ca2e7;
  --on-accent: #ffffff;
  --toolbar-active: #d3e3ff;
  --toolbar-active-text: #2252b9;
  /* Canvas selection: the colour farthest from every wire colour */
  --selection: #081e60;
  /* Channel triplets for rgb(var(--name-rgb) / alpha) */
  --canvas-rgb: 236 240 244;
  --panel-rgb: 254 254 255;
  --raised-rgb: 255 255 255;
  --border-rgb: 216 221 227;
  --muted-rgb: 75 80 85;
  --accent-rgb: 44 100 208;
}

:root[data-scheme='copper'], :root[data-scheme='copper'][data-theme='dark'] {
  /* Surfaces */
  --canvas: #120f0d;
  --panel: #171512;
  --raised: #1f1c19;
  --block: #25211e;
  --hover: #2f2b27;
  --border: #373430;
  --border-strong: #726e69;
  --quiet-block-outline: #534f4b;
  --routing-tag-outline: #726e69;
  /* Text */
  --text: #efedea;
  --text-secondary: #d1ceca;
  --text-muted: #b3aeaa;
  --text-dim: #9b9692;
  /* Accent */
  --accent: #eb8b4d;
  --accent-control: #eb8342;
  --accent-control-hover: #eba25f;
  --accent-text: #f6af74;
  --accent-muted: #472a18;
  --accent-border: #7c4e32;
  --on-accent: #22130a;
  --toolbar-active: #472a18;
  --toolbar-active-text: #f6af74;
  /* Canvas selection: the colour farthest from every wire colour */
  --selection: #f9f4ec;
  /* Channel triplets for rgb(var(--name-rgb) / alpha) */
  --canvas-rgb: 18 15 13;
  --panel-rgb: 23 21 18;
  --raised-rgb: 31 28 25;
  --border-rgb: 55 52 48;
  --muted-rgb: 179 174 170;
  --accent-rgb: 235 139 77;
}

:root[data-scheme='copper'][data-theme='light'] {
  /* Surfaces */
  --canvas: #f2efea;
  --panel: #fffdf9;
  --raised: #ffffff;
  --block: #ffffff;
  --hover: #efebe5;
  --border: #e1dcd5;
  --border-strong: #8b867f;
  --quiet-block-outline: #b4afa8;
  --routing-tag-outline: #8b867f;
  /* Text */
  --text: #24201a;
  --text-secondary: #3d3932;
  --text-muted: #534f48;
  --text-dim: #67635d;
  /* Accent */
  --accent: #c1591e;
  --accent-control: #ab4501;
  --accent-control-hover: #a43e13;
  --accent-text: #a34409;
  --accent-muted: #fadfcb;
  --accent-border: #d7966f;
  --on-accent: #ffffff;
  --toolbar-active: #fadfcb;
  --toolbar-active-text: #a34409;
  /* Canvas selection: the colour farthest from every wire colour */
  --selection: #392316;
  /* Channel triplets for rgb(var(--name-rgb) / alpha) */
  --canvas-rgb: 242 239 234;
  --panel-rgb: 255 253 249;
  --raised-rgb: 255 255 255;
  --border-rgb: 225 220 213;
  --muted-rgb: 83 79 72;
  --accent-rgb: 193 89 30;
}

/* Roles that follow the palette above. Related marks blocks and rows that share
   a value or virtual signal with the selection. It takes teal, the hue furthest
   from the signal and electrical wires, the selection and both accents, so a
   related block stands out from the blocks around it. */
:root {
  --related: var(--hue-teal);
  --related-text: var(--hue-teal);
}
