/* BIMCheck design tokens. One source for colour, space, type, radius, elevation and motion.
   Dark is the default; [data-theme="light"] on <html> switches every surface token.
   Contrast (WCAG 2.1 AA) is checked in tests/design-tokens.test.mjs for every text/surface pair.
   Accent belongs to the one primary action only; selection and focus have their own hues. */
:root {
  color-scheme: dark;

  /* Surfaces: chrome (rail, bars) < panel < raised < active */
  --bg-0: #0c0e11;
  --bg-1: #13161a;
  --bg-2: #1a1e23;
  --bg-3: #22272e;
  --line: #242a31;
  --line-2: #323941;

  /* Text */
  --text-1: #e8ebef;
  --text-2: #b3bbc5;
  --text-3: #8e97a2;
  --text-inverse: #0c0e11;

  /* The one primary action */
  --accent: #4f8cff;
  --accent-strong: #2c6be0;
  --accent-hover: #2360d2;
  --on-accent: #ffffff;
  --brand-a: #0f9d94;
  --brand-b: #3b82f6;
  --shadow-tabs: 0 18px 50px -42px #000000a0;

  /* Selection, focus */
  --sel-bg: #1c2836;
  --sel-line: #8fb0d8;
  --focus: #d7e3f6;

  /* Severity and state (text-safe on --bg-1) */
  --sev-blocking: #f26b6f;
  --sev-review: #e3a83f;
  --sev-info: #93a3b8;
  --ok: #45b98f;
  --sev-blocking-bg: #3a1c1f;
  --sev-review-bg: #372a14;
  --sev-info-bg: #232a33;

  /* 3D stage: stays a dark neutral light-box in both themes so model colours read the same */
  --stage-bg: #161b22;
  --stage-grid: #232a33;
  --stage-chrome: #14181dee;
  --stage-chrome-line: #2d343d;
  --stage-text: #e3e7ec;
  --stage-text-2: #a6afba;
  --stage-hover: #252c35;
  --stage-on: #34404e;
  --card-line: #242a31;

  /* Categorical data-viz palette (families of elements, Données › Flux IFC). Fixed order,
     validated for colour-vision deficiency (adjacent ΔE ≥ 8, OKLab ×100; structure /
     architecture / networks all-pairs) and ≥ 3:1 on the panel surface; never a severity hue.
     Severity colours stay for the quality view only. */
  --viz-structure: #3987e5;
  --viz-architecture: #d95926;
  --viz-mep: #199e70;
  --viz-furniture: #9085e9;
  --viz-site: #c98500;
  --viz-proxy: #8e97a2;
  --viz-other: #5d6773;
  --viz-root: #b3bbc5;

  /* Space: 4 px scale */
  --s-0: 2px;
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;

  /* Type: RC1.2 comfort scale (caption → hero). Semantic names are the product scale;
     --t-* stay as the numeric ladder they map onto. Tabular numbers where values line up. */
  --font-ui: "DM Sans", Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --t-caption: 12px;
  --t-body: 14.5px;
  --t-body-strong: 15.5px;
  --t-section-title: 18px;
  --t-page-title: 28px;
  --t-metric: 34px;
  --t-hero: 46px;
  --t-micro: var(--t-caption);
  --t-xs: 12.5px;
  --t-sm: var(--t-body);
  --t-md: var(--t-body-strong);
  --t-lg: var(--t-section-title);
  --t-xl: var(--t-page-title);
  --lh-tight: 1.2;
  --lh: 1.5;
  --w-regular: 400;
  --w-medium: 500;
  --w-semibold: 600;

  /* Radius: QC scale (8 tabs and fields / 11 buttons / 14 bars and cards / 18 large surfaces) */
  --r-1: 8px;
  --r-2: 11px;
  --r-3: 14px;
  --r-4: 18px;

  /* Elevation: subtle, never "dashboard crypto" */
  --shadow-1: 0 1px 2px #00000033, 0 4px 14px #00000026;
  --shadow-2: 0 2px 6px #00000040, 0 18px 48px #00000059;
  --shadow-float: 0 4px 14px #00000038, 0 1px 3px #00000022;

  /* Motion: swift and purposeful (120–200 ms), never a gimmick */
  --ease: cubic-bezier(.2, 0, 0, 1);
  --dur-1: 120ms;
  --dur-2: 200ms;

  /* Layout metrics: comfortable hit areas (mission UX: zones interactives ≥ 32 px) */
  --sidebar-w: 240px;
  --topbar-h: 52px;
  --panel-w: 280px;
  --inspector-w: 340px;
  --drawer-h: 232px;
  --drawer-head-h: 36px;
  --row-h: 30px;
  --control-h: 34px;
  /* Compat aliases for old tokens still referenced in some modules */
  --header-h: var(--topbar-h);
  --side-w: var(--sidebar-w);
  --tabbar-h: 0px;
  --status-h: 0px;
}

/* RC1.3 — BIMCheck-QC identity as the PRIMARY theme: cool white canvas with a faint teal/blue
   wash, white cards, deep-ink text, one teal→blue brand gradient for the single primary action.
   Contrast pairs are verified against WCAG AA (design-tokens.test.mjs). */
:root[data-theme="light"] {
  color-scheme: light;
  --bg-0: #f3f8fc;
  --bg-1: #ffffff;
  --bg-2: #f6fbff;
  --bg-3: #e9f2f9;
  --line: #d8e8f2;
  --line-2: #c3d9e8;
  --text-1: #172437;
  --text-2: #3a4c61;
  --text-3: #566a7f;
  --text-inverse: #ffffff;
  --accent: #0e7490;
  --accent-strong: #088079;
  --accent-hover: #066a65;
  --on-accent: #ffffff;
  --brand-a: #088079;
  --brand-b: #2563c9;
  --sel-bg: #e2f4f6;
  --sel-line: #0a6f7a;
  --focus: #2563c9;
  --sev-blocking: #b3261e;
  --sev-review: #8a5a00;
  --sev-info: #4a5c70;
  --ok: #1a6b47;
  --sev-blocking-bg: #fdecec;
  --sev-review-bg: #fdf3df;
  --sev-info-bg: #eaf1f7;
  /* LIGHT VIEWER: the same cool studio the canvas paints (stage-appearance.js) — never a black void. */
  --stage-bg: #e6edf4;
  --stage-grid: #cfdde9;
  --stage-chrome: #ffffffee;
  --stage-chrome-line: #d3e2ee;
  --stage-text: #172437;
  --stage-text-2: #4d5f73;
  --stage-hover: #e9f2f9;
  --stage-on: #cfe3ef;
  --card-line: #d8e8f2;
  --viz-structure: #2a78d6;
  --viz-architecture: #d9602b;
  --viz-mep: #0f9a78;
  --viz-furniture: #4a3aa7;
  --viz-site: #b07a00;
  --viz-proxy: #6b7785;
  --viz-other: #7f8a99;
  --viz-root: #3a4c61;
  --shadow-1: 0 1px 2px #0d1b2a0f, 0 6px 16px -8px #0d1b2a29;
  --shadow-2: 0 2px 6px #0d1b2a14, 0 18px 40px -14px #17243747;
  --shadow-float: 0 6px 18px -8px #17243738, 0 1px 3px #0d1b2a14;
  --shadow-tabs: 0 18px 50px -42px #1724376b;
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-1: 0ms; --dur-2: 0ms; }
}
