@filipgutica/design-system 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +20 -8
  2. package/dist/class/base.css +188 -0
  3. package/dist/class/themes/graphite-indigo.css +133 -0
  4. package/dist/themes/graphite-indigo.css +9 -0
  5. package/dist/tokens.d.ts +117 -0
  6. package/dist/tokens.js +222 -0
  7. package/dist/tokens.json +218 -0
  8. package/fonts/OFL-IBM-Plex-Mono.txt +93 -0
  9. package/fonts/OFL-IBM-Plex-Sans.txt +93 -0
  10. package/fonts/fonts.css +55 -0
  11. package/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
  12. package/fonts/ibm-plex-mono-latin-500-normal.woff2 +0 -0
  13. package/fonts/ibm-plex-mono-latin-600-normal.woff2 +0 -0
  14. package/fonts/ibm-plex-sans-latin-400-normal.woff2 +0 -0
  15. package/fonts/ibm-plex-sans-latin-500-normal.woff2 +0 -0
  16. package/fonts/ibm-plex-sans-latin-600-normal.woff2 +0 -0
  17. package/language/DESIGN.md +29 -29
  18. package/language/components.html +189 -189
  19. package/language/components.md +55 -55
  20. package/language/decisions.md +96 -18
  21. package/language/docs.html +20 -20
  22. package/language/product.html +22 -22
  23. package/language/reference.html +213 -213
  24. package/language/tokens.css +142 -143
  25. package/language/visualizations/build-count-report.mjs +4 -2
  26. package/language/visualizations/report.css +2 -2
  27. package/package.json +33 -6
  28. package/scripts/build-tokens.mjs +0 -236
  29. package/tokens/graphite-indigo.json +0 -298
  30. /package/language/{themes → editor-themes}/graphite-indigo/LICENSE +0 -0
  31. /package/language/{themes → editor-themes}/graphite-indigo/README.md +0 -0
  32. /package/language/{themes → editor-themes}/graphite-indigo/SOURCE.json +0 -0
  33. /package/language/{themes → editor-themes}/graphite-indigo/THIRD_PARTY_NOTICES.md +0 -0
  34. /package/language/{themes → editor-themes}/graphite-indigo/graphite-indigo.t3-theme.json +0 -0
  35. /package/language/{themes → editor-themes}/graphite-indigo/package.json +0 -0
  36. /package/language/{themes → editor-themes}/graphite-indigo/themes/graphite-indigo-dark-color-theme.json +0 -0
  37. /package/language/{themes → editor-themes}/graphite-indigo/themes/graphite-indigo-light-color-theme.json +0 -0
@@ -11,7 +11,7 @@ Each section has the same parts: anatomy, tokens, states, keyboard and screen re
11
11
  | Core | Tokens, depth, controls and their states, focus, motion, accessibility, forced colors | Adopts it as is |
12
12
  | Identity | The terminal folio look: the `~/name` header, the project registry, mono display headings, `##` section marks, terminal plates, captures, and the mono section rail | Replaces it with its own |
13
13
 
14
- The identity layer reads only the identity tokens (`--project`, `--project-dark`, `--font-sans`, `--font-mono`) and the terminal tokens. A core component never depends on an identity component.
14
+ The identity layer reads only the identity tokens (`--color-project`, `--color-project-dark`, `--font-ui`, `--font-mono`) and the terminal tokens. A core component never depends on an identity component.
15
15
 
16
16
  ## Rules for every control
17
17
 
@@ -19,29 +19,29 @@ The identity layer reads only the identity tokens (`--project`, `--project-dark`
19
19
  - **Borders.** Every control keeps a 1px border, transparent unless its section says otherwise, so forced colors can draw an edge.
20
20
  - **Depth.** Each control takes its shadow from the [depth tiers](DESIGN.md#depth).
21
21
  - **Press.** Only a button has a pressed state; see [Button](#button). A [quiet action](#quiet-action) tints on press without sinking. Other controls have no `:active` treatment: they show their latched state as their section says.
22
- - **Focus.** One ring for every role but fields: `outline: var(--focus-width) solid var(--focus); outline-offset: var(--focus-offset)` (2px, 3px), with no halo or glow. `--focus` is the accent (`--accent`), which reaches 3:1 on `--bg`, `--surface`, and `--surface-raised` in both themes. It sits around primary, danger, and selected controls too. Do not give a role its own ring colour; where a variant must recolour the ring, set only `outline-color`. The ring is drawn over the control's own raise or sink shadow, which does not change. It goes on the visible part of a composite control: the switch track, the radio card, and the slider thumb. A dark plate (command plate, terminal capture) sets `--focus: var(--project-dark)`, the dark-theme accent, which reaches 3:1 on the plate in both page themes. In forced colors, a control that opts out of adjustment (a checked box, the switch track, a pressed segmented option) sets `outline-color: CanvasText`. Inside a scrolling or clipping parent, the ring is inset (`outline-offset: calc(var(--focus-width) * -1)`), and a comment names the reason. Only `:focus-visible` shows a ring; pointer hover never does.
23
- - **Field focus.** Fields (input, select, textarea, and the search wrapper) draw no ring. On `:focus-visible` (the search wrapper uses `:has(input:focus-visible)`) the 1px edge turns `--accent`, and `--field-shadow-focus` (`inset 0 0 0 2px`, the accent at 18% over transparent) draws a muted accent line inside it, with `outline: none`. The fill does not change in either theme. An invalid field keeps its `--danger` edge while focused, and its inset line is `--field-shadow-focus-invalid` (`--danger` at 18%). Forced colors drop the inset line, so a focused field there draws `outline: var(--focus-width) solid Highlight; outline-offset: -1px`.
24
- - **Disabled.** Opacity 0.58, `cursor: not-allowed`, and no hover or press. Buttons drop their shadow. Fields drop theirs and fill with the `--field` well (the grey well in light; the same as rest in dark). Other controls keep theirs. Use the native `disabled` attribute. A link styled as a button has no disabled state: use `<button disabled>`.
25
- - **Invalid.** Fields only: `aria-invalid="true"` and a `--danger` border (not in forced colors; see [field focus](#rules-for-every-control)). Other controls show an invalid state through the [field wrapper](#field-wrapper)'s error text. Link the error text with `aria-describedby` or `aria-errormessage`.
22
+ - **Focus.** One ring for every role but fields: `outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset)` (2px, 3px), with no halo or glow. `--color-focus` is the accent (`--color-accent`), which reaches 3:1 on `--color-bg`, `--color-surface`, and `--color-surface-raised` in both themes. It sits around primary, danger, and selected controls too. Do not give a role its own ring colour; where a variant must recolour the ring, set only `outline-color`. The ring is drawn over the control's own raise or sink shadow, which does not change. It goes on the visible part of a composite control: the switch track, the radio card, and the slider thumb. A dark plate (command plate, terminal capture) sets `--color-focus: var(--color-project-dark)`, the dark-theme accent, which reaches 3:1 on the plate in both page themes. In forced colors, a control that opts out of adjustment (a checked box, the switch track, a pressed segmented option) sets `outline-color: CanvasText`. Inside a scrolling or clipping parent, the ring is inset (`outline-offset: calc(var(--focus-width) * -1)`), and a comment names the reason. Only `:focus-visible` shows a ring; pointer hover never does.
23
+ - **Field focus.** Fields (input, select, textarea, and the search wrapper) draw no ring. On `:focus-visible` (the search wrapper uses `:has(input:focus-visible)`) the 1px edge turns `--color-accent`, and `--shadow-field-focus` (`inset 0 0 0 2px`, the accent at 18% over transparent) draws a muted accent line inside it, with `outline: none`. The fill does not change in either theme. An invalid field keeps its `--color-error` edge while focused, and its inset line is `--shadow-field-focus-invalid` (`--color-error` at 18%). Forced colors drop the inset line, so a focused field there draws `outline: var(--focus-width) solid Highlight; outline-offset: -1px`.
24
+ - **Disabled.** Opacity 0.58, `cursor: not-allowed`, and no hover or press. Buttons drop their shadow. Fields drop theirs and fill with the `--color-well` well (the grey well in light; the same as rest in dark). Other controls keep theirs. Use the native `disabled` attribute. A link styled as a button has no disabled state: use `<button disabled>`.
25
+ - **Invalid.** Fields only: `aria-invalid="true"` and a `--color-error` border (not in forced colors; see [field focus](#rules-for-every-control)). Other controls show an invalid state through the [field wrapper](#field-wrapper)'s error text. Link the error text with `aria-describedby` or `aria-errormessage`.
26
26
  - **Motion.** Hover and press transitions use `--duration-fast` with `--ease-out`. State changes such as a switch knob use `--duration`. Under `prefers-reduced-motion: reduce`, transitions are instant.
27
27
 
28
28
  ## Button
29
29
 
30
30
  Layer: Core. ui: `UiButton`.
31
31
 
32
- - **Anatomy.** A native `<button>` with a label and an optional 16px leading icon. A link that should look like a button is an `<a>` with the same classes and no underline; in `@filipgutica/ui`, `class="fg-button"` with `data-variant` and `data-size`. Medium weight, `-0.01em` tracking, line height 1.25, `--radius-md` (pill). Horizontal padding is 10px at `sm`, `--space-3` at `md`, and `--space-4` at `lg`.
32
+ - **Anatomy.** A native `<button>` with a label and an optional 16px leading icon. A link that should look like a button is an `<a>` with the same classes and no underline; in `@filipgutica/ui`, `class="fg-button"` with `data-variant` and `data-size`. Medium weight, `-0.01em` tracking, line height 1.25, `--radius-control` (pill). Horizontal padding is 10px at `sm`, `--space-3` at `md`, and `--space-4` at `lg`.
33
33
  - **Variants.**
34
34
 
35
35
  | Variant | Rest | Hover | Pressed |
36
36
  | --- | --- | --- | --- |
37
- | Primary | `--accent` fill, `--accent-text`, `--shadow-raise` | `--button-hover` | `--button-hover`, `--shadow-sink` |
38
- | Secondary | `--control-thumb` fill, `--text`, `--shadow-raise` | `--text` 8% into `--control-thumb` | `--field` fill, `--shadow-sink` |
39
- | Ghost | Transparent, `--text-muted`, no shadow | `--row-hover` fill, `--text` | `--field` fill, `--shadow-sink` |
40
- | Danger | `--danger-soft` fill, `--danger` mixed 75% with `--text` (85% in dark), `--shadow-raise` | `--danger` 10% into `--danger-soft` | `--danger` 16% into `--danger-soft`, `--shadow-sink` |
41
- | Text | Transparent, `--link`, underlined, 4px padding | No change | No change |
37
+ | Primary | `--color-accent` fill, `--color-accent-text`, `--shadow-raise` | `--color-button-hover` | `--color-button-hover`, `--shadow-sink` |
38
+ | Secondary | `--color-control-thumb` fill, `--color-text`, `--shadow-raise` | `--color-text` 8% into `--color-control-thumb` | `--color-well` fill, `--shadow-sink` |
39
+ | Ghost | Transparent, `--color-muted`, no shadow | `--color-row-hover` fill, `--color-text` | `--color-well` fill, `--shadow-sink` |
40
+ | Danger | `--color-error-surface` fill, `--color-error` mixed 75% with `--color-text` (85% in dark), `--shadow-raise` | `--color-error` 10% into `--color-error-surface` | `--color-error` 16% into `--color-error-surface`, `--shadow-sink` |
41
+ | Text | Transparent, `--color-link`, underlined, 4px padding | No change | No change |
42
42
 
43
43
  - **States.** Pressed also moves the button 1px down, for every variant but text, and applies to `aria-pressed="true"`. Busy sets `aria-busy="true"` and `disabled`, so the button takes no hover or press, with `cursor: wait`. It shows a 14px spinner before the label: a 2px `currentColor` ring with a transparent right edge, turning once every 700ms. Keep the label while busy.
44
- - **Danger label.** Check the label at 4.5:1 on the rest, hover, and pressed fills. Where the mix misses, use the first of `--text`, black, and white that reads on all three.
44
+ - **Danger label.** Check the label at 4.5:1 on the rest, hover, and pressed fills. Where the mix misses, use the first of `--color-text`, black, and white that reads on all three.
45
45
  - **Use.** One primary action for each decision group. The hue fill marks that action; every other action is secondary, ghost, or text.
46
46
  - **Keyboard and screen reader.** Native button behavior: Enter and Space activate it. An icon-only button needs `aria-label`.
47
47
  - **Motion.** Fill and shadow transition over `--duration-fast`. Reduced motion slows the spinner to 1.4s instead of stopping it, so the busy state stays visible. The `tokens.css` base holds that exception.
@@ -52,8 +52,8 @@ Layer: Core. ui: `UiButton`.
52
52
  Layer: Core. ui: the `fg-quiet-action` class.
53
53
 
54
54
  - **Use.** An icon or short text action inside a component: code block and command list Copy, capture Full size, dialog and drawer close, and the project trigger. Use a [button](#button) for an action that stands on its own.
55
- - **Anatomy.** A native `<button>`, or the `<summary>` of a menu. Transparent fill, a transparent 1px border, `--radius-md`, and `--text-muted`. The content is centred in the box. An icon-only action holds an SVG icon, never a text glyph such as ×, because a font draws a glyph's ink off the centre of its box. Give the shared recipe zero specificity (`:where()`), so each component sets the action's size, place, and resting colour.
56
- - **States.** Hover turns the text `--text` and fills `currentColor` at 12% over transparent. Pressed fills `currentColor` at 18%, with no sink. Focus-visible is the focus ring, inset where the parent clips. An open menu keeps its trigger at the 12% tint, below the press. The code block's Copy keeps the block's text colour on hover. A disabled quiet action follows the shared [disabled](#rules-for-every-control) rule.
55
+ - **Anatomy.** A native `<button>`, or the `<summary>` of a menu. Transparent fill, a transparent 1px border, `--radius-control`, and `--color-muted`. The content is centred in the box. An icon-only action holds an SVG icon, never a text glyph such as ×, because a font draws a glyph's ink off the centre of its box. Give the shared recipe zero specificity (`:where()`), so each component sets the action's size, place, and resting colour.
56
+ - **States.** Hover turns the text `--color-text` and fills `currentColor` at 12% over transparent. Pressed fills `currentColor` at 18%, with no sink. Focus-visible is the focus ring, inset where the parent clips. An open menu keeps its trigger at the 12% tint, below the press. The code block's Copy keeps the block's text colour on hover. A disabled quiet action follows the shared [disabled](#rules-for-every-control) rule.
57
57
  - **Keyboard and screen reader.** Native button behavior. An icon-only action needs `aria-label`.
58
58
  - **Motion.** Fill and colour change over `--duration-fast` with `--ease-out`.
59
59
  - **Forced colors.** The transparent border draws as the system edge.
@@ -63,19 +63,19 @@ Layer: Core. ui: the `fg-quiet-action` class.
63
63
  Layer: Core. ui: `UiInput`. ui has no textarea; a textarea uses the same field recipe.
64
64
 
65
65
  - **Anatomy.** A native `<input>` or `<textarea>`. Full width, line height 1.35. Input heights follow the control size, and horizontal padding is about 9px, 10px, or 11px.
66
- - **Tokens.** Fill `--field-bg` (`--surface-raised` in light, the sunk `--field` well in dark), text `--text`, placeholder `--text-muted` at full opacity, corners `--radius-field`, border 1px `--field-edge` (`--border-subtle`), shadow `--field-shadow` (none in light, `--shadow-sink` in dark).
67
- - **States.** Rest, focus-visible (the accent edge and inset line from [field focus](#rules-for-every-control)), disabled (the `--field` well, no shadow), invalid (`--danger` border), and invalid while focused (`--danger` border and a `--danger` inset line). A textarea keeps the same padding at the top and bottom as at the sides, and resizes vertically only.
66
+ - **Tokens.** Fill `--color-field-bg` (`--color-surface-raised` in light, the sunk `--color-well` well in dark), text `--color-text`, placeholder `--color-muted` at full opacity, corners `--radius-field`, border 1px `--color-field-edge` (`--color-border-subtle`), shadow `--shadow-field` (none in light, `--shadow-sink` in dark).
67
+ - **States.** Rest, focus-visible (the accent edge and inset line from [field focus](#rules-for-every-control)), disabled (the `--color-well` well, no shadow), invalid (`--color-error` border), and invalid while focused (`--color-error` border and a `--color-error` inset line). A textarea keeps the same padding at the top and bottom as at the sides, and resizes vertically only.
68
68
  - **Keyboard and screen reader.** Each field has a visible `<label>`. A search field is the one exception: its leading magnifier and an accessible name that names the search (`aria-label`, or a visually hidden `<label>`) stand in for the visible label. A field inside a [field wrapper](#field-wrapper) gets its description and error ids from it.
69
69
  - **Motion.** None.
70
- - **Search.** `type="search"` keeps the native clear button, quieted to a 12px cross drawn with a `mask` (1.5px round strokes) and filled `--text-muted`, with `--space-2` before it. Hover fills it `--text`. The cross sits at the input's trailing edge, so inside a field wrapper with an icon or key hint the input takes the free space (`flex: 1`, `min-width: 0`) and the wrapper carries the width. The wrapper carries the field fill, edge, shadow, and focus, so the input inside it draws nothing. In forced colors the cross opts out of adjustment and fills `CanvasText`, so the mask keeps a visible fill.
71
- - **Forced colors.** The border draws as the system field edge. The inset line drops, so a focused field draws a `Highlight` outline just inside its edge. The system edge replaces the `--danger` edge, so the invalid state relies on its error text there; see [known gaps](decisions.md#known-gaps).
70
+ - **Search.** `type="search"` keeps the native clear button, quieted to a 12px cross drawn with a `mask` (1.5px round strokes) and filled `--color-muted`, with `--space-2` before it. Hover fills it `--color-text`. The cross sits at the input's trailing edge, so inside a field wrapper with an icon or key hint the input takes the free space (`flex: 1`, `min-width: 0`) and the wrapper carries the width. The wrapper carries the field fill, edge, shadow, and focus, so the input inside it draws nothing. In forced colors the cross opts out of adjustment and fills `CanvasText`, so the mask keeps a visible fill.
71
+ - **Forced colors.** The border draws as the system field edge. The inset line drops, so a focused field draws a `Highlight` outline just inside its edge. The system edge replaces the `--color-error` edge, so the invalid state relies on its error text there; see [known gaps](decisions.md#known-gaps).
72
72
 
73
73
  ## Select
74
74
 
75
75
  Layer: Core. ui: `UiSelect`.
76
76
 
77
- - **Anatomy.** A native `<select>` with the input's field recipe and a chevron on the right. Draw the chevron in `currentColor`, or with an 8px border corner in `--text-muted` turned 45°. Right padding leaves room for it at every size.
78
- - **Picker.** Where `appearance: base-select` is supported, the open list is a floating layer: `--surface-raised`, a transparent 1px border, `--radius-lg`, `--shadow-popover`, 4px padding, at least the select's width, and at most `min(20rem, 50dvh)` tall. Options are at least 32px tall (44px on coarse pointers), with `--space-2` `--space-3` padding and corners of `--radius-lg` minus 4px. Hover fills `--row-hover`. An `--accent` check at the end marks the checked option. The check carries the state: the option's `--row-selected` fill equals `--surface-raised`. Keyboard focus is the focus ring, inset because the list scrolls. Other browsers keep the native picker.
77
+ - **Anatomy.** A native `<select>` with the input's field recipe and a chevron on the right. Draw the chevron in `currentColor`, or with an 8px border corner in `--color-muted` turned 45°. Right padding leaves room for it at every size.
78
+ - **Picker.** Where `appearance: base-select` is supported, the open list is a floating layer: `--color-surface-raised`, a transparent 1px border, `--radius-panel`, `--shadow-dialog`, 4px padding, at least the select's width, and at most `min(20rem, 50dvh)` tall. Options are at least 32px tall (44px on coarse pointers), with `--space-2` `--space-3` padding and corners of `--radius-panel` minus 4px. Hover fills `--color-row-hover`. An `--color-accent` check at the end marks the checked option. The check carries the state: the option's `--color-row-selected` fill equals `--color-surface-raised`. Keyboard focus is the focus ring, inset because the list scrolls. Other browsers keep the native picker.
79
79
  - **States.** Rest, focus-visible, disabled, invalid, and invalid while focused, as for the input.
80
80
  - **Keyboard and screen reader.** Native select behavior. A visible `<label>`.
81
81
  - **Motion.** None.
@@ -86,15 +86,15 @@ Layer: Core. ui: `UiSelect`.
86
86
  Layer: Core. ui: `UiField`.
87
87
 
88
88
  - **Anatomy.** A grid with a 6px gap: label, control, then a description or an error. The error replaces the description.
89
- - **Tokens.** Label `--text-sm` semibold `--text`. Description `--text-sm` `--text-muted`. Error `--text-sm` `--danger`.
89
+ - **Tokens.** Label `--text-sm` semibold `--color-text`. Description `--text-sm` `--color-muted`. Error `--text-sm` `--color-error`.
90
90
  - **Keyboard and screen reader.** The label's `for` names the control. The control points `aria-describedby` at the description, and `aria-errormessage` at the error with `aria-invalid="true"`.
91
91
 
92
92
  ## Checkbox and radio
93
93
 
94
94
  Layer: Core. ui: `UiCheckbox`. ui has no standalone radio; radio cards cover radio choices there.
95
95
 
96
- - **Anatomy.** A `<label>` around the box and its text, with a gap of about 9px. The box is 16px at `sm`, 18px at `md`, and 20px at `lg`. Checkbox corners are `--radius-sm`; a radio is round. The row is at least the control height of its size, and the label takes that size's text: `--text-sm` at `sm`, `--text-md` at `md`, and `--text-lg` at `lg`.
97
- - **Tokens.** Unchecked: `--surface-raised` fill and a 1px `--border` edge. Checked: `--accent` fill and edge, with a check mark in `--accent-text`. A checked radio shows a 5px `--accent` ring around a `--surface-raised` centre.
96
+ - **Anatomy.** A `<label>` around the box and its text, with a gap of about 9px. The box is 16px at `sm`, 18px at `md`, and 20px at `lg`. Checkbox corners are `--radius-inline`; a radio is round. The row is at least the control height of its size, and the label takes that size's text: `--text-sm` at `sm`, `--text-md` at `md`, and `--text-lg` at `lg`.
97
+ - **Tokens.** Unchecked: `--color-surface-raised` fill and a 1px `--color-border` edge. Checked: `--color-accent` fill and edge, with a check mark in `--color-accent-text`. A checked radio shows a 5px `--color-accent` ring around a `--color-surface-raised` centre.
98
98
  - **States.** Rest, checked, focus-visible (the focus ring on the box), and disabled.
99
99
  - **Keyboard and screen reader.** Native `<input type="checkbox">` or `type="radio"`. Space toggles a checkbox. Arrow keys move between radios in a named `radiogroup` or `<fieldset>`.
100
100
  - **Forced colors.** Native inputs keep system colors. A custom-drawn box redraws in `Highlight` when checked.
@@ -104,7 +104,7 @@ Layer: Core. ui: `UiCheckbox`. ui has no standalone radio; radio cards cover rad
104
104
  Layer: Core. ui: `UiRadioCardGroup`, `UiRadioCard`.
105
105
 
106
106
  - **Anatomy.** A grid of cards (`repeat(auto-fit, minmax(160px, 1fr))`, `--space-3` gap). Each card is a `<label>` with a title, an optional muted description, and a 16px round indicator in the top right corner. The native radio stays inside the card.
107
- - **Tokens.** Unselected: `--surface-raised`, `--shadow-raise`, transparent border, `--radius-lg`, `--space-3` padding. Hover: `--surface-hover` 45% into `--surface-raised`. Selected: `--field` fill and `--shadow-sink`, with the indicator filled `--accent` and an `--accent-text` check. The selected card has no accent ring.
107
+ - **Tokens.** Unselected: `--color-surface-raised`, `--shadow-raise`, transparent border, `--radius-panel`, `--space-3` padding. Hover: `--color-surface-muted` 45% into `--color-surface-raised`. Selected: `--color-well` fill and `--shadow-sink`, with the indicator filled `--color-accent` and an `--color-accent-text` check. The selected card has no accent ring.
108
108
  - **States.** Rest, hover, selected, focus-visible (the focus ring over the card's raise or sink), and disabled.
109
109
  - **Keyboard and screen reader.** One Tab stop for the group; arrow keys change the selection. Name the group.
110
110
  - **Motion.** The fill changes over `--duration-fast` with `--ease-out`.
@@ -115,7 +115,7 @@ Layer: Core. ui: `UiRadioCardGroup`, `UiRadioCard`.
115
115
  Layer: Core. ui: `UiSwitch`.
116
116
 
117
117
  - **Anatomy.** A `<button role="switch" aria-checked>` that contains the track, and a separate `<label for>` with an optional description. The button's hit area is at least 32px wide and the control height tall. The track is 44×22 with a pill radius; the knob is 18px, inset 2px. `sm` scales both by 0.8 and `lg` by 1.2.
118
- - **Tokens.** Off track: `--border` 90% into `--field`, `--shadow-sink`, transparent 1px border. Knob: `--surface-raised` with `--shadow-raise`. On: `--accent` track, `--accent-text` knob moved 22px to the right.
118
+ - **Tokens.** Off track: `--color-border` 90% into `--color-well`, `--shadow-sink`, transparent 1px border. Knob: `--color-surface-raised` with `--shadow-raise`. On: `--color-accent` track, `--color-accent-text` knob moved 22px to the right.
119
119
  - **States.** Off, on, focus-visible (the focus ring goes on the track, not the hit area), and disabled.
120
120
  - **Keyboard and screen reader.** Space and Enter toggle it. The label names it; the description is linked with `aria-describedby`.
121
121
  - **Motion.** The knob's transform and the track's fill change over `--duration` with `--ease-out`.
@@ -125,8 +125,8 @@ Layer: Core. ui: `UiSwitch`.
125
125
 
126
126
  Layer: Core. ui: `UiToggleButton`.
127
127
 
128
- - **Anatomy.** A `<button aria-pressed>` with a switch track at the start, then a label and an optional `--text-xs` muted description. `--radius-field` corners (a labelled card, so wrapped labels sit square), `--space-2` `--space-3` padding, `--surface-raised` fill, a 1px `--border-subtle` edge, and no shadow. The visible edge and the missing raise are a named exception; see [decisions](decisions.md).
129
- - **States.** Rest, hover (`--border` edge), pressed (the track turns on as in the switch and carries the state; the card takes `--accent` at 8% over `--surface-raised` and a hairline of `--accent` at 35%), focus-visible, and disabled.
128
+ - **Anatomy.** A `<button aria-pressed>` with a switch track at the start, then a label and an optional `--text-xs` muted description. `--radius-field` corners (a labelled card, so wrapped labels sit square), `--space-2` `--space-3` padding, `--color-surface-raised` fill, a 1px `--color-border-subtle` edge, and no shadow. The visible edge and the missing raise are a named exception; see [decisions](decisions.md).
129
+ - **States.** Rest, hover (`--color-border` edge), pressed (the track turns on as in the switch and carries the state; the card takes `--color-accent` at 8% over `--color-surface-raised` and a hairline of `--color-accent` at 35%), focus-visible, and disabled.
130
130
  - **Keyboard and screen reader.** A native button; Space and Enter toggle `aria-pressed`.
131
131
  - **Motion.** The card's fill and edge change over `--duration-fast` with `--ease-out`; the track moves as the switch does.
132
132
  - **Forced colors.** As for the switch track.
@@ -136,8 +136,8 @@ Layer: Core. ui: `UiToggleButton`.
136
136
  Layer: Core. ui: `UiSegmentedControl`.
137
137
 
138
138
  - **Use.** Two to five short options that apply at once, such as a view mode or the System, Light, and Dark appearance choice. Use a select for longer lists and radio cards for options that need descriptions.
139
- - **Anatomy.** A `role="group"` with an accessible name, containing one `<button aria-pressed>` for each option. The track is undivided: `--field` fill, `--shadow-sink`, a transparent 1px border, and `--radius-md`. Each button is the full control height with `--space-3` padding (square when icon-only). Its thumb is a `::before` layer inset 2px inside the button, behind the label.
140
- - **Tokens.** Labels are `--text-muted`. The pressed option's thumb is `--control-thumb` with `--shadow-raise` and no ring. Its label is `--segmented-current-text`: `--accent` where it reaches 4.5:1 on the thumb, on the page and on a surface, and otherwise the first of `--text`, black, and white that does. An icon-only option needs 3:1. Hover on an unpressed option shows the thumb at 45% and turns the label `--text`.
139
+ - **Anatomy.** A `role="group"` with an accessible name, containing one `<button aria-pressed>` for each option. The track is undivided: `--color-well` fill, `--shadow-sink`, a transparent 1px border, and `--radius-control`. Each button is the full control height with `--space-3` padding (square when icon-only). Its thumb is a `::before` layer inset 2px inside the button, behind the label.
140
+ - **Tokens.** Labels are `--color-muted`. The pressed option's thumb is `--color-control-thumb` with `--shadow-raise` and no ring. Its label is `--color-segmented-current-text`: `--color-accent` where it reaches 4.5:1 on the thumb, on the page and on a surface, and otherwise the first of `--color-text`, black, and white that does. An icon-only option needs 3:1. Hover on an unpressed option shows the thumb at 45% and turns the label `--color-text`.
141
141
  - **States.** Rest, hover, pressed, focus-visible (an inset ring, so it hugs the thumb instead of crossing into the next option), and disabled.
142
142
  - **Keyboard and screen reader.** Each option is its own Tab stop; Space and Enter press it. Icon-only options use the label as `aria-label` and `title`.
143
143
  - **Motion.** Hover fades the label colour over `--duration-fast` with `--ease-out`. When the reader changes the choice, one thumb glides from the old option to the new one. Start the new thumb's left and right edges where the old thumb was, then animate each edge home with CSS `ease`. The leading edge takes 260ms and the trailing edge 300ms, so the thumb stretches a little on the way. Labels cross-fade their colour over 260ms. If a glide is cut short, start the next one from the thumb's current position. There is no motion on first render, on a value restored from storage, or on a theme change: allow glides only after the first frame. Reduced motion moves the thumb at once.
@@ -147,7 +147,7 @@ Layer: Core. ui: `UiSegmentedControl`.
147
147
 
148
148
  Layer: Core. ui: `UiSlider`.
149
149
 
150
- - **Anatomy.** A 6px track with `--radius-sm` and `--surface-hover`, an `--accent` range, and a round thumb (16px, 18px, or 20px) with a 2px `--accent` edge and a `--surface-raised` fill.
150
+ - **Anatomy.** A 6px track with `--radius-inline` and `--color-surface-muted`, an `--color-accent` range, and a round thumb (16px, 18px, or 20px) with a 2px `--color-accent` edge and a `--color-surface-raised` fill.
151
151
  - **States.** Rest, dragging (`cursor: grabbing`), focus-visible on the thumb, and disabled.
152
152
  - **Keyboard and screen reader.** The thumb has `role="slider"`, `aria-valuemin`, `aria-valuemax`, `aria-valuenow`, and a name. Arrow keys step; Home and End jump to the ends. A native `<input type="range">` styled to match is acceptable.
153
153
  - **Forced colors.** The range redraws in `Highlight` with `forced-color-adjust: none`. The thumb keeps the system colours.
@@ -156,7 +156,7 @@ Layer: Core. ui: `UiSlider`.
156
156
 
157
157
  Layer: Core. ui: `UiProgress`.
158
158
 
159
- - **Anatomy.** A track about 9px tall with a 1px `--border-subtle` edge, `--radius-sm`, and `--surface-hover`, holding an `--accent` indicator moved with `translateX`.
159
+ - **Anatomy.** A track about 9px tall with a 1px `--color-border-subtle` edge, `--radius-inline`, and `--color-surface-muted`, holding an `--color-accent` indicator moved with `translateX`.
160
160
  - **Keyboard and screen reader.** `role="progressbar"` with a name and `aria-valuenow`, or a native `<progress>`.
161
161
  - **Motion.** The indicator's transform moves over `--duration-fast` with `--ease-out`.
162
162
  - **Forced colors.** The indicator redraws in `Highlight` with `forced-color-adjust: none`.
@@ -165,7 +165,7 @@ Layer: Core. ui: `UiProgress`.
165
165
 
166
166
  Layer: Core. ui: `UiScore`.
167
167
 
168
- - **Anatomy.** A row of 8px pips with 3px gaps, then the value in medium weight and `/max` in muted regular weight, in tabular numbers. Empty pips have a 1px `--border` edge; filled pips are `--accent`.
168
+ - **Anatomy.** A row of 8px pips with 3px gaps, then the value in medium weight and `/max` in muted regular weight, in tabular numbers. Empty pips have a 1px `--color-border` edge; filled pips are `--color-accent`.
169
169
  - **Keyboard and screen reader.** The pips are `aria-hidden`; the text value carries the score.
170
170
  - **Forced colors.** Filled pips redraw in `Highlight` with `forced-color-adjust: none`.
171
171
 
@@ -173,8 +173,8 @@ Layer: Core. ui: `UiScore`.
173
173
 
174
174
  Layer: Core. ui: `UiTabs`.
175
175
 
176
- - **Anatomy.** A `role="tablist"` with no rule below it and a 12px gap below it. It scrolls sideways when needed, and a 24px mask fades each clipped edge. Scrolling clips on every side, so the list has 4px (`--space-1`) padding all round: it keeps the selected tab's shadow whole and its fill off the frame edge. Each tab is a borderless button at least `--control-md` tall (`--control-lg` on phones), with `--space-2` `--space-3` padding, `--radius-field` corners, medium weight, and `--text-muted`.
177
- - **States.** Hover fills `--row-hover` and turns the text `--text`. The selected tab takes the [navigation row](#navigation-list)'s current-page recipe: `--nav-current` fill and `--shadow-nav-current`, with no underline. Its text is `--nav-current-text`: the first of `--accent`, `--text`, black, and white that reaches 4.5:1 over the tinted fill, both on the page and on a surface (composite a translucent fill over each first). Focus-visible is the focus ring, inset because the list scrolls.
176
+ - **Anatomy.** A `role="tablist"` with no rule below it and a 12px gap below it. It scrolls sideways when needed, and a 24px mask fades each clipped edge. Scrolling clips on every side, so the list has 4px (`--space-1`) padding all round: it keeps the selected tab's shadow whole and its fill off the frame edge. Each tab is a borderless button at least `--control-md` tall (`--control-lg` on phones), with `--space-2` `--space-3` padding, `--radius-field` corners, medium weight, and `--color-muted`.
177
+ - **States.** Hover fills `--color-row-hover` and turns the text `--color-text`. The selected tab takes the [navigation row](#navigation-list)'s current-page recipe: `--color-nav-current` fill and `--shadow-nav-current`, with no underline. Its text is `--color-nav-current-text`: the first of `--color-accent`, `--color-text`, black, and white that reaches 4.5:1 over the tinted fill, both on the page and on a surface (composite a translucent fill over each first). Focus-visible is the focus ring, inset because the list scrolls.
178
178
  - **Motion.** Fill, colour, and shadow change as on a [navigation row](#navigation-list).
179
179
  - **Keyboard and screen reader.** Roving `tabindex`: arrow keys move between tabs, Home and End go to the ends, and focus selects the tab. Each tab has `aria-controls` and `aria-selected`; each panel has `role="tabpanel"`. Without JavaScript, show every panel under its own heading. Apply the tab roles and hide the headings and unselected panels only when the script enhances the markup.
180
180
  - **Forced colors.** The fill and shadow drop, so the selected tab takes a 2px `Highlight` border, and its padding shrinks by 2px to keep its size.
@@ -184,37 +184,37 @@ Layer: Core. ui: `UiTabs`.
184
184
  Layer: Core. ui: `UiBadge`.
185
185
 
186
186
  - **Anatomy.** An inline pill: `--radius-pill`, about 3px by 9px padding, `--text-xs`, medium weight, and a transparent 1px border.
187
- - **Tokens.** Neutral: `--surface-hover` fill, `--text-muted`, no dot. Status tones (success, warning, danger, info): the tone at 22% over `--surface-raised`, text of the tone mixed 75% with `--text` in light and 85% in dark, and a leading 6px dot in `currentColor`.
187
+ - **Tokens.** Neutral: `--color-surface-muted` fill, `--color-muted`, no dot. Status tones (success, warning, danger, info): the tone at 22% over `--color-surface-raised`, text of the tone mixed 75% with `--color-text` in light and 85% in dark, and a leading 6px dot in `currentColor`.
188
188
  - **Keyboard and screen reader.** Static text; the label carries the meaning, never the colour alone.
189
189
 
190
190
  ## Alert
191
191
 
192
192
  Layer: Core. ui: `UiAlert`.
193
193
 
194
- - **Anatomy.** An optional 16px icon and short text. `--space-3` `--space-4` padding, `--radius-lg`, and a transparent 1px border.
195
- - **Tokens.** Neutral: `--surface`. Status tones use their `--*-soft` tint with `--text`; the icon takes the status colour.
194
+ - **Anatomy.** An optional 16px icon and short text. `--space-3` `--space-4` padding, `--radius-panel`, and a transparent 1px border.
195
+ - **Tokens.** Neutral: `--color-surface`. Status tones use their `--color-*-surface` tint with `--color-text`; the icon takes the status colour.
196
196
  - **Keyboard and screen reader.** Static content. Use `role="status"` or `role="alert"` only for a message that appears while the reader works.
197
197
 
198
198
  ## Surface and card
199
199
 
200
200
  Layer: Core. ui: `UiSurface`, `UiCard`.
201
201
 
202
- - **Anatomy.** A panel: `--surface-raised`, transparent 1px border, `--radius-lg`, and `--shadow-surface`. A card adds a header (title in `--text-md` medium weight, with actions at the end), a body, and an optional footer above a `--border-subtle` rule in `--text-sm` muted text. Header and body padding is `--space-4`; padding is compact (`--space-3`) or default (`--space-4`).
202
+ - **Anatomy.** A panel: `--color-surface-raised`, transparent 1px border, `--radius-panel`, and `--shadow-surface`. A card adds a header (title in `--text-md` medium weight, with actions at the end), a body, and an optional footer above a `--color-border-subtle` rule in `--text-sm` muted text. Header and body padding is `--space-4`; padding is compact (`--space-3`) or default (`--space-4`).
203
203
  - **Use.** A few parallel, self-contained options that a reader compares. Do not nest panels.
204
204
 
205
205
  ## Figure
206
206
 
207
207
  Layer: Core. ui: `UiFigure`.
208
208
 
209
- - **Anatomy.** A well (`--surface`, 1px `--border-subtle`, `--radius-lg`, `--space-5` padding, or `--space-4` on phones) with a caption below it in `--text-sm` muted text. Wide content scrolls inside the well. A figure number is `--text` in medium weight.
209
+ - **Anatomy.** A well (`--color-surface`, 1px `--color-border-subtle`, `--radius-panel`, `--space-5` padding, or `--space-4` on phones) with a caption below it in `--text-sm` muted text. Wide content scrolls inside the well. A figure number is `--color-text` in medium weight.
210
210
  - **Identity.** On folio sites the caption is mono.
211
211
 
212
212
  ## Dialog
213
213
 
214
214
  Layer: Core. ui: `UiDialog`.
215
215
 
216
- - **Anatomy.** A floating layer centred on an `--overlay` backdrop, at most 512px wide and 672px tall. It has a header (title in 18px semibold with an optional muted description, and a 44px close button), a body that scrolls, and an optional footer on `--surface` with its actions at the end. Rules between the parts are `--border-subtle`. On phones it becomes a bottom sheet with rounded top corners.
217
- - **Tokens.** `--surface-raised`, a transparent 1px border, `--radius-lg`, `--shadow-popover`. The close button is a [quiet action](#quiet-action).
216
+ - **Anatomy.** A floating layer centred on an `--color-overlay` backdrop, at most 512px wide and 672px tall. It has a header (title in 18px semibold with an optional muted description, and a 44px close button), a body that scrolls, and an optional footer on `--color-surface` with its actions at the end. Rules between the parts are `--color-border-subtle`. On phones it becomes a bottom sheet with rounded top corners.
217
+ - **Tokens.** `--color-surface-raised`, a transparent 1px border, `--radius-panel`, `--shadow-dialog`. The close button is a [quiet action](#quiet-action).
218
218
  - **Keyboard and screen reader.** `role="dialog"`, `aria-modal="true"`, named by its title. Focus moves in on open and is trapped. Escape closes it, and focus returns to the trigger. A native `<dialog>` opened with `showModal()` provides most of this.
219
219
  - **Motion.** None by default.
220
220
 
@@ -222,7 +222,7 @@ Layer: Core. ui: `UiDialog`.
222
222
 
223
223
  Layer: Core. ui: `UiDrawer`.
224
224
 
225
- - **Anatomy.** A dialog fixed to the left edge, full height, `min(--sidebar + 48px, 100vw - 48px)` wide, with a header (title and close button) and a body that scrolls on its own. It is a floating layer with square corners: `--surface-raised`, a transparent 1px border, and `--shadow-popover`. The close button is a [quiet action](#quiet-action).
225
+ - **Anatomy.** A dialog fixed to the left edge, full height, `min(--sidebar + 48px, 100vw - 48px)` wide, with a header (title and close button) and a body that scrolls on its own. It is a floating layer with square corners: `--color-surface-raised`, a transparent 1px border, and `--shadow-dialog`. The close button is a [quiet action](#quiet-action).
226
226
  - **Keyboard and screen reader.** As for the dialog. Following an in-page link inside the drawer closes it and moves focus to the link's destination (given `tabindex="-1"` if it is not focusable), not back to the trigger. Modified clicks (a new tab or window) leave it open.
227
227
  - **Motion.** It slides in over `--duration` and out over `--duration-fast`, with `--ease-out`, while the overlay fades. Reduced motion shows and hides it at once.
228
228
 
@@ -230,20 +230,20 @@ Layer: Core. ui: `UiDrawer`.
230
230
 
231
231
  Layer: Core. The mono font on rail rows is identity. ui: the rows in `UiSiteNav` and the project menu.
232
232
 
233
- - **Anatomy.** A `<nav>` with a name, holding links in rows: at least `--row` tall (`--control-lg` at tablet width), `0 --space-3` padding, `--radius-field` corners, `--text-sm`, and `--text-muted`. Groups have a `--text-xs` semibold muted label and 2px gaps between rows.
234
- - **States.** Hover: `--row-hover` fill and `--text`. Current page (`aria-current="page"`): `--nav-current` fill, `--shadow-nav-current`, `--nav-current-text`, and medium weight; hover keeps that fill. `--nav-current` is an accent tint: `--accent` at 14% over `--surface-raised` in light, and `--accent` at 20% over transparent in dark. `--nav-current-text` is the first of `--accent`, `--text`, black, and white that reaches 4.5:1 over the tinted fill, both on the page and on a surface (composite a translucent fill over each first). Selected tabs and selected list rows use the same fill and rule. Current location in the page (`aria-current="location"`): `--text` in medium weight, with a 3×14 `--accent` pip at the leading edge, inset 4px, and no fill. Focus-visible: the focus ring, inset because the rail and the drawer scroll.
233
+ - **Anatomy.** A `<nav>` with a name, holding links in rows: at least `--row` tall (`--control-lg` at tablet width), `0 --space-3` padding, `--radius-field` corners, `--text-sm`, and `--color-muted`. Groups have a `--text-xs` semibold muted label and 2px gaps between rows.
234
+ - **States.** Hover: `--color-row-hover` fill and `--color-text`. Current page (`aria-current="page"`): `--color-nav-current` fill, `--shadow-nav-current`, `--color-nav-current-text`, and medium weight; hover keeps that fill. `--color-nav-current` is an accent tint: `--color-accent` at 14% over `--color-surface-raised` in light, and `--color-accent` at 20% over transparent in dark. `--color-nav-current-text` is the first of `--color-accent`, `--color-text`, black, and white that reaches 4.5:1 over the tinted fill, both on the page and on a surface (composite a translucent fill over each first). Selected tabs and selected list rows use the same fill and rule. Current location in the page (`aria-current="location"`): `--color-text` in medium weight, with a 3×14 `--color-accent` pip at the leading edge, inset 4px, and no fill. Focus-visible: the focus ring, inset because the rail and the drawer scroll.
235
235
  - **Phone.** At tablet width a section rail becomes a drawer. Its trigger is a secondary button at `--control-lg` with a three-line menu glyph (14×10, 1.5px lines) before the label. Without JavaScript the list opens in place, so the trigger is a `<details>` summary with the secondary button classes and a chevron after the label. Only the chevron is local.
236
236
  - **Horizontal strip.** A section strip laid out in a row uses these rows and states unchanged, the location pip included.
237
237
  - **Keyboard and screen reader.** Plain links in Tab order.
238
238
  - **Motion.** Fill, colour, and shadow change over `--duration-fast` with `--ease-out`.
239
239
  - **Forced colors.** Fills and shadows drop. Only the current page (`aria-current="page"`) takes a 2px `Highlight` border on its leading edge. The location pip keeps its shape with `forced-color-adjust: none` and a `Highlight` fill, so page and location still differ.
240
- - **List selection.** A selected row in a list or table (`aria-selected="true"`) takes the current-page recipe: `--nav-current` fill, `--shadow-nav-current`, medium weight, and its primary text in `--nav-current-text`, with no accent bar. Hover keeps that fill. Rows keep their own radius. Dividers between rows are straight 1px `--border-subtle` lines inset by the row's inline padding, drawn on the row, not as a shadow, and hidden next to a filled (hovered or selected) row. Forced colors: the fill and shadow drop, and the selected row takes a 2px `Highlight` border on its leading edge, as the current page does.
240
+ - **List selection.** A selected row in a list or table (`aria-selected="true"`) takes the current-page recipe: `--color-nav-current` fill, `--shadow-nav-current`, medium weight, and its primary text in `--color-nav-current-text`, with no accent bar. Hover keeps that fill. Rows keep their own radius. Dividers between rows are straight 1px `--color-border-subtle` lines inset by the row's inline padding, drawn on the row, not as a shadow, and hidden next to a filled (hovered or selected) row. Forced colors: the fill and shadow drop, and the selected row takes a 2px `Highlight` border on its leading edge, as the current page does.
241
241
 
242
242
  ## Code block
243
243
 
244
244
  Layer: Core. ui: `UiCodeBlock`.
245
245
 
246
- - **Anatomy.** A source code well: `--code-bg`, transparent 1px border, `--radius-lg`, `--shadow-surface`. An optional header (at least 40px, `--surface-raised`, `--text-xs`, a `--border-subtle` rule below) holds the title in semibold, the language in muted text, and a Copy button. The `<pre>` has `--space-4` padding, scrolls in both directions, is at most 32rem tall, and sets `--font-mono` at `--text-code` with a line height of 1.65. Line numbers are muted and right-aligned. Syntax uses the `--code-*` tokens. A compact variant puts the code and the Copy button on one row, with no header.
246
+ - **Anatomy.** A source code well: `--color-code`, transparent 1px border, `--radius-panel`, `--shadow-surface`. An optional header (at least 40px, `--color-surface-raised`, `--text-xs`, a `--color-border-subtle` rule below) holds the title in semibold, the language in muted text, and a Copy button. The `<pre>` has `--space-4` padding, scrolls in both directions, is at most 32rem tall, and sets `--font-mono` at `--text-code` with a line height of 1.65. Line numbers are muted and right-aligned. Syntax uses the `--color-syntax-*` tokens. A compact variant puts the code and the Copy button on one row, with no header.
247
247
  - **Phone text.** Set `text-size-adjust: 100%` (and `-webkit-text-size-adjust`) on the block, and align each line's items to the baseline, so iOS Safari does not enlarge one line.
248
248
  - **Copy.** Copies the code text only: no line numbers or prompts, and one line per row joined with newlines. A [quiet action](#quiet-action) at least 44×44 with an accessible name. Announce the result in a polite live region; in the compact variant the success message is visually hidden.
249
249
  - **Keyboard and screen reader.** The `<pre>` is focusable when it scrolls. Its focus ring and the Copy button's ring are inset, because the block clips its content.
@@ -253,8 +253,8 @@ Layer: Core. ui: `UiCodeBlock`.
253
253
  ui: `UiExample`.
254
254
 
255
255
  - **Use.** Documentation that shows a live component above the code that makes it. Use the plain code block for code with no live result, and a [figure](#figure) for a static picture.
256
- - **Anatomy.** One frame: a `<figure>` with a 1px `--border-subtle` edge, `--radius-lg`, no shadow, and its content clipped to the corners. The stage comes first and holds the live preview, centred, at least 8rem tall, with `--space-8` padding. The code block follows directly below the stage, after one `--border-subtle` hairline. There is no header row and no language label. An optional caption follows the frame, as a [figure](#figure) caption does.
257
- - **Tokens.** Frame edge `--border-subtle` and corners `--radius-lg`. Stage `--bg`. Hairline `--border-subtle`.
256
+ - **Anatomy.** One frame: a `<figure>` with a 1px `--color-border-subtle` edge, `--radius-panel`, no shadow, and its content clipped to the corners. The stage comes first and holds the live preview, centred, at least 8rem tall, with `--space-8` padding. The code block follows directly below the stage, after one `--color-border-subtle` hairline. There is no header row and no language label. An optional caption follows the frame, as a [figure](#figure) caption does.
257
+ - **Tokens.** Frame edge `--color-border-subtle` and corners `--radius-panel`. Stage `--color-bg`. Hairline `--color-border-subtle`.
258
258
  - **Stage.** The stage sits on the page background, not in a well or a panel. This is a named exception to the container [depth](DESIGN.md#depth) tier: a preview shows each component on the surface it sits on in a page; see [decisions](decisions.md).
259
259
  - **Source.** Inside the frame the code block has no radius, border, or shadow of its own, and it spans the frame's full width, not `--measure`.
260
260
  - **Copy.** Icon-only and named "Copy code", in the source's top right corner. It comes before the `<pre>` in DOM order, so the reader reaches it before the code.
@@ -268,22 +268,22 @@ ui: `UiExample`.
268
268
 
269
269
  Layer: Identity. ui: `UiCodeBlock` with a shell language or the compact variant.
270
270
 
271
- - **Anatomy.** A code block for a shell command, drawn as a dark plate in both themes: `--command-bg` with a `--command-border` edge (transparent in light). Text, syntax, and the caption all use `--terminal-text` or `--terminal-caption-text`. Each line starts with a `$ ` prompt in `--project-dark`, drawn with `content: "$ " / ""` and `user-select: none`, so copied and spoken text omit it. The plate sets `--focus: var(--project-dark)`, the dark-theme accent, so every ring on it, Copy's included, reads at 3:1 or more on the dark plate in both page themes.
272
- - **Contrast.** Plate text at least 4.5:1 and the prompt at least 3:1 on `--command-bg`, for each project hue.
271
+ - **Anatomy.** A code block for a shell command, drawn as a dark plate in both themes: `--color-command-bg` with a `--color-command-border` edge (transparent in light). Text, syntax, and the caption all use `--color-terminal-text` or `--color-terminal-caption-text`. Each line starts with a `$ ` prompt in `--color-project-dark`, drawn with `content: "$ " / ""` and `user-select: none`, so copied and spoken text omit it. The plate sets `--color-focus: var(--color-project-dark)`, the dark-theme accent, so every ring on it, Copy's included, reads at 3:1 or more on the dark plate in both page themes.
272
+ - **Contrast.** Plate text at least 4.5:1 and the prompt at least 3:1 on `--color-command-bg`, for each project hue.
273
273
 
274
274
  ## Terminal capture
275
275
 
276
276
  Layer: Identity. ui: `UiCapture`.
277
277
 
278
- - **Anatomy.** A panel whose header holds mono tabs (one for each capture) and a Full size [quiet action](#quiet-action) at the end. The screen is the neutral `--terminal` plate, and a mono status-line caption sits below it on `--terminal-caption` with `--terminal-caption-text`. Full size opens the capture in a dialog.
278
+ - **Anatomy.** A panel whose header holds mono tabs (one for each capture) and a Full size [quiet action](#quiet-action) at the end. The screen is the neutral `--color-terminal` plate, and a mono status-line caption sits below it on `--color-terminal-caption` with `--color-terminal-caption-text`. Full size opens the capture in a dialog.
279
279
  - **Keyboard and screen reader.** Tabs follow the tabs spec. Full size opens the selected capture in a modal dialog named after it, and focus returns to the button when the dialog closes. Without JavaScript the button is hidden. Focus rings are inset, because the panel clips its content. Without JavaScript, every capture is listed under its own heading.
280
- - **Header.** The whole panel, header included, is the `--terminal` plate in both page appearances, with a 1px `--terminal-border` edge. It scopes its own palette so the tabs read on it: current fill `--project-dark` at 20% over transparent, with a `--terminal-shadow-nav-current` lift, hover `--terminal-text` at 4%, selected text, accent, and focus `--project-dark`, text `--terminal-text`, muted text `--terminal-caption-text`, and dividers `--terminal-border`. The tab list keeps its 4px block padding, and the Full size control stays centred on the tab row.
280
+ - **Header.** The whole panel, header included, is the `--color-terminal` plate in both page appearances, with a 1px `--color-terminal-border` edge. It scopes its own palette so the tabs read on it: current fill `--color-project-dark` at 20% over transparent, with a `--shadow-nav-current-dark` lift, hover `--color-terminal-text` at 4%, selected text, accent, and focus `--color-project-dark`, text `--color-terminal-text`, muted text `--color-terminal-caption-text`, and dividers `--color-terminal-border`. The tab list keeps its 4px block padding, and the Full size control stays centred on the tab row.
281
281
 
282
282
  ## Site header
283
283
 
284
284
  Layer: Identity. ui: `UiSiteHeader`, `UiSiteAppearancePicker`.
285
285
 
286
- - **Anatomy.** A static header at least 64px tall on `--bg` with a solid 1px `--text` rule below it. At the start is the project switcher: a `<details>` whose summary, a [quiet action](#quiet-action), shows the mono, semibold project name after a `~/` mark in `--project` (drawn by CSS, so it is not read), then a chevron. Its menu is a floating layer, with the dialog's tokens, listing the shared project registry in the order it defines, as navigation rows, with the current project marked `aria-current="page"`. At the end are the site links (`--text-muted`, at least 44px tall, `--text` on hover) and the appearance picker: an icon-only segmented control at `lg`.
286
+ - **Anatomy.** A static header at least 64px tall on `--color-bg` with a solid 1px `--color-text` rule below it. At the start is the project switcher: a `<details>` whose summary, a [quiet action](#quiet-action), shows the mono, semibold project name after a `~/` mark in `--color-project` (drawn by CSS, so it is not read), then a chevron. Its menu is a floating layer, with the dialog's tokens, listing the shared project registry in the order it defines, as navigation rows, with the current project marked `aria-current="page"`. At the end are the site links (`--color-muted`, at least 44px tall, `--color-text` on hover) and the appearance picker: an icon-only segmented control at `lg`.
287
287
  - **Phone.** With three or more links, the links take a second row.
288
288
  - **Keyboard and screen reader.** The summary is named "Project: <name>". Escape closes the menu and returns focus to the summary; moving focus out of it closes it. The chevron turns 180° while the menu is open, over `--duration-fast` with `--ease-out`.
289
289
 
@@ -291,8 +291,8 @@ Layer: Identity. ui: `UiSiteHeader`, `UiSiteAppearancePicker`.
291
291
 
292
292
  Layer: Identity. ui: `site.css` helpers.
293
293
 
294
- - **Headings.** Documentation, CLI tool, article, and product page titles (`--text-3xl`) use `--font-mono`; application titles use `--font-sans` at `--text-2xl` or smaller. On documentation, CLI tool, article, and product pages, a page-level section heading (h2) uses `--font-mono` at `--text-xl` (a product page may set it larger, up to `--text-3xl`), starts with a `## ` mark in `--accent`, drawn with `content: "## " / ""`, and has a `--border-subtle` rule above the section. Application and inline-visualization section headings use `--font-sans`, semibold, at `--text-xl` or smaller, with no mark and no rule; h3 and lower never take the mark. A product page or tool home may use a mono `--text-display` title (`--text-display-sm` on phones).
295
- - **Steps.** An ordered list in which each step hangs from a mono number in `--accent` on a ruled leading column, with an h3 title per step.
294
+ - **Headings.** Documentation, CLI tool, article, and product page titles (`--text-3xl`) use `--font-mono`; application titles use `--font-ui` at `--text-2xl` or smaller. On documentation, CLI tool, article, and product pages, a page-level section heading (h2) uses `--font-mono` at `--text-xl` (a product page may set it larger, up to `--text-3xl`), starts with a `## ` mark in `--color-accent`, drawn with `content: "## " / ""`, and has a `--color-border-subtle` rule above the section. Application and inline-visualization section headings use `--font-ui`, semibold, at `--text-xl` or smaller, with no mark and no rule; h3 and lower never take the mark. A product page or tool home may use a mono `--text-display` title (`--text-display-sm` on phones).
295
+ - **Steps.** An ordered list in which each step hangs from a mono number in `--color-accent` on a ruled leading column, with an h3 title per step.
296
296
  - **Definitions.** A definition list of terms and short meanings: medium-weight terms and muted meanings in two columns, one column on phones. Flags such as `--all` do not break.
297
297
  - **Skip link.** The first focusable element, hidden above the page until it takes focus, then shown as a floating layer with the base focus ring.
298
298
  - **Facts.** A mono definition list of short labels and values, such as a repository path. Values wrap anywhere.
@@ -6,36 +6,114 @@ Each entry records a choice this language made, the options it rejected, and why
6
6
  | --- | --- | --- | --- |
7
7
  | Units | Core | Type (`--text-*`), spacing (`--space-*`), and control and row heights (`--control-*`, `--row`) are rem, as are the page literals that size text, padding, gaps, and line heights. Each equals its old pixel value at the default 16px root, so the default render does not change. Hairlines, focus rings and their offsets, shadows, fixed icon and box sizes, layout widths, and radii stay px. Media query breakpoints stay px and are out of scope here. | All px: text and controls ignored the reader's browser font-size setting. All rem: 1px hairlines and the 2px focus ring would grow or round to uneven widths. |
8
8
  | Depth | Core | Quiet lift: borderless controls take one tight shadow at rest (`--shadow-raise`) and sink when pressed. Containers take a fainter edge (`--shadow-surface`). No outer light highlight, and no blur wider than 2px. A transparent 1px border stays for forced colors. | A dual raise (a dark blur below and a light highlight above) on controls and containers alike: cards looked heavy, idle buttons looked too raised, and dark mode showed a fuzzy halo. Before that, a crisp, bordered look. |
9
- | Primary button | Core | Filled with the project hue (`--accent`), with `--accent-text`. | Plain ink (black in light, white in dark) looked too severe. Graphite ink looked disabled. |
10
- | Danger button | Core | A raised `--danger-soft` button with danger-tinted text, mixed toward `--text` as status badges are. Hover and press deepen the tint, and press sinks it. The label must read at 4.5:1 on all three fills; where the mix misses, it falls back to `--text`, black, or white. | A flat button with `--text` and a hover border read as a pink secondary button, and pressing it showed nothing. |
9
+ | Primary button | Core | Filled with the project hue (`--color-accent`), with `--color-accent-text`. | Plain ink (black in light, white in dark) looked too severe. Graphite ink looked disabled. |
10
+ | Danger button | Core | A raised `--color-error-surface` button with danger-tinted text, mixed toward `--color-text` as status badges are. Hover and press deepen the tint, and press sinks it. The label must read at 4.5:1 on all three fills; where the mix misses, it falls back to `--color-text`, black, or white. | A flat button with `--color-text` and a hover border read as a pink secondary button, and pressing it showed nothing. |
11
11
  | Pressed button | Core | Every variant but text sinks 1px, takes `--shadow-sink`, and changes its fill. Press is a button state: other controls show their latched state, and quiet actions tint without sinking. | The sink shadow alone was too faint to show a click, especially on secondary and ghost. |
12
12
  | Busy button | Core | Busy also disables the button, so it takes no hover or press. | A busy button that still hovered and pressed looked ready for a second click. |
13
- | Quiet actions | Core | One recipe for Copy, Full size, dialog and drawer close, and the project trigger: transparent, `currentColor` at 12% on hover and 18% pressed, no sink, and the control ring. | Each had its own hover (`--row-hover`, a colour change only, or a 12% tint), so the same kind of action behaved differently. |
13
+ | Quiet actions | Core | One recipe for Copy, Full size, dialog and drawer close, and the project trigger: transparent, `currentColor` at 12% on hover and 18% pressed, no sink, and the control ring. | Each had its own hover (`--color-row-hover`, a colour change only, or a 12% tint), so the same kind of action behaved differently. |
14
14
  | One source per control | Core | Each control comes from the owning library's component or class, including a link styled as a button. | Local copies built from the same tokens drifted: a docs button had no raise and only faded when pressed. |
15
- | Section mark | Identity | The `##` mark goes only on the page-level section headings (h2) of documentation, CLI tool, article, and product pages, which are mono with a `--border-subtle` rule above. Application and inline-visualization section headings are plain `--font-sans` semibold at `--text-xl` or smaller, with no mark and no rule. h3 and lower never take it. | The mark on every section heading: on a dense screen, such as a metrics dashboard with six sections, it repeated down the page and competed with the data. The mark on h2 and h3: deeper levels repeat more often. A per-page opt-out class: every application page would need to remember it. Dropping the mark: reading pages lose the folio identity that ties them to the `~/name` header. Mono application section headings without the mark: the mono face alone still reads as a document heading among compact sans rows. |
16
- | Command plate | Identity | A dark plate tinted with the project hue (`--command-bg`). Terminal captures keep the neutral plate. | The near-black plate looked too severe. |
17
- | Navigation current row | Core | A quiet lifted fill (`--nav-current`, `--shadow-nav-current`) with 10px corners and accent text. In-page location is a 3×14 accent pip with no fill. In forced colors only the current page takes a `Highlight` edge, and the pip redraws in `Highlight`. | A raised pill looked odd. The old 2px inset bar curved away on rounded rows and disappeared in the dark drawer. |
18
- | Fields | Core | 10px rounded rectangles (`--radius-field`) with a 1px `--border-subtle` edge (`--field-edge`) in both themes. Light fields take a `--surface-raised` fill and no shadow (`--field-bg`, `--field-shadow`). Dark fields stay in the sunk `--field` well with `--shadow-sink`; the well is about 1.01:1 against the canvas, so the edge carries the shape. A disabled field takes the `--field` well and no shadow. `--field` itself still fills tracks, pressed buttons, and selected radio cards. | Pill fields, the earlier shape. A grey sunk well with a transparent edge in light: the user said it looked disabled. Without the edge, dark fields disappeared. |
15
+ | Section mark | Identity | The `##` mark goes only on the page-level section headings (h2) of documentation, CLI tool, article, and product pages, which are mono with a `--color-border-subtle` rule above. Application and inline-visualization section headings are plain `--font-ui` semibold at `--text-xl` or smaller, with no mark and no rule. h3 and lower never take it. | The mark on every section heading: on a dense screen, such as a metrics dashboard with six sections, it repeated down the page and competed with the data. The mark on h2 and h3: deeper levels repeat more often. A per-page opt-out class: every application page would need to remember it. Dropping the mark: reading pages lose the folio identity that ties them to the `~/name` header. Mono application section headings without the mark: the mono face alone still reads as a document heading among compact sans rows. |
16
+ | Command plate | Identity | A dark plate tinted with the project hue (`--color-command-bg`). Terminal captures keep the neutral plate. | The near-black plate looked too severe. |
17
+ | Navigation current row | Core | A quiet lifted fill (`--color-nav-current`, `--shadow-nav-current`) with 10px corners and accent text. In-page location is a 3×14 accent pip with no fill. In forced colors only the current page takes a `Highlight` edge, and the pip redraws in `Highlight`. | A raised pill looked odd. The old 2px inset bar curved away on rounded rows and disappeared in the dark drawer. |
18
+ | Fields | Core | 10px rounded rectangles (`--radius-field`) with a 1px `--color-border-subtle` edge (`--color-field-edge`) in both themes. Light fields take a `--color-surface-raised` fill and no shadow (`--color-field-bg`, `--shadow-field`). Dark fields stay in the sunk `--color-well` well with `--shadow-sink`; the well is about 1.01:1 against the canvas, so the edge carries the shape. A disabled field takes the `--color-well` well and no shadow. `--color-well` itself still fills tracks, pressed buttons, and selected radio cards. | Pill fields, the earlier shape. A grey sunk well with a transparent edge in light: the user said it looked disabled. Without the edge, dark fields disappeared. |
19
19
  | Switch | Core | Borderless track, 44×22 with an 18px knob. The off state shows through the track fill. | A visible track border, which was not needed. |
20
20
  | Segmented control | Core | One thumb glides between options: the leading edge takes 260ms and the trailing edge 300ms, with CSS `ease`, so the thumb stretches a little on the way. This was matched frame by frame to a reference. There is no motion on load, on a restored value, or on a theme change. Reduced motion makes the change instant. | The earlier 180ms ease-out looked like a jump. |
21
- | Segmented label | Core | The selected label reads at 4.5:1 on its thumb, and an icon at 3:1 (`--segmented-current-text`): `--accent`, or the first of `--text`, black, and white that reads. | Accent at 3:1 for labels too, which let some hues' text fall below 4.5:1. |
21
+ | Segmented label | Core | The selected label reads at 4.5:1 on its thumb, and an icon at 3:1 (`--color-segmented-current-text`): `--color-accent`, or the first of `--color-text`, black, and white that reads. | Accent at 3:1 for labels too, which let some hues' text fall below 4.5:1. |
22
22
  | Phone drawer trigger | Core | A soft secondary button with a three-line menu glyph. The no-JavaScript fallback keeps a chevron, because it opens in place. | A down chevron promised a dropdown, but the trigger opens a side drawer. |
23
- | Focus ring | Core | One accent ring for every role but fields: `outline: var(--focus-width) solid var(--focus); outline-offset: var(--focus-offset)` (2px, 3px), with no glow, over the control's own shadow. Variants recolour it with `outline-color` only. `--focus` is `--accent`: 6.26:1 on the page, 5.72:1 on a surface, and 6.61:1 on a raised surface in light; 8.31:1, 7.85:1, and 7.39:1 in dark. Dark plates use `--project-dark`: 6.98:1 on the command plate on a light page, 7.48:1 on a dark page, and 8.53:1 on the terminal capture. Inspired by Astryx `focusDefaults` (`utils/focusOutline.stylex.ts`), which writes the width, accent colour, and offset once from tokens. The user chose it from rendered demos and accepted an accent ring around primary, danger, and selected controls. | The neutral ink ring (`--focus: var(--text)`, offset 2px), the previous choice; the user preferred the accent ring with a 3px gap in rendered demos. Before that, an accent ring on controls and a `--link` ring on links, tabs, and navigation rows: two ring hues, cyan around the purple selected tab and current row. A ring in each control's own tone, such as `--danger` around the danger button: every role needs its own ring rule, and the ring changes colour from control to control. A 2px ring with a 6px accent halo felt jarring, and a 1.5px ring was hard to see; Chromium drew it 1px at 1x. |
23
+ | Focus ring | Core | One accent ring for every role but fields: `outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset)` (2px, 3px), with no glow, over the control's own shadow. Variants recolour it with `outline-color` only. `--color-focus` is `--color-accent`: 6.26:1 on the page, 5.72:1 on a surface, and 6.61:1 on a raised surface in light; 8.31:1, 7.85:1, and 7.39:1 in dark. Dark plates use `--color-project-dark`: 6.98:1 on the command plate on a light page, 7.48:1 on a dark page, and 8.53:1 on the terminal capture. Inspired by Astryx `focusDefaults` (`utils/focusOutline.stylex.ts`), which writes the width, accent colour, and offset once from tokens. The user chose it from rendered demos and accepted an accent ring around primary, danger, and selected controls. | The neutral ink ring (`--color-focus: var(--color-text)`, offset 2px), the previous choice; the user preferred the accent ring with a 3px gap in rendered demos. Before that, an accent ring on controls and a `--color-link` ring on links, tabs, and navigation rows: two ring hues, cyan around the purple selected tab and current row. A ring in each control's own tone, such as `--color-error` around the danger button: every role needs its own ring rule, and the ring changes colour from control to control. A 2px ring with a 6px accent halo felt jarring, and a 1.5px ring was hard to see; Chromium drew it 1px at 1x. |
24
24
  | Page colours outside the base layer | Core | `tokens.css` sets the body background and text colour unlayered; the rest of the base stays in `@layer base`, so component rules still outrank it. | Everything in the layer: a host that wraps the page in its own unlayered reset, such as an artifact viewer, kept its light body while the tokens switched to dark, so token-coloured text sat near-white on white. A note telling each page to restate the body: every delivered page would need to remember it, and the failure only shows in dark mode. |
25
- | Field focus | Core | No ring. The 1px edge turns `--accent` with a 2px inset line of the accent at 18% (`--field-shadow-focus`; `--field-shadow-focus-invalid` for an invalid field), and the fill does not change in either theme. An invalid field keeps `--danger` for the edge and the line. Forced colors drop the line, so a focused field there draws a `Highlight` outline 1px inside its edge. Inspired by Astryx `Field/inputStyles.stylex.ts`: a full accent border with an inset muted-accent line, and `Highlight` in forced colors. The user approved it from rendered demos. | The control ring plus a lift out of the well onto the control surface (`--field-focus`, `--control-thumb`, `--shadow-raise`), the previous choice, replaced by the edge the user chose from rendered demos. Before that, the lift with a 35% accent edge and no ring, which measured below 3:1 in light, and an accent edge with a halo and an underline, which felt too heavy. |
26
- | Selected tab | Core | The navigation row's lifted fill (`--nav-current`, `--shadow-nav-current`, accent text, 10px corners), with no underline. Navigation and tabs share one selected state. | A 2px accent underline curved at rounded corners and did not match navigation. |
27
- | Selected text | Core | The first of accent, body text, black, and white that reaches 4.5:1 over the rendered current-row fill, on the page and on a surface (`--nav-current-text`). | Accent text everywhere: the accent is validated only at 3:1, so some hues miss 4.5:1 as text on the fill. |
28
- | Selected tint | Core | The current row, selected tabs, and selected list rows take an accent tint: `--accent` at 14% over `--surface-raised` in light, at 20% over transparent in dark, and the capture's terminal accent at 20%. With the default hue, accent text measures 5.34:1 in light, and in dark 5.87:1 on `--bg`, 5.42:1 on `--surface`, and 5.05:1 on `--surface-raised`. The filip-stack site hue measures 4.94:1 in light and at least 5.06:1 in dark. A hue that misses 4.5:1 takes another `--nav-current-text`. | The plain white fill vanished on near-white panels, such as the light phone drawer. An 8% light tint (14% in dark): the light fill measured 1.07:1 against the page and read as nearly invisible. |
29
- | Toggle card | Core | A 10px card (`--radius-field`). It is the named exception to borderless raised controls: a visible `--border-subtle` edge and no rest raise. Pressed, it takes an 8% accent tint over `--surface-raised` and a 35% accent hairline, and the switch carries the on state. Pressed text measures 15.99:1 in light and 12.15:1 in dark; muted text 6.28:1 and 5.79:1. | A pill with a solid accent border looked heavy, and wrapped labels sat badly in pill corners. |
30
- | List selection | Core | A selected list row takes the navigation row's current recipe: `--nav-current` fill, `--shadow-nav-current`, medium weight, and `--nav-current-text` on its primary text. Dividers are straight pseudo-element lines inset by the row padding, hidden next to a filled row. In forced colors, a 2px `Highlight` border on the leading edge. | A 2px inset accent bar: it curved away on rounded rows, and the same bar was already rejected for navigation. A straight square bar beside a rounded fill: a second selection mark that navigation and tabs do not have. Square-cornered rows: they would break the rounded row shape shared with navigation and the select picker. |
25
+ | Field focus | Core | No ring. The 1px edge turns `--color-accent` with a 2px inset line of the accent at 18% (`--shadow-field-focus`; `--shadow-field-focus-invalid` for an invalid field), and the fill does not change in either theme. An invalid field keeps `--color-error` for the edge and the line. Forced colors drop the line, so a focused field there draws a `Highlight` outline 1px inside its edge. Inspired by Astryx `Field/inputStyles.stylex.ts`: a full accent border with an inset muted-accent line, and `Highlight` in forced colors. The user approved it from rendered demos. | The control ring plus a lift out of the well onto the control surface (`--field-focus`, `--color-control-thumb`, `--shadow-raise`), the previous choice, replaced by the edge the user chose from rendered demos. Before that, the lift with a 35% accent edge and no ring, which measured below 3:1 in light, and an accent edge with a halo and an underline, which felt too heavy. |
26
+ | Selected tab | Core | The navigation row's lifted fill (`--color-nav-current`, `--shadow-nav-current`, accent text, 10px corners), with no underline. Navigation and tabs share one selected state. | A 2px accent underline curved at rounded corners and did not match navigation. |
27
+ | Selected text | Core | The first of accent, body text, black, and white that reaches 4.5:1 over the rendered current-row fill, on the page and on a surface (`--color-nav-current-text`). | Accent text everywhere: the accent is validated only at 3:1, so some hues miss 4.5:1 as text on the fill. |
28
+ | Selected tint | Core | The current row, selected tabs, and selected list rows take an accent tint: `--color-accent` at 14% over `--color-surface-raised` in light, at 20% over transparent in dark, and the capture's terminal accent at 20%. With the default hue, accent text measures 5.34:1 in light, and in dark 5.87:1 on `--color-bg`, 5.42:1 on `--color-surface`, and 5.05:1 on `--color-surface-raised`. The filip-stack site hue measures 4.94:1 in light and at least 5.06:1 in dark. A hue that misses 4.5:1 takes another `--color-nav-current-text`. | The plain white fill vanished on near-white panels, such as the light phone drawer. An 8% light tint (14% in dark): the light fill measured 1.07:1 against the page and read as nearly invisible. |
29
+ | Toggle card | Core | A 10px card (`--radius-field`). It is the named exception to borderless raised controls: a visible `--color-border-subtle` edge and no rest raise. Pressed, it takes an 8% accent tint over `--color-surface-raised` and a 35% accent hairline, and the switch carries the on state. Pressed text measures 15.99:1 in light and 12.15:1 in dark; muted text 6.28:1 and 5.79:1. | A pill with a solid accent border looked heavy, and wrapped labels sat badly in pill corners. |
30
+ | List selection | Core | A selected list row takes the navigation row's current recipe: `--color-nav-current` fill, `--shadow-nav-current`, medium weight, and `--color-nav-current-text` on its primary text. Dividers are straight pseudo-element lines inset by the row padding, hidden next to a filled row. In forced colors, a 2px `Highlight` border on the leading edge. | A 2px inset accent bar: it curved away on rounded rows, and the same bar was already rejected for navigation. A straight square bar beside a rounded fill: a second selection mark that navigation and tabs do not have. Square-cornered rows: they would break the rounded row shape shared with navigation and the select picker. |
31
31
  | Code blocks | Core | `text-size-adjust: 100%` on code, and prompts aligned to the line's baseline. | iOS Safari enlarged one line of wrapped code and left the `$` prompt misaligned. |
32
32
  | Live example layout | Core | Stage over source: one frame with the live preview on top and its code below one hairline, no header row and no language label, and Copy in the code's top right corner. shadcn/ui, Radix Themes, Mantine, Tailwind, Nuxt UI, React Aria, Primer, MUI, and Vuetify also stack preview over code. | A preview box and a code box, each with its own header at a different height, read as two unrelated boxes. |
33
33
  | Live example side by side | Core | Stage over source, at every width. | Preview and code side by side: a tall preview leaves the code column empty, long code leaves the preview floating, and the order breaks when the columns stack on phones. |
34
34
  | Live example code view | Core | The preview and its code show together. | Preview and Code tabs, as in Chakra UI: the reader never sees the element and its code together, the frame changes height with the tab, and reading the code takes an extra click. Storybook hides code by default, for the same cost. |
35
- | Live example stage | Core | The stage sits on the page background (`--bg`), not in a well or a panel. It is the named exception to the container depth tier. | A raised or inset stage changes the surface under the preview, so raised controls do not look as they do on a page. |
35
+ | Live example stage | Core | The stage sits on the page background (`--color-bg`), not in a well or a panel. It is the named exception to the container depth tier. | A raised or inset stage changes the surface under the preview, so raised controls do not look as they do on a page. |
36
36
  | Live example source | Core | Inside the frame, the code block drops its own radius, border, and shadow, and spans the frame's width. The frame draws the one edge. | A rounded well with its own edge and shadow inside the frame is a frame inside a frame. |
37
+ | Token names | Core | One set of names, shared with `@filipgutica/ui`: `--color-*` for colours, `--shadow-*` for shadows, and ui's type, radius, and font names. See [Token names](#token-names). | Two sets, the [1.x short names](#token-names) here and `--color-*` names in ui: every site and agent translated between them through `ui:` comments, and the 1.x control radius used Tailwind's `-md` name for a 999px pill where Tailwind's is 0.375rem. Short names everywhere: about 920 references in 27 files across six repositories, a ui major release, and 18 new names. |
38
+
39
+ ## Token names
40
+
41
+ Version 2.0.0 renamed 56 short names to the names `@filipgutica/ui` already declared. No value changed. Each 1.x `tokens.css` line named its ui variable in a `ui:` comment, and that variable became the line's name. Where a comment named several, the first one did.
42
+
43
+ To update a page or stylesheet that still uses 1.x names, run `node scripts/rename-tokens.mjs <file>...`. It reads the table below. A test fails when a 1.x name appears in `language/` outside this table.
44
+
45
+ Name a new token by these rules:
46
+
47
+ - Give it one name. `tokens.css`, the class flavour, and `@filipgutica/ui` all declare it under that name, with no alias.
48
+ - Use Tailwind 4's theme namespaces where one fits: `--color-<role>` for a colour, `--shadow-<role>` for a shadow, `--radius-<role>` for a radius, `--font-<role>` for a font family, and `--text-<step>` for a type size. Other families keep their prefix, such as `--space-*`, `--control-*`, `--weight-*`, and `--duration-*`.
49
+ - Name the role, not the value: `--color-error`, not `--color-red`.
50
+ - A component role that always has the same value as a general token is a ui role in the token JSON's `library.roles`, listed after the general name in its `ui:` comment. It is not a new `tokens.css` line.
51
+ - Do not reuse a 1.x name from this table.
52
+
53
+ <!-- rename-table:start -->
54
+ Prose patterns moved with the names: `--*-soft` is now `--color-*-surface`, and `--code-*` is now `--color-code`, `--color-code-text`, and `--color-syntax-*`.
55
+
56
+ | 1.x name | 2.0 name |
57
+ | --- | --- |
58
+ | `--project` | `--color-project` |
59
+ | `--project-dark` | `--color-project-dark` |
60
+ | `--font-sans` | `--font-ui` |
61
+ | `--bg` | `--color-bg` |
62
+ | `--surface` | `--color-surface` |
63
+ | `--surface-raised` | `--color-surface-raised` |
64
+ | `--surface-hover` | `--color-surface-muted` |
65
+ | `--field` | `--color-well` |
66
+ | `--field-bg` | `--color-field-bg` |
67
+ | `--field-edge` | `--color-field-edge` |
68
+ | `--field-shadow` | `--shadow-field` |
69
+ | `--control-thumb` | `--color-control-thumb` |
70
+ | `--nav-current` | `--color-nav-current` |
71
+ | `--nav-current-text` | `--color-nav-current-text` |
72
+ | `--segmented-current-text` | `--color-segmented-current-text` |
73
+ | `--row-hover` | `--color-row-hover` |
74
+ | `--row-selected` | `--color-row-selected` |
75
+ | `--border-subtle` | `--color-border-subtle` |
76
+ | `--border` | `--color-border` |
77
+ | `--text` | `--color-text` |
78
+ | `--text-muted` | `--color-muted` |
79
+ | `--overlay` | `--color-overlay` |
80
+ | `--accent` | `--color-accent` |
81
+ | `--accent-text` | `--color-accent-text` |
82
+ | `--accent-hover` | `--color-accent-hover` |
83
+ | `--button-hover` | `--color-button-hover` |
84
+ | `--link` | `--color-link` |
85
+ | `--focus` | `--color-focus` |
86
+ | `--success` | `--color-success` |
87
+ | `--warning` | `--color-warning` |
88
+ | `--danger` | `--color-error` |
89
+ | `--info` | `--color-info` |
90
+ | `--success-soft` | `--color-success-surface` |
91
+ | `--warning-soft` | `--color-warning-surface` |
92
+ | `--danger-soft` | `--color-error-surface` |
93
+ | `--info-soft` | `--color-info-surface` |
94
+ | `--command-bg` | `--color-command-bg` |
95
+ | `--command-border` | `--color-command-border` |
96
+ | `--terminal` | `--color-terminal` |
97
+ | `--terminal-text` | `--color-terminal-text` |
98
+ | `--terminal-border` | `--color-terminal-border` |
99
+ | `--terminal-caption` | `--color-terminal-caption` |
100
+ | `--terminal-caption-text` | `--color-terminal-caption-text` |
101
+ | `--terminal-shadow-nav-current` | `--shadow-nav-current-dark` |
102
+ | `--code-bg` | `--color-code` |
103
+ | `--code-text` | `--color-code-text` |
104
+ | `--code-key` | `--color-syntax-keyword` |
105
+ | `--code-string` | `--color-syntax-string` |
106
+ | `--code-number` | `--color-syntax-number` |
107
+ | `--code-comment` | `--color-syntax-comment` |
108
+ | `--radius-sm` | `--radius-inline` |
109
+ | `--radius-md` | `--radius-control` |
110
+ | `--radius-lg` | `--radius-panel` |
111
+ | `--shadow-popover` | `--shadow-dialog` |
112
+ | `--field-shadow-focus` | `--shadow-field-focus` |
113
+ | `--field-shadow-focus-invalid` | `--shadow-field-focus-invalid` |
114
+ <!-- rename-table:end -->
37
115
 
38
116
  ## Known gaps
39
117
 
40
- - Field focus is a 1px `--accent` edge with a faint 2px inset line. The edge reaches 3:1 for a focus indicator (WCAG 1.4.11): 6.61:1 against the light field fill and 6.26:1 against `--bg`, and 8.43:1 and 8.31:1 in dark. It is thinner than the 2px perimeter that the WCAG 2.2 AAA focus appearance criterion (2.4.13) asks for; the inset line, at 18% of the accent, does not reach 3:1 on its own.
41
- - In forced colors (high contrast), an invalid field shows the system edge, not the `--danger` edge, focused or not; the error text carries the state. A visible high-contrast invalid edge needs an error colour validated against high-contrast fills.
118
+ - Field focus is a 1px `--color-accent` edge with a faint 2px inset line. The edge reaches 3:1 for a focus indicator (WCAG 1.4.11): 6.61:1 against the light field fill and 6.26:1 against `--color-bg`, and 8.43:1 and 8.31:1 in dark. It is thinner than the 2px perimeter that the WCAG 2.2 AAA focus appearance criterion (2.4.13) asks for; the inset line, at 18% of the accent, does not reach 3:1 on its own.
119
+ - In forced colors (high contrast), an invalid field shows the system edge, not the `--color-error` edge, focused or not; the error text carries the state. A visible high-contrast invalid edge needs an error colour validated against high-contrast fills.