/* Battery Core — module theme bridge and shared page chrome.
 *
 * The interactive modules were each authored as a standalone page with its own
 * generic light/dark token set (--background, --primary, --card, --border,
 * --viz-series-N, …). Those defaults are blue-on-white and clash with the
 * course shell in `site.css`.
 *
 * This file re-declares that same generic contract in Battery Core colours, so
 * a module adopts the course palette without any change to its own layout or
 * markup. Link it AFTER the module's own stylesheet or <style> block:
 *
 *     <link rel="stylesheet" href="styles.css">
 *     <link rel="stylesheet" href="../../assets/module-theme.css">
 *
 * Same specificity, later wins. The module keeps its structure; only the
 * colours move. Colour roles are documented in `assets/README.md`.
 *
 * This file is only for pages written against the generic contract. A page
 * with its own vocabulary — the workbench reads --muted as a text colour,
 * not a surface — must not link it. The shared header and footer live in
 * `site-chrome.css` so such a page can still have them.
 */

:root {
  color-scheme: dark;

  /* Course palette — the source of truth, identical to site.css. */
  --bc-background: #07131d;
  --bc-surface: #0d1d29;
  --bc-surface-raised: #122635;
  --bc-text: #edf6f8;
  --bc-muted: #9fb3bd;
  --bc-line: rgba(196, 224, 231, 0.16);
  --bc-accent: #68e0bd;
  --bc-accent-strong: #95f1d5;
  --bc-blue: #71b7ff;
  --bc-orange: #ffb067;

  /* Generic contract, restated in course colours. Names and meanings are the
     modules' own; only the values change. */
  --background: var(--bc-background);
  --foreground: var(--bc-text);
  --card: rgba(255, 255, 255, 0.045);
  --card-foreground: var(--bc-text);
  --popover: var(--bc-surface-raised);
  --popover-foreground: var(--bc-text);
  --primary: var(--bc-accent);
  --primary-foreground: #04251e;
  --secondary: rgba(255, 255, 255, 0.05);
  --secondary-foreground: var(--bc-text);
  --muted: rgba(255, 255, 255, 0.09);
  --muted-foreground: var(--bc-muted);
  /* Generic --accent is a tinted surface, not the course mint; --bc-accent is
     the mint. Keeping the distinction stops soft washes turning fluorescent. */
  --accent: rgba(104, 224, 189, 0.12);
  --accent-foreground: var(--bc-accent-strong);
  --destructive: #ff9a6b;
  --red: #ff7f6a;
  --green: var(--bc-accent);
  --border: var(--bc-line);
  --input: rgba(255, 255, 255, 0.06);
  --ring: var(--bc-accent);

  /* One categorical series, ordered by how often a module needs a colour.
     Each is legible on --bc-background and distinguishable from its
     neighbours. */
  --viz-series-1: var(--bc-accent);
  --viz-series-2: var(--bc-orange);
  --viz-series-3: var(--bc-blue);
  --viz-series-4: #c9a2f2;
  --viz-series-5: #f2d574;
  --viz-series-6: #5fc9c1;

  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;

  /* Legacy aliases some modules still read. */
  --viz-bg: var(--background);
  --viz-panel: var(--card);
  --viz-border: var(--border);
  --viz-text: var(--foreground);
  --viz-muted: var(--muted-foreground);
  --viz-accent: var(--primary);
  --viz-accent-text: var(--primary-foreground);
  --viz-accent-bg: var(--accent);
  --viz-warning: var(--destructive);
  --color-background-primary: var(--background);
  --color-text-primary: var(--foreground);
  --color-border-secondary: var(--border);
}

/* Some modules opt into a host background by marking the root. On the course
   site there is no host, so the page paints its own ground. */
:root,
:root[data-visualize-standalone],
:root[data-theme="light"],
:root[data-theme="dark"] {
  color-scheme: dark;
  background-color: var(--bc-background);
}
