/* co:nous design tokens: colour, type, radii, spacing and shadow, light and dark.

   One source for the app, the website and the dossier page (ui-kit/README.md).
   Edit here, then run ci/ui-kit.sh to update the copies.

   The colours come from the logo and the icon in assets/. The brand scale runs
   through the icon's three blues (#005cb2 is 600, #004f99 is 700, #004280 is
   800) at the same hue, and the greys lean slightly to that blue, so a panel
   reads as co:nous and not as a stock grey. Every text colour here meets WCAG
   contrast against the backgrounds it sits on: 4.5:1 for text, 3:1 for the
   focus ring, in both schemes.

   The ring in the mark is round, so corners are generous: 8px on controls,
   12px on cards, 16px on dialogs.

   Which scheme applies:
   - the reader's system setting, by default (the app and the dossier page);
   - a `dark` class on <html> forces dark (the website's own switch);
   - a `light` class, or an inline `color-scheme: light`, forces light. The
     website sets the inline style when someone picks light, so the system
     setting does not win over their choice.
   The dark values are written twice, once per way of asking for them. Change
   both blocks together. Paper is always light. */

:root {
  color-scheme: light dark;

  /* brand scale */
  --cn-brand-50: #f1f7ff;
  --cn-brand-100: #e0eeff;
  --cn-brand-200: #c2ddff;
  --cn-brand-300: #99c4fa;
  --cn-brand-400: #65a1ea;
  --cn-brand-500: #2773c8;
  --cn-brand-600: #005cb2;
  --cn-brand-700: #004f99;
  --cn-brand-800: #004280;
  --cn-brand-900: #082e57;

  /* greys, tinted towards the brand blue */
  --cn-gray-50: #f5f8fb;
  --cn-gray-100: #ecf1f5;
  --cn-gray-200: #dbe2e9;
  --cn-gray-300: #c6cfd8;
  --cn-gray-400: #9ba6b1;
  --cn-gray-500: #697481;
  --cn-gray-600: #56626f;
  --cn-gray-700: #3a4654;
  --cn-gray-800: #222f3c;
  --cn-gray-900: #121e2b;
  --cn-gray-950: #0a1520;

  /* type: the system's own faces, so nothing is downloaded and the app works
     offline. Headings take the rounded system face where there is one (Apple
     platforms), which echoes the ring; elsewhere they fall back to the text
     face. */
  --cn-font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --cn-font-heading: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --cn-font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;

  /* radii */
  --cn-radius-sm: 6px;
  --cn-radius: 8px;
  --cn-radius-lg: 12px;
  --cn-radius-xl: 16px;
  --cn-radius-pill: 999px;

  /* spacing, on a 4px step */
  --cn-space-1: 4px;
  --cn-space-2: 8px;
  --cn-space-3: 12px;
  --cn-space-4: 16px;
  --cn-space-5: 24px;
  --cn-space-6: 32px;

  /* the focus ring: a solid outline in --cn-focus, clear of the control */
  --cn-focus-width: 2px;
  --cn-focus-offset: 2px;

  /* light */
  --cn-bg: #ffffff;
  --cn-panel: #f5f8fb;
  --cn-fg: #121e2b;
  --cn-muted: #56626f;
  --cn-line: #dbe2e9;
  /* a field's edge, 3:1 or more against --cn-bg and --cn-panel (--cn-line is not) */
  --cn-field-border: #7d8995;
  --cn-accent: #005cb2;
  --cn-accent-hover: #004f99;
  --cn-accent-fg: #ffffff;
  --cn-accent-soft: #f1f7ff;
  --cn-focus: #005cb2;
  --cn-ok: #1d7339;
  --cn-ok-bg: #e6fae9;
  --cn-warn: #97570d;
  --cn-warn-bg: #fff2d6;
  --cn-danger: #b02a2d;
  --cn-danger-bg: #ffecec;
  --cn-shadow-sm: 0 1px 2px rgb(18 30 43 / .08);
  --cn-shadow: 0 4px 14px rgb(18 30 43 / .14);
  --cn-shadow-lg: 0 12px 36px rgb(18 30 43 / .22);
  --cn-scrim: rgb(10 21 32 / .40);
}

@media screen and (prefers-color-scheme: dark) {
  :root:not(.light):not([style*="color-scheme: light"]) {
    --cn-bg: #0a1520;
    --cn-panel: #121e2b;
    --cn-fg: #ecf1f5;
    --cn-muted: #9ba6b1;
    --cn-line: #2b3846;
    --cn-field-border: #697481;
    --cn-accent: #99c4fa;
    --cn-accent-hover: #c2ddff;
    --cn-accent-fg: #082e57;
    --cn-accent-soft: #122a46;
    --cn-focus: #99c4fa;
    --cn-ok: #76cf8a;
    --cn-ok-bg: #152d1a;
    --cn-warn: #eeb563;
    --cn-warn-bg: #37250e;
    --cn-danger: #f47a79;
    --cn-danger-bg: #3b1c1c;
    --cn-shadow-sm: 0 1px 2px rgb(0 0 0 / .40);
    --cn-shadow: 0 4px 14px rgb(0 0 0 / .45);
    --cn-shadow-lg: 0 12px 36px rgb(0 0 0 / .55);
    --cn-scrim: rgb(0 0 0 / .60);
  }
}

:root.dark {
  --cn-bg: #0a1520;
  --cn-panel: #121e2b;
  --cn-fg: #ecf1f5;
  --cn-muted: #9ba6b1;
  --cn-line: #2b3846;
  --cn-field-border: #697481;
  --cn-accent: #99c4fa;
  --cn-accent-hover: #c2ddff;
  --cn-accent-fg: #082e57;
  --cn-accent-soft: #122a46;
  --cn-focus: #99c4fa;
  --cn-ok: #76cf8a;
  --cn-ok-bg: #152d1a;
  --cn-warn: #eeb563;
  --cn-warn-bg: #37250e;
  --cn-danger: #f47a79;
  --cn-danger-bg: #3b1c1c;
  --cn-shadow-sm: 0 1px 2px rgb(0 0 0 / .40);
  --cn-shadow: 0 4px 14px rgb(0 0 0 / .45);
  --cn-shadow-lg: 0 12px 36px rgb(0 0 0 / .55);
  --cn-scrim: rgb(0 0 0 / .60);
}

@media print {
  :root { color-scheme: light; }
}
