/* Base tokens, global reset, loaders, and shared primitives. */

/* The Aleph Brandbook's two worlds (Aleph_Assistant apps/shared_web/static/tokens.css). Dark is the
   default and the brand; light is an explicit choice (app/ui/theme.js sets data-theme="light" on the
   root) that deepens the same hues on cool paper instead of inverting them. Model pixels keep
   their materials; the renderer ground and all host controls follow the theme.
   Tokens ending in -rgb are channel triplets for rgba(var(--x-rgb), alpha): white
   ink, black shade and the near-black surface each become their light counterpart in one place, and
   --shade-k scales every shadow and recess, since paper takes far less darkening than black takes
   lightening. Stylesheets use these tokens, never raw colours. */
/* An explicitly dark brand surface can keep this same palette inside a light page. */
:root,
.brand-theme-dark,
.work-record-popup,
.work-record-launcher {
  color-scheme: dark;
  --ink-rgb: 255, 255, 255;
  --shade-rgb: 0, 0, 0;
  --shade-k: 1;
  --surface-rgb: 7, 10, 14;
  --brand-blue-rgb: 109, 172, 200;
  --brand-blue-soft-rgb: 164, 207, 217;
  --brand-orange-rgb: 251, 145, 38;
  --brand-warm-rgb: 229, 222, 179;
  --text-main-rgb: 248, 250, 252;
  --text-pale-rgb: 232, 240, 247;
  --text-soft-rgb: 214, 228, 239;
  --alert-rgb: 255, 132, 100;
  --amber-rgb: 255, 211, 123;
  --cyan-rgb: 141, 211, 255;
  --ground:
    radial-gradient(at 0% 48%, rgba(var(--brand-orange-rgb), 0.12) 0px, transparent 48%),
    radial-gradient(at 100% 52%, rgba(var(--brand-blue-rgb), 0.14) 0px, transparent 52%),
    var(--bg-dark);
  --bg-panel: rgba(12, 14, 16, 0.62);
  /* The brandbook panel (--bg-panel) over the black ground, opaque: for surfaces that float over content
     or the 3D scene, or must hide what scrolls under them. */
  --bg-panel-strong: #07090a;
  /* Aleph Brandbook dark surface tokens (Aleph_Assistant apps/shared_web/static/tokens.css): the black
     ground, the one panel layer's hairline and shadow, an inner card that rises from its panel, a recess,
     faint fills, the warm glow, and the embed and code surfaces. */
  --bg-dark: #000000;
  --panel-line: rgba(255, 255, 255, 0.05);
  --glass-shadow: 0 10px 36px rgba(0, 0, 0, 0.82);
  /* Windows that float over the workspace (the work window, Ask Aleph). On black a black shadow and a
     faint hairline vanish, so a floating surface rises a step above the panels, keeps a brand-blue
     edge and glows brand blue around it, a tight glow and a wide one, over a deep shadow. */
  --bg-float: #0b0f13;
  --float-line: rgba(109, 172, 200, 0.34);
  --float-shadow: 0 0 0 1px rgba(109, 172, 200, 0.18), 0 0 18px rgba(109, 172, 200, 0.24), 0 0 56px rgba(109, 172, 200, 0.12), 0 24px 64px rgba(0, 0, 0, 0.85);
  --fill-card: rgba(255, 255, 255, 0.04);
  --fill-recess: rgba(0, 0, 0, 0.28);
  --fill-recess-strong: rgba(0, 0, 0, 0.50);
  --fill-faint: rgba(255, 255, 255, 0.05);
  --fill-faintest: rgba(255, 255, 255, 0.02);
  --glow-orange: rgba(251, 145, 38, 0.08);
  --embed-surface: #05070a;
  --code-surface: #071019;
  --brand-blue: #6dacc8;
  --brand-blue-soft: #a4cfd9;
  --brand-orange: #fb9126;
  --brand-warm: #e5deb3;
  --text-main: #f8fafc;
  --text-muted: #9aa9bd;
  --border: rgba(109, 172, 200, 0.14);
  --border-strong: rgba(109, 172, 200, 0.26);
  --shadow: 0 14px 48px rgba(0, 0, 0, 0.72);
  --focus-ring: 0 0 0 3px rgba(109, 172, 200, 0.22); /* the brandbook's settled .22, on every surface */
  /* Aleph Brandbook tokens (Aleph_Assistant apps/shared_web/static/tokens.css) used by the dashboards.
     --line is the hairline colour; the four states carry one meaning each and are never decoration. */
  --text-faint: #64748b;
  --line: rgba(109, 172, 200, 0.14);
  --input-line: rgba(109, 172, 200, 0.28);
  --tint-brand: rgba(109, 172, 200, 0.08);
  --text-on-accent: #000;
  --state-running: #6dacc8;
  --state-waiting: #fb9126;
  --state-done: #a4d9b3;
  --state-failed: #f87171;
}

/* Light: the brandbook's [data-theme="light"] values; FM's own tokens follow the same rules. The help
   balloon lives in the scene shell's markup but explains the whole page, so it follows the page. */
:root[data-theme="light"],
:root[data-theme="light"] #context-help-balloon,
:root[data-theme="light"] .work-record-popup,
:root[data-theme="light"] .work-record-launcher {
  color-scheme: light;
  --ink-rgb: 16, 40, 55;
  --shade-rgb: 16, 40, 55;
  --shade-k: 0.16;
  --surface-rgb: 255, 255, 255;
  --brand-blue-rgb: 45, 118, 145;
  --brand-blue-soft-rgb: 63, 143, 168;
  --brand-orange-rgb: 194, 102, 10;
  --brand-warm-rgb: 138, 116, 64;
  --text-main-rgb: 14, 26, 33;
  --text-pale-rgb: 26, 38, 46;
  --text-soft-rgb: 38, 51, 60;
  --alert-rgb: 179, 38, 30;
  --amber-rgb: 138, 90, 18;
  --cyan-rgb: 45, 118, 145;
  --bg-panel: rgba(255, 255, 255, 0.74);
  --bg-panel-strong: #f9fbfc;
  --bg-dark: #eef3f5;
  --panel-line: rgba(16, 40, 55, 0.10);
  --glass-shadow: 0 8px 28px rgba(16, 40, 55, 0.10);
  --bg-float: #f9fbfc;
  --float-line: rgba(16, 40, 55, 0.13);
  --float-shadow: 0 8px 28px rgba(16, 40, 55, 0.10);
  --fill-card: rgba(255, 255, 255, 0.72);
  --fill-recess: rgba(14, 26, 33, 0.05);
  --fill-recess-strong: rgba(14, 26, 33, 0.10);
  --fill-faint: rgba(16, 40, 55, 0.05);
  --fill-faintest: rgba(16, 40, 55, 0.035);
  --glow-orange: rgba(194, 102, 10, 0.08);
  --embed-surface: #e8eef0;
  --code-surface: #e4ebee;
  --brand-blue: #2d7691;
  --brand-blue-soft: #3f8fa8;
  --brand-orange: #c2660a;
  --brand-warm: #8a7440;
  --text-main: #0e1a21;
  --text-muted: #5a6b76;
  --border: rgba(16, 40, 55, 0.13);
  --border-strong: rgba(16, 40, 55, 0.24);
  --shadow: 0 14px 48px rgba(16, 40, 55, 0.12);
  --focus-ring: 0 0 0 3px rgba(45, 118, 145, 0.22);
  --text-faint: #7d8b95;
  --line: rgba(16, 40, 55, 0.13);
  --input-line: rgba(45, 118, 145, 0.30);
  --tint-brand: rgba(45, 118, 145, 0.10);
  --text-on-accent: #ffffff;
  --state-running: #2d7691;
  --state-waiting: #a85408;
  --state-done: #1f5c6b;
  --state-failed: #b3261e;
}
