/* The design system's values. Everything else in the console's CSS refers
   to these roles, never to raw colours or sizes, so light and dark swap here
   and nowhere else.

   The look follows Apple's interface language: the system font (San
   Francisco and PingFang on Apple devices), grouped content on a quiet
   page, translucent materials for what floats (the sidebar, menus, bars),
   capsule controls, continuous large radii, and Apple's system colours,
   stepped where needed so text keeps 4.5:1 and the edges of controls 3:1.

   Dark is declared twice: once for the system setting and once for the
   theme chosen in the console, which wins in both directions (the
   :not([data-theme="light"]) guard lets a chosen light theme beat a dark
   system; :where() keeps the media block weaker than the chosen one). */
:root {
  /* Spacing: a 4px scale. */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;
  --sp-9: 56px;

  /* Type: the system's own faces. */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", system-ui, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", "Noto Sans CJK SC", "Noto Sans SC", "Helvetica Neue", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro", system-ui, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", "Noto Sans CJK SC", "Noto Sans SC", "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, "JetBrains Mono", Consolas, "Liberation Mono", monospace;
  --fs-2xs: 11px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 17px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 30px;
  --fs-hero: 34px;
  --lh-tight: 1.22;
  --lh-normal: 1.5;

  /* Radii: continuous and concentric, an inner radius is the outer one less
     the padding between them. */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-2xl: 24px;
  --r-full: 999px;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --t-fast: 150ms;
  --t-med: 260ms;

  --sidebar-width: 268px;
  --content-width: 1320px;

  /* Light. */
  color-scheme: light;
  --page: #f5f5f7;
  --surface: #ffffff;
  --raised: #ffffff;
  --sunken: #f5f5f7;
  --material: rgba(255, 255, 255, 0.72);
  --material-strong: rgba(250, 250, 252, 0.86);
  --material-edge: rgba(0, 0, 0, 0.07);
  --card-edge: rgba(0, 0, 0, 0.05);
  --overlay: rgba(0, 0, 0, 0.22);
  --ink-1: #1d1d1f;
  --ink-2: #424245;
  --ink-3: #636366;
  --ink-on-accent: #ffffff;
  --line: rgba(60, 60, 67, 0.12);
  --line-strong: rgba(60, 60, 67, 0.2);
  --control-border: #86868b;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-hover: rgba(120, 120, 128, 0.18);
  --fill-press: rgba(120, 120, 128, 0.26);
  --hover: rgba(120, 120, 128, 0.08);
  --press: rgba(120, 120, 128, 0.14);
  --thumb: #ffffff;
  --switch-off: #8e8e93;
  --grid: #ececee;
  --axis: #c7c7cc;

  --accent: #0071e3;
  --accent-hover: #0068d1;
  --accent-ink: #0062c4;
  /* Filled buttons take a step deep enough for white words on them. */
  --accent-fill: #0071e3;
  --accent-fill-hover: #0062c4;
  --accent-wash: rgba(0, 113, 227, 0.1);
  --accent-wash-strong: rgba(0, 113, 227, 0.16);
  --focus-ring: 0 0 0 4px rgba(0, 113, 227, 0.28);

  /* Chart marks. series-1 is the single-series blue; slots 1-6 are the
     categorical order (validated: adjacent CVD ΔE ≥ 15, normal ΔE ≥ 20 in
     both modes), slot 7 the grey of "the rest". The four token kinds are
     their own fixed order (adjacent CVD ΔE ≥ 13). Red and green stay with
     status and are never a series. */
  --series-1: #007aff;
  --series-muted: #c7c7cc;
  --series-other: #aeaeb2;
  --slot-1: #007aff;
  --slot-2: #ff9500;
  --slot-3: #30b0c7;
  --slot-4: #5856d6;
  --slot-5: #ff2d55;
  --slot-6: #af52de;
  --kind-input: #007aff;
  --kind-cache-read: #00c7be;
  --kind-cache-write: #af52de;
  --kind-output: #ff9500;

  /* Status: a colour for the symbol, an ink for words, a wash behind them. */
  --good: #34c759;
  --good-ink: #1a7431;
  --good-wash: rgba(52, 199, 89, 0.14);
  --warn: #ff9500;
  --warn-ink: #a34a00;
  --warn-wash: rgba(255, 149, 0, 0.14);
  --bad: #ff3b30;
  --bad-ink: #c4000f;
  --bad-fill: #d70015;
  --bad-fill-hover: #c4000f;
  --bad-wash: rgba(255, 59, 48, 0.1);
  --off: #8e8e93;
  --off-wash: rgba(120, 120, 128, 0.12);

  /* Icon tiles in the sidebar, as in System Settings. */
  --tone-blue: #007aff;
  --tone-indigo: #5856d6;
  --tone-orange: #ff9500;
  --tone-teal: #30b0c7;
  --tone-green: #34c759;
  --tone-pink: #ff2d55;
  --tone-purple: #af52de;
  --tone-gray: #8e8e93;
  --tone-brown: #a2845e;

  --shadow-1: 0 1px 1px rgba(0, 0, 0, 0.02), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 1px 1px rgba(0, 0, 0, 0.02), 0 2px 10px rgba(0, 0, 0, 0.035);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.06), 0 12px 32px -6px rgba(0, 0, 0, 0.14);
  --shadow-3: 0 4px 12px rgba(0, 0, 0, 0.08), 0 28px 80px -12px rgba(0, 0, 0, 0.32);
  --shadow-thumb: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04);
  --highlight: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  --brand-a: #2d9bff;
  --brand-b: #0058d6;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #000000;
    --surface: #1c1c1e;
    --raised: #2c2c2e;
    --sunken: rgba(255, 255, 255, 0.05);
    --material: rgba(30, 30, 32, 0.72);
    --material-strong: rgba(44, 44, 46, 0.86);
    --material-edge: rgba(255, 255, 255, 0.09);
    --card-edge: rgba(255, 255, 255, 0.06);
    --overlay: rgba(0, 0, 0, 0.56);
    --ink-1: #f5f5f7;
    --ink-2: #d1d1d6;
    --ink-3: #aeaeb2;
    --line: rgba(84, 84, 88, 0.5);
    --line-strong: rgba(120, 120, 128, 0.6);
    --control-border: #7c7c80;
    --fill: rgba(118, 118, 128, 0.24);
    --fill-hover: rgba(118, 118, 128, 0.32);
    --fill-press: rgba(118, 118, 128, 0.4);
    --hover: rgba(255, 255, 255, 0.06);
    --press: rgba(255, 255, 255, 0.1);
    --thumb: #636366;
    --switch-off: #7c7c80;
    --grid: #2c2c2e;
    --axis: #48484a;
    --accent: #0a84ff;
    --accent-hover: #2b95ff;
    --accent-ink: #6cb6ff;
    --accent-fill: #0071e3;
    --accent-fill-hover: #0062c4;
    --accent-wash: rgba(10, 132, 255, 0.18);
    --accent-wash-strong: rgba(10, 132, 255, 0.26);
    --focus-ring: 0 0 0 4px rgba(10, 132, 255, 0.42);
    --series-1: #0a84ff;
    --series-muted: #48484a;
    --series-other: #636366;
    --slot-1: #0a84ff;
    --slot-2: #cf8002;
    --slot-3: #02a7be;
    --slot-4: #696af5;
    --slot-5: #ff375f;
    --slot-6: #bf5af2;
    --kind-input: #0a84ff;
    --kind-cache-read: #0daaa7;
    --kind-cache-write: #bf5af2;
    --kind-output: #cf8002;
    --good: #30d158;
    --good-ink: #30d158;
    --good-wash: rgba(48, 209, 88, 0.18);
    --warn: #ff9f0a;
    --warn-ink: #ff9f0a;
    --warn-wash: rgba(255, 159, 10, 0.18);
    --bad: #ff453a;
    --bad-ink: #ff8a82;
    --bad-fill: #d70015;
    --bad-fill-hover: #c4000f;
    --bad-wash: rgba(255, 69, 58, 0.18);
    --off: #8e8e93;
    --off-wash: rgba(118, 118, 128, 0.24);
    --tone-blue: #0a84ff;
    --tone-indigo: #5e5ce6;
    --tone-orange: #ff9f0a;
    --tone-teal: #40c8e0;
    --tone-green: #30d158;
    --tone-pink: #ff375f;
    --tone-purple: #bf5af2;
    --tone-gray: #8e8e93;
    --tone-brown: #ac8e68;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 2px 8px rgba(0, 0, 0, 0.45), 0 16px 40px -8px rgba(0, 0, 0, 0.7);
    --shadow-3: 0 4px 16px rgba(0, 0, 0, 0.5), 0 32px 90px -12px rgba(0, 0, 0, 0.85);
    --shadow-thumb: 0 3px 8px rgba(0, 0, 0, 0.3), 0 3px 1px rgba(0, 0, 0, 0.1);
    --highlight: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #000000;
  --surface: #1c1c1e;
  --raised: #2c2c2e;
  --sunken: rgba(255, 255, 255, 0.05);
  --material: rgba(30, 30, 32, 0.72);
  --material-strong: rgba(44, 44, 46, 0.86);
  --material-edge: rgba(255, 255, 255, 0.09);
  --card-edge: rgba(255, 255, 255, 0.06);
  --overlay: rgba(0, 0, 0, 0.56);
  --ink-1: #f5f5f7;
  --ink-2: #d1d1d6;
  --ink-3: #aeaeb2;
  --line: rgba(84, 84, 88, 0.5);
  --line-strong: rgba(120, 120, 128, 0.6);
  --control-border: #7c7c80;
  --fill: rgba(118, 118, 128, 0.24);
  --fill-hover: rgba(118, 118, 128, 0.32);
  --fill-press: rgba(118, 118, 128, 0.4);
  --hover: rgba(255, 255, 255, 0.06);
  --press: rgba(255, 255, 255, 0.1);
  --thumb: #636366;
  --switch-off: #7c7c80;
  --grid: #2c2c2e;
  --axis: #48484a;
  --accent: #0a84ff;
  --accent-hover: #2b95ff;
  --accent-ink: #6cb6ff;
  --accent-fill: #0071e3;
  --accent-fill-hover: #0062c4;
  --accent-wash: rgba(10, 132, 255, 0.18);
  --accent-wash-strong: rgba(10, 132, 255, 0.26);
  --focus-ring: 0 0 0 4px rgba(10, 132, 255, 0.42);
  --series-1: #0a84ff;
  --series-muted: #48484a;
  --series-other: #636366;
  --slot-1: #0a84ff;
  --slot-2: #cf8002;
  --slot-3: #02a7be;
  --slot-4: #696af5;
  --slot-5: #ff375f;
  --slot-6: #bf5af2;
  --kind-input: #0a84ff;
  --kind-cache-read: #0daaa7;
  --kind-cache-write: #bf5af2;
  --kind-output: #cf8002;
  --good: #30d158;
  --good-ink: #30d158;
  --good-wash: rgba(48, 209, 88, 0.18);
  --warn: #ff9f0a;
  --warn-ink: #ff9f0a;
  --warn-wash: rgba(255, 159, 10, 0.18);
  --bad: #ff453a;
  --bad-ink: #ff8a82;
  --bad-fill: #d70015;
  --bad-fill-hover: #c4000f;
  --bad-wash: rgba(255, 69, 58, 0.18);
  --off: #8e8e93;
  --off-wash: rgba(118, 118, 128, 0.24);
  --tone-blue: #0a84ff;
  --tone-indigo: #5e5ce6;
  --tone-orange: #ff9f0a;
  --tone-teal: #40c8e0;
  --tone-green: #30d158;
  --tone-pink: #ff375f;
  --tone-purple: #bf5af2;
  --tone-gray: #8e8e93;
  --tone-brown: #ac8e68;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, 0.45), 0 16px 40px -8px rgba(0, 0, 0, 0.7);
  --shadow-3: 0 4px 16px rgba(0, 0, 0, 0.5), 0 32px 90px -12px rgba(0, 0, 0, 0.85);
  --shadow-thumb: 0 3px 8px rgba(0, 0, 0, 0.3), 0 3px 1px rgba(0, 0, 0, 0.1);
  --highlight: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
