/* StackJack Portal: theme tokens ("look C"), the one place every colour token lives.
 *
 * Linked by BOTH root documents (App.razor and ControlPlaneApp.razor) through @Assets["css/theme.css"], directly
 * after Blueprint's two stylesheets, so the Portal and the ControlPlane cannot drift. It replaces the two inline
 * <style> token blocks those documents used to carry.
 *
 * Values: round 2 (spec section 14.5): the brand's own family (the mascot's ink and seafoam) replaces indigo, with a canvas,
 * menu and card that separate, borders that read, and a deep petrol primary that carries white text in both modes.
 * Round 1 values were the targets in docs/superpowers/specs/2026-10-26-ui-overhaul-design.md section 5.1.
 * One deliberate departure: light --muted-foreground and --sj-neutral-fg are #656a79, not the spec's #6b7080, which
 * is 4.41:1 on --muted and 4.33:1 on the neutral pill fill (AA needs 4.5:1). The field border (--input, both modes) and
 * the light chart slots 3-5 are likewise darker (light) or lighter (dark) than the spec's first values, lifted until
 * they reach the 3:1 that ThemeTokenContrastTests pins for them (SC 1.4.11); the spec records the build-time values.
 * --input is a BORDER colour, so a field's FILL is --sj-field (app.css points Blueprint's dark field tint at it).
 *
 * Rules for editing this file:
 *   - Blueprint's token NAMES are kept (--background, --primary, --sidebar, ...), so every Blueprint component
 *     recolours at once. The --sj-* names are ours: state fills for StatusPill, the rail, the accent, the shadows.
 *   - Every token is declared in BOTH :root and .dark. The theme class is stamped on <html> by PortalTheme and
 *     applied before first paint by js/theme-init.js, so .dark and :root describe the same element.
 *   - Colour-scheme first in each block: ThemeRootDocumentTests slices the block at the first closing brace.
 *   - app.css must NOT redeclare a token this file owns. It loads after this file and is unlayered, so it would
 *     win silently (ThemeTokensTests.AppCss_RedeclaresNoTokenThemeCssOwns).
 *   - State colours (--sj-good/warn/crit/neutral/info) are for state only, always beside a label; they are never
 *     chart colours. Chart colours are --chart-1 .. --chart-8, in this order, never cycled.
 *   - Flat rules only (no nested at-rules): the token pins read this file with a one-level block matcher.
 *
 * Tailwind sees these through the @theme inline block in tailwind.css, which is what makes a slash-opacity
 * utility on a theme colour (bg-primary/10) compile.
 */

/* Inter, self-hosted: no third-party font request (EU customers), served under /css which the ControlPlane
 * allow-list already admits. The url() is relative to this stylesheet's own URL, so it resolves to
 * /css/fonts/InterVariable.woff2 whether the stylesheet is the fingerprinted or the plain route. Inter 4.1,
 * SIL Open Font License 1.1 (fonts/OFL.txt). */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/InterVariable.woff2") format("woff2");
}

:root {
  color-scheme: light;

  --background: #eaeef1;
  --foreground: #14181d;
  --card: #ffffff;
  --card-foreground: #14181d;
  --popover: #ffffff;
  --popover-foreground: #14181d;
  --primary: #0f6a72;
  --primary-foreground: #ffffff;
  --secondary: #e1e7ea;
  --secondary-foreground: #14181d;
  --muted: #f1f4f6;
  --muted-foreground: #56616b;
  --accent: #e6ecef;
  --accent-foreground: #14181d;
  --destructive: #d4183d;
  --destructive-foreground: #ffffff;
  --border: #d3dbe0;
  --input: #7d8a93;
  --sj-border-strong: #c3ccd2;
  --ring: #137c85;
  --radius: 0.875rem;

  --sidebar: #fbfcfd;
  --sidebar-foreground: #14181d;
  --sidebar-primary: #0f6a72;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #eef2f4;
  --sidebar-accent-foreground: #14181d;
  --sidebar-border: #d9e0e4;
  --sidebar-ring: #137c85;

  /* Chart series: the dataviz reference categorical palette, fixed order, never cycled. */
  --chart-1: #2a78d6;
  --chart-2: #eb6834;
  --chart-3: #13946a;
  --chart-4: #a87400;
  --chart-5: #d4568b;
  --chart-6: #008300;
  --chart-7: #6250d6;
  --chart-8: #e34948;

  /* Non-text accent: active menu tile, progress fills, focus ring, selected option. */
  --sj-accent: #137c85;
  --sj-accent-soft: #dcefef;
  --sj-accent-soft-foreground: #0b4f55;

  /* The tabs (layout rework, owner 2026-11-05). In light mode Blueprint's default strip is lighter than the page and its open tab is darker than the strip, so neither reads as a tab. The dark values are what those defaults resolve to today. */
  --sj-tablist-bg: #d9e0e4;
  --sj-tablist-fg: #3f4a53;
  --sj-tab-active-bg: #ffffff;
  --sj-tab-active-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  --sj-page-tab-line: var(--sj-border-strong);
  --sj-page-tab-active-bg: var(--sj-accent-soft);
  --sj-page-tab-active-fg: var(--sj-accent-soft-foreground);

  --sj-rail: #0c0f12;
  --sj-rail-foreground: #9aa6ae;
  --sj-field: #ffffff;

  /* State fills (StatusPill). Always shown with a label and usually a dot, never colour alone. */
  --sj-good-bg: #dcfce7;
  --sj-good-fg: #166534;
  --sj-warn-bg: #ffedd5;
  --sj-warn-fg: #9a3412;
  --sj-crit-bg: #ffe4e6;
  --sj-crit-fg: #9f1239;
  --sj-neutral-bg: #eceff1;
  --sj-neutral-fg: #56616b;
  --sj-info-bg: #dcefef;
  --sj-info-fg: #0b4f55;

  --sj-shadow-card: 0 1px 2px rgba(16, 24, 32, 0.06), 0 2px 8px -2px rgba(16, 24, 32, 0.08);
  --sj-shadow-pop: 0 2px 4px rgba(16, 24, 32, 0.08), 0 16px 36px -10px rgba(16, 24, 32, 0.28);

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

.dark {
  color-scheme: dark;

  --background: #0d1013;
  --foreground: #e8ecee;
  --card: #1a1f24;
  --card-foreground: #e8ecee;
  --popover: #1e2329;
  --popover-foreground: #e8ecee;
  --primary: #167680;
  --primary-foreground: #ffffff;
  --secondary: #262c33;
  --secondary-foreground: #e8ecee;
  --muted: #22282e;
  --muted-foreground: #98a3ac;
  --accent: #262c33;
  --accent-foreground: #e8ecee;
  --destructive: #fb7185;
  --destructive-foreground: #141418;
  --border: #2e353c;
  --input: #6f7b84;
  --sj-border-strong: #3a434b;
  --ring: #3fb0b9;
  --radius: 0.875rem;

  --sidebar: #121619;
  --sidebar-foreground: #e8ecee;
  --sidebar-primary: #3fb0b9;
  --sidebar-primary-foreground: #0d1013;
  --sidebar-accent: #20262b;
  --sidebar-accent-foreground: #e8ecee;
  --sidebar-border: #242a30;
  --sidebar-ring: #3fb0b9;

  --chart-1: #3987e5;
  --chart-2: #d95926;
  --chart-3: #199e70;
  --chart-4: #c98500;
  --chart-5: #d55181;
  --chart-6: #008300;
  --chart-7: #9085e9;
  --chart-8: #e66767;

  --sj-accent: #2a9aa3;
  --sj-accent-soft: rgba(63, 176, 185, 0.14);
  --sj-accent-soft-foreground: #a5dde1;

  /* The tabs stay as they are in dark mode: each value is what the rule resolved to before the tokens. The stronger shadow and the open page tab's fill have no dark value, because their rules never apply here. */
  --sj-tablist-bg: #22282e;
  --sj-tablist-fg: #98a3ac;
  --sj-tab-active-bg: #0d1013;
  --sj-page-tab-line: var(--border);
  --sj-page-tab-active-fg: var(--foreground);

  --sj-rail: #08090b;
  --sj-rail-foreground: #8f9aa3;
  --sj-field: #13171b;

  --sj-good-bg: rgba(34, 197, 94, 0.14);
  --sj-good-fg: #86efac;
  --sj-warn-bg: rgba(249, 115, 22, 0.15);
  --sj-warn-fg: #fdba74;
  --sj-crit-bg: rgba(244, 63, 94, 0.15);
  --sj-crit-fg: #fda4af;
  --sj-neutral-bg: #262c33;
  --sj-neutral-fg: #98a3ac;
  --sj-info-bg: rgba(63, 176, 185, 0.14);
  --sj-info-fg: #a5dde1;

  --sj-shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.035), 0 8px 24px -14px rgba(0, 0, 0, 0.7);
  --sj-shadow-pop: 0 0 0 1px rgba(255, 255, 255, 0.07), 0 18px 40px -10px rgba(0, 0, 0, 0.7);

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

/* The body takes Inter through the font-sans class both roots already put on it; this keeps a page that renders
 * without that class (the framework's own error UI, a static-SSR page) on the same face. */
body {
  font-family: var(--font-sans);
}

/* Prevent Blazor focus restoration from showing outlines on non-interactive elements. Moved here from the roots'
 * inline <style> blocks, which carried it beside the tokens. */
h1:focus, h2:focus, div:focus, main:focus, header:focus {
  outline: none;
}
