/*
 * V1-TYPOGRAPHY-EDITORIAL-1.0 — Premium-M3 (HYP-OPS-205)
 *
 * Premium type stack + scale + rhythm. PREFIX: --p-font-*, --p-type-*,
 * --p-tracking-*, --p-weight-*. These coexist with the legacy
 * --sans / --mono / --fs-* / --fw-* variables in client_v2.html.
 *
 * Premium discipline:
 *   - NO Google Fonts CDN dependency (privacy + speed; the owner-local
 *     install runs offline by default).
 *   - System font stack (Stripe / Linear / Vercel approach): each OS
 *     renders its premium sans/mono natively. SF Pro on macOS, Segoe
 *     UI Variable on Windows, Inter on systems that have it.
 *   - 8-step type scale with explicit line-height + tracking anchors
 *     (no ambient `font-size:; line-height:` lottery).
 *   - 3 tracking tokens (tight / normal / wide); wide is reserved for
 *     uppercase micro-labels.
 *   - 4 weights (regular / medium / semibold / bold).
 *
 * Forbidden by construction:
 *   - NO @import url(fonts.googleapis.com); the existing legacy import
 *     is left in client_v2.html and the legacy --sans / --mono
 *     variables continue to resolve to the system stack via their
 *     fallback chain when the network is unavailable.
 *   - NO web font @font-face from a CDN; if self-hosting is ever
 *     authorised, it lands as a separate slice with its own Fase 0.
 *   - NO icon-font shenanigans here (icons are inline SVG; this file
 *     is type-only).
 */

:root {
  /* ─── FONT STACKS — premium system fonts, OS-native rendering ── */
  /*
   * The sans stack mirrors the modern Vercel / Linear / Stripe choice:
   * each OS picks its premium sans, with Inter as a soft fallback on
   * systems that have it manually installed and a final system-ui /
   * sans-serif backstop. NO commercial font downloaded.
   */
  --p-font-sans:
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI Variable",
    "Segoe UI",
    Inter,
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;

  --p-font-mono:
    ui-monospace,
    SFMono-Regular,
    "SF Mono",
    Menlo,
    Consolas,
    "Liberation Mono",
    "Roboto Mono",
    monospace;

  /*
   * Display stack is the SAME as the sans stack — no separate display
   * font. Premium = restraint; we lean weight + tracking, not a third
   * family.
   */
  --p-font-display: var(--p-font-sans);

  /* ─── TYPE SCALE — 8 steps, size/line-height anchored ─────────── */
  /*
   * Each token encodes ONLY a font-size. Line-height is paired via the
   * --p-line-* tokens from Premium-M2 (fex_premium_tokens.css). The
   * intent is that consumers pick a size + an explicit line anchor
   * rather than relying on a single hardcoded line-height per size.
   */
  --p-type-micro:      11px;
  --p-type-caption:    12px;
  --p-type-body:       14px;
  --p-type-emphasis:   15px;
  --p-type-title-sm:   17px;
  --p-type-title-md:   20px;
  --p-type-title-lg:   26px;
  --p-type-display:    36px;

  /* ─── TRACKING — 3 anchors ─────────────────────────────────────── */
  --p-tracking-tight:   -0.02em;
  --p-tracking-normal:  0;
  --p-tracking-wide:    0.04em;

  /* ─── WEIGHTS — 4 anchors ──────────────────────────────────────── */
  --p-weight-regular:   400;
  --p-weight-medium:    500;
  --p-weight-semibold:  600;
  --p-weight-bold:      700;
}

/*
 * Premium body baseline. The legacy `body { font-family: var(--sans); }`
 * rule in client_v2.html still wins (loaded after this file), but the
 * legacy --sans variable falls back through its chain to system-ui /
 * sans-serif when the Google Fonts @import is unavailable, which makes
 * the SAME premium stack render either way. This rule is a defense-
 * in-depth — if the legacy import is ever removed, the shell still
 * picks up the premium stack from THIS file.
 *
 * font-feature-settings:
 *   "ss01"  — stylistic alternates (where the font has them; SF Pro
 *             uses ss01 for the alt 'a').
 *   "cv11"  — tabular numbers in Inter; ignored elsewhere.
 *   "tnum"  — tabular numbers everywhere for data tables.
 *   "kern"  — kerning on.
 */
html, body {
  font-feature-settings: "kern" 1, "tnum" 1, "ss01" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/*
 * Tabular-numbers utility class for data tables, KPI counters and any
 * inline number that should line up vertically across rows.
 */
.p-tnum {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "kern" 1;
}

/*
 * Mono utility class for inline data (case_id, sha, etc.).
 */
.p-mono {
  font-family: var(--p-font-mono);
}

/*
 * Uppercase micro-label utility class — used for section heads,
 * boundary line callouts, and chip labels. Pairs WIDE tracking with
 * the MICRO size by convention.
 */
.p-micro-label {
  font-size: var(--p-type-micro);
  letter-spacing: var(--p-tracking-wide);
  text-transform: uppercase;
  font-weight: var(--p-weight-medium);
}
