# Typography

Typography pairs Sora for display and UI copy with JetBrains Mono for code, tokens, and numeric tables. Headings scale fluidly between `320px` and `1920px` via `clamp()`, while body text stays fixed at `16px`.

## Font families

| Token | Tailwind | Stack | Use |
| --- | --- | --- | --- |
| --font-display | font-display | Sora, system-ui, -apple-system, sans-serif | Display and headings |
| --font-sans | font-sans | Sora, system-ui, -apple-system, sans-serif | Body copy and UI controls |
| --font-mono | font-mono | "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace | Code, tokens, tabular numbers |

Apply `tabular-nums` on every data table, metric, and token list so columns of numbers align vertically.

## Fluid and fixed type scale

| Step | Tailwind | 320px (size / lh) | 1920px (size / lh) | Mode |
| --- | --- | --- | --- | --- |
| caption | text-caption | 12px / 16px | 12px / 16px | Fixed |
| body | text-body | 16px / 24px | 16px / 24px | Fixed |
| body-lg | text-body-lg | 20px / 28px | 20px / 28px | Fixed |
| h6 | text-h6 | 20px / 28px | 20px / 28px | Fixed |
| h5 | text-h5 | 20px / 28px | 24px / 32px | Fluid clamp |
| h4 | text-h4 | 24px / 32px | 32px / 40px | Fluid clamp |
| h3 | text-h3 | 32px / 40px | 40px / 48px | Fluid clamp |
| h2 | text-h2 | 32px / 40px | 52px / 60px | Fluid clamp |
| h1 | text-h1 | 40px / 48px | 68px / 76px | Fluid clamp |
| display | text-display | 52px / 60px | 88px / 96px | Fluid clamp |

Line heights snap to the `4px` grid at both viewport bounds. Body text never drops below `16px` so mobile browsers do not auto-zoom focused inputs.

## Usage

Apply typography utilities in Tailwind CSS or `--text-*` variables in CSS:

```tsx
<section>
  <h2 className="font-display text-h2 font-semibold tracking-tight">
    Section title
  </h2>
  <p className="mt-4 font-sans text-body">
    Body copy stays at 16px across every viewport.
  </p>
  <p className="mt-2 font-mono text-caption tabular-nums">
    1,024.00 ms
  </p>
</section>
```

```css
.metric-value {
  font-family: var(--font-mono);
  font-size: var(--text-body);
  line-height: var(--text-body--line-height);
  font-variant-numeric: tabular-nums;
}
```

## Do and don't

- **Do: Keep body at 16px and apply tabular-nums to metrics** — Use text-body (16px / 24px) for prose and inputs, and add tabular-nums to tables, timers, and numeric readouts.
- **Don't: Use off-scale Tailwind text sizes or drop body below 16px** — Do not write text-sm, text-base, or text-lg because default Tailwind type classes are disabled and sub-16px inputs trigger iOS zoom.

## Accessibility

- Keeping `body` at `16px` (`1rem`) prevents forced viewport zoom on iOS form inputs and supports browser text scaling.
- Fluid `clamp()` expressions use `rem + vw` units so user zoom preferences still scale headings proportionally.

## Rationale

Deriving steps from `√φ` (`≈1.272`) and snapping line heights to `4px` creates consistent vertical rhythm without media-query font jumps.
