/*
 * tokens.css — night-ink + amber design system, UNIFIED tokens.
 * =============================================================================
 * Single source of truth for BOTH the static public site (site.css) and the
 * app SPA (style.css). Loaded via <link> BEFORE either stylesheet:
 *   - public site: templates.js head, before /site/site.css
 *   - app SPA:     frontend/app/index.html, before /src/css/style.css
 *
 * The old `:root {…}` colour blocks in site.css / style.css have been removed so
 * the compat aliases at the bottom (old name → new value) win the cascade and
 * existing `var(--bg)` / `var(--color-primary)` references keep working. Rename
 * to the canonical tokens at your own pace, then drop the aliases.
 *
 * Values come from docs/design/design-system-2026-07-18 (the style guide).
 * Constraints unchanged: no backdrop-blur / CSS filters (Intel Mac 2015), AA.
 */

/* ---- Served display + mono fonts (latin woff2, self-hosted for CSP + no
 *      external request). Regenerate from the same Google Fonts sources:
 *        Fraunces:   ital,opsz,wght@0,9..144,400;0,9..144,560;1,9..144,500
 *        Space Mono: wght@400;700
 *      System sans stays the body default (--font-sans), so no sans @font-face. */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/site/fonts/fraunces-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 560;
  font-display: swap;
  src: url('/site/fonts/fraunces-560.woff2') format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url('/site/fonts/fraunces-italic-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/site/fonts/space-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/site/fonts/space-mono-700.woff2') format('woff2');
}

:root {
  /* ---- Neutrals — the night-blue ground (not pure black) ---- */
  --ink:    #0B0E13;   /* page ground */
  --ink-2:  #12161F;   /* cards, surfaces */
  --ink-3:  #1B212D;   /* hover, raised */
  --line:   #262E3B;   /* hairlines, borders */

  /* ---- Text ---- */
  --paper:  #ECEEF2;   /* primary text (warm white) */
  --dim:    #8B93A3;   /* secondary text — 5.9:1 on --ink-2, AA */
  /* Metadata, captions. Was #5D6575, which measured 3.30 / 3.09 / 2.75 against
   * ink / ink-2 / ink-3 — under the 4.5:1 AA floor on every surface it is used
   * on, including the "AI companion · not a real person" disclosure and the
   * mono HUD. Lifted to the lightest value that clears AA on all three while
   * keeping the blue cast: 5.42 / 5.08 / 4.53. */
  --dim-2:  #808898;

  /* ---- Accent & semantic (spend boldness in one place) ---- */
  --amber:       #F4C152;             /* brand accent · the call gesture */
  --amber-deep:  #C8871A;             /* amber hover / detail */
  --amber-rgb:   244, 193, 82;        /* for rgba(var(--amber-rgb), .12) */
  --on-amber:    #1A1204;             /* text on amber (CTA label) */
  --live:        #5FD08A;             /* presence "online" (semantic) */
  --live-rgb:    95, 208, 138;
  --danger:      #F0655F;             /* hang up / destructive (semantic) */
  --danger-rgb:  240, 101, 95;

  /* ---- Type — three roles ---- */
  --font-serif: 'Fraunces', Georgia, serif;                                       /* display */
  --font-sans:  -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; /* body */
  --font-mono:  'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace;      /* labels/data */

  /* ---- Type scale (px) ---- */
  --fs-display: 56px;
  --fs-h1:      40px;
  --fs-h2:      26px;
  --fs-body:    16px;
  --fs-small:   13px;
  --fs-label:   11px;

  /* =========================================================================
   * COMPAT ALIASES — old name → new value. These win the cascade because the
   * old :root colour blocks in site.css / style.css were deleted. Remove each
   * once the consuming stylesheet is migrated to the canonical tokens above.
   * See docs/design/tokens-migration-2026-07-18/README.md for the full mapping.
   * ========================================================================= */

  /* --- site.css (public site) --- */
  --bg:               var(--ink);
  --surface:          var(--ink-2);
  --surface-2:        var(--ink-3);
  --border:           var(--line);
  --text:             var(--paper);
  --muted:            var(--dim);
  --call-green:       var(--live);        /* green is now presence-only… */
  --call-green-hover: var(--amber-deep);  /* …the CTA itself becomes amber */
  --on-green:         var(--on-amber);
  --font:             var(--font-sans);
  /* --maxw: 620px stays a LAYOUT token in site.css (removed in the layout pass). */

  /* --- style.css (app SPA) --- */
  --color-primary:     var(--amber);      /* primary accent is now amber, not blue */
  --color-primary-rgb: var(--amber-rgb);
  --color-accent:      var(--live);       /* call/online green → presence */
  --color-accent-rgb:  var(--live-rgb);
  --color-error:       var(--danger);     /* destructive red → danger */
  --color-error-rgb:   var(--danger-rgb);
  /* --color-danger was aliased to --amber while the wordmark still used it as a
   * decorative pink. The wordmark is mono+dot now, so the only consumers left are
   * destructive ones (.btn-danger = hang up / factory reset, .text-danger). It
   * points at the semantic danger colour: amber means "call", never "delete". */
  --color-danger:      var(--danger);
  /* --font-base/-title/-small (px sizes): kept in style.css for now. */

  /* The retired gradient-wordmark tokens (--doa-pink / --doa-blue) are fully
   * gone: every site.css reference was rewritten to a canonical token (--amber,
   * --on-amber). The app SPA never used them. */
}
