/* Bixz: the one token sheet. Every server-rendered page (chat, sign-in,
   admin, setup) loads this first, then its own sheet. Fonts are declared once
   here, so a page change never re-downloads them.

   The world: an assay office. A rail that follows the theme (pale in light,
   graphite in dark), a pale assay-grey work area, white slips, struck-metal
   gold (deepened on the pale rail), violet only for the question being
   answered right now, red and amber only with an icon and a word. */

@font-face { font-family: "Hanken Grotesk"; font-weight: 400; font-display: swap;
  src: url("fonts/hanken-grotesk-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-weight: 500; font-display: swap;
  src: url("fonts/hanken-grotesk-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-weight: 600; font-display: swap;
  src: url("fonts/hanken-grotesk-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-weight: 700; font-display: swap;
  src: url("fonts/hanken-grotesk-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Saira Semi Condensed"; font-weight: 500; font-display: swap;
  src: url("fonts/saira-semi-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Saira Semi Condensed"; font-weight: 600; font-display: swap;
  src: url("fonts/saira-semi-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Saira Semi Condensed"; font-weight: 700; font-display: swap;
  src: url("fonts/saira-semi-condensed-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap;
  src: url("fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }

:root {
  /* graphite rail: the same in both themes */
  --rail: #201f24; --rail-2: #2c2b32; --rail-3: #38373f; --rail-edge: #201f24;
  --rail-ink: #efeee9; --rail-ink-2: #a9a7b0;
  --gold: #d4ad4a;           /* struck metal: on graphite only (7.7:1 there) */

  --ground: #f2f1ee;         /* the work area */
  --ground-2: #e8e7e2;       /* tinted blocks, hover */
  --ground-3: #dedcd5;       /* row dividers */
  --slip: #ffffff;           /* assay slips, inputs, controls */
  --ink: #1d1c20; --ink-2: #45434b; --ink-3: #63616b;   /* ink-3 is 4.9:1 on ground-2 */
  --ink-soft: #45434b; --ink-2-soft: #57555e;          /* earlier answers */
  --line: #d3d1ca;           /* hairlines */
  --line-strong: #8f8d86;    /* input and control outlines, 3:1 */

  --live: #6a4ff0; --live-ink: #ffffff; --live-soft: rgba(106, 79, 240, 0.14);
  --bad: #b3261e; --bad-soft: #f9e7e5;
  --warn: #8a5608; --warn-soft: #f8eedb;
  --good: #1d6b41; --good-soft: #e2f0e7;

  --font: "Hanken Grotesk", system-ui, sans-serif;
  --font-display: "Saira Semi Condensed", "Hanken Grotesk", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --r-xs: 2px; --r-sm: 5px; --r-md: 8px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --lift: 0 10px 30px -14px rgba(20, 19, 24, 0.35);
  color-scheme: light;
}

/* Dark: the ground goes near-black and the rail stays graphite, so the rail
   now sits lighter than the page and keeps its edge. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --rail: #232228; --rail-2: #2f2e35; --rail-3: #3b3a42; --rail-edge: #34333b;
    --ground: #121115; --ground-2: #1b1a1f; --ground-3: #26252b; --slip: #19181d;
    --ink: #edece8; --ink-2: #c3c1c9; --ink-3: #9a98a2; --ink-soft: #c3c1c9; --ink-2-soft: #aeacb5;
    --line: #2d2c33; --line-strong: #5d5b65;
    --live: #a593ff; --live-ink: #121115; --live-soft: rgba(165, 147, 255, 0.18);
    --bad: #ff8a80; --bad-soft: #3a1d1f; --warn: #f0b75a; --warn-soft: #36290f;
    --good: #74d39f; --good-soft: #15302a;
    --lift: 0 12px 34px -12px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --rail: #232228; --rail-2: #2f2e35; --rail-3: #3b3a42; --rail-edge: #34333b;
  --ground: #121115; --ground-2: #1b1a1f; --ground-3: #26252b; --slip: #19181d;
  --ink: #edece8; --ink-2: #c3c1c9; --ink-3: #9a98a2; --ink-soft: #c3c1c9; --ink-2-soft: #aeacb5;
  --line: #2d2c33; --line-strong: #5d5b65;
  --live: #a593ff; --live-ink: #121115; --live-soft: rgba(165, 147, 255, 0.18);
  --bad: #ff8a80; --bad-soft: #3a1d1f; --warn: #f0b75a; --warn-soft: #36290f;
  --good: #74d39f; --good-soft: #15302a;
  --lift: 0 12px 34px -12px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

/* The sidebars (chat, admin, setup, sign-in) follow the theme. The --rail
   tokens are re-scoped on those elements only, so graphite surfaces elsewhere
   (primary buttons, the question-number mark, the Ask button) stay graphite.
   Light: a pale rail a step darker than the ground, with a deeper gold that
   holds 4.8:1 on it. Dark: the graphite rail as before. */
:is(.rail, .signin-rail, .setup-rail) {
  --rail: #e9e8e3; --rail-2: #dedcd5; --rail-3: #d3d1ca; --rail-edge: #d3d1ca;
  --rail-ink: #1d1c20; --rail-ink-2: #4f4d56;
  --gold: #7d5f0e;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(.rail, .signin-rail, .setup-rail) {
    --rail: #232228; --rail-2: #2f2e35; --rail-3: #3b3a42; --rail-edge: #34333b;
    --rail-ink: #efeee9; --rail-ink-2: #a9a7b0;
    --gold: #d4ad4a;
  }
}
:root[data-theme="dark"] :is(.rail, .signin-rail, .setup-rail) {
  --rail: #232228; --rail-2: #2f2e35; --rail-3: #3b3a42; --rail-edge: #34333b;
  --rail-ink: #efeee9; --rail-ink-2: #a9a7b0;
  --gold: #d4ad4a;
}

/* ---------------------------------------------------------------- shared base */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 400 15px/1.5 var(--font); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--ink) 18%, transparent); color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: var(--r-xs); }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid var(--ground); }
textarea, input { caret-color: var(--ink); }
/* JetBrains Mono would draw >= as one glyph; a query you check must show its own characters. */
html body :is(code, pre, kbd, samp, .qn, .qn-ref, .draft) { font-variant-ligatures: none; font-feature-settings: "calt" 0, "liga" 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The hallmark: a struck row of square cells. Used under every answer, in
   the admin log, and as the sign-in's one statement of what Bixz guarantees. */
.marks { display: inline-flex; flex-wrap: wrap; border: solid var(--ink); border-width: 1.5px 0 0 1.5px; border-radius: var(--r-xs);
  font: 600 11.5px/1 var(--font-display); letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink); }
.marks > * { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; min-height: 28px;
  border: solid var(--ink); border-width: 0 1.5px 1.5px 0; white-space: nowrap; }
.marks svg { flex: none; }
.marks .qn { background: var(--rail); color: var(--gold); font: 400 12.5px/1 var(--font-mono);
  letter-spacing: 0; text-transform: none; text-decoration: none; }
.marks .qn a { color: inherit; text-decoration: none; }
.marks .qn a:hover, .marks .qn a[aria-expanded="true"] { text-decoration: underline; text-underline-offset: 3px; }
.marks .qn a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.rail .marks, .signin-rail .marks { border-color: var(--rail-3); color: var(--rail-ink-2); }
.rail .marks > *, .signin-rail .marks > * { border-color: var(--rail-3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
