/**
 * Text roles — the only way markup sets typography (r-39 step b3).
 *
 * Each class combines type tokens from tokens.css into one named role, so a
 * role changes in one place for the whole app. HTML and JS name a role here
 * instead of writing font-size/family/weight, letter-spacing, text-transform
 * or line-height inline; `npm run check-typography` enforces that.
 *
 * Colour: a role only carries a colour when that role always has it (labels,
 * captions). Elsewhere the colour stays with the context.
 *
 * @see docs/architecture/ui-design-system.md §13 "Text roles"
 * @see docs/architecture/module-map/typography.css.md
 */

/* Section labels, field labels (.field-label, forms.css) and small table
   headers: "HISTORY", "CUSTOMER", "QTY" */
.text-label,
.field-label {
  font-family: var(--font-family-head);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-heavy);
  letter-spacing: var(--letter-spacing-md);
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

/* Meta lines, empty states, secondary cell lines */
.text-caption {
  font-family: var(--font-family-body);
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

/* Default reading text: item tables, selects, prompt text */
.text-body {
  font-family: var(--font-family-body);
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
}

/* Entity names in table cells (customer, case) */
.text-name {
  font-family: var(--font-family-head);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
}

/* Small pop-up titles: "Change Status", "Add Note" */
.text-title {
  font-family: var(--font-family-head);
  font-size: var(--font-size-lg);
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-tracking);
  color: var(--color-text-primary);
}

/* RULE: the key and number font is a per-person preference (r-152, Peter
   2026-11-03: "I like all four"). My profile → Appearance stores it with the
   account; js/theme-prepaint.js puts data-key-font on <html> before the first
   frame; every key, date and number reads --font-family-mono. No attribute =
   JetBrains Mono (tokens.css). utils/key-font-preference.js KEY_FONTS. */
:root[data-key-font="inter"] { --font-family-mono: var(--font-family-body); }
:root[data-key-font="plex"] { --font-family-mono: var(--font-family-mono-plex); }
:root[data-key-font="roboto"] { --font-family-mono: var(--font-family-mono-roboto); }

/* Codes and amounts; keeps the surrounding size, colour comes from context.
   Keys, dates and numbers are weight 500 with tabular numerals (r-152). */
.text-mono {
  font-family: var(--font-family-mono);
  font-weight: var(--font-weight-medium);
  font-variant-numeric: tabular-nums;
}

.text-mono-strong {
  font-family: var(--font-family-mono);
  font-variant-numeric: tabular-nums;
  font-weight: var(--font-weight-bold);
}

/* Code and log text (a stack trace, a log entry's values): always the fixed
   monospace, never the person's key font (r-152 review F4). */
.text-code {
  font-family: var(--font-family-code);
}

/* Tone helpers: colour only, for a message, icon or link that needs a
   status colour on top of its text role (r-39 f5r-c). */
.text-warning { color: var(--color-warning); }
.text-accent { color: var(--color-accent); }
.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-on-header-strong { color: var(--color-on-header-strong); }
/* Takes the surrounding colour, e.g. a message inside an empty state */
.text-inherit { color: inherit; }

/* App name in the sidebar */
.text-brand {
  font-family: var(--font-family-head);
  font-size: var(--font-size-xl);
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-tracking);
  line-height: 1;
}

/* Icon sizes for standalone icons; icons inside text inherit its size */
.icon-sm { font-size: var(--icon-sm); }
.icon-md { font-size: var(--icon-md); }
.icon-lg { font-size: var(--icon-lg); }
.icon-xl { font-size: var(--icon-xl); }

/* Large glyph for loading, empty and error states */
.state-icon {
  font-size: var(--icon-2xl);
}

/* Softer state glyphs: a hint ("click a row") and an empty inbox */
.state-icon-faint { opacity: 0.25; }
.state-icon-dim { opacity: 0.35; }
