/* envita bench console - design tokens (plan E2). Light on :root, the ONE dark block on
   :root[data-scheme="dark"] (boot.js / theme.js set data-scheme before the first paint, from the
   System / Light / Dark choice). Every colour the page, the charts (theme.js palette()) and the 3D
   scene (scene.js applyPalette) use comes from here; tests/test_web_contract.py pins the series
   palettes and checks the text and mark contrasts below.

   Brand (envita.ch, 2026-10-06): Fira Sans 400/500/700 + Fira Mono 500, warm white #F4F2F0, navy
   #1A3C66 (titles, primary buttons), navy-700 #213254 (sections), coral #E87555 (the wordmark's full
   stop, the product shell and the "bench is acting" signal - never text, never a button: 2.65:1 on
   warm white), terracotta #C1594C.

   Status colours are reserved for status (always with a shape and a word) and are never a series.

   Series palettes - dataviz validate_palette.js, 2026-10-06 (pinned; change them only together with
   the validator output and tests/test_web_contract.py):
     node scripts/validate_palette.js "#2563B0,#EB6834,#1BAF7A,#EDA100,#E87BA4,#008300,#4A3AA7,#E34948" --mode light --surface "#FFFFFF"
       [PASS] Lightness band       all 8 inside L 0.43-0.77
       [PASS] Chroma floor         all 8 >= 0.1
       [PASS] CVD separation       worst adjacent #EDA100/#1BAF7A dE 9.1 (protan), tritan 5.8
       [PASS] Normal-vision floor  worst adjacent #E87BA4/#EDA100 dE 19.6 (normal)
       [WARN] Contrast vs surface  below 3:1: #1BAF7A 2.82, #EDA100 2.17, #E87BA4 2.69
              -> relief required: the chart's table view and the legend's direct values (F-11)
     node scripts/validate_palette.js "#4A86D8,#D95926,#199E70,#C98500,#D55181,#008300,#9085E9,#E66767" --mode dark --surface "#0B2333"
       [PASS] Lightness band       all 8 inside L 0.48-0.67
       [PASS] Chroma floor         all 8 >= 0.1
       [PASS] CVD separation       worst adjacent #C98500/#199E70 dE 8.4 (protan), tritan 8.7
       [PASS] Normal-vision floor  worst adjacent #D55181/#C98500 dE 19.3 (normal)
       [PASS] Contrast vs surface  all 8 >= 3:1
   Every series is a solid line (owner 2026-10-07): --series-9..16 add eight more hues, then they repeat
   (chart/slots.js); the legend chips and the hover highlight tell repeated hues apart.

   Contrast exceptions (documented, checked as such by the contract test):
     --st-offline (both schemes) is the "absent" mark: drawn as a hollow ring next to the word, never
       a filled status on its own; --st-off in dark is 2.9:1 on --surface (3.2:1 on --bg) and always
       carries the hollow-circle glyph and its label. */

/* ---- fonts: Latin subsets (pyftsubset, ~25 KB each); everything outside the unicode-range (Chinese)
   falls through to the CJK system fonts in --font-sans ---- */
@font-face {
  font-family: "Fira Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("vendor/fonts/FiraSans-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fira Sans"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("vendor/fonts/FiraSans-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fira Sans"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("vendor/fonts/FiraSans-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fira Mono"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("vendor/fonts/FiraMono-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;

  /* surfaces */
  --bg: #F4F2F0;
  --surface: #FFFFFF;
  --surface-2: #F4F2F0;
  --surface-3: #E3DFDC;
  --surface-float: rgba(255, 255, 255, 0.94);
  --chart-surface: #FFFFFF;
  --scrim: rgba(11, 35, 51, 0.32);

  /* ink */
  --ink: #1A3C66;
  --ink-2: #47555D;
  --ink-3: #5E6A71;
  --line: #E3DFDC;
  --line-strong: #7A8790;
  --grid: #ECE9E6;
  --focus: #1A3C66;
  --reference: #5E6A71;
  --accent-ink: #B5462F;

  /* brand constants (the same in both schemes) */
  --navy: #1A3C66;
  --navy-700: #213254;
  --navy-900: #0B2333;
  --navy-950: #081C28;
  --coral: #E87555;
  --terracotta: #C1594C;
  --flame-fold: #943A31;
  --warm-white: #F4F2F0;

  /* buttons */
  --btn-primary: #1A3C66;
  --btn-primary-ink: #FFFFFF;
  --btn-primary-hover: #213254;
  --btn-danger: #B42318;
  --btn-danger-ink: #FFFFFF;

  /* status: reserved, always colour + shape + word */
  --st-pass: #2E8540;      --st-pass-soft: rgba(46, 133, 64, 0.12);
  --st-fail: #B42318;      --st-fail-soft: rgba(180, 35, 24, 0.10);
  --st-warn: #B7791F;      --st-warn-soft: rgba(183, 121, 31, 0.13);
  --st-warn-ink: #9A6700;
  --st-ota: #2F64C0;       --st-ota-soft: rgba(47, 100, 192, 0.11);
  --st-run: #B5462F;       --st-run-soft: rgba(181, 70, 47, 0.10);
  --st-neutral: #7A8790;   --st-neutral-soft: rgba(122, 135, 144, 0.13);
  --st-off: #8C8782;       --st-off-soft: rgba(140, 135, 130, 0.13);
  --st-offline: #B8B1AA;   --st-offline-soft: rgba(184, 177, 170, 0.18);

  /* chart series (pinned, see the header) */
  --series-1: #2563B0;
  --series-2: #EB6834;
  --series-3: #1BAF7A;
  --series-4: #EDA100;
  --series-5: #E87BA4;
  --series-6: #008300;
  --series-7: #4A3AA7;
  --series-8: #E34948;
  /* 9-16: solid lines only (owner 2026-10-07) - more hues instead of dash patterns; not part of the
     validated eight, so the legend chips and the hover highlight carry identification */
  --series-9: #0F7B8A;
  --series-10: #A0522D;
  --series-11: #6F8E00;
  --series-12: #B0328F;
  --series-13: #5A9BE6;
  --series-14: #8A6A00;
  --series-15: #2E3E9E;
  --series-16: #7C6F5B;
  --band: rgba(47, 100, 192, 0.08);

  /* 3D scene (scene.js applyPalette): warm hall, navy screens / gateways / cloud / cables, coral
     product shells and current glow */
  --scene-bg: #EFEBE7;
  --scene-floor: #F1EEEA;
  --scene-wall: #E6E1DC;
  --scene-ceiling: #F6F4F1;
  --scene-column: #FAF8F6;
  --scene-housing: #BDB6AF;
  --scene-cell-a: #F7F5F2;
  --scene-cell-b: #E2DDD7;
  --scene-screen: #1A3C66;
  --scene-lane: #E9D68A;
  --scene-tray: #DBD6D0;
  --scene-stringer: #CCC6BF;
  --scene-cabinet: #F6F4F1;
  --scene-cable: #213254;
  --scene-glow: #E87555;
  --scene-product: #E87555;
  --scene-gateway: #1A3C66;
  --scene-cloud: #DDE3EA;
  --scene-cloud-glow: #10161C;
  --scene-uplink: #1A3C66;
  --scene-reading: #8FB4E8;
  --scene-display: #1A3C66;
  --scene-key-light: #FFF6EE;
  --scene-env-room: #C9C3BD;
  --scene-hemi: 0.75;
  --scene-key: 1.9;
  --scene-env: 0.75;
  --scene-fog-near: 250;
  --scene-fog-far: 6200;
  --scene-strip: 1;
  --scene-blob: 0.5;

  /* type */
  --font-sans: "Fira Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --font-mono: "Fira Mono", ui-monospace, Consolas, monospace;
  --fs-1: 12px;  --lh-1: 16px;
  --fs-2: 13px;  --lh-2: 18px;
  --fs-3: 15px;  --lh-3: 22px;
  --fs-4: 18px;  --lh-4: 24px;
  --fs-5: 24px;  --lh-5: 30px;
  --fs-6: clamp(24px, 1.6vw + 16px, 44px);  --lh-6: 1.1;    /* the headline only */

  /* space, radius, depth, motion */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;
  --r-1: 3px;      /* tags, status pills */
  --r-2: 5px;      /* the brand radius: buttons, inputs, chips, icon buttons */
  --r-3: 8px;
  --r-4: 12px;     /* panels, drawer, sheets */
  --r-round: 50%;  /* dots only */
  --shadow-1: 0 1px 2px rgba(26, 60, 102, 0.08);
  --shadow-2: 0 4px 14px rgba(26, 60, 102, 0.10), 0 1px 3px rgba(26, 60, 102, 0.06);
  --shadow-3: 0 18px 48px rgba(26, 60, 102, 0.16), 0 2px 8px rgba(26, 60, 102, 0.06);
  --dur-1: 120ms; --dur-2: 200ms; --dur-3: 320ms; --dur-4: 600ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* layout */
  --top-h: 64px;
  --drawer-h: min(46vh, 460px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

:root[data-scheme="dark"] {
  color-scheme: dark;

  --bg: #081C28;
  --surface: #0B2333;
  --surface-2: #081C28;
  --surface-3: #163049;
  --surface-float: rgba(11, 35, 51, 0.94);
  --chart-surface: #0B2333;
  --scrim: rgba(4, 12, 18, 0.55);

  --ink: #F4F2F0;
  --ink-2: #AEBBC6;
  --ink-3: #8796A3;
  --line: #1C3A52;
  --line-strong: #5C7387;
  --grid: #15304A;
  --focus: #E87555;
  --reference: #AEBBC6;
  --accent-ink: #E87555;

  --btn-primary: #F4F2F0;
  --btn-primary-ink: #1A3C66;
  --btn-primary-hover: #FFFFFF;
  --btn-danger: #FF6B5E;
  --btn-danger-ink: #081C28;

  --st-pass: #4CC250;      --st-pass-soft: rgba(76, 194, 80, 0.15);
  --st-fail: #FF6B5E;      --st-fail-soft: rgba(255, 107, 94, 0.15);
  --st-warn: #F2B544;      --st-warn-soft: rgba(242, 181, 68, 0.15);
  --st-warn-ink: #F2B544;
  --st-ota: #7FA8F0;       --st-ota-soft: rgba(127, 168, 240, 0.15);
  --st-run: #E87555;       --st-run-soft: rgba(232, 117, 85, 0.16);
  --st-neutral: #6F7F8C;   --st-neutral-soft: rgba(111, 127, 140, 0.18);
  --st-off: #5B6B78;       --st-off-soft: rgba(91, 107, 120, 0.2);
  --st-offline: #3E5468;   --st-offline-soft: rgba(62, 84, 104, 0.3);

  --series-1: #4A86D8;
  --series-2: #D95926;
  --series-3: #199E70;
  --series-4: #C98500;
  --series-5: #D55181;
  --series-6: #008300;
  --series-7: #9085E9;
  --series-8: #E66767;
  --series-9: #2FB3C2;
  --series-10: #D0804F;
  --series-11: #A3C23A;
  --series-12: #D86BB8;
  --series-13: #8BBDF5;
  --series-14: #C9A23A;
  --series-15: #8C9BEA;
  --series-16: #B8AC93;
  --band: rgba(127, 168, 240, 0.12);

  --scene-bg: #081C28;
  --scene-floor: #0E2635;
  --scene-wall: #0B2131;
  --scene-ceiling: #071823;
  --scene-column: #1C3A52;
  --scene-housing: #132E42;
  --scene-cell-a: #163049;
  --scene-cell-b: #10283B;
  --scene-screen: #24508F;
  --scene-lane: #6B6340;
  --scene-tray: #4C6378;
  --scene-stringer: #3E5468;
  --scene-cabinet: #D9D4CF;
  --scene-cable: #3A5A7A;
  --scene-glow: #E87555;
  --scene-product: #E87555;
  --scene-gateway: #2E5288;
  --scene-cloud: #3A5470;
  --scene-cloud-glow: #16283A;
  --scene-uplink: #9DB8E6;
  --scene-reading: #7FA8F0;
  --scene-display: #0B2333;
  --scene-key-light: #FFF6EE;
  --scene-env-room: #05101A;
  --scene-hemi: 0.25;
  --scene-key: 2.3;
  --scene-env: 0.55;
  --scene-fog-near: 500;
  --scene-fog-far: 7000;
  --scene-strip: 2.2;
  --scene-blob: 0.7;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 4px 14px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-3: 0 18px 48px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* reduced motion (system, or ?still=1): every duration to zero */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-1: 0ms; --dur-2: 0ms; --dur-3: 0ms; --dur-4: 0ms; }
}
:root[data-still] { --dur-1: 0ms; --dur-2: 0ms; --dur-3: 0ms; --dur-4: 0ms; }
