/* The one design-token file — both viewers (the design app and the
   manual page) load THIS, so a value edit lands everywhere at once.
   Two layers: these are the semantic tokens (named for role, not hue);
   the raw values are the primitives. Theming: the html element carries
   data-theme="light" | "dark" (both pages set it the same way).
   Every color is sRGB: the build does not change this file, and an older
   browser (Chrome 102) takes an oklch() color for none. */

:root,
[data-theme='light'] {
  /* The UA's own canvas (the ground it paints between documents and
     behind late CSS) follows the theme — without this a dark-themed
     navigation flashes the default white canvas. */
  color-scheme: light;
  --background: #ffffff;
  --foreground: #030712;
  --card: #ffffff;
  --card-foreground: #030712;
  --popover: #ffffff;
  --popover-foreground: #030712;
  --primary: #3958d1;
  --primary-foreground: #f9fafb;
  --secondary: #f3f4f6;
  --secondary-foreground: #101828;
  --muted: #f3f4f6;
  --muted-foreground: #6a7282;
  --accent: #e2ebff;
  --accent-foreground: #19285f;
  --destructive: #e7000b;
  --destructive-foreground: #f9fafb;
  --border: #e5e7eb;
  --input: #e5e7eb;
  --ring: #5a79d9;
  --sidebar: #f9fafb;
  --sidebar-foreground: #030712;
  --sidebar-border: #e5e7eb;

  --radius: 0.625rem;
}

[data-theme='dark'] {
  color-scheme: dark;
  --background: #030712;
  --foreground: #f9fafb;
  --card: #101828;
  --card-foreground: #f9fafb;
  --popover: #101828;
  --popover-foreground: #f9fafb;
  --primary: #7699fb;
  --primary-foreground: #030712;
  --secondary: #1e2939;
  --secondary-foreground: #f9fafb;
  --muted: #1e2939;
  --muted-foreground: #99a1af;
  --accent: #233056;
  --accent-foreground: #dfe8fd;
  --destructive: #ff6467;
  --destructive-foreground: #f9fafb;
  --border: rgb(255 255 255 / 10%);
  --input: rgb(255 255 255 / 15%);
  --ring: #6a7282;
  --sidebar: #101828;
  --sidebar-foreground: #f9fafb;
  --sidebar-border: rgb(255 255 255 / 10%);
}

/* The Studio's own colors: its window takes the colors of its 3D view, so
   the window and the 3D view read as one surface in both themes, as
   Fusion's UI and canvas do. The 3D view's ground (index.css .canvas-ground)
   fades from white through --background to --muted in light, and from a
   glow behind the design through --muted to --background in dark. The
   theme boot (src/theme-boot.ts) marks the Studio's pages with
   data-studio before the first paint: the Studio, its framed viewer and
   its framed manual. The Playground and the manual page outside the
   Studio keep the tokens above. Each text keeps its contrast on these
   surfaces: a text at 4.5:1 or more stays there, and a text below it does
   not fall, also on the 10 to 15 % tints of the chips. So the primary,
   the red of an error and the gray of a quiet text are a step darker in
   light and lighter in dark; the palette colors of the texts (the --color-*
   lines) move a part of a step along their own shades; in dark, the
   selected row is a deeper blue, as far from the panel as before, and a
   text on the red of a danger button is dark. */
:root[data-studio]:not([data-theme='dark']) {
  --background: #f5f6f8;
  --foreground: #0f141b;
  --card-foreground: #0f141b;
  --popover-foreground: #0f141b;
  --secondary: #e6e9ed;
  --secondary-foreground: #161d27;
  --muted: #e6e9ed;
  --muted-foreground: #5c6573;
  --primary: #3655cd;
  --destructive: #d00114;
  --border: #d7dbe1;
  --input: #d7dbe1;
  --sidebar: #eceef1;
  --sidebar-foreground: #0f141b;
  --sidebar-border: #d7dbe1;
  --color-amber-500: #f58c00;
  --color-amber-700: #b14800;
  --color-blue-600: #1559f7;
  --color-emerald-500: #00b075;
  --color-emerald-600: #008f61;
  --color-emerald-700: #007753;
  --color-green-600: #009b3c;
  --color-red-500: #ef0c22;
  --color-red-600: #d90009;
  --color-slate-500: #5b6c86;
}

:root[data-studio][data-theme='dark'] {
  --background: #252a33;
  --foreground: #f1f3f6;
  --card: #2c323d;
  --card-foreground: #f1f3f6;
  --popover: #2c323d;
  --popover-foreground: #f1f3f6;
  --primary: #87a7ff;
  --primary-foreground: #10151d;
  --secondary: #353c49;
  --secondary-foreground: #f1f3f6;
  --muted: #353c49;
  --muted-foreground: #adb5c1;
  --accent: #223573;
  --destructive: #ff6a6c;
  --destructive-foreground: #10151d;
  --border: rgb(255 255 255 / 9%);
  --input: rgb(255 255 255 / 14%);
  --sidebar: #2c323d;
  --sidebar-foreground: #f1f3f6;
  --sidebar-border: rgb(255 255 255 / 9%);
  --color-amber-500: #ffaf00;
  --color-blue-400: #5ca9ff;
  --color-emerald-500: #00d899;
  --color-red-400: #ff7f80;
  --color-red-500: #ff8182;
  --color-slate-400: #97a7be;
}

/* The color-* names both codebases address tokens through. */
:root,
[data-theme='light'],
[data-theme='dark'] {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-destructive-foreground: var(--destructive-foreground);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --color-sidebar: var(--sidebar);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar-border: var(--sidebar-border);
}
