/* Disclosure Gate design tokens v4.
   One system for every surface: the operator console, the Hub, the room display, the exports.
   Neutral, quiet surfaces; colour is reserved for meaning. Near-black is the primary action, blue is
   focus and selection, and four status hues carry state: red is recording and danger, amber is
   checking and waiting, green is shared and done, violet marks a decision.
   Themes: light is the default. data-theme="dark" forces dark; data-theme="auto" follows the system.
   Every semantic token is a light-dark() pair, so a subtree can flip with color-scheme alone.
   Custody: data-custody="private" marks what stays on the laptop (a sunk surface and the lock mark);
   data-custody="shared" marks what the team sees (a raised surface). The label always says which.
   Contrast figures are WCAG 2.x ratios from voice/web/design/contrast.mjs, which reads this file
   (floors: 4.5 text, 3 control borders and focus; tests/contrast.test.mjs holds them). The export
   renderer inlines only the tokens section. */

/* @section fonts */
/* Geist and Geist Mono, self-hosted under design/fonts/ with their OFL licences
   (docs/THIRD-PARTY-NOTICES.md). Both carry wght 100 to 900. */
@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-VF.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-Italic-VF.ttf") format("truetype");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("fonts/GeistMono-VF.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
/* @endsection */

/* @section tokens */
:root {
  color-scheme: light;

  /* Raw palette, light values. Emails cannot read custom properties, so voice/render/email.mjs
     repeats these by hand and a test holds the two in step. */
  --paper: #f7f7f8;            /* page canvas; ink 16.55 */
  --surface: #ffffff;          /* cards, sheets, inputs; ink 17.72, muted 7.73, subtle 5.35 */
  --paper-deep: #f1f1f3;       /* wells and private surfaces; muted 6.85, subtle 4.75 */
  --ink: #18181b;              /* text and the primary fill; white on it 17.72 */
  --muted: #52525b;            /* secondary text; 7.73 surface, 7.22 paper */
  --subtle: #6a6a73;           /* tertiary text; 5.35 surface, 5.00 paper, 4.75 deep */
  --line: #e4e4e7;             /* hairlines and dividers, never a control border */
  --control: #8b8b95;          /* control borders; 3.37 surface, 3.15 paper */
  --blue: #2563eb;             /* focus, selection, links; 5.17 surface, white on it 5.17 */
  --blue-deep: #1d4ed8;        /* blue as text on its tint; 6.16 */
  --blue-tint: #eff6ff;
  --red: #dc2626;              /* recording and danger fills; white on it 4.83 */
  --red-deep: #b91c1c;         /* red as text; 5.91 on its tint */
  --red-tint: #fef2f2;
  --ok: #15803d;               /* shared, done; 5.02 surface, 4.79 on its tint */
  --ok-tint: #f0fdf4;
  --advisory: #b45309;         /* checking, waiting, advisories; 5.02 surface, 4.84 on its tint */
  --advisory-tint: #fffbeb;
  --violet: #6d28d9;           /* decisions; 6.48 on its tint */
  --violet-tint: #f5f3ff;

  /* Surfaces */
  --bg: light-dark(#f7f7f8, #0a0a0c);
  --bg-surface: light-dark(#ffffff, #141417);
  --bg-raised: light-dark(#ffffff, #1b1b1f);
  --bg-sunk: light-dark(#f1f1f3, #0f0f12);
  --bg-hover: light-dark(#f4f4f5, #1f1f23);
  --bg-active: light-dark(#ececef, #26262b);
  --bg-inverse: light-dark(#18181b, #f4f4f5);
  --bg-scrim: light-dark(rgb(9 9 11 / 0.36), rgb(0 0 0 / 0.62));

  /* Text (dark: fg 16.73, muted 7.17, subtle 5.38 on the dark surface) */
  --fg: light-dark(#18181b, #f4f4f5);
  --fg-muted: light-dark(#52525b, #a1a1aa);
  --fg-subtle: light-dark(#6a6a73, #8a8a94);
  --fg-disabled: light-dark(#a1a1aa, #52525b);
  --fg-inverse: light-dark(#ffffff, #0a0a0c);

  /* Lines */
  --border: light-dark(#e4e4e7, #26262b);
  --border-strong: light-dark(#d4d4d8, #34343b);
  --border-control: light-dark(#8b8b95, #6b6b75);   /* dark: 3.49 surface, 3.75 canvas */
  --divider: var(--border);

  /* Primary fill: near-black in light, near-white in dark */
  --fill-strong: light-dark(#18181b, #f4f4f5);
  --fill-strong-hover: light-dark(#2e2e33, #ffffff);
  --on-fill-strong: light-dark(#ffffff, #0a0a0c);

  /* Accent: focus, selection, links, the current item */
  --accent: light-dark(#2563eb, #60a5fa);           /* dark: 7.23 on the surface */
  --accent-hover: light-dark(#1d4ed8, #93c5fd);
  --accent-fg: light-dark(#1d4ed8, #93c5fd);
  --accent-bg: light-dark(#eff6ff, rgb(96 165 250 / 0.14));
  --accent-border: light-dark(#bfdbfe, rgb(96 165 250 / 0.32));
  --on-accent: light-dark(#ffffff, #0a0a0c);
  --focus-ring: light-dark(#2563eb, #60a5fa);
  --selection-bg: light-dark(#dbeafe, rgb(96 165 250 / 0.32));

  /* Status: live (recording), attention (danger, errors), advisory (checking, waiting), ok (shared,
     done), decision (violet), neutral. Each has text, tint, border and a solid mark. */
  --live-fg: light-dark(#b91c1c, #f87171);
  --live-bg: light-dark(#fef2f2, rgb(248 113 113 / 0.12));
  --live-border: light-dark(#fecaca, rgb(248 113 113 / 0.3));
  --live-mark: light-dark(#dc2626, #ef4444);
  --attention-fg: light-dark(#b91c1c, #f87171);      /* dark: 5.65 on its tint over a card */
  --attention-bg: light-dark(#fef2f2, rgb(248 113 113 / 0.12));
  --attention-border: light-dark(#fecaca, rgb(248 113 113 / 0.3));
  --attention-mark: light-dark(#dc2626, #ef4444);
  --advisory-fg: light-dark(#b45309, #fbbf24);       /* dark: 8.68 on its tint over a card */
  --advisory-bg: light-dark(#fffbeb, rgb(251 191 36 / 0.12));
  --advisory-border: light-dark(#fde68a, rgb(251 191 36 / 0.28));
  --advisory-mark: light-dark(#f59e0b, #fbbf24);
  --ok-fg: light-dark(#15803d, #4ade80);             /* dark: 8.40 on its tint over a card */
  --ok-bg: light-dark(#f0fdf4, rgb(74 222 128 / 0.12));
  --ok-border: light-dark(#bbf7d0, rgb(74 222 128 / 0.28));
  --ok-mark: light-dark(#16a34a, #22c55e);
  --decision-fg: light-dark(#6d28d9, #c4b5fd);
  --decision-bg: light-dark(#f5f3ff, rgb(167 139 250 / 0.14));
  --decision-border: light-dark(#ddd6fe, rgb(167 139 250 / 0.3));
  --decision-mark: light-dark(#7c3aed, #a78bfa);
  --neutral-fg: light-dark(#3f3f46, #d4d4d8);
  --neutral-bg: light-dark(#f4f4f5, rgb(255 255 255 / 0.06));
  --neutral-border: light-dark(#e4e4e7, rgb(255 255 255 / 0.1));
  --neutral-mark: light-dark(#a1a1aa, #71717a);

  /* Custody */
  --private-bg: light-dark(#f1f1f3, #0f0f12);
  --private-fg: light-dark(#3f3f46, #d4d4d8);
  --private-mark: light-dark(#18181b, #f4f4f5);
  --private-mark-fg: light-dark(#ffffff, #0a0a0c);
  --shared-bg: light-dark(#ffffff, #141417);

  /* Type: Geist for everything, Geist Mono for times, counts and fingerprints. The system stacks
     follow so exports (no font loading under their CSP) keep the same voice. */
  --font-ui: "Geist", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: var(--font-ui);
  --font-notes: var(--font-ui);
  --font-mono: "Geist Mono", "Cascadia Mono", "SF Mono", Consolas, ui-monospace, Menlo, monospace;
  --text-xs: 12px;    --leading-xs: 16px;    /* the floor: no text is smaller (avatar initials, which are decoration, excepted) */
  --text-sm: 13px;    --leading-sm: 18px;
  --text-base: 14px;  --leading-base: 20px;
  --text-md: 15px;    --leading-md: 24px;
  --text-lg: 16px;    --leading-lg: 24px;
  --text-xl: 18px;    --leading-xl: 26px;
  --text-2xl: 20px;   --leading-2xl: 28px;
  --text-3xl: 24px;   --leading-3xl: 32px;
  --text-4xl: 30px;   --leading-4xl: 36px;
  --text-5xl: 36px;   --leading-5xl: 40px;
  --text-display: clamp(40px, 3.4vw, 64px);
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --tracking-tight: -0.011em;
  --tracking-tighter: -0.022em;
  --tracking-display: -0.032em;
  --tracking-caps: 0.06em;
  --figures-data: tabular-nums;
  --measure-notes: 72ch;

  /* Space: a 4 px grid */
  --space-0-5: 2px;
  --space-1: 4px;  --space-1-5: 6px; --space-2: 8px;  --space-2-5: 10px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px;  --space-7: 28px; --space-8: 32px;    --space-10: 40px;
  --space-12: 48px; --space-16: 64px; --space-20: 80px;

  /* Shape */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 999px;

  /* Elevation. Dark mode adds a hairline top light instead of a heavier shadow. */
  --shadow-xs: 0 1px 2px light-dark(rgb(16 24 40 / 0.05), rgb(0 0 0 / 0.4));
  --shadow-sm: 0 1px 2px light-dark(rgb(16 24 40 / 0.04), rgb(0 0 0 / 0.4)), 0 1px 3px light-dark(rgb(16 24 40 / 0.07), rgb(0 0 0 / 0.3));
  --shadow-md: 0 2px 4px -2px light-dark(rgb(16 24 40 / 0.06), rgb(0 0 0 / 0.5)), 0 4px 10px -2px light-dark(rgb(16 24 40 / 0.08), rgb(0 0 0 / 0.4));
  --shadow-lg: 0 4px 8px -4px light-dark(rgb(16 24 40 / 0.06), rgb(0 0 0 / 0.5)), 0 16px 32px -8px light-dark(rgb(16 24 40 / 0.14), rgb(0 0 0 / 0.6));
  --shadow-xl: 0 8px 16px -8px light-dark(rgb(16 24 40 / 0.1), rgb(0 0 0 / 0.6)), 0 32px 64px -16px light-dark(rgb(16 24 40 / 0.28), rgb(0 0 0 / 0.72));
  --ring-highlight: inset 0 1px 0 light-dark(rgb(255 255 255 / 0), rgb(255 255 255 / 0.05));

  /* Focus: 2 px ring with a 2 px gap, never removed (2.4.7, 2.4.13) */
  --focus-width: 2px;
  --focus-offset: 2px;

  /* Targets: 24 px floor on the console (2.5.8), 32 px controls, 44 px on touch */
  --target-min: 24px;
  --target-control: 32px;
  --target-touch: 44px;

  /* Layout */
  --sidebar-w: 248px;
  --topbar-h: 56px;
  --content-max: 1200px;
  --sticky-offset: 0px;

  /* Motion: short and purposeful; nothing loops except the level meters and the live dot. */
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-spring: linear(0, 0.009, 0.035 2.1%, 0.141 4.4%, 0.723 12.9%, 0.938 16.7%, 1.017 19.4%, 1.067, 1.089 24.8%, 1.084 27.3%, 1.065 30.3%, 0.995 38.5%, 0.982 42.9%, 0.984 49.3%, 0.999 62%, 1.003 70.3%, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 320ms;
  --dur-tick: 180ms;      /* the update number turns */
  --dur-withdraw: 220ms;  /* a withdrawn item leaves and the rest close up */
  --dur-cross: 420ms;     /* an item crosses the gate into the notes */
  --dur-state: 200ms;     /* a state pill changes */
  --dur-flap: 0ms;        /* kept for flap.mjs callers; the split flap is retired */
  --dur-stamp: 240ms;     /* a status pill lands */

  /* Layers */
  --z-sticky: 10;
  --z-nav: 20;
  --z-drawer: 40;
  --z-dialog: 50;
  --z-toast: 60;
}

:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="auto"] { color-scheme: light dark; }
.theme-dark { color-scheme: dark; }
.theme-light { color-scheme: light; }

/* Custody surfaces. The label and the lock carry the meaning; the surface only reinforces it. */
[data-custody="private"] { --bg-panel: var(--private-bg); }
[data-custody="shared"] { --bg-panel: var(--shared-bg); }

/* Teams side panel and narrow embeds: denser type, flatter panels. */
[data-embed="side-panel"] {
  --measure-notes: none;
  --radius-lg: 10px;
  --shadow-sm: none;
  --shadow-md: none;
}

/* Reduced motion: every duration is zero, so the computed transition-duration reads 0s. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
    --dur-base: 0ms;
    --dur-slow: 0ms;
    --dur-tick: 0ms;
    --dur-withdraw: 0ms;
    --dur-cross: 0ms;
    --dur-state: 0ms;
    --dur-flap: 0ms;
    --dur-stamp: 0ms;
  }
}

/* Windows contrast themes: system colours take over; every state keeps its words and borders. */
@media (forced-colors: active) {
  :root {
    --focus-ring: Highlight;
    --border: GrayText;
    --border-strong: CanvasText;
    --border-control: CanvasText;
    --divider: GrayText;
    --live-mark: Highlight;
    --attention-mark: Highlight;
    --advisory-mark: Highlight;
    --ok-mark: Highlight;
    --decision-mark: Highlight;
    --private-mark: CanvasText;
    --private-mark-fg: Canvas;
  }
}
/* @endsection */
