/*
 * Design tokens. docs/console-design-baseline.md section 1 is the spec; this file is its only copy
 * in code.
 *
 * The only file in the console that may contain a colour value. Everything else references these,
 * and `tests/test_design_tokens.py` fails the build on a raw hex in a component. The reason is not
 * tidiness: a health colour that is right in four places and stale in the fifth gives a box a green
 * name beside a red dot, which tells an operator two different things at once.
 *
 * -- The Circle Eight restyle (November 2026) ----------------------------------------------------
 *
 * The console now wears the same brand as circleeight.ai, so a partner who signs in from the
 * website lands somewhere that is visibly the same company. The palette is the brand guidelines':
 * indigo for type and for the rail, peach and blush for warmth, lilac for quiet fills, terracotta as
 * the small accent. The website is peach-led because it persuades; the console is indigo-led because
 * it is operated all day and has to read as solid. Same family, different job.
 *
 * Health colours are deliberately NOT brand colours. Terracotta is the brand accent and red is
 * "this box is down"; letting one stand in for the other would make every accent look like an
 * alarm. The three states keep their own hues, warmed to sit beside the palette.
 *
 * -- Fonts, and why they are vendored -----------------------------------------------------------
 *
 * Sora for headings, DM Sans for UI text, IBM Plex Mono for all data. Served from this box, not
 * from Google: a CDN font is uncontrolled egress on every page load, from a control plane whose
 * pitch is that it makes no requests it did not have to, and the CSP (`default-src 'self'`) would
 * refuse it anyway. Latin subsets, SIL Open Font Licence, licences beside the files.
 */

@font-face {
  font-family: "Sora";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/sora-600.woff2") format("woff2");
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/dm-sans-400.woff2") format("woff2");
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/dm-sans-500.woff2") format("woff2");
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/dm-sans-600.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/ibm-plex-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/ibm-plex-mono-500.woff2") format("woff2");
}

:root {
  /* surfaces */
  --ground: #fbf6f5;   /* page background: pale blush, toned down for all-day use */
  --surf: #ffffff;     /* cards, panels, tables */
  --surf-2: #fff8f7;   /* subtle alt surface */
  --rail: #1f1a54;     /* left nav background: brand indigo */
  --rail-ink: #ffffff;        /* active and hovered rail text */
  --rail-text: #dcd9f0;       /* rail links at rest (11:1 on indigo) */
  --rail-faint: #a6a2cf;      /* rail group headings (6.4:1 on indigo) */
  --rail-hover: rgb(255 255 255 / 7%);
  --rail-active: rgb(255 184 177 / 15%);
  --rail-line: rgb(255 255 255 / 12%);
  --rail-marker: #ffb8b1;     /* brand peach */

  /* lines */
  --hair: #e3d6d4;     /* input borders, strong dividers */
  --hair-2: #efe4e2;   /* topbar / rail dividers */
  --row: #f2e8e6;      /* row hairlines inside tables */
  --track: #efe2df;    /* progress-bar track, panel-head divider */

  /* text */
  --ink: #1f1a54;      /* primary text + headings */
  --ink-2: #4a4570;    /* secondary text */
  --muted: #625e84;    /* labels */
  --faint: #8a86a8;    /* micro-labels, meta, timestamps */

  /* accent: terracotta for small marks, indigo for links and emphasis */
  --accent: #d9736b;            /* icons, small fills, the active marker */
  --accent-deep: #2b2570;       /* emphasis values, links */
  --tint: rgb(207 203 234 / 38%); /* chips, selected rows: lilac */
  --brand-fill: #ffe8e5;        /* button fill, brand chip bg: soft blush */
  --brand-edge: #ffb8b1;        /* peach border on chips/buttons */

  /* misc */
  --amber: #9a6b15;
  --rose: #c0656a;

  /* geometry */
  --radius: 12px;      /* cards, panels, tables */
  --radius-sm: 9px;    /* buttons, inputs */
  --ring-w: 1.5px;     /* the container ring */
  --radius-pill: 999px; /* bars and chips */

  /* -- Health states (baseline §1, "the important part") ------------------------------------
     Every box has a state, that state drives one colour, and the colour is used on *every*
     element representing the box: the container ring, the dot, the word, the node name and any
     load or VRAM bar. Colouring one and leaving the others grey is the specific failure this is
     arranged to prevent. */
  /* The neutral default frame: a quiet lilac-grey rather than a health colour. A generic container,
     such as Reports, Settings or Keys, is not making a claim about anybody's health, and framing it
     in green would make every page look like a fleet that is fine. Single-box containers override
     this with --state, which is where green, amber and red belong. */
  /* Print. A quote goes to a client on paper or as a PDF, and it is the one surface where the
     viewer's theme is irrelevant — nobody wants a dark-mode invoice, and a light-on-dark document
     costs the reader a toner cartridge. These are deliberately outside the theme switches below:
     the printed page is always ink on white, whatever the screen was doing. */
  --print-bg: #ffffff;
  --print-ink: #101010;

  --ring: #d9cbe0;

  --state-healthy: #2e7d57;
  --state-updating: #b86e12;
  --state-crashed: #b83a3a;  /* also: unreachable / offline */

  --tint-healthy: rgb(47 133 92 / 12%);
  --tint-updating: rgb(199 124 28 / 13%);
  --tint-crashed: rgb(194 74 66 / 13%);

  /* -- Beyond the baseline -------------------------------------------------------------------
     Two additions, marked as such so a reader can tell them from the spec.

     `--state-retired` is the fourth state the baseline invites ("if you later want to split ...
     add a fourth state"). A decommissioned box is not a degree of health — giving it one of the
     three colours would put it in the same visual sentence as boxes that still matter — so it is
     deliberately colourless.

     The type and depth tokens are not in §1 because §3 states them as prose. They are here rather
     than in components so the rule about no raw values in components can hold. */
  --state-retired: #8a86a8;
  --tint-retired: rgb(138 134 168 / 12%);

  --font-display: "Sora", "DM Sans", -apple-system, "Segoe UI", sans-serif;
  --font-sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* §3 type scale. Sizes live here so a heading cannot be 17px on one page and 16px on another. */
  --size-page-title: 25px;
  --size-panel-title: 16px;
  --size-card-title: 15px;
  --size-body: 13.5px;
  --size-label: 12px;
  --size-micro: 9.5px;
  --tracking-micro: 1.2px;

  /* Almost no depth. The ring does the separating; a shadow on every card produces a page that
     looks like it is hovering and makes the ring redundant. */
  --shadow: 0 1px 2px rgb(31 26 84 / 6%);
  --shadow-raised: 0 8px 30px rgb(31 26 84 / 18%);

  /* §4 shell geometry. */
  --rail-width: 252px;
  --content-pad: 26px 34px 40px;
  --section-gap: 22px;
}

/*
 * The health-state helpers.
 *
 * A container or row carries one of these, after which every coloured child reads `--state`. That
 * indirection is the whole design: a template sets the state once, and the dot, the word, the name
 * and the bar cannot disagree because they are all reading the same variable. There is no
 * per-element colour to set and therefore none to forget.
 */
.state-healthy { --state: var(--state-healthy); --state-tint: var(--tint-healthy); }
.state-updating { --state: var(--state-updating); --state-tint: var(--tint-updating); }
.state-crashed { --state: var(--state-crashed); --state-tint: var(--tint-crashed); }
.state-retired { --state: var(--state-retired); --state-tint: var(--tint-retired); }
