/*
  tokens.css — every design value of the site, in one place.

  Fonts, sizes, spacing, corners, colours and motion live here and nowhere
  else. The other stylesheets only refer to these names, never to a raw
  number or colour. To change the look of the whole site, change it here.

  Load order on every page:  tokens.css  →  base.css  →  app.css

  Rules
  • No raw values in other files. If no token fits, add a step here.
  • Colour is written once. Each theme names its page colour (--bg) and its
    ink (--ink); every grey, border and wash is ink at an opacity, so a theme
    change carries through everywhere.
  • Opacities step by 0.05.
*/

:root {

  /* ── Type ─────────────────────────────────────────────────────────── */
  --font-sans: 'Instrument Sans', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;

  --fs-sm: 14px;    /* small print: hints, the header, buttons   */
  --fs-md: 16px;    /* body text and the chat — the base size    */
  --fs-lg: 20px;    /* the brand name, headings in an answer     */

  --fw-normal: 400;
  --fw-bold: 600;

  --lh-tight: 1.25;   /* headings, single-line controls */
  --lh-normal: 1.6;   /* body and chat text             */

  /* ── Space — one ramp for padding, margin and gap ─────────────────── */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 20px;
  --sp-5: 40px;

  /* ── Sizes ────────────────────────────────────────────────────────── */
  --content-max: 760px;   /* width of the chat column               */
  --form-max: 360px;      /* width of the login form                */
  --input-max-h: 200px;   /* the prompt box grows up to this height */
  --bubble-max: 85%;      /* widest a chat bubble may be            */
  --editor-h: 50vh;       /* admin: the system prompt box           */

  /* ── Lines ──────────────────────────────────────────────────────── */
  --line: 1px;      /* every border and outline */

  /* ── Corners ──────────────────────────────────────────────────────── */
  --r-sm: 4px;      /* buttons, fields  */
  --r-lg: 12px;     /* chat bubbles, the prompt box */

  /* ── Motion ───────────────────────────────────────────────────────── */
  --t-fast: 0.15s ease;
  --busy-opacity: 0.50;   /* a button while it waits */

  /* ── Layers ───────────────────────────────────────────────────────── */
  --z-bar: 10;   /* the fixed prompt bar */

  /* ── Source colours — the only colour values in the site ──────────── */
  --c-white: #ffffff;
  --c-paper: #fafaf9;
  --c-black: #111113;
  --c-night: #141616;
  --c-accent: #39b3b0;   /* teal, the one accent colour */
  --c-error-light: #b00020;
  --c-error-dark: #ff6b6b;
}

/* ── Themes: each states its page, ink and error colour. Light is the
      default; dark follows the visitor's system setting. ─────────────── */

:root {
  color-scheme: light;
  --bg: var(--c-paper);
  --ink: var(--c-black);
  --error: var(--c-error-light);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: var(--c-night);
    --ink: var(--c-white);
    --error: var(--c-error-dark);
  }
}

/* ── Derived colours — shared by both themes ─────────────────────────── */

:root {
  --text: rgb(from var(--ink) r g b / 0.90);         /* main text          */
  --muted: rgb(from var(--ink) r g b / 0.55);        /* hints, small print */
  --border: rgb(from var(--ink) r g b / 0.10);       /* lines and outlines */
  --surface: rgb(from var(--ink) r g b / 0.05);      /* bubbles, fields    */
  --surface-hover: rgb(from var(--ink) r g b / 0.10);
  --accent: var(--c-accent);
  --on-accent: var(--c-white);                       /* text on the accent */
}
