/* Design tokens of the interface (`DESIGN.md` describes the system). Every colour, size, radius, shadow
   and curve a component uses is named here; components.css and pages.css never write a raw hex value or
   pixel shadow. A neutral frame, and three colours with one job each: the primary (actions) is the
   installation's `[brand]`, which its brand sheet writes as `--cb-brand-*` and the roles below read; the
   secondary (data) and the tertiary (evidence) are values of this file. */

@font-face {
  font-family: 'Inter IOS';
  src: url("../vendor/fonts/inter-latin-opsz-normal.4b73e2ff3024.woff2") format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'Geist Mono IOS';
  src: url("../vendor/fonts/geist-mono-latin-wght-normal.a15f9d568fb0.woff2") format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* a hairline is half a point only where a point is two device pixels (Retina); on a 1x display
     a .5px border or spread is partly dropped by WebKit, so it is a full pixel there */
  --hairline: 1px;
  /* icon sizes by role: s inline in text and small controls, m in buttons, menus and fields, b the
     round icon button, l the back link, the palette and an outcome title, xl an empty state */
  --icon-s: 14px; --icon-m: 16px; --icon-b: 18px; --icon-l: 20px; --icon-xl: 28px;
  /* ---------------------------------------------------------------- type */
  --font: 'Inter IOS', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; /* password fields: the system face shows the dots well */
  --mono: 'Geist Mono IOS', ui-monospace, 'SF Mono', Menlo, monospace; /* SQL and codes only */
  --t-hero: 40px;      /* the question page title */
  --t-large: 34px;     /* the large title of every other page */
  --t-title: 18px;     /* section titles */
  --t-head: 16px;      /* headline: card and widget titles */
  --t-read: 19px;      /* the answer's reading */
  --t-body: 15px;
  --t-control: 14px;   /* buttons, menus, table cells */
  --t-sub: 13px;       /* subhead, labels, metadata */
  --t-foot: 12.5px;    /* footnotes, axis */
  --w-regular: 400; --w-medium: 500; --w-semibold: 600; --w-bold: 700;

  /* ---------------------------------------------------------------- radii by role */
  --r-xs: 7px;    /* kbd, segment, small chips */
  --r-sm: 10px;   /* fields, rows, chips, search */
  --r-md: 10px;   /* cards, menus, code, preview surfaces */
  --r-lg: 12px;   /* sheets, dialogs, lifted dashboard tiles */
  --r-xl: 14px;   /* the question field */
  --r-pill: 999px;/* the state pill, a dot, toasts */
  --radius: 10px;    /* a card */
  --radius-s: 8px;   /* a control inside a card */
  --figure: 32px;       /* a figure: semibold, tight tracking */
  --figure-lead: 44px;  /* the figure of the card that leads a screen */
  --loading-line: 3px;  /* the line at the top of the content while a page opens */

  /* ---------------------------------------------------------------- space: a 4-point grid */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;
  --sidebar-w: 252px;
  --page-x: 56px;
  --toolbar-h: 56px;
  --control-h: 34px;
  --field-h: 40px;

  /* ---------------------------------------------------------------- motion
     core.js overwrites these four with the sampled springs (linear()); these are the
     fallbacks for engines without linear(). Durations are the measured settle times. */
  --spring-smooth: cubic-bezier(.25, .8, .25, 1); --spring-smooth-d: 500ms;
  --spring-snappy: cubic-bezier(.3, 1.25, .4, 1); --spring-snappy-d: 420ms;
  --spring-bouncy: cubic-bezier(.3, 1.45, .4, 1); --spring-bouncy-d: 600ms;
  --spring-gentle: cubic-bezier(.22, .9, .2, 1); --spring-gentle-d: 700ms;
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --fade: 200ms;  /* colour and opacity changes that answer hover */
}

/* ---------------------------------------------------------------- light */
:root, :root[data-theme='light'] {
  color-scheme: light;
  --bg: #ffffff;              /* the sheet */
  --bg-side: #f7f7f8;         /* sidebar plane: the page's own, the canvas */
  --bg-group: #f4f4f5;        /* code, preview, quiet surfaces */
  --bg-elev: #ffffff;         /* menus, dialogs, field */
  --material: rgba(255, 255, 255, .86);
  --material-side: rgba(247, 247, 248, .8);
  --label: #17181c;
  --label-2: #5f6168;         /* 6.2:1 on --bg, 5.9:1 on the canvas */
  --label-3: #8a8c93;         /* icons and disabled text only: under 4.5:1 */
  --placeholder: #6e7077;
  --fill: rgba(116, 118, 128, .12);
  --fill-soft: rgba(116, 118, 128, .075);
  --fill-press: rgba(116, 118, 128, .2);
  --fill-strong: rgba(116, 118, 128, .28);
  --sep: #e4e4e7;
  --sep-strong: #d4d4d8;
  --scrim: rgba(20, 21, 26, .18);
  --positive: #157a3f;
  --negative: #c62323;
  --caution: #876500;
  --mark-muted: #d5d7dc;

  /* the frame: grey with no hue, so any colour an installation chooses sits on it without clashing.
     The menu is the page's own plane (the canvas), parted by a hairline; a card is white on it. */
  --canvas: #f7f7f8;
  --card: #ffffff;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --track: #f1f1f3;           /* a quiet ground: a pill, a bar's track, a hover */
  --side-hover: #ececee;
  /* states are always a dot and a word, never the colour alone. They are literals, computed from no
     value of an installation, so a red brand cannot make every button read as an error. The amber
     leans to gold, away from an orange tertiary. */
  --ok: #1a9a50;
  --warn: #c99700;
  --bad: #dc2626;
  --ok-soft: #e7f6ed;
  --warn-soft: #fbf3d5;
  --bad-soft: #fde8e8;
  /* the series after the first (the first is the secondary): hues no state uses, the same for every
     installation, in the order a chart takes them */
  --series-2: #c2557f;
  --series-3: #a9783f;
  --series-4: #45506e;
  --series-5: #3a9e98;
  --series-6: #8c79c2;
  --series-7: #7e8b3a;
  --series-8: #8a8f98;
  --compare: #a1a3aa;         /* a comparison period: the quiet line beside the data */
  --tint: 12%;
  /* the guards of an installation's colour, as OKLCH lightness: a mark (a line, a bar, a rule) is held
     between --mark-lo and --mark-hi, a text between --ink-lo and --ink-hi, whatever the colour
     chosen; the dark theme moves the bands up */
  --mark-lo: 0;
  --mark-hi: .6;
  --ink-lo: 0;
  --ink-hi: .48;
  --soft-share: 7%;
  --mark-muted-line: #b3b5bc;
  --shadow-field: 0 0 0 1px var(--line), 0 1px 2px rgba(23, 24, 28, .04), 0 8px 24px -12px rgba(23, 24, 28, .12);
  --shadow-pop: 0 0 0 1px var(--line-strong), 0 2px 6px rgba(23, 24, 28, .05), 0 16px 40px -10px rgba(23, 24, 28, .16);
  --shadow-lift: 0 0 0 var(--hairline) rgba(0, 0, 0, .06), 0 2px 6px rgba(0, 0, 0, .04), 0 18px 40px -12px rgba(0, 0, 0, .14);
  --shadow-drag: 0 0 0 var(--hairline) rgba(0, 0, 0, .08), 0 30px 60px -12px rgba(0, 0, 0, .25);
  --shadow-thumb: 0 0 0 var(--hairline) rgba(0, 0, 0, .06), 0 2px 5px rgba(0, 0, 0, .1);
  --thumb: #ffffff;
  --white: #ffffff;
  --black: #000000;
  --shadow-knob: 0 1px 3px rgba(0, 0, 0, .2), 0 0 0 var(--hairline) rgba(0, 0, 0, .04);
}

/* ---------------------------------------------------------------- dark */
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #111113;
  --bg-side: #111113;
  --bg-group: #1e1f22;
  --bg-elev: #18191b;
  --material: rgba(17, 17, 19, .84);
  --material-side: rgba(17, 17, 19, .8);
  --label: #ededef;
  --label-2: #a3a5ac;         /* 7.3:1 on --bg */
  --label-3: #75777e;
  --placeholder: #8c8e95;
  --fill: rgba(120, 122, 132, .24);
  --fill-soft: rgba(120, 122, 132, .14);
  --fill-press: rgba(120, 122, 132, .34);
  --fill-strong: rgba(120, 122, 132, .4);
  --sep: #2a2b2f;
  --sep-strong: #3a3b40;
  --scrim: rgba(0, 0, 0, .48);
  --positive: #52cf85;
  --negative: #ff6f64;
  --caution: #f0c445;
  --mark-muted: #43454a;
  --mark-muted-line: #5d5f66;
  --canvas: #111113;
  --card: #18191b;
  --line: #2a2b2f;
  --line-strong: #3a3b40;
  --track: #222326;
  --side-hover: #1e1f22;
  --ok: #45c988;
  --warn: #f0c445;
  --bad: #ff6f64;
  --ok-soft: rgba(69, 201, 136, .14);
  --warn-soft: rgba(240, 196, 69, .14);
  --bad-soft: rgba(255, 111, 100, .14);
  --series-2: #e07aa1;
  --series-3: #cf9c5e;
  --series-4: #8a96b8;
  --series-5: #5cc3bc;
  --series-6: #ae9ce6;
  --series-7: #a7b460;
  --series-8: #8e929a;
  --compare: #6c6e75;
  --tint: 16%;
  --mark-lo: .72;
  --mark-hi: 1;
  --ink-lo: .8;
  --ink-hi: 1;
  --soft-share: 10%;
  --shadow-field: 0 0 0 1px var(--line), 0 10px 30px -8px rgba(0, 0, 0, .55);
  --shadow-pop: 0 0 0 1px var(--line-strong), 0 16px 48px -6px rgba(0, 0, 0, .6);
  --shadow-lift: 0 0 0 var(--hairline) rgba(255, 255, 255, .09), 0 18px 40px -12px rgba(0, 0, 0, .6);
  --shadow-drag: 0 0 0 var(--hairline) rgba(255, 255, 255, .14), 0 30px 60px -12px rgba(0, 0, 0, .7);
  --shadow-thumb: none;
  --thumb: #5a5b61;
  --white: #ffffff;
  --black: #000000;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #111113;
    --bg-side: #111113;
    --bg-group: #1e1f22;
    --bg-elev: #18191b;
    --material: rgba(17, 17, 19, .84);
    --material-side: rgba(17, 17, 19, .8);
    --label: #ededef;
    --label-2: #a3a5ac;         /* 7.3:1 on --bg */
    --label-3: #75777e;
    --placeholder: #8c8e95;
    --fill: rgba(120, 122, 132, .24);
    --fill-soft: rgba(120, 122, 132, .14);
    --fill-press: rgba(120, 122, 132, .34);
    --fill-strong: rgba(120, 122, 132, .4);
    --sep: #2a2b2f;
    --sep-strong: #3a3b40;
    --scrim: rgba(0, 0, 0, .48);
    --positive: #52cf85;
    --negative: #ff6f64;
    --caution: #f0c445;
    --mark-muted: #43454a;
    --mark-muted-line: #5d5f66;
    --canvas: #111113;
    --card: #18191b;
    --line: #2a2b2f;
    --line-strong: #3a3b40;
    --track: #222326;
    --side-hover: #1e1f22;
    --ok: #45c988;
    --warn: #f0c445;
    --bad: #ff6f64;
    --ok-soft: rgba(69, 201, 136, .14);
    --warn-soft: rgba(240, 196, 69, .14);
    --bad-soft: rgba(255, 111, 100, .14);
    --series-2: #e07aa1;
    --series-3: #cf9c5e;
    --series-4: #8a96b8;
    --series-5: #5cc3bc;
    --series-6: #ae9ce6;
    --series-7: #a7b460;
    --series-8: #8e929a;
    --compare: #6c6e75;
    --tint: 16%;
    --mark-lo: .72;
    --mark-hi: 1;
    --ink-lo: .8;
    --ink-hi: 1;
    --soft-share: 10%;
    --shadow-field: 0 0 0 1px var(--line), 0 10px 30px -8px rgba(0, 0, 0, .55);
    --shadow-pop: 0 0 0 1px var(--line-strong), 0 16px 48px -6px rgba(0, 0, 0, .6);
    --shadow-lift: 0 0 0 var(--hairline) rgba(255, 255, 255, .09), 0 18px 40px -12px rgba(0, 0, 0, .6);
    --shadow-drag: 0 0 0 var(--hairline) rgba(255, 255, 255, .14), 0 30px 60px -12px rgba(0, 0, 0, .7);
    --shadow-thumb: none;
    --thumb: #5a5b61;
  
    --white: #ffffff;
    --black: #000000;
  }
}

/* ---------------------------------------------------------------- the three roles, derived
   An installation chooses three colours and each has one job; a colour never does two (`DESIGN.md`).

     PRIMARY    actions: primary buttons, the current menu entry, links, the brand mark, focus.
     SECONDARY  data: the first series of a chart, the trend of a card, the bar behind a figure.
     TERTIARY   evidence: the one card that leads a screen, and what is new without being an error.

   The primary is the installation's `[brand.colors] brand`: `installation/colors.py` derives the sixteen
   `--cb-brand-*` tokens from it, contrast guaranteed in both themes, and the brand sheet (`/brand/sheet/`)
   writes them. The roles read those with `var()`, and the formulas after each comma are only the fallback of a
   page with no brand sheet, built the way `colors.py` builds them. This file declares no `--cb-*` token: one
   declared here would sit under the brand sheet at the same specificity and mask the colour the installation
   configures. The three values below are defaults; only the primary has a place in `[brand]` today. */
:root {
  --primary: #1e2a55;
  --secondary: #1e6b87;
  --tertiary: #e8711a;
}
/* Every token of this block is a formula of the three values and of the theme's guards above: the same text
   for both themes, and what changes is the parameters. A computed colour goes through `color-mix(… 100%,
   transparent)` so every reader of it, a contrast check included, sees plain sRGB. */
:root {
  /* PRIMARY, actions */
  --primary-fill: var(--cb-brand-action, color-mix(in srgb, oklch(from var(--primary) clamp(var(--mark-lo), l, var(--mark-hi)) c h) 100%, transparent));
  --primary-hover: var(--cb-brand-action-hover, color-mix(in srgb, var(--primary-fill) 88%, var(--label)));
  --primary-on: var(--cb-brand-on, var(--card));
  --primary-tint: var(--cb-brand-tint, color-mix(in srgb, var(--primary-fill) 10%, var(--card)));
  --primary-ink: var(--cb-brand-ink, color-mix(in srgb, oklch(from var(--primary) clamp(var(--ink-lo), l, var(--ink-hi)) min(c, .14) h) 100%, transparent));
  --primary-focus: var(--cb-focus, var(--primary-fill));
  --primary-selection: var(--cb-selection-text-bg, color-mix(in srgb, var(--primary-fill) 24%, transparent));
  /* the names the components were written with: the accent is the primary */
  --accent: var(--primary-ink);
  --accent-fill: var(--primary-fill);
  --on-accent: var(--primary-on);
  --on-accent-2: color-mix(in srgb, var(--on-accent) 85%, transparent);
  --accent-soft: var(--primary-tint);
  --focus: var(--primary-focus);
  --accent-soft-2: color-mix(in srgb, var(--accent) 30%, var(--bg));   /* ranked bars after the first */
  --accent-2: color-mix(in srgb, var(--accent) 58%, var(--bg));        /* the third series of a chart, a share's third part */

  /* SECONDARY, data: a mark held where it reads as a line or a bar on the card (3:1 or near) */
  --data: color-mix(in srgb, oklch(from var(--secondary) clamp(var(--mark-lo), l, var(--mark-hi)) c h) 100%, transparent);
  --data-soft: color-mix(in srgb, var(--data) 35%, var(--card));
  --data-ink: color-mix(in srgb, oklch(from var(--secondary) clamp(var(--ink-lo), l, var(--ink-hi)) min(c, .14) h) 100%, transparent);
  --series-1: var(--data);
  --series-1-soft: var(--data-soft);

  /* TERTIARY, evidence: a soft tint behind ink words, a rule, a dot; text only in its ink variant */
  --evidence: color-mix(in srgb, oklch(from var(--tertiary) clamp(var(--mark-lo), l, calc(var(--mark-hi) + .08)) c h) 100%, transparent);
  --evidence-tint: color-mix(in srgb, var(--tertiary) var(--soft-share), var(--card));
  --evidence-line: color-mix(in srgb, var(--evidence) 32%, var(--line));
  --evidence-ink: color-mix(in srgb, oklch(from var(--tertiary) clamp(var(--ink-lo), l, var(--ink-hi)) min(c, .13) h) 100%, transparent);
  /* the card that leads a screen: the tint, its line, and a rule along the top */
  --lead-bg: var(--evidence-tint);
  --lead-shadow: 0 0 0 1px var(--evidence-line), inset 0 3px 0 var(--evidence);

  /* a card is flat: its ground and one hairline, no soft shadow. Only what floats has one
     (`--shadow-field`, `--shadow-pop`). */
  --card-shadow: 0 0 0 1px var(--line);
  accent-color: var(--accent-fill);
  caret-color: var(--label);
}
/* the browser's own surfaces carry the roles too */
::selection { background: var(--primary-selection); color: var(--label); }

@media (min-resolution: 2dppx) {
  :root { --hairline: .5px; }
}
