/* Base rules every project uses with the tokens. Small on purpose: parts do the rest. */
/* Sizes include padding and border, so a 40 control is 40 and a 400 dialog is 400 */
:where(*, *::before, *::after) { box-sizing: border-box; }
:where(html) { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
:where(body) { margin: 0; background: var(--color-surface-page); color: var(--color-text-primary); font-family: var(--font-sans); font-weight: var(--font-weight-reading); font-size: var(--type-body-size); line-height: var(--type-body-leading-wrapped); }
/* Text is trimmed to cap height and baseline; gaps are measured from the letters, never with margins */
:where(h1, h2, h3, h4, h5, h6, p, li, dt, dd, label, figcaption, blockquote, td, th, span.trim) { text-box: trim-both cap alphabetic; margin: 0; }
:where(ul, ol, dl, menu, figure) { margin: 0; }
:where(h1, h2, h3, h4, h5, h6) { text-wrap: balance; font-weight: var(--font-weight-emphasis); }
:where(p, li, dd, blockquote) { text-wrap: pretty; max-width: var(--layout-measure); }
/* Inline links: text colour, thin underline, darker under a mouse (T18, T21) */
:where(p, li, dd) a { color: inherit; text-decoration: underline; text-decoration-thickness: var(--line-hairline); text-underline-offset: var(--line-underline-offset); text-decoration-color: var(--color-line-strong); }
@media (hover: hover) { :where(p, li, dd) a:hover { text-decoration-color: currentColor; } }
::selection { background: var(--color-accent-selection); color: inherit; }
/* Keyboard focus only: 2px ring, 2 out, following the corner (W2, W3) */
:where(:focus-visible) { outline: var(--line-focus-width) solid var(--color-line-focus); outline-offset: var(--line-focus-offset); }
:where(:focus:not(:focus-visible)) { outline: none; }
/* Fixed-width figures where small; proportional where big (section 4) */
:where(table, .tabular, time, [data-figures="tabular"]) { font-variant-numeric: tabular-nums; }
/* No italics in UI or body text; display headings may opt in per project (T4) */
:where(em, i, cite, var, address) { font-style: normal; }
/* Fields are 16px on phones so iPhone never zooms */
@media (pointer: coarse) { :where(input, textarea, select) { font-size: max(var(--font-size-16), 1em); } }
