/* ─────────────────────────────────────────────────────────────────────────
 * LETA design-system bridge for NickOS
 *
 * NickOS's markup and CSS reference ~2,200 var(--…) names of its own. Rather
 * than rewrite all of them, this file redefines what those names resolve to,
 * pointing each at a LETA token. Re-skinning the app is therefore a change of
 * mapping, not a change of markup.
 *
 * Load order matters. This file must come AFTER leta/tokens.css so the
 * --fonts-family-inter-variable override below wins, and after
 * leta/dark-elevation.css so --scrim can read --leta-overlay-scrim.
 *
 * RULE: only ever map to LETA's *mapped tier* — --surface-*, --text-*,
 * --border-*, --icons-*. Those are the only tokens that flip under
 * [data-theme="dark"]. Mapping to a --colors-* alias or a --primitive-* value
 * looks identical today and silently breaks the day dark mode ships.
 * ───────────────────────────────────────────────────────────────────────── */

:root {

  /* ── Typeface ───────────────────────────────────────────────────────────
   * No override here any more. Until 0.4.1 we loaded Inter from Google Fonts,
   * where the family is called "Inter" — but the tokens resolve to
   * "Inter Variable", so every one of the 42 typography classes silently fell
   * back to a system font unless we re-pointed the variable.
   *
   * @leta-io/design-tokens/fonts now ships the real @fontsource face under its
   * proper name, imported by frontend/src/entries/tokens.ts and self-hosted, so
   * the token resolves correctly on its own. Re-adding an override here would
   * now point at a family that is not loaded.
   */

  /* ── Neutrals ─────────────────────────────────────────────────────────── */

  /* Canvas is bg-raised (#f5f5f5), not page-secondary (#fafafa): NickOS is
   * wall-to-wall card grids and needs the figure/ground separation. #fafafa
   * against #fefefe cards is ~1.4% luminance and reads flat. */
  --bg:        var(--surface-neutral-bg-raised);
  --surface:   var(--surface-neutral-card-idle);
  --surface2:  var(--surface-neutral-bg-muted);

  --border:    var(--border-neutral-default);
  /* --border-md is only used for interaction emphasis (.k-card:hover,
   * .col-drop.over, the mobile burger), so card-pressed is the right slot.
   * It is visibly heavier than the old rgba(0,0,0,.14) — intentional. */
  --border-md: var(--border-neutral-card-pressed);

  --text:       var(--text-default-body);
  /* Both of these darken against the old values (#7a7970 → #4f4f4f,
   * #b0afa6 → #808080). That is a deliberate contrast fix, not drift:
   * --text-light was failing at ~2.0:1 on the old cream canvas. */
  --text-muted: var(--text-default-sub-body);
  --text-light: var(--text-default-helper);

  --gray-dot:   var(--icons-neutral-idle);

  /* ── Status: green → success ──────────────────────────────────────────── */
  --green:     var(--text-success-label);
  --green-bg:  var(--surface-success-bg-subtle);
  --green-dot: var(--surface-success-bg);

  /* Amber → caution (not warning): decided 2026-09-09.
   * Original amber dot (#EF9F27) was closer to warning's orange (#fb8500),
   * but warning's text token (--text-warning-default #fb8500) only hits
   * ~2.3:1 on --surface-warning-bg-subtle — fails WCAG AA, illegible at 10px.
   * Caution's mapped-tier tokens (e.g. --text-caution-label #956b1d, ~4.9:1)
   * pass, and — critically — stay theme-aware for the planned dark mode.
   * Tradeoff accepted: amber's dot/solid visibly shifts from orange to
   * caution's yellow (#f9b330). Do not "fix" this back toward warning's
   * orange without re-solving the contrast + dark-mode-token problem.
   */
  --amber:     var(--text-caution-label);
  --amber-bg:  var(--surface-caution-bg-subtle);
  --amber-dot: var(--surface-caution-bg);

  /* Status: red → error. Note --red and --red-dot now resolve to the same
   * #cd3234: LETA has no separate "dot" tier, so the old two-tone red
   * (#A32D2D text / #E24B4A dot) flattens to one. Accepted. */
  --red:       var(--text-error-default);
  --red-bg:    var(--surface-error-bg-subtle);
  --red-dot:   var(--surface-error-bg);

  /* Status: blue → information */
  --blue:      var(--text-information-label);
  --blue-bg:   var(--surface-information-bg-subtle);
  --blue-dot:  var(--surface-information-bg);

  /* Badge hairlines. NickOS had no equivalent — badges were fill+text only.
   * LETA's badge borders give them definition at 10px. */
  --green-border: var(--border-success-desktop-badge);
  --amber-border: var(--border-caution-desktop-badge);
  --red-border:   var(--border-error-desktop-badge);
  --blue-border:  var(--border-information-desktop-badge);

  /* ── Geometry ─────────────────────────────────────────────────────────── */
  --radius:    var(--rounding-xl);   /* 12px — exact match to the old value */
  --radius-sm: var(--rounding-lg);   /*  8px — exact match */
  --radius-pill: var(--rounding-round);

  /* 224px is not on LETA's scale ladder (…16, 18, 20, 24…, 256). Kept as a
   * literal rather than forced onto a token that does not mean this. */
  --nav-w: 224px;

  /* ── Elevation ────────────────────────────────────────────────────────── */
  /* NickOS had no shadow tokens — four hardcoded shadows scattered across
   * base.html and tasks.css. These give them a home. */
  --shadow-sm: var(--shadow-neutral-1);
  --shadow-md: var(--shadow-neutral-2);
  --shadow-lg: var(--shadow-neutral-3);

  /* Overlay scrim comes from leta/dark-elevation.css, which also darkens it
   * under [data-theme="dark"]. Fallback matches its light value. */
  --scrim: var(--leta-overlay-scrim, rgb(16 16 16 / 0.40));
}

/* ── Numerics ───────────────────────────────────────────────────────────────
 * DM Mono is gone and LETA ships no mono family. Uppercase micro-labels move
 * to Inter via the caption/label text styles; genuinely tabular content keeps
 * column alignment through tabular-nums instead of a second typeface.
 * .mono is kept as a class name so the ~20 existing usages keep working.
 * ─────────────────────────────────────────────────────────────────────────── */
.mono,
.tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
