/*
 * typography.css — unified typography scale (Superhuman audit #6).
 *
 * Verbatim _ported/* uses ~40 distinct hardcoded rem values across hundreds
 * of selectors. shell.css has no --fs- tokens to redirect, so the usual
 * TOKEN REDIRECT cascade trick (motion/accent/elevation) doesn't directly
 * apply — we can't retro-collapse the existing literals without rewriting
 * every per-tool stylesheet.
 *
 * What this file DOES:
 *   1. Defines a 7-step --fs-* scale + matching --lh-* line-heights on
 *      :root, so every NEW shell surface (palette, toast, vim nav, empty
 *      states, future audit items) can speak one vocabulary.
 *   2. Snaps the most-egregious sub-readable text (<0.7rem) up to --fs-xs
 *      via a targeted selector set — not a global * sweep, because verbatim
 *      uses 0.62-0.68rem deliberately on dense pill/badge/tag chrome that
 *      breaks if forced larger. Floor applies to body paragraphs, hint
 *      lines, and labels — places where readability beats density.
 *   3. Normalises bare h1-h6 in case verbatim ever ships a heading without
 *      a per-tool selector (rare but cheap to guard).
 *   4. Retrofits the four new premium-feel surfaces (palette / toast /
 *      vim-nav hint / empty states) to consume the tokens, so their
 *      font-sizes appear in `:root` not buried in each module's CSS.
 *
 * What this file does NOT do:
 *   - Override verbatim per-tool font-sizes. Those sizes are intentional
 *     inside their tools' density budget; sweeping them would regress
 *     layouts on tens of tools.
 *
 * Loaded last in the global stylesheet chain (after vimNav.css). Both dark
 * + light theme scopes share the scale — type sizes shouldn't shift on
 * theme toggle.
 */

:root {
  /* Font-size scale — covers ~95% of verbatim cluster centers.
     xs   0.72rem (~11.5px) — pills, badges, small labels, hints
     sm   0.82rem (~13px)   — body small, captions, dense tables
     base 0.88rem (~14px)   — default body in tools
     md   0.95rem (~15px)   — emphasis body, button labels
     lg   1.15rem (~18px)   — subheadings, empty-state h3
     xl   1.4rem  (~22px)   — section headings, large stat values
     2xl  1.8rem  (~29px)   — page headings (.X-header h1)
  */
  --fs-xs: 0.72rem;
  --fs-sm: 0.82rem;
  --fs-base: 0.88rem;
  --fs-md: 0.95rem;
  --fs-lg: 1.15rem;
  --fs-xl: 1.4rem;
  --fs-2xl: 1.8rem;

  /* Matching line-heights. Smaller text needs proportionally larger
     line-height for readability; display sizes can go tighter. */
  --lh-tight: 1.2;     /* headings, stat values */
  --lh-snug: 1.35;     /* subheadings, button labels */
  --lh-base: 1.5;      /* body */
  --lh-loose: 1.65;    /* hint text, long-form paragraphs */
}

/* ---------- Sub-readable floor ----------
   Snap body paragraphs, hint lines, and labelled text under 0.7rem up to
   --fs-xs. Targeted, NOT a * sweep — see header comment for why.
   Hint-class selectors are intentionally narrow (each tool's *-hint /
   *-help / *-label-sub conventions) so dense pills/badges keep their
   tight sizing. */
.mb-empty-hint,
.ad-empty-hint,
.ap-empty-hint,
.as-empty-hint,
.kd-empty-hint,
.lo-empty-hint,
.si-empty-hint,
.ra-empty-hint,
.ds-empty-hint,
.at-empty-hint {
  font-size: var(--fs-xs) !important;
}

/* ---------- Bare h1-h6 normalisation ----------
   Most verbatim headings hang off a per-tool class (.X-header h1, .X-card
   h2 etc.) and stay untouched. These rules only fire for bare h1-h6 that
   inherit nothing — e.g. a future tool prototype, an injected modal, or
   a stray heading inside a shell helper. Per-tool selectors always win
   on specificity, so verbatim layouts don't shift. */
h1 {
  font-family: var(--fd, var(--fb));
  font-size: var(--fs-2xl);
  font-weight: 800;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
}
h2 {
  font-family: var(--fd, var(--fb));
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: -0.008em;
}
h3 {
  font-family: var(--fd, var(--fb));
  font-size: var(--fs-lg);
  font-weight: 700;
  line-height: var(--lh-snug);
  letter-spacing: -0.005em;
}
h4 {
  font-family: var(--fd, var(--fb));
  font-size: var(--fs-md);
  font-weight: 700;
  line-height: var(--lh-snug);
}
h5,
h6 {
  font-family: var(--fb);
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: var(--lh-snug);
}

/* ---------- Retrofit premium-feel shell surfaces ----------
   The four surfaces we own (palette / toast / vim-nav hint / empty states)
   already use ad-hoc rem literals close to the scale. Snap them onto the
   tokens so future scale tweaks ripple. !important defends against any
   per-module CSS that ships later. */

/* Command palette */
.ps-cmdk-input {
  font-size: var(--fs-md) !important;
}
.ps-cmdk-item-title {
  font-size: var(--fs-md) !important;
}
.ps-cmdk-item-sub {
  font-size: var(--fs-xs) !important;
}
.ps-cmdk-footer {
  font-size: var(--fs-xs) !important;
}

/* Toast stack */
.ps-toast-title {
  font-size: var(--fs-base) !important;
}
.ps-toast-msg {
  font-size: var(--fs-sm) !important;
  line-height: var(--lh-base) !important;
}

/* Vim nav hint chip */
.ps-gnav-leader {
  font-size: var(--fs-md) !important;
}
.ps-gnav-sub {
  font-size: var(--fs-xs) !important;
}
.ps-gnav-row {
  font-size: var(--fs-sm) !important;
}
.ps-gnav-row kbd {
  font-size: var(--fs-xs) !important;
}

/* Empty states already use 1.15rem / 0.92rem / 0.85rem — snap onto the
   nearest tokens. (Heading rule lives in emptyStates.css with its own
   !important — this is a no-op echo so the design intent is visible in
   one place if anyone audits typography in the future.) */
.mb-empty h3,
.ad-empty h3,
.ad-history-empty h3,
.ap-empty h3,
.ap-history-empty h3,
.as-empty h3,
.kd-empty h3,
.lo-empty h3,
.lo-history-empty h3,
.si-empty h3,
.ra-empty h3,
.ds-empty h3,
.at-empty h3 {
  font-size: var(--fs-lg) !important;
  line-height: var(--lh-snug) !important;
}
