@eldrajs/ui 0.2.9 → 0.3.1

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 (121) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +171 -151
  3. package/dist/{VariantPicker-Da41_oGA.js → VariantPicker-DDFlMvgJ.js} +1222 -833
  4. package/dist/components/accordion/Accordion.vue.d.ts +1 -2
  5. package/dist/components/accordion/AccordionItem.vue.d.ts +1 -1
  6. package/dist/components/accordion/types.d.ts +6 -7
  7. package/dist/components/avatar/Avatar.vue.d.ts +1 -1
  8. package/dist/components/avatar/types.d.ts +6 -4
  9. package/dist/components/badge/types.d.ts +6 -4
  10. package/dist/components/breadcrumb/types.d.ts +5 -2
  11. package/dist/components/button/Button.vue.d.ts +3 -3
  12. package/dist/components/button/ButtonGroup.vue.d.ts +0 -1
  13. package/dist/components/button/types.d.ts +7 -6
  14. package/dist/components/card/ContentCard.vue.d.ts +1 -1
  15. package/dist/components/card/FeatureCard.vue.d.ts +1 -1
  16. package/dist/components/card/stretchedLink.d.ts +3 -3
  17. package/dist/components/card/types.d.ts +6 -4
  18. package/dist/components/carousel/types.d.ts +7 -3
  19. package/dist/components/checkbox/Checkbox.vue.d.ts +3 -3
  20. package/dist/components/checkbox/CheckboxGroup.vue.d.ts +1 -1
  21. package/dist/components/checkbox/types.d.ts +10 -4
  22. package/dist/components/chip/Chip.vue.d.ts +1 -1
  23. package/dist/components/chip/ChipGroup.vue.d.ts +0 -1
  24. package/dist/components/chip/types.d.ts +5 -6
  25. package/dist/components/container/Container.vue.d.ts +0 -1
  26. package/dist/components/container/types.d.ts +0 -4
  27. package/dist/components/dialog/Dialog.vue.d.ts +2 -2
  28. package/dist/components/dialog/types.d.ts +5 -2
  29. package/dist/components/drawer/Drawer.vue.d.ts +1 -1
  30. package/dist/components/drawer/types.d.ts +5 -2
  31. package/dist/components/empty-state/EmptyState.vue.d.ts +1 -1
  32. package/dist/components/empty-state/types.d.ts +7 -6
  33. package/dist/components/field-wrapper/FieldWrapper.vue.d.ts +1 -1
  34. package/dist/components/field-wrapper/types.d.ts +5 -2
  35. package/dist/components/filter-panel/FilterPanel.vue.d.ts +4 -4
  36. package/dist/components/filter-panel/facets/shared.d.ts +4 -4
  37. package/dist/components/filter-panel/types.d.ts +5 -2
  38. package/dist/components/form-layout/FormLayout.vue.d.ts +1 -1
  39. package/dist/components/form-layout/types.d.ts +5 -2
  40. package/dist/components/icon/Icon.vue.d.ts +1 -2
  41. package/dist/components/icon/types.d.ts +0 -4
  42. package/dist/components/image/types.d.ts +3 -2
  43. package/dist/components/input/Input.vue.d.ts +6 -6
  44. package/dist/components/input/classes.d.ts +25 -19
  45. package/dist/components/input/types.d.ts +5 -2
  46. package/dist/components/lightbox/Lightbox.vue.d.ts +1 -1
  47. package/dist/components/lightbox/types.d.ts +5 -2
  48. package/dist/components/link/Link.vue.d.ts +1 -1
  49. package/dist/components/link/types.d.ts +5 -2
  50. package/dist/components/load-more/types.d.ts +4 -3
  51. package/dist/components/logo-item/LogoItem.vue.d.ts +1 -1
  52. package/dist/components/logo-item/types.d.ts +2 -1
  53. package/dist/components/nav-menu/NavMenu.vue.d.ts +1 -1
  54. package/dist/components/nav-menu/navLinks.d.ts +1 -1
  55. package/dist/components/nav-menu/types.d.ts +3 -3
  56. package/dist/components/pagination/types.d.ts +5 -2
  57. package/dist/components/popover/Popover.vue.d.ts +1 -1
  58. package/dist/components/popover/types.d.ts +5 -6
  59. package/dist/components/price/types.d.ts +3 -2
  60. package/dist/components/product-card/ProductCard.vue.d.ts +1 -1
  61. package/dist/components/product-card/types.d.ts +3 -2
  62. package/dist/components/quantity-stepper/QuantityStepper.vue.d.ts +4 -4
  63. package/dist/components/quantity-stepper/types.d.ts +5 -2
  64. package/dist/components/radio/Radio.vue.d.ts +3 -3
  65. package/dist/components/radio/RadioGroup.vue.d.ts +3 -3
  66. package/dist/components/radio/recipes.d.ts +11 -7
  67. package/dist/components/radio/types.d.ts +11 -5
  68. package/dist/components/range-slider/RangeSlider.vue.d.ts +1 -1
  69. package/dist/components/range-slider/types.d.ts +5 -2
  70. package/dist/components/rating/Rating.vue.d.ts +1 -1
  71. package/dist/components/rating/types.d.ts +3 -2
  72. package/dist/components/search-bar/SearchBar.vue.d.ts +3 -3
  73. package/dist/components/search-bar/SearchResultsPanel.vue.d.ts +1 -1
  74. package/dist/components/search-bar/types.d.ts +5 -2
  75. package/dist/components/search-modal/SearchModal.vue.d.ts +2 -2
  76. package/dist/components/search-modal/types.d.ts +7 -4
  77. package/dist/components/section/Section.vue.d.ts +0 -1
  78. package/dist/components/section/types.d.ts +0 -4
  79. package/dist/components/select/MultiSelect.vue.d.ts +5 -5
  80. package/dist/components/select/Select.vue.d.ts +4 -4
  81. package/dist/components/select/SelectPanel.vue.d.ts +2 -2
  82. package/dist/components/select/panelParts.d.ts +21 -20
  83. package/dist/components/select/types.d.ts +10 -4
  84. package/dist/components/site-form/SiteForm.vue.d.ts +1 -1
  85. package/dist/components/site-form/types.d.ts +6 -2
  86. package/dist/components/skeleton/Skeleton.vue.d.ts +3 -2
  87. package/dist/components/skeleton/types.d.ts +16 -6
  88. package/dist/components/switch/Switch.vue.d.ts +2 -2
  89. package/dist/components/switch/types.d.ts +5 -2
  90. package/dist/components/tabler-icon/TablerIcon.vue.d.ts +2 -3
  91. package/dist/components/tabler-icon/types.d.ts +0 -4
  92. package/dist/components/tabs/Tab.vue.d.ts +1 -1
  93. package/dist/components/tabs/TabPanel.vue.d.ts +1 -3
  94. package/dist/components/tabs/Tabs.vue.d.ts +1 -1
  95. package/dist/components/tabs/types.d.ts +13 -11
  96. package/dist/components/textarea/Textarea.vue.d.ts +4 -4
  97. package/dist/components/textarea/types.d.ts +5 -2
  98. package/dist/components/toast/types.d.ts +9 -3
  99. package/dist/components/tooltip/types.d.ts +4 -3
  100. package/dist/components/unit-input/UnitInput.vue.d.ts +7 -7
  101. package/dist/components/unit-input/types.d.ts +5 -2
  102. package/dist/components/variant-picker/VariantPicker.vue.d.ts +1 -1
  103. package/dist/components/variant-picker/types.d.ts +3 -2
  104. package/dist/components/visually-hidden/VisuallyHidden.vue.d.ts +0 -1
  105. package/dist/components/visually-hidden/types.d.ts +0 -4
  106. package/dist/components.css +1481 -2342
  107. package/dist/composables/useDialog.d.ts +9 -1
  108. package/dist/composables/useEldraScope.d.ts +7 -9
  109. package/dist/index.d.ts +5 -6
  110. package/dist/index.js +1380 -884
  111. package/dist/style.css +1487 -2348
  112. package/dist/tailwind.css +11 -2234
  113. package/dist/theme.css +108 -0
  114. package/dist/tokens.css +1 -0
  115. package/dist/utilities.css +2228 -0
  116. package/dist/utils/mergeClass.d.ts +3 -0
  117. package/dist/utils/tagRecipe.d.ts +3 -3
  118. package/dist/vee-validate.js +1 -1
  119. package/package.json +4 -3
  120. package/dist/scoped.css +0 -4623
  121. package/dist/utils/cx.d.ts +0 -31
@@ -0,0 +1,2228 @@
1
+ /* The package's custom utilities, keyframes and registered properties (`eldra-focus`, `control-h`,
2
+ `text-body`, …). The package's own build compiles them with the `eldra:` prefix; an app that runs
3
+ Tailwind gets them unprefixed for its own markup through `tailwind.css`. */
4
+
5
+ /* A coloured section (Section, or an app's own element with `data-section="primary|accent"`): its
6
+ descendants' inversions. Keyed on the attribute alone, so an app's section needs no class of the
7
+ package's. A nearer element with another `data-section` (`none` on a light card) stops it; the
8
+ `:where` keeps the specificity the `group-data-*` form had. */
9
+ @custom-variant section-primary (&:is([data-section='primary'] *):not(:where([data-section='primary'] [data-section]:not([data-section='primary']) *)));
10
+ @custom-variant section-accent (&:is([data-section='accent'] *):not(:where([data-section='accent'] [data-section]:not([data-section='accent']) *)));
11
+ /* `Container`'s own max-width utilities (spec "Container and section" → Sizes). `--eldra-
12
+ container-{narrow,content,wide}` (tokens.css, generated from `layout.container-*`) stay
13
+ `var()`-driven, unlike the `--container-*` breakpoint scale above whose values had to become
14
+ literals for the container-query engine — `max-width` accepts a `var()` just fine, so a consumer
15
+ still restyles a block's width by setting one of these three at runtime. `Container.vue` reads
16
+ these named utilities for its own width cap rather than Tailwind's auto-generated `max-w-narrow`/
17
+ `-content`/`-wide` (now literal numbers, from the `--container-*` keys above), which would
18
+ otherwise defeat that contract for the one place it actually matters. Each shares the stock
19
+ `max-w` merge group in `cx.ts`, alongside those three literal utilities, so a consumer's
20
+ `classes.root` override or `Container`'s own `full` (`max-w-none`) still replaces it outright. */
21
+ @utility eldra-container-narrow {
22
+ max-width: var(--eldra-container-narrow);
23
+ }
24
+ @utility eldra-container-content {
25
+ max-width: var(--eldra-container-content);
26
+ }
27
+ @utility eldra-container-wide {
28
+ max-width: var(--eldra-container-wide);
29
+ }
30
+
31
+ /* Type styles, one per spec style. Weight reads `--tw-font-weight` so a `font-*` utility wins. */
32
+ @utility text-display {
33
+ font-family: var(--eldra-text-display-family);
34
+ font-size: var(--eldra-text-display-size);
35
+ line-height: var(--eldra-text-display-line);
36
+ font-weight: var(--tw-font-weight, var(--eldra-text-display-weight));
37
+ letter-spacing: var(--eldra-text-display-tracking);
38
+ }
39
+ @utility text-h1 {
40
+ font-family: var(--eldra-text-h1-family);
41
+ font-size: var(--eldra-text-h1-size);
42
+ line-height: var(--eldra-text-h1-line);
43
+ font-weight: var(--tw-font-weight, var(--eldra-text-h1-weight));
44
+ letter-spacing: var(--eldra-text-h1-tracking);
45
+ }
46
+ @utility text-h2 {
47
+ font-family: var(--eldra-text-h2-family);
48
+ font-size: var(--eldra-text-h2-size);
49
+ line-height: var(--eldra-text-h2-line);
50
+ font-weight: var(--tw-font-weight, var(--eldra-text-h2-weight));
51
+ letter-spacing: var(--eldra-text-h2-tracking);
52
+ }
53
+ @utility text-h3 {
54
+ font-family: var(--eldra-text-h3-family);
55
+ font-size: var(--eldra-text-h3-size);
56
+ line-height: var(--eldra-text-h3-line);
57
+ font-weight: var(--tw-font-weight, var(--eldra-text-h3-weight));
58
+ letter-spacing: var(--eldra-text-h3-tracking);
59
+ }
60
+ @utility text-h4 {
61
+ font-family: var(--eldra-text-h4-family);
62
+ font-size: var(--eldra-text-h4-size);
63
+ line-height: var(--eldra-text-h4-line);
64
+ font-weight: var(--tw-font-weight, var(--eldra-text-h4-weight));
65
+ letter-spacing: var(--eldra-text-h4-tracking);
66
+ }
67
+ @utility text-body-lg {
68
+ font-family: var(--eldra-text-body-lg-family);
69
+ font-size: var(--eldra-text-body-lg-size);
70
+ line-height: var(--eldra-text-body-lg-line);
71
+ font-weight: var(--tw-font-weight, var(--eldra-text-body-lg-weight));
72
+ letter-spacing: var(--eldra-text-body-lg-tracking);
73
+ }
74
+ @utility text-body {
75
+ font-family: var(--eldra-text-body-family);
76
+ font-size: var(--eldra-text-body-size);
77
+ line-height: var(--eldra-text-body-line);
78
+ font-weight: var(--tw-font-weight, var(--eldra-text-body-weight));
79
+ letter-spacing: var(--eldra-text-body-tracking);
80
+ }
81
+ @utility text-body-sm {
82
+ font-family: var(--eldra-text-body-sm-family);
83
+ font-size: var(--eldra-text-body-sm-size);
84
+ line-height: var(--eldra-text-body-sm-line);
85
+ font-weight: var(--tw-font-weight, var(--eldra-text-body-sm-weight));
86
+ letter-spacing: var(--eldra-text-body-sm-tracking);
87
+ }
88
+ @utility text-caption {
89
+ font-family: var(--eldra-text-caption-family);
90
+ font-size: var(--eldra-text-caption-size);
91
+ line-height: var(--eldra-text-caption-line);
92
+ font-weight: var(--tw-font-weight, var(--eldra-text-caption-weight));
93
+ letter-spacing: var(--eldra-text-caption-tracking);
94
+ }
95
+ @utility text-overline {
96
+ font-family: var(--eldra-text-overline-family);
97
+ font-size: var(--eldra-text-overline-size);
98
+ line-height: var(--eldra-text-overline-line);
99
+ font-weight: var(--tw-font-weight, var(--eldra-text-overline-weight));
100
+ letter-spacing: var(--eldra-text-overline-tracking);
101
+ text-transform: uppercase;
102
+ }
103
+ @utility text-label {
104
+ font-family: var(--eldra-text-label-family);
105
+ font-size: var(--eldra-text-label-size);
106
+ line-height: var(--eldra-text-label-line);
107
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
108
+ letter-spacing: var(--eldra-text-label-tracking);
109
+ }
110
+ @utility text-code {
111
+ font-family: var(--eldra-text-code-family);
112
+ font-size: var(--eldra-text-code-size);
113
+ line-height: var(--eldra-text-code-line);
114
+ font-weight: var(--tw-font-weight, var(--eldra-text-code-weight));
115
+ letter-spacing: var(--eldra-text-code-tracking);
116
+ }
117
+
118
+ /* Badge type (spec "Badge" → Sizes): "0.8125rem, weight 600, line-height 1, letter-spacing
119
+ 0.01em, no wrapping." The size and tracking already read the caption token exactly; the weight
120
+ reads the label token's 600 (the caption token's own weight is 400, which the badge does not
121
+ want); only the 1 line ratio has no token of its own, so — like `text-button-md`'s 1.2 — it is
122
+ a per-component variable with that literal default. */
123
+ @utility text-badge {
124
+ font-family: var(--eldra-font-body);
125
+ font-size: var(--eldra-text-caption-size);
126
+ line-height: var(--eldra-badge-line-height, 1);
127
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
128
+ letter-spacing: var(--eldra-text-caption-tracking);
129
+ }
130
+
131
+ /* The stock status line's own text (spec "Badge" → Sizes, "Status line text" row): "0.875rem,
132
+ weight 600." Both numbers already read tokens (`text-label-weight` is 600, `text-body-sm-size`
133
+ is 0.875rem); the spec gives no line ratio for this row, so — the same shape as
134
+ `text-card-title`'s 1.4 — it is a per-component variable with a literal default. Unlike the
135
+ badge text above, the status line is a short sentence rather than a tag, so it is allowed to
136
+ wrap on a narrow card rather than forcing `whitespace-nowrap`. */
137
+ @utility text-stock-status {
138
+ font-family: var(--eldra-font-body);
139
+ font-size: var(--eldra-text-body-sm-size);
140
+ line-height: var(--eldra-stock-status-line, 1.4);
141
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
142
+ }
143
+
144
+ /* The Logo item wordmark fallback (spec "Logo item" → Sizes, "Wordmark" row): "heading family,
145
+ 1.25rem, weight 700, line-height 1.15, letter-spacing −0.01em." No shared type-scale token gives
146
+ that exact combination, but three of its four dimensions individually match ones that do:
147
+ `h1`/`h2`'s weight (700), `h2`'s line-height (1.15), `h3`'s tracking (−0.01em) — reused directly
148
+ rather than duplicated. Only the 1.25rem size has no token of its own, so — the same shape as
149
+ `Button`'s `--eldra-button-font-size-lg` — it is a per-component variable with that literal
150
+ default. */
151
+ @utility text-logo-wordmark {
152
+ font-family: var(--eldra-text-h2-family);
153
+ font-size: var(--eldra-logo-wordmark-size, 1.25rem);
154
+ line-height: var(--eldra-text-h2-line);
155
+ font-weight: var(--tw-font-weight, var(--eldra-text-h2-weight));
156
+ letter-spacing: var(--eldra-text-h3-tracking);
157
+ }
158
+
159
+ /* --- Price -------------------------------------------------------------------------------- */
160
+
161
+ /* Price's root size (spec "Price" → Sizes): only `sm` and `lg` set an explicit font-size, on the
162
+ root rather than on `current` directly, because `compareAt`/`from` below need to read the same
163
+ size to compute their own 0.9em. `md`'s current price "inherits parent (1rem by default)" and
164
+ gets no utility of its own, so a `<Price size="md">` sitting inside a product-card title or a
165
+ cart line naturally matches whatever text surrounds it, exactly as the spec's own wording asks. */
166
+ @utility text-price-sm {
167
+ font-size: var(--eldra-price-current-sm-size, 0.9375rem);
168
+ }
169
+ @utility text-price-lg {
170
+ font-size: var(--eldra-price-current-lg-size, 1.5rem);
171
+ }
172
+
173
+ /* The current price (spec "Price" → Sizes): weight 600, tabular numerals, at the size the root
174
+ above sets or inherits. */
175
+ @utility text-price-current {
176
+ font-family: var(--eldra-font-body);
177
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
178
+ font-variant-numeric: tabular-nums;
179
+ }
180
+
181
+ /* The compare-at and "From" text (spec "Price" → Sizes, "Compare-at / From (0.9em)" column): 90%
182
+ of whatever size the root sets, weight 400. `0.9em` is the spec's own explicit multiplier, not a
183
+ rem magnitude with a token to reach for, so it is written literally — and it reproduces the
184
+ table's 0.84rem/0.9rem/1.35rem rows exactly (0.9 × 0.9375rem/1rem/1.5rem) from the one root size
185
+ rather than three more per-size variables. `tabular-nums` is harmless on "From" (no digits) and
186
+ required on the compare-at, which shares this utility (spec "Price" → Acceptance criteria:
187
+ "Numerals are tabular so prices align in lists"). */
188
+ @utility text-price-secondary {
189
+ font-family: var(--eldra-font-body);
190
+ font-size: 0.9em;
191
+ font-weight: var(--tw-font-weight, var(--eldra-text-body-weight));
192
+ font-variant-numeric: tabular-nums;
193
+ }
194
+
195
+ /* The unit-price line (spec "Price" → Sizes, Unit column): "0.8125rem" at every size — the one
196
+ part of Price whose size does not scale with the root. Reuses the caption token's size exactly,
197
+ the same reuse `text-badge` makes. */
198
+ @utility text-price-unit {
199
+ font-family: var(--eldra-font-body);
200
+ font-size: var(--eldra-text-caption-size);
201
+ font-weight: var(--tw-font-weight, var(--eldra-text-body-weight));
202
+ font-variant-numeric: tabular-nums;
203
+ }
204
+
205
+ /* --- Rating --------------------------------------------------------------------------------- */
206
+
207
+ /* A half star's filled overlay (spec "Rating" → Anatomy, part 1: "half-filled"; the API contract: "half
208
+ star via a clipped overlay"). Stacked absolutely over the same star's full outline icon
209
+ (`RatingStars.vue`), clipped to its own left half so the outline shows through the unfilled
210
+ half rather than leaving blank space. `50%`/`0` are the shape's own geometry, not a design
211
+ token — there is no "half" scale to register this against — so, like `eldra-variant-pill-
212
+ selected-line`'s inset line, it is a named utility purely so the one-off `clip-path` value has a
213
+ single documented home instead of an arbitrary bracket value repeated at the call site. */
214
+ @utility eldra-rating-half {
215
+ clip-path: inset(0 50% 0 0);
216
+ }
217
+
218
+ /* Button type (spec "Button" → Sizes): weight 600 on a 1.2 line at every size, with the size's
219
+ own font size. sm and md reuse the body-sm and body token sizes; lg's 1.0625rem sits between two
220
+ type styles and has no token, so it is a per-component variable with that default. */
221
+ @utility text-button-sm {
222
+ font-family: var(--eldra-font-body);
223
+ font-size: var(--eldra-text-body-sm-size);
224
+ line-height: var(--eldra-button-line-height, 1.2);
225
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
226
+ }
227
+ @utility text-button-md {
228
+ font-family: var(--eldra-font-body);
229
+ font-size: var(--eldra-text-body-size);
230
+ line-height: var(--eldra-button-line-height, 1.2);
231
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
232
+ }
233
+ @utility text-button-lg {
234
+ font-family: var(--eldra-font-body);
235
+ font-size: var(--eldra-button-font-size-lg, 1.0625rem);
236
+ line-height: var(--eldra-button-line-height, 1.2);
237
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
238
+ }
239
+
240
+ /* Compact-control type (spec "Actions and forms" → Compact controls, and "Input" → Sizes): the
241
+ text of a text input, textarea or select trigger, at body weight on the spec's fixed 1.5rem
242
+ line — not the body token's 1.6 ratio, which is a prose line and would make a 2.5rem box too
243
+ tall for its own text. sm and lg reuse the body-sm and body token sizes; md's 0.9375rem sits
244
+ between two type styles and has no token, so — like the button's lg size above — it is a
245
+ per-component variable with that default. `text-control-mobile` is the spec's viewport
246
+ exception: "Below a 48rem viewport the text of inputs … is 1rem, so iOS never zooms into a
247
+ focused field", applied as `max-md:text-control-mobile` (Tailwind's `md` *viewport* breakpoint
248
+ is 48rem, which is the edge the spec measures for this rule — a viewport query, not the block
249
+ `@max-tablet` container query the spec's own button touch-target growth would have measured). */
250
+ @utility text-control-sm {
251
+ font-family: var(--eldra-font-body);
252
+ font-size: var(--eldra-text-body-sm-size);
253
+ line-height: var(--eldra-control-line-height, 1.5rem);
254
+ font-weight: var(--tw-font-weight, var(--eldra-text-body-weight));
255
+ }
256
+ @utility text-control {
257
+ font-family: var(--eldra-font-body);
258
+ font-size: var(--eldra-control-font-size, 0.9375rem);
259
+ line-height: var(--eldra-control-line-height, 1.5rem);
260
+ font-weight: var(--tw-font-weight, var(--eldra-text-body-weight));
261
+ }
262
+ @utility text-control-lg {
263
+ font-family: var(--eldra-font-body);
264
+ font-size: var(--eldra-text-body-size);
265
+ line-height: var(--eldra-control-line-height, 1.5rem);
266
+ font-weight: var(--tw-font-weight, var(--eldra-text-body-weight));
267
+ }
268
+ @utility text-control-mobile {
269
+ font-family: var(--eldra-font-body);
270
+ font-size: var(--eldra-control-font-size-mobile, 1rem);
271
+ line-height: var(--eldra-control-line-height, 1.5rem);
272
+ font-weight: var(--tw-font-weight, var(--eldra-text-body-weight));
273
+ }
274
+
275
+ /* A field's character counter (spec "Textarea" → Sizes, Counter row): "0.8125rem, line-height
276
+ 1.5, tabular numerals, never wraps." The size reuses the caption token; the 1.5 ratio has no
277
+ token of its own (unlike the controls above, whose 1.5rem line is fixed, this one is the
278
+ button's kind of bare ratio), so — like `text-button-lg`'s font size — it is a per-component
279
+ variable with that literal default. Deliberately no `font-weight` here: the spec's over-limit
280
+ state needs `font-semibold` layered on top, and a shorthand `font` property here would fight a
281
+ separate `font-weight` utility for the same declaration depending on generation order, so the
282
+ component pairs this with the stock `font-normal`/`font-semibold` utilities instead. */
283
+ @utility text-counter {
284
+ font-family: var(--eldra-font-body);
285
+ font-size: var(--eldra-text-caption-size);
286
+ line-height: var(--eldra-counter-line-height, 1.5);
287
+ }
288
+
289
+ /* A field's help and error text (spec "Field wrapper" -> Sizes): both are 0.8125rem on a 1.45
290
+ line, and they differ only in weight and colour (help 400 `muted`, error 500 `danger`) — so
291
+ they share one type utility. The size reuses the caption token; the 1.45 ratio has no token of
292
+ its own, so — exactly like `text-counter` above — it is a per-component variable with that
293
+ literal default. Deliberately no `font-weight` here for the same reason `text-counter` has
294
+ none: the component pairs it with the stock `font-normal`/`font-medium` utilities, which are
295
+ unambiguously ordered against each other, rather than layering a `font-weight` utility over a
296
+ shorthand `font` declaration. */
297
+ @utility text-field-note {
298
+ font-family: var(--eldra-font-body);
299
+ font-size: var(--eldra-text-caption-size);
300
+ line-height: var(--eldra-field-note-line-height, 1.45);
301
+ }
302
+
303
+ /* A radio Card's title and meta (spec "Radio group" → Sizes, "Card title / hint / meta" row):
304
+ "1rem 600 (line-height 1.4)" for the title, and the same run again for the meta ("1rem 600
305
+ tabular, no wrap"), which pairs this with the stock `tabular-nums`/`whitespace-nowrap`
306
+ utilities rather than a second near-identical type utility. The weight and size both already
307
+ read a token (`text-label-weight` is 600, `text-body-size` is 1rem); only the 1.4 ratio has
308
+ none of its own, so — like `text-counter`'s 1.5 above — it is a per-component variable with
309
+ that literal default. The card's hint reuses `text-body-sm` `muted`, exactly as `Checkbox`'s
310
+ hint does. */
311
+ @utility text-card-title {
312
+ font-family: var(--eldra-font-body);
313
+ font-size: var(--eldra-text-body-size);
314
+ line-height: var(--eldra-radio-card-title-line, 1.4);
315
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
316
+ }
317
+
318
+ /* Accordion's label (spec "Accordion" → Sizes, "Label" row): "1.0625rem / 1.4, weight 600" —
319
+ between `text-body` (1rem) and `text-h4` (1.125rem), no token of its own, so — the same shape as
320
+ `text-card-title` just above — it is its own utility reusing `--eldra-text-label-weight` (600)
321
+ and the body family, with the 1.4 line ratio as a per-component variable carrying that literal
322
+ default. */
323
+ @utility text-accordion-title {
324
+ font-family: var(--eldra-font-body);
325
+ font-size: 1.0625rem;
326
+ line-height: var(--eldra-accordion-title-line, 1.4);
327
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
328
+ }
329
+
330
+ /* The Quantity stepper's value (spec "Quantity stepper" → Sizes): "0.9375rem, 600, tabular" at
331
+ `md`, "0.875rem" at `sm` (weight and line stay the same size only). The size matches
332
+ `text-control`/`text-control-sm` exactly; the weight reuses `--eldra-text-label-weight` (600). */
333
+ @utility text-stepper-value {
334
+ font-family: var(--eldra-font-body);
335
+ font-size: var(--eldra-control-font-size, 0.9375rem);
336
+ line-height: var(--eldra-control-line-height, 1.5rem);
337
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
338
+ }
339
+ @utility text-stepper-value-sm {
340
+ font-family: var(--eldra-font-body);
341
+ font-size: var(--eldra-text-body-sm-size);
342
+ line-height: var(--eldra-control-line-height, 1.5rem);
343
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
344
+ }
345
+
346
+ /* `FilterGroup`'s trigger label (spec "Filter panel" → Sizes, "Trigger" row): "0.9375rem weight
347
+ 600, left-aligned" — the same size and line as `text-control`, at `--eldra-text-label-weight`
348
+ (600), the same shape as `text-stepper-value`. */
349
+ @utility text-filter-trigger {
350
+ font-family: var(--eldra-font-body);
351
+ font-size: var(--eldra-control-font-size, 0.9375rem);
352
+ line-height: var(--eldra-control-line-height, 1.5rem);
353
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
354
+ }
355
+
356
+ /* `EmptyState`'s title (spec "Empty and error states" → Sizes, "Title" row): "heading family,
357
+ 1.25rem, line-height 1.3, weight 600" — between `text-h4` (1.125rem) and `text-h3` (1.5rem), so
358
+ it is its own utility rather than either. The weight is a literal spec number with no token of
359
+ its own (like `text-card-title`'s 600 above); the size and the 1.3 line ratio are both
360
+ per-component variables with that literal default, the same shape as `text-counter`'s 1.5 — see
361
+ the README's Customisation table for `--eldra-empty-state-title-size`. */
362
+ @utility text-empty-state-title {
363
+ font-family: var(--eldra-font-heading);
364
+ font-size: var(--eldra-empty-state-title-size, 1.25rem);
365
+ line-height: var(--eldra-empty-state-title-line, 1.3);
366
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
367
+ }
368
+
369
+ /* `ContentCard`'s title (spec "Content card" → Sizes, "Title" row): "heading family, 1.25rem,
370
+ line-height 1.3, weight 600, letter-spacing −0.01em" — the same size/line/weight/family
371
+ combination as `text-empty-state-title` just above, but with a tracking value that one has none
372
+ of, so it is its own utility rather than that one plus an arbitrary `tracking-*` alongside it.
373
+ The weight and tracking both already read tokens (`text-label-weight` is 600, `text-h3-tracking`
374
+ is −0.01em, reused directly the same way `text-logo-wordmark` reuses three `h2`/`h3` tokens at
375
+ once); the size and the 1.3 line ratio are both per-component variables with that literal
376
+ default — the same shape as `text-empty-state-title`'s own — see the README's Customisation
377
+ table for `--eldra-content-card-title-size`. */
378
+ @utility text-content-card-title {
379
+ font-family: var(--eldra-font-heading);
380
+ font-size: var(--eldra-content-card-title-size, 1.25rem);
381
+ line-height: var(--eldra-content-card-title-line, 1.3);
382
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
383
+ letter-spacing: var(--eldra-text-h3-tracking);
384
+ }
385
+
386
+ /* `ContentCard`'s excerpt and `FeatureCard`'s body (spec "Content card" → Sizes, "Excerpt" row:
387
+ "0.9375rem, clamp 3 lines"; "Feature card" → Sizes, "Body" row: "0.9375rem, `muted`") — the same
388
+ numeric size in both specs, reused as one utility across the two components rather than two
389
+ near-identical ones, the same "share when the numbers actually match" reuse `text-badge`/
390
+ `text-stock-status` make across their own components. Neither spec gives a line ratio for this
391
+ size, so — like `text-counter`'s 1.5 — it is a per-component variable with a literal default; a
392
+ readable paragraph ratio rather than a control's fixed line box, since both are prose. */
393
+ @utility text-content-card-excerpt {
394
+ font-family: var(--eldra-font-body);
395
+ font-size: var(--eldra-content-card-excerpt-size, 0.9375rem);
396
+ line-height: var(--eldra-content-card-excerpt-line, 1.5);
397
+ font-weight: var(--tw-font-weight, var(--eldra-text-body-weight));
398
+ }
399
+
400
+ /* Control heights and targets. */
401
+ @utility control-h {
402
+ height: var(--eldra-control-height);
403
+ }
404
+ @utility control-h-sm {
405
+ height: var(--eldra-control-height-sm);
406
+ }
407
+ @utility control-h-lg {
408
+ height: var(--eldra-control-height-lg);
409
+ }
410
+ @utility target-min {
411
+ min-height: var(--eldra-target-min);
412
+ min-width: var(--eldra-target-min);
413
+ }
414
+ @utility target-touch {
415
+ min-height: var(--eldra-target-touch);
416
+ }
417
+
418
+ /* Motion. */
419
+ @utility duration-fast {
420
+ transition-duration: var(--eldra-duration-fast);
421
+ }
422
+ @utility duration-base {
423
+ transition-duration: var(--eldra-duration-base);
424
+ }
425
+ @utility duration-slow {
426
+ transition-duration: var(--eldra-duration-slow);
427
+ }
428
+
429
+ /* Accordion (spec "Accordion" → Behaviour & motion): "Chevron rotation: `duration-base` (200ms)
430
+ `ease-out`." self-conditioned on the ancestor `<details>`'s own native `[open]` attribute, so no
431
+ JS state is needed for it at all — `AccordionItem.vue` never touches this class beyond putting
432
+ it on the chevron `<svg>`. The reduced-motion override is baked into the utility itself, the
433
+ same shape as `eldra-focus`'s own `@media` block, rather than a `motion-reduce:` variant at the
434
+ call site: this is one bundled rule, not a component assembling stock `transition-*`/`duration-
435
+ *` pieces the way `Switch`'s track/thumb do. */
436
+ @utility eldra-accordion-chevron {
437
+ transition: rotate var(--eldra-duration-base) var(--eldra-ease-out);
438
+ details[open] & {
439
+ rotate: 180deg;
440
+ }
441
+ @media (prefers-reduced-motion: reduce) {
442
+ transition: none;
443
+ }
444
+ }
445
+
446
+ /* Accordion's panel (spec "Accordion" → Behaviour & motion): "Panel: fades in over `duration-base`
447
+ `ease-out` when opened." Deliberately an opacity fade only, not a height animation: the panel
448
+ `<div>` is a plain child of `<details>`, and its `display: none` while closed comes entirely
449
+ from the browser's own default rendering rule for `<details>` content
450
+ (`details:not([open]) > *:not(summary) { display: none; }`, the HTML spec's own UA style) —
451
+ nothing here touches or replaces that. `@starting-style` plus `transition-behavior: allow-
452
+ discrete` is the standard mechanism for animating *into* a value on an element whose `display`
453
+ toggles between `none` and its default (Chrome 117+, Safari 17.4+, Firefox 129+); everywhere
454
+ else the panel simply pops open, exactly like `<details>` always has, which is a fine
455
+ progressive-enhancement fallback and never a broken one.
456
+
457
+ A grid-rows height animation was the first design considered here and was rejected: making it
458
+ work at all requires overriding the panel's own `display` so it never actually leaves the
459
+ layout while "closed" (only collapsed to a zero-height row) — and the spec's own acceptance
460
+ criteria requires "Find-in-page finds text in closed panels and opens the item", which is a
461
+ `<details>`-specific browser feature keyed to the element's default closed-content hiding.
462
+ Overriding `display` to keep the row always rendered is exactly what would defeat that feature
463
+ in whichever engine implements it that way. This utility never sets `display` at all — only
464
+ `opacity` and `display`'s own place in the transition list — so the native hide/reveal (and
465
+ whatever a browser does with it for find-in-page) is completely untouched.
466
+
467
+ Operator override, 2026-09-26 ("the accordion should have some expand transition"):
468
+ `AccordionItem.vue` now also plays a *height* animation on the same panel element, through the
469
+ Web Animations API (`heightTransition.ts`) rather than CSS — it animates a measured pixel height
470
+ (`0` ↔ `scrollHeight`), never touches `display`, and needs no grid wrapper, so the find-in-page
471
+ argument above never applies to it. This utility is unchanged and keeps doing exactly what it
472
+ always did (the opacity fade); the two run side by side. See the README's Deviations entry for
473
+ the fuller account, including the exclusive-group sibling that still closes with no animation of
474
+ its own. */
475
+ @utility eldra-accordion-panel {
476
+ transition:
477
+ opacity var(--eldra-duration-base) var(--eldra-ease-out),
478
+ display var(--eldra-duration-base) allow-discrete;
479
+ @starting-style {
480
+ opacity: 0;
481
+ }
482
+ @media (prefers-reduced-motion: reduce) {
483
+ transition: none;
484
+ }
485
+ }
486
+
487
+ /* The Button spinner (spec "Button" → Behaviour & motion): it turns once every 700ms, linear,
488
+ without end; with reduced motion it pulses at 60-100% opacity over 1.2s instead of spinning.
489
+ These two timings are the spec's own and are the only durations in the package that do not read
490
+ `--eldra-duration-*` — the reduced-motion rule in tokens.css zeroes those, which would stop the
491
+ pulse as well. */
492
+ @keyframes eldra-spin {
493
+ to {
494
+ rotate: 360deg;
495
+ }
496
+ }
497
+ @keyframes eldra-pulse {
498
+ 0%,
499
+ 100% {
500
+ opacity: 0.6;
501
+ }
502
+ 50% {
503
+ opacity: 1;
504
+ }
505
+ }
506
+ @utility animate-eldra-spin {
507
+ animation: eldra-spin 700ms linear infinite;
508
+ }
509
+ @utility animate-eldra-pulse {
510
+ animation: eldra-pulse 1.2s var(--eldra-ease-out) infinite;
511
+ }
512
+
513
+ /* The skeleton shimmer (spec "Skeleton" → Behaviour & motion: "Shimmer sweeps left to right…
514
+ infinitely… Reduced motion: shimmer removed; shapes are static."). The shape is a
515
+ `surface-strong` fill (States, "Shape" row) with a `background`-coloured glare at 60% strength
516
+ (States, "Shimmer" row) laid on by a `::after` that slides across it, so reduced motion removes
517
+ the glare outright (`display: none`) rather than freezing it mid-sweep.
518
+
519
+ The glare sweeps for the first 1.8s of a 3s cycle and then rests, eased at both ends, and is a
520
+ soft band across the middle of the `::after` rather than a wash over the whole shape. The
521
+ spec's 1.4s `ease-out` sweep, back to back with no rest, lunged and then jumped back to the
522
+ start, which read as fast and mechanical (operator review, 2026-11-10; README Deviations).
523
+
524
+ Consumer knobs, each with the default below: `--eldra-skeleton-duration` (3s, the whole cycle),
525
+ `--eldra-skeleton-color` (`surface-strong`, the shape's fill) and `--eldra-skeleton-highlight`
526
+ (`background` at 60%, the glare). `Price`'s loading state shares the utility. */
527
+ @keyframes eldra-shimmer {
528
+ 0% {
529
+ transform: translateX(-100%);
530
+ }
531
+ 60%,
532
+ 100% {
533
+ transform: translateX(100%);
534
+ }
535
+ }
536
+ @utility eldra-skeleton {
537
+ position: relative;
538
+ overflow: hidden;
539
+ background-color: var(--eldra-skeleton-color, var(--eldra-color-surface-strong));
540
+ &::after {
541
+ content: '';
542
+ position: absolute;
543
+ inset: 0;
544
+ background: linear-gradient(
545
+ 90deg,
546
+ transparent 15%,
547
+ var(
548
+ --eldra-skeleton-highlight,
549
+ color-mix(in oklab, var(--eldra-color-background), transparent 40%)
550
+ )
551
+ 50%,
552
+ transparent 85%
553
+ );
554
+ transform: translateX(-100%);
555
+ animation: eldra-shimmer var(--eldra-skeleton-duration, 3s) var(--eldra-ease-in-out) infinite;
556
+ }
557
+ @media (prefers-reduced-motion: reduce) {
558
+ &::after {
559
+ display: none;
560
+ }
561
+ }
562
+ }
563
+ /* `Skeleton`'s `text` and `title` rows (spec "Skeleton" → Sizes: text "height 0.875rem, 0.3rem
564
+ margin above and below (one 1.5 line-height row)", title 1.5rem). Variables with the spec's
565
+ numbers as defaults, so a consumer sets a taller line for its own denser or larger type without
566
+ sizing every shape: `--eldra-skeleton-line-height`, `--eldra-skeleton-line-gap` and
567
+ `--eldra-skeleton-title-height`. */
568
+ @utility eldra-skeleton-text {
569
+ height: var(--eldra-skeleton-line-height, 0.875rem);
570
+ margin-block: var(--eldra-skeleton-line-gap, 0.3rem);
571
+ }
572
+ @utility eldra-skeleton-title {
573
+ height: var(--eldra-skeleton-title-height, 1.5rem);
574
+ }
575
+ /* `Skeleton`'s `box`: one shape of any size, the component itself. Its height before a consumer
576
+ sizes it is `--eldra-skeleton-box-height`, so a bare box is visible rather than 0px tall; a
577
+ `height` prop (inline) or a height class (a later layer) wins over it. */
578
+ @utility eldra-skeleton-box {
579
+ height: var(--eldra-skeleton-box-height, 1rem);
580
+ }
581
+
582
+ /* A value that is still on screen while a fresher one is being fetched (`Price`, `StockBadge` and,
583
+ through them, `ProductCard`, with `revalidating` set): the value keeps its place and its text and
584
+ is drawn at `--eldra-revalidating-opacity`, with the spinner beside it left at full strength. Not
585
+ a literal `opacity-75`: the amount of the dim is a token a store restyles, like every other value
586
+ in this package. The default is the deepest dim at which every colour these values are drawn in
587
+ still clears 3:1 on every ground this package ships — deep enough to read as unsettled rather
588
+ than as settled text, and below 4.5:1 for everything but `text` while the read lasts (see
589
+ `eldra-starter-spec/tokens.json` for the numbers and for which way to move it). Registered in
590
+ `src/utils/mergeClass.ts`'s `opacity` merge group, so a consumer's own `classes.current: 'opacity-100'`
591
+ replaces it rather than landing beside it.
592
+
593
+ The dim is only half of the treatment: the *change* is eased too. A changed amount, or a changed
594
+ stock line, fades in over `--eldra-duration-base` — played in JavaScript on the value's own inner
595
+ span (`src/utils/valueFade.ts`), not in CSS and not through a `<Transition>`, so the text itself
596
+ is never a frame behind the props. The fade is on that inner span rather than on the value part
597
+ for the same reason the dim is on the part: both are `opacity`, and one element cannot animate a
598
+ property another rule is holding at the token's value. */
599
+ @utility eldra-revalidating {
600
+ opacity: var(--eldra-revalidating-opacity);
601
+ }
602
+
603
+ /* Layers. */
604
+ @utility z-sticky {
605
+ z-index: var(--eldra-z-sticky);
606
+ }
607
+ /* A non-modal popup's layer (spec "Select" -> Sizes, Popover row): "Stacks above page content and
608
+ the sticky header (z-index 30; the sticky header is 20)." 30 sits between two tokens and has
609
+ none of its own, so — like `eldra-link-radius`'s 2px — it is a per-component variable with that
610
+ literal default here, and no literal reaches a component class. */
611
+ @utility z-popover {
612
+ z-index: var(--eldra-z-popover, 30);
613
+ }
614
+ @utility z-drawer {
615
+ z-index: var(--eldra-z-drawer);
616
+ }
617
+ @utility z-dialog {
618
+ z-index: var(--eldra-z-dialog);
619
+ }
620
+ @utility z-toast {
621
+ z-index: var(--eldra-z-toast);
622
+ }
623
+
624
+ /* The one focus ring (spec 1 "Focus ring"): 2px focus-inner infill hugging the element, 2px focus
625
+ ring outside it, arriving over duration-base. `eldra-focus` shows on :focus-visible; text fields
626
+ add `eldra-focus-always` so it shows on any focus. `eldra-focus-inset` draws both inside.
627
+
628
+ THE RING FADES IN AT FULL SIZE; IT DOES NOT GROW. The spec describes the ring "growing from 0 to
629
+ 2px over duration-base", and that is what this first shipped — an `outline-width` and a
630
+ `box-shadow` spread animating 0 -> 2px. It looks broken. A browser paints both at whole device
631
+ pixels, so a 2px growth has two or three distinct frames however long the transition runs, and a
632
+ 200ms stagger of three steps reads as a dropped-frame stutter rather than motion. Drawn at full
633
+ size and faded from alpha 0 to 1 the same 200ms is continuous, and the end state — the thing the
634
+ contrast requirements are about — is identical. Recorded under Deviations in the README.
635
+
636
+ The fade is driven by `--eldra-focus-alpha`, registered with `@property` above so it is a
637
+ `<number>` the engine can interpolate (an unregistered custom property is a token string and
638
+ jumps). Both ring colours are `color-mix(... calc(var(--eldra-focus-alpha) * 100%), transparent)`,
639
+ so one animated number fades both, and the frame-by-frame work is a colour change on a shadow
640
+ that never moves. Where `@property` is unsupported the alpha still switches 0 -> 1, so the ring
641
+ simply appears at full size — the same thing reduced motion asks for, never a missing ring.
642
+
643
+ The ring is two `box-shadow` spreads off the element's border edge: the `focus-inner` infill
644
+ and, under it, the coloured ring. At rest the ring is a 1px band against the border
645
+ (`--eldra-focus-rest-width`, `--eldra-focus-rest-offset`), transparent unless a field is invalid
646
+ (`eldra-field-invalid` sets `--eldra-focus-rest-color`). On focus the same `--eldra-focus-alpha`
647
+ that fades the colours also moves the band out past the 2px infill and widens it to 2px, and
648
+ back on blur. Shadows, not an outline: a browser draws an outline's width and offset only at
649
+ whole device pixels (3 distinct frames across a 2px move at 2x, measured in Chromium), but a
650
+ shadow's spread at any fraction (all 9 of 9 steps), so the move is continuous. A spread is
651
+ measured from the border's outer edge, the edge the border itself is drawn from, so the band
652
+ never comes apart from the border at a fractional zoom. Under forced colours, where a UA drops
653
+ `box-shadow`, an `outline` stands in, static, in `Highlight`.
654
+
655
+ Each mix reads `color-mix(in srgb, transparent, <colour> calc(...))` — transparent FIRST — on
656
+ purpose. Tailwind compiles every `color-mix()` with a plain fallback for engines that lack it,
657
+ and that fallback is the mix's first colour. Written the other way round the fallback is the
658
+ ring's colour at full strength, which paints a permanent black ring around every control in
659
+ those engines. This way the fallback is the resting state, and the `@supports not` block on each
660
+ focus selector draws the whole ring at once instead — the old behaviour minus the animation,
661
+ never a missing indicator.
662
+
663
+ `eldra-focus` and `eldra-focus-inset` OWN the transition list of the element they sit on, and a
664
+ component must not add a `transition-*`/`duration-*` utility beside them. `transition` is one
665
+ shorthand property: a `transition-[background-color] duration-fast` utility on the same element
666
+ is a later rule in the same layer, so it replaced the ring's entry outright and the ring arrived
667
+ instantly — silently, because the ring was still drawn. So the ring declares every property a
668
+ control in this package animates, each at the spec's duration for it: `duration-fast` for the
669
+ colour and press changes, `duration-base` for the ring's own alpha. Reduced motion is handled
670
+ here too, so components do not carry `motion-reduce:transition-none` either (it stays harmless
671
+ where a consumer adds it). `src/__tests__/focus-transition.spec.ts` fails a component that
672
+ breaks the rule. */
673
+ @property --eldra-focus-alpha {
674
+ syntax: '<number>';
675
+ inherits: false;
676
+ initial-value: 0;
677
+ }
678
+ /* The ring's resting band (see above). Registered without inheritance, so a field's error line
679
+ never reaches a focusable element inside it (a tag's remove button, a clear button).
680
+ `--eldra-focus-rest-forced` is the band's width under forced colours, 0 unless a field sets it. */
681
+ @property --eldra-focus-rest-width {
682
+ syntax: '*';
683
+ inherits: false;
684
+ }
685
+ @property --eldra-focus-rest-offset {
686
+ syntax: '*';
687
+ inherits: false;
688
+ }
689
+ @property --eldra-focus-rest-color {
690
+ syntax: '*';
691
+ inherits: false;
692
+ }
693
+ @property --eldra-focus-rest-forced {
694
+ syntax: '*';
695
+ inherits: false;
696
+ }
697
+ /* The ring's `box-shadow` ends with Tailwind's own shadow variables (`--tw-shadow`, `--tw-ring-shadow`
698
+ and the rest), each falling back to an empty shadow: a consumer's `shadow-*` or `ring-*` on the
699
+ same element is drawn under the ring rather than replaced by it, and with none set the list
700
+ paints exactly the ring. The band's moving edges are lifted into `--eldra-focus-gap` and
701
+ `--eldra-focus-reach` so each `calc()` holds one `var()` per term: a `var()` nested in another's
702
+ fallback inside a `calc()` is what a bundler's postcss-calc pass warns about on every build. */
703
+ @utility eldra-focus {
704
+ --eldra-focus-alpha: 0;
705
+ --eldra-focus-from-width: var(--eldra-focus-rest-width, 1px);
706
+ --eldra-focus-from-offset: var(--eldra-focus-rest-offset, 0px);
707
+ --eldra-focus-from-color: var(--eldra-focus-rest-color, transparent);
708
+ --eldra-focus-gap: calc(
709
+ var(--eldra-focus-from-offset) + (var(--eldra-focus-offset) - var(--eldra-focus-from-offset)) *
710
+ var(--eldra-focus-alpha)
711
+ );
712
+ --eldra-focus-reach: calc(
713
+ var(--eldra-focus-gap) + var(--eldra-focus-from-width) +
714
+ (var(--eldra-focus-width) - var(--eldra-focus-from-width)) * var(--eldra-focus-alpha)
715
+ );
716
+ /* Width 0 in every colour mode but forced colours, where the shadows below are dropped. */
717
+ outline: 0 solid transparent;
718
+ /* The infill is listed three times on purpose. Both spreads are cut out at the element's edge,
719
+ and on a rounded corner that cut is anti-aliased: one infill lets a hairline of the ring
720
+ beneath show through it (a grey arc inside a ghost `Button`'s ring, at 4x), three cover it. */
721
+ box-shadow:
722
+ 0 0 0 var(--eldra-focus-gap)
723
+ color-mix(
724
+ in srgb,
725
+ transparent,
726
+ var(--eldra-color-focus-inner) calc(var(--eldra-focus-alpha) * 100%)
727
+ ),
728
+ 0 0 0 var(--eldra-focus-gap)
729
+ color-mix(
730
+ in srgb,
731
+ transparent,
732
+ var(--eldra-color-focus-inner) calc(var(--eldra-focus-alpha) * 100%)
733
+ ),
734
+ 0 0 0 var(--eldra-focus-gap)
735
+ color-mix(
736
+ in srgb,
737
+ transparent,
738
+ var(--eldra-color-focus-inner) calc(var(--eldra-focus-alpha) * 100%)
739
+ ),
740
+ 0 0 0 var(--eldra-focus-reach)
741
+ color-mix(
742
+ in srgb,
743
+ var(--eldra-focus-from-color),
744
+ var(--eldra-color-focus) calc(var(--eldra-focus-alpha) * 100%)
745
+ ),
746
+ var(--tw-inset-shadow, 0 0 #0000),
747
+ var(--tw-inset-ring-shadow, 0 0 #0000),
748
+ var(--tw-ring-offset-shadow, 0 0 #0000),
749
+ var(--tw-ring-shadow, 0 0 #0000),
750
+ var(--tw-shadow, 0 0 #0000);
751
+ transition:
752
+ color var(--eldra-duration-base) var(--eldra-ease-in-out),
753
+ background-color var(--eldra-duration-base) var(--eldra-ease-in-out),
754
+ border-color var(--eldra-duration-base) var(--eldra-ease-in-out),
755
+ text-decoration-color var(--eldra-duration-base) var(--eldra-ease-in-out),
756
+ text-decoration-thickness var(--eldra-duration-base) var(--eldra-ease-in-out),
757
+ translate var(--eldra-duration-fast) var(--eldra-ease-out),
758
+ scale var(--eldra-duration-fast) var(--eldra-ease-out),
759
+ opacity var(--eldra-duration-fast) var(--eldra-ease-out),
760
+ --eldra-focus-alpha var(--eldra-duration-base) var(--eldra-ease-out);
761
+ @media (prefers-reduced-motion: reduce) {
762
+ transition: none;
763
+ }
764
+ &:focus-visible {
765
+ --eldra-focus-alpha: 1;
766
+ @supports not (color: color-mix(in srgb, red, red)) {
767
+ box-shadow:
768
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
769
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
770
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
771
+ 0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width)) var(--eldra-color-focus),
772
+ var(--tw-inset-shadow, 0 0 #0000),
773
+ var(--tw-inset-ring-shadow, 0 0 #0000),
774
+ var(--tw-ring-offset-shadow, 0 0 #0000),
775
+ var(--tw-ring-shadow, 0 0 #0000),
776
+ var(--tw-shadow, 0 0 #0000);
777
+ }
778
+ }
779
+ /* Static under forced colours: a field's error line in `CanvasText` against the border (none
780
+ elsewhere), and the ring in `Highlight` past the infill while it shows. */
781
+ @media (forced-colors: active) {
782
+ outline-width: var(--eldra-focus-rest-forced, 0px);
783
+ outline-color: CanvasText;
784
+ &:focus-visible {
785
+ outline-width: var(--eldra-focus-width);
786
+ outline-offset: var(--eldra-focus-offset);
787
+ outline-color: Highlight;
788
+ }
789
+ }
790
+ }
791
+ @utility eldra-focus-always {
792
+ &:focus {
793
+ --eldra-focus-alpha: 1;
794
+ @supports not (color: color-mix(in srgb, red, red)) {
795
+ box-shadow:
796
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
797
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
798
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
799
+ 0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width)) var(--eldra-color-focus),
800
+ var(--tw-inset-shadow, 0 0 #0000),
801
+ var(--tw-inset-ring-shadow, 0 0 #0000),
802
+ var(--tw-ring-offset-shadow, 0 0 #0000),
803
+ var(--tw-ring-shadow, 0 0 #0000),
804
+ var(--tw-shadow, 0 0 #0000);
805
+ }
806
+ }
807
+ @media (forced-colors: active) {
808
+ &:focus {
809
+ outline-width: var(--eldra-focus-width);
810
+ outline-offset: var(--eldra-focus-offset);
811
+ outline-color: Highlight;
812
+ }
813
+ }
814
+ }
815
+ /* The ring while a popup is open (operator request, 2026-09-25). A `Select` or `MultiSelect`
816
+ trigger opened with the *pointer* is focused but not `:focus-visible`, so the ring did not show —
817
+ and the control then had an open popover attached to a trigger with no visible indication that it
818
+ was the thing the keyboard was about to act on. The `SearchBar` has never had this problem: its
819
+ trigger is a text field, which carries `eldra-focus-always` and shows the ring on any focus.
820
+
821
+ A *modifier* of the same shape as `eldra-focus-always` and `eldra-focus-proxy` — it carries no
822
+ ring of its own, it only turns on the one `eldra-focus` already put on the element, keyed to the
823
+ state the element itself publishes in `aria-expanded`. So it never needs a second class to be
824
+ kept in sync, and closing the popup fades the ring back out over the transition `eldra-focus`
825
+ already owns rather than snapping it off. It carries no base, so it must never share a merge
826
+ group with `eldra-focus` (see `src/utils/mergeClass.ts`): a modifier never shares a group with the thing
827
+ it modifies.
828
+
829
+ The forced-colours rule is repeated here for the same reason `eldra-focus-proxy` repeats it: the
830
+ one in `eldra-focus` is keyed to that element's own `:focus-visible`, which an open pointer-
831
+ opened trigger is not. */
832
+ @utility eldra-focus-open {
833
+ &[aria-expanded='true'] {
834
+ --eldra-focus-alpha: 1;
835
+ @supports not (color: color-mix(in srgb, red, red)) {
836
+ box-shadow:
837
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
838
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
839
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
840
+ 0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width)) var(--eldra-color-focus),
841
+ var(--tw-inset-shadow, 0 0 #0000),
842
+ var(--tw-inset-ring-shadow, 0 0 #0000),
843
+ var(--tw-ring-offset-shadow, 0 0 #0000),
844
+ var(--tw-ring-shadow, 0 0 #0000),
845
+ var(--tw-shadow, 0 0 #0000);
846
+ }
847
+ }
848
+ @media (forced-colors: active) {
849
+ &[aria-expanded='true'] {
850
+ outline-width: var(--eldra-focus-width);
851
+ outline-offset: var(--eldra-focus-offset);
852
+ outline-color: Highlight;
853
+ }
854
+ }
855
+ }
856
+ /* Proxy focus (spec 1 "Focus ring" → Proxy focus): "When the focusable element is visually hidden
857
+ (the radio inside a size pill, the stretched link of a card), draw the ring on the visible shape
858
+ (the pill, the whole card), not on the hidden element."
859
+
860
+ Exactly the shape of `eldra-focus-always` above, and a *modifier* in the same way: it carries no
861
+ ring of its own, it only adds the rule that turns on the one `eldra-focus` already put on this
862
+ element. The difference is whose focus turns it on — a descendant's, not the element's own. So a
863
+ Checkbox writes `eldra-focus eldra-focus-proxy` on its drawn box and puts the `sr-only`
864
+ `<input>` inside it; the transition, the reduced-motion handling and the ring itself all still
865
+ live in `eldra-focus`, which is why the two must never share a merge group in `src/utils/mergeClass.ts`.
866
+ The forced-colours rule is repeated here because the one in `eldra-focus` is keyed to that
867
+ element's own `:focus-visible`, which never happens on a box that is not focusable. */
868
+ @utility eldra-focus-proxy {
869
+ &:has(:focus-visible) {
870
+ --eldra-focus-alpha: 1;
871
+ @supports not (color: color-mix(in srgb, red, red)) {
872
+ box-shadow:
873
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
874
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
875
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
876
+ 0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width)) var(--eldra-color-focus),
877
+ var(--tw-inset-shadow, 0 0 #0000),
878
+ var(--tw-inset-ring-shadow, 0 0 #0000),
879
+ var(--tw-ring-offset-shadow, 0 0 #0000),
880
+ var(--tw-ring-shadow, 0 0 #0000),
881
+ var(--tw-shadow, 0 0 #0000);
882
+ }
883
+ }
884
+ @media (forced-colors: active) {
885
+ &:has(:focus-visible) {
886
+ outline-width: var(--eldra-focus-width);
887
+ outline-offset: var(--eldra-focus-offset);
888
+ outline-color: Highlight;
889
+ }
890
+ }
891
+ }
892
+
893
+ /* The Link focus ring's corner radius (spec "Link" → Sizes): "2px for every variant." No radius
894
+ token is this small — radius-sm is 0.375rem, for badges and chips — so, like the button's
895
+ lg font size above, it is a per-component variable with a literal default and no token behind
896
+ it; a consumer restyles it with `--eldra-link-radius` on any ancestor. `box-shadow` and modern
897
+ `outline` both already follow an element's own `border-radius`, so this is enough to round both
898
+ rings the focus ring foundation draws. */
899
+ @utility eldra-link-radius {
900
+ border-radius: var(--eldra-link-radius, 2px);
901
+ }
902
+
903
+ /* The inset ring's "any focus" modifier, the exact counterpart of `eldra-focus-always` above and a
904
+ modifier in the same way: it carries no ring of its own. A select's search field is a text field,
905
+ and the focus-ring foundation's rule for those — "Text fields (Input, Textarea, Search bar, a
906
+ select's search field) show it on *any* focus, pointer included, because a caret alone is easy to
907
+ miss" — applies whether the ring is drawn outside the element or, as here, just inside it. */
908
+ @utility eldra-focus-inset-always {
909
+ &:focus {
910
+ --eldra-focus-alpha: 1;
911
+ @supports not (color: color-mix(in srgb, red, red)) {
912
+ box-shadow:
913
+ inset 0 0 0 var(--eldra-focus-width) var(--eldra-color-focus),
914
+ inset 0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width))
915
+ var(--eldra-color-focus-inner);
916
+ }
917
+ }
918
+ @media (forced-colors: active) {
919
+ &:focus {
920
+ outline-width: var(--eldra-focus-width);
921
+ outline-color: Highlight;
922
+ }
923
+ }
924
+ }
925
+
926
+ /* The ring sits against the element's edge and its gap inside it, toward the content: every inset
927
+ ring is drawn inside a bordered container, where an outer gap read as padding. */
928
+ @utility eldra-focus-inset {
929
+ outline: 0 solid transparent;
930
+ outline-offset: calc(-1 * (var(--eldra-focus-width) + var(--eldra-focus-offset)));
931
+ --eldra-focus-alpha: 0;
932
+ box-shadow:
933
+ inset 0 0 0 var(--eldra-focus-width)
934
+ color-mix(
935
+ in srgb,
936
+ transparent,
937
+ var(--eldra-color-focus) calc(var(--eldra-focus-alpha) * 100%)
938
+ ),
939
+ inset 0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width))
940
+ color-mix(
941
+ in srgb,
942
+ transparent,
943
+ var(--eldra-color-focus-inner) calc(var(--eldra-focus-alpha) * 100%)
944
+ );
945
+ transition:
946
+ color var(--eldra-duration-base) var(--eldra-ease-in-out),
947
+ background-color var(--eldra-duration-base) var(--eldra-ease-in-out),
948
+ border-color var(--eldra-duration-base) var(--eldra-ease-in-out),
949
+ text-decoration-color var(--eldra-duration-base) var(--eldra-ease-in-out),
950
+ text-decoration-thickness var(--eldra-duration-base) var(--eldra-ease-in-out),
951
+ translate var(--eldra-duration-fast) var(--eldra-ease-out),
952
+ scale var(--eldra-duration-fast) var(--eldra-ease-out),
953
+ opacity var(--eldra-duration-fast) var(--eldra-ease-out),
954
+ --eldra-focus-alpha var(--eldra-duration-base) var(--eldra-ease-out);
955
+ @media (prefers-reduced-motion: reduce) {
956
+ transition: none;
957
+ }
958
+ &:focus-visible {
959
+ --eldra-focus-alpha: 1;
960
+ @supports not (color: color-mix(in srgb, red, red)) {
961
+ box-shadow:
962
+ inset 0 0 0 var(--eldra-focus-width) var(--eldra-color-focus),
963
+ inset 0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width))
964
+ var(--eldra-color-focus-inner);
965
+ }
966
+ }
967
+ @media (forced-colors: active) {
968
+ &:focus-visible {
969
+ outline-width: var(--eldra-focus-width);
970
+ outline-color: Highlight;
971
+ }
972
+ }
973
+ }
974
+
975
+ /* A field's own boundary (spec "Actions and forms" -> Compact controls: "1px `border-strong`
976
+ boundary"). The width is a variable rather than Tailwind's `border`, because the invalid line
977
+ (`eldra-field-invalid` below) is drawn exactly this thick against it: with `border` hard-wired to
978
+ 1px, setting `--eldra-field-border-width` thickened one and not the other. One variable drives
979
+ both. The literal default lives here,
980
+ not in a component class — the same shape as `eldra-link-radius` above. `border-style` comes
981
+ from Tailwind's preflight (`*, ::before, ::after { border: 0 solid }`), which both the
982
+ `tailwind.css` and the `style.css` route carry, so a width alone is a solid border and
983
+ `border-dashed` still wins where a component asks for one. */
984
+ /* Colour changes (hover, selection, a revealed colour) on an element that carries no
985
+ `eldra-focus*` utility, at the same timing that utility gives a control's colours:
986
+ `duration-base` and `ease-in-out`, so a colour fades rather than switches. One shorthand, so it
987
+ cannot sit beside a second `transition-*` on the same element. */
988
+ @utility eldra-transition-colors {
989
+ transition:
990
+ color var(--eldra-duration-base) var(--eldra-ease-in-out),
991
+ background-color var(--eldra-duration-base) var(--eldra-ease-in-out),
992
+ border-color var(--eldra-duration-base) var(--eldra-ease-in-out),
993
+ text-decoration-color var(--eldra-duration-base) var(--eldra-ease-in-out),
994
+ text-decoration-thickness var(--eldra-duration-base) var(--eldra-ease-in-out),
995
+ fill var(--eldra-duration-base) var(--eldra-ease-in-out),
996
+ stroke var(--eldra-duration-base) var(--eldra-ease-in-out);
997
+ @media (prefers-reduced-motion: reduce) {
998
+ transition: none;
999
+ }
1000
+ }
1001
+
1002
+ @utility eldra-field-border {
1003
+ border-width: var(--eldra-field-border-width, 1px);
1004
+ }
1005
+
1006
+ /* A Button's boundary (spec "Button" -> Anatomy: "1px border that a variant may colour"), a
1007
+ variable for the same reason as the field's: `ButtonGroup`'s attached buttons overlap by exactly
1008
+ this width, so a wider border still leaves one shared line. The height stays the size's control
1009
+ height whatever the width, because the box is `border-box`. */
1010
+ @utility eldra-button-border {
1011
+ border-width: var(--eldra-button-border-width, 1px);
1012
+ }
1013
+
1014
+ /* The Checkbox box (spec "Checkbox" → Sizes: "Border | 1.5px", and → States, Error row: "**2px**
1015
+ `danger`"). Neither number is a token — they are this component's own — so each is a variable
1016
+ with a literal default here, the same shape as `eldra-link-radius` and `eldra-field-border`
1017
+ above, and neither literal reaches a component class. They are two utilities rather than one
1018
+ because the error state changes the width as well as the colour, and both sit in the `border-w`
1019
+ merge group, so the error width replaces the ordinary one instead of landing beside it. */
1020
+ @utility eldra-checkbox-border {
1021
+ border-width: var(--eldra-checkbox-border-width, 1.5px);
1022
+ }
1023
+ @utility eldra-checkbox-border-invalid {
1024
+ border-width: var(--eldra-checkbox-border-width-invalid, 2px);
1025
+ }
1026
+
1027
+ /* `EditorPlaceholder`'s own boundary (spec "Empty and error states" → Sizes, "Editor hint" row:
1028
+ "1.5px dashed border, `radius-lg`") — not a token, and a different number from the panel's own
1029
+ `EmptyState` boundary (a stock `border` at 1px, spec's "Panel border and radius" row), so it
1030
+ gets a variable of its own rather than reusing `eldra-checkbox-border`, the same shape as that
1031
+ utility. `border-style: dashed` is a separate stock `border-dashed` utility on the component,
1032
+ same as `EmptyState`'s panel. */
1033
+ @utility eldra-editor-placeholder-border {
1034
+ border-width: var(--eldra-editor-placeholder-border-width, 1.5px);
1035
+ }
1036
+
1037
+ /* The error boundary of a field (spec "Input" → States, Error row): "2px `danger`". Drawn as the
1038
+ field's 1px `danger` border plus `eldra-focus`'s resting band in `danger`, as wide as the border
1039
+ and against its outer edge. Both start from that one edge, so they stay one 2px line at every
1040
+ zoom (a second line drawn by a pseudo-element inset by the border width came apart from it at
1041
+ 90%, 110% and 125%). The border stays 1px in every state, so the value never moves when the
1042
+ field turns invalid. On focus the band travels out past the `focus-inner` infill and becomes the
1043
+ ring, as on every control; the border reads 1px `danger` inside it. It goes on the element that
1044
+ carries `eldra-focus` and the border (the input, the textarea, the select trigger, or the
1045
+ `MultiSelect` field that wraps its tags). */
1046
+ @utility eldra-field-invalid {
1047
+ --eldra-focus-rest-width: var(--eldra-field-border-width, 1px);
1048
+ --eldra-focus-rest-color: var(--eldra-color-danger);
1049
+ --eldra-focus-rest-forced: var(--eldra-field-border-width, 1px);
1050
+ }
1051
+
1052
+ /* The radio group Card's own boundary (spec "Radio group" → Sizes, Card row: "1px border"). The
1053
+ radio circle inside a card reuses `eldra-checkbox-border`/`-invalid` unchanged — the spec gives
1054
+ it the exact same numbers as the Checkbox box (1.5px / 2px) — but the card itself is a
1055
+ different element with its own 1px number, so it gets its own variable rather than sharing one
1056
+ that happens to have a different default. */
1057
+ @utility eldra-radio-card-border {
1058
+ border-width: var(--eldra-radio-card-border-width, 1px);
1059
+ }
1060
+
1061
+ /* The selected Card's boundary (spec "Radio group" → States, Selected row: "2px `primary` (1px
1062
+ border + 1px inset line)"). Keeping the real border at 1px in every state and adding a second 1px inset line only
1063
+ when selected is what stops the card growing — and its neighbours shifting — the moment it is
1064
+ chosen. The line's colour defaults to `primary`; the invalid-and-selected state (Decision: an
1065
+ invalid `Checkbox` that is also checked keeps its fill and swaps only the border colour) sets
1066
+ `--eldra-radio-card-selected-color` to `danger` instead, so one utility serves both cases rather
1067
+ than two nearly-identical ones. */
1068
+ @utility eldra-radio-card-selected {
1069
+ position: relative;
1070
+ &::after {
1071
+ content: '';
1072
+ position: absolute;
1073
+ inset: var(--eldra-radio-card-border-width, 1px);
1074
+ border: var(--eldra-radio-card-border-width, 1px) solid
1075
+ var(--eldra-radio-card-selected-color, var(--eldra-color-primary));
1076
+ border-radius: calc(
1077
+ var(--eldra-radio-card-radius, var(--eldra-radius-md)) -
1078
+ var(--eldra-radio-card-border-width, 1px)
1079
+ );
1080
+ pointer-events: none;
1081
+ }
1082
+ }
1083
+
1084
+ /* The Switch track's own boundary (spec "Switch" → Sizes: "1.5px border", both sizes). A
1085
+ per-component variable with a literal default, the same shape as `eldra-checkbox-border`. */
1086
+ @utility eldra-switch-track-border {
1087
+ border-width: var(--eldra-switch-track-border-width, 1.5px);
1088
+ }
1089
+
1090
+ /* The Switch thumb's rest position (spec "Switch" → Sizes: "1rem, 0.1875rem from the track's
1091
+ start edge"). 0.1875rem is not a `--spacing` multiple (0.75 of a step), so it is a
1092
+ per-component variable rather than a spacing utility; logical so it reads correctly in an RTL
1093
+ document. The "on" position is the thumb's own `translate-x-*`, a `--spacing` multiple, added on
1094
+ top of this rest position. */
1095
+ @utility eldra-switch-thumb-offset {
1096
+ inset-inline-start: var(--eldra-switch-thumb-offset, 0.1875rem);
1097
+ }
1098
+
1099
+ /* The Switch label (spec "Switch" → Sizes: "Label | 1rem" at md; the sm row's "0.875rem / 1.5"
1100
+ reuses `text-body-sm` unchanged since the two numbers match a token exactly). 1rem already reads
1101
+ the body token's size; only the line-height has no token of its own (the spec gives it once, in
1102
+ the "with description" paragraph: "line-height 1.4"), so — like `text-card-title`'s 1.4 before
1103
+ it — it is a per-component variable with that literal default. */
1104
+ @utility text-switch-label {
1105
+ font-family: var(--eldra-font-body);
1106
+ font-size: var(--eldra-text-body-size);
1107
+ line-height: var(--eldra-switch-label-line, 1.4);
1108
+ font-weight: var(--tw-font-weight, var(--eldra-text-body-weight));
1109
+ }
1110
+
1111
+ /* The Switch description (spec "Switch" → Sizes: "the description is 0.875rem `muted`", and the
1112
+ same paragraph's "line-height 1.4"). 0.875rem already reads the body-sm token's size; the line
1113
+ ratio is this component's own, exactly like `text-switch-label` above. */
1114
+ @utility text-switch-description {
1115
+ font-family: var(--eldra-font-body);
1116
+ font-size: var(--eldra-text-body-sm-size);
1117
+ line-height: var(--eldra-switch-description-line, 1.4);
1118
+ font-weight: var(--tw-font-weight, var(--eldra-text-body-weight));
1119
+ }
1120
+
1121
+ /* --- Select ---------------------------------------------------------------------------------- */
1122
+
1123
+ /* A group heading inside a select panel (spec "Select" -> Sizes, Group heading row): "0.75rem,
1124
+ 600, uppercase, 0.06em tracking, `muted`". Every number but the tracking is the overline token's
1125
+ already; the spec's 0.06em is half the overline token's 0.12em, so it is this component's own
1126
+ and gets a variable with that literal default, exactly like `text-card-title`'s 1.4 line. */
1127
+ @utility text-select-group {
1128
+ font-family: var(--eldra-font-body);
1129
+ font-size: var(--eldra-text-overline-size);
1130
+ line-height: var(--eldra-text-overline-line);
1131
+ font-weight: var(--tw-font-weight, var(--eldra-text-overline-weight));
1132
+ letter-spacing: var(--eldra-select-group-tracking, 0.06em);
1133
+ text-transform: uppercase;
1134
+ }
1135
+
1136
+ /* An option row's own text (spec "Select" -> Sizes, Option row): "0.9375rem text on a 1.35 line".
1137
+ The size is the control font size the trigger already uses (`--eldra-control-font-size`), so a
1138
+ row and the trigger above it read at one size; only the 1.35 line is this component's own. It is
1139
+ deliberately not `text-control`, whose fixed 1.5rem line is the height of a 2.5rem field box and
1140
+ would push a two-line option (label + hint) past the spec's row. */
1141
+ @utility text-select-option {
1142
+ font-family: var(--eldra-font-body);
1143
+ font-size: var(--eldra-control-font-size, 0.9375rem);
1144
+ line-height: var(--eldra-select-option-line, 1.35);
1145
+ font-weight: var(--tw-font-weight, var(--eldra-text-body-weight));
1146
+ }
1147
+
1148
+ /* The "+N" pill on a Multi-select trigger (spec "Multi-select" -> Sizes: "0.75rem 600 tabular").
1149
+ The overline token carries both numbers, but `text-overline` itself is uppercase — which "+2"
1150
+ must not be — so the pill takes the token pair without the transform, on the pill's own 1.25rem
1151
+ height as its line box. */
1152
+ @utility text-select-pill {
1153
+ font-family: var(--eldra-font-body);
1154
+ font-size: var(--eldra-text-overline-size);
1155
+ line-height: var(--eldra-select-pill-line, 1.25rem);
1156
+ font-weight: var(--tw-font-weight, var(--eldra-text-overline-weight));
1157
+ font-variant-numeric: tabular-nums;
1158
+ }
1159
+
1160
+ /* The popover's own box (spec "Select" -> Sizes, Popover row): "Min width = trigger, grows to fit
1161
+ its content up to min(22rem, 90vw). Max height 20rem: the list scrolls while the search field
1162
+ stays put." Two utilities rather than one, because they belong to Tailwind's `max-h` and `max-w`
1163
+ merge groups respectively — so a consumer's `classes.panel: 'max-h-64'` replaces the height
1164
+ without also dropping the width clamp. */
1165
+ @utility eldra-select-panel-height {
1166
+ max-height: var(--eldra-select-panel-max-height, 20rem);
1167
+ }
1168
+ @utility eldra-select-panel-width {
1169
+ max-width: min(var(--eldra-select-panel-max-width, 22rem), 90vw);
1170
+ }
1171
+
1172
+ /* The matched run of a filtered option (spec "Select" -> States, "Option filtered match"):
1173
+ "matched characters weight 700, 2px underline at 0.15em offset". None of the three is a token —
1174
+ the type styles stop at 600 and no underline offset exists anywhere else — so all three are
1175
+ per-component variables with the spec's literals as defaults. */
1176
+ @utility eldra-select-match {
1177
+ font-weight: var(--eldra-select-match-weight, 700);
1178
+ text-decoration-line: underline;
1179
+ text-decoration-thickness: var(--eldra-select-match-underline, 2px);
1180
+ text-underline-offset: var(--eldra-select-match-underline-offset, 0.15em);
1181
+ }
1182
+
1183
+ /* An option's colour swatch (spec "Select" -> Sizes, Option row): "Swatch 1rem with a 1px inner
1184
+ edge of `text` at 30%", which the Accessibility notes explain — "Swatch edges carry a 1px inner
1185
+ edge so pale colours stay visible". An inner edge rather than a border, so the swatch stays
1186
+ exactly 1rem whatever colour a store's product data carries. */
1187
+ @utility eldra-select-swatch {
1188
+ box-shadow: inset 0 0 0 var(--eldra-select-swatch-edge, 1px)
1189
+ color-mix(in oklab, var(--eldra-color-text), transparent 70%);
1190
+ }
1191
+
1192
+ /* A Multi-select option's checkbox (spec "Multi-select" -> Sizes, "Checkbox in option"): "1rem
1193
+ square, 1.5px `border-strong`, 0.25rem radius". The radius is its own variable rather than
1194
+ `--eldra-checkbox-radius`: the box is 1rem where a `Checkbox`'s is 1.125rem or 1.5rem, and
1195
+ `radius-sm` (0.375rem) on a 1rem square reads as a pill rather than a checkbox. The border
1196
+ width is shared with `Checkbox` through `eldra-checkbox-border`. */
1197
+ @utility eldra-select-check-radius {
1198
+ border-radius: var(--eldra-select-check-radius, 0.25rem);
1199
+ }
1200
+
1201
+ /* The active and selected option rows under forced colours (spec "Select" -> States: the active row
1202
+ is "`surface-strong`" fill and the selected row is "weight 600 + check"). Forced-colours mode
1203
+ replaces every fill with the system canvas and flattens most weight differences, so each of the
1204
+ two states needs a real boundary there or the list reads as one undifferentiated block. Both are
1205
+ drawn as insets, so a row never changes size when it becomes active or selected.
1206
+
1207
+ `Highlight` for the active row is the system's own "this is where you are" colour, the same one
1208
+ the focus ring borrows; the selected row takes a thinner `CanvasText` line, which reads as a
1209
+ property of the row rather than as the cursor. `eldra-select-option-active` is declared *after*
1210
+ `-selected` on purpose: the two write the same `outline`, and on a row that is both, the one
1211
+ worth seeing is where the keyboard is — selection is still carried by the check mark beside it.
1212
+ Nothing here applies outside forced colours, so the two utilities never fight the fill and weight
1213
+ that carry the same states everywhere else. */
1214
+ @utility eldra-select-option-selected {
1215
+ @media (forced-colors: active) {
1216
+ outline: var(--eldra-select-selected-outline, 1px) solid CanvasText;
1217
+ outline-offset: calc(-1 * var(--eldra-select-selected-outline, 1px));
1218
+ }
1219
+ }
1220
+ @utility eldra-select-option-active {
1221
+ @media (forced-colors: active) {
1222
+ outline: var(--eldra-select-active-outline, 2px) solid Highlight;
1223
+ outline-offset: calc(-1 * var(--eldra-select-active-outline, 2px));
1224
+ }
1225
+ }
1226
+
1227
+ /* The entrance of EVERY popover in this package — `Select`'s panel, `MultiSelect`'s and the
1228
+ `SearchBar`'s results panel — is this one animation: opacity 0 -> 1 and a uniform scale 0.98 -> 1
1229
+ over `duration-base` with `ease-out`, growing from the corner the panel is anchored by. Closing
1230
+ is instant.
1231
+
1232
+ The spec ("Select" -> Behaviour & motion, Opening) writes it as a fade plus a 0.25rem slide plus
1233
+ a *vertical* scale, and that is what shipped first. Operator decision, 2026-09-25: drop the slide
1234
+ and scale both axes. The slide is what made the panel read as a separate object arriving from
1235
+ somewhere rather than as the control opening out, and a `scaleY`-only entrance stretches the type
1236
+ inside the panel while it plays. Recorded under Deviations in the README. The `SearchBar`'s panel
1237
+ had no entrance at all before that decision; it now plays the same one.
1238
+
1239
+ The origin is a custom property the panel sets inline from the placement it resolved to
1240
+ (`usePopover`'s `panelStyle`): `top left` below the control, `bottom left` above it, so the panel
1241
+ grows out of the edge it is attached to. One keyframe set with that property rather than two sets
1242
+ with two names: a panel that flips swaps its origin the frame after it mounts — floating-ui
1243
+ measures asynchronously — and a new `animation-name` would restart the animation from zero, so
1244
+ the popover visibly faded in twice. A custom property is read by the running animation instead,
1245
+ so the entrance plays exactly once whichever way it ends up pointing.
1246
+
1247
+ Reduced motion needs nothing here: `--eldra-duration-base` is 0ms under
1248
+ `prefers-reduced-motion: reduce` (tokens.css), so the panel simply appears in its end state — the
1249
+ same mechanism every transition in this package uses. `transform: scale()` rather than the
1250
+ independent `scale` property, because the panel's `transform` is otherwise untouched and the
1251
+ shorthand is the more widely animatable of the two. */
1252
+ @keyframes eldra-popover-in {
1253
+ from {
1254
+ opacity: 0;
1255
+ transform: scale(0.98);
1256
+ }
1257
+ to {
1258
+ opacity: 1;
1259
+ transform: none;
1260
+ }
1261
+ }
1262
+ @utility animate-eldra-popover-in {
1263
+ animation: eldra-popover-in var(--eldra-duration-base) var(--eldra-ease-out);
1264
+ transform-origin: var(--eldra-popover-origin, top left);
1265
+ }
1266
+
1267
+ /* --- Tooltip ---------------------------------------------------------------------------------- */
1268
+
1269
+ /* Spec "Tooltip" -> Sizes: "0.8125rem / 1.4, weight 500, one line (no wrap)". The size and line
1270
+ are `text-caption`'s exactly (0.8125rem / 1.4) -- reused rather than duplicated, the same shape
1271
+ as `text-variant-legend` reusing `text-body-sm`'s. The weight is left to the stock
1272
+ `font-medium` utility, also `text-variant-legend`'s own reasoning: a `font` shorthand here would
1273
+ bake a weight in ahead of it in source order, and `tailwind-merge`'s `font-size` group (this
1274
+ utility's own, via `cx.ts`) does not touch `font-weight` anyway. */
1275
+ @utility text-tooltip {
1276
+ font-family: var(--eldra-font-body);
1277
+ font-size: var(--eldra-text-caption-size);
1278
+ line-height: var(--eldra-text-caption-line);
1279
+ }
1280
+
1281
+ /* The arrow (spec "Tooltip" -> Sizes, Arrow row): "0.3125rem, centred (start / end: 1.25rem from
1282
+ the aligned edge)" -- a rotated square, half on each side of the boundary between the bubble and
1283
+ the trigger, so it reads as a triangle pointing at whichever one is behind it. `0.3125rem` has no
1284
+ shared token (nothing else in the package needs a fifth-of-a-rem), so it is a per-component
1285
+ variable with that literal default, the same shape as `--eldra-avatar-initials-size-*`; see the
1286
+ README's Customisation table. The horizontal alignment (`left-5`/`right-5`/centred) and the
1287
+ vertical offset (which edge, since the bubble can flip) are `Tooltip.vue`'s own reactive classes
1288
+ and inline style -- this utility only draws the shape. */
1289
+ @utility eldra-tooltip-arrow {
1290
+ position: absolute;
1291
+ width: var(--eldra-tooltip-arrow-size, 0.3125rem);
1292
+ height: var(--eldra-tooltip-arrow-size, 0.3125rem);
1293
+ background-color: var(--eldra-color-text);
1294
+ transform: rotate(45deg);
1295
+ pointer-events: none;
1296
+ }
1297
+
1298
+ /* --- Search bar ------------------------------------------------------------------------------- */
1299
+
1300
+ /* A result row's meta (spec "Search bar" -> Sizes, "Title / sub / meta" row): "0.875rem 600
1301
+ tabular" — a price. Both numbers already read tokens (`text-label-weight` is 600,
1302
+ `text-body-sm-size` is 0.875rem); only the 1.35 line of the row's text stack is this component's
1303
+ own, and it is shared with the row's title, which reuses `text-select-option` (the same
1304
+ 0.9375rem on the same 1.35 line the spec gives both components). */
1305
+ @utility text-search-meta {
1306
+ font-family: var(--eldra-font-body);
1307
+ font-size: var(--eldra-text-body-sm-size);
1308
+ line-height: var(--eldra-search-text-line, 1.35);
1309
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
1310
+ font-variant-numeric: tabular-nums;
1311
+ }
1312
+
1313
+ /* The no-results title (spec -> Sizes, "No-results message" row): "Title 1rem 600". The size and
1314
+ the weight are tokens; the 1.4 line has none of its own, so it is a per-component variable with
1315
+ that literal default, exactly like `text-card-title`'s. */
1316
+ @utility text-search-title {
1317
+ font-family: var(--eldra-font-body);
1318
+ font-size: var(--eldra-text-body-size);
1319
+ line-height: var(--eldra-search-empty-line, 1.4);
1320
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
1321
+ }
1322
+
1323
+ /* The `/` keyboard-key chip (spec -> Sizes, "Keyboard hint" row): "monospace, 0.75rem". The size
1324
+ is the overline token's, the family the mono token's, and the 1rem line box is the chip's own
1325
+ height rather than a ratio. */
1326
+ @utility text-search-kbd {
1327
+ font-family: var(--eldra-font-mono);
1328
+ font-size: var(--eldra-text-overline-size);
1329
+ line-height: var(--eldra-search-kbd-line, 1rem);
1330
+ font-weight: var(--tw-font-weight, var(--eldra-text-body-weight));
1331
+ }
1332
+
1333
+ /* The results panel's own box (spec -> Sizes, Panel row): "Max height min(32rem, 70vh), scrolls
1334
+ inside". Tailwind's `max-h` group, so a consumer's `classes.panel: 'max-h-64'` replaces it
1335
+ outright. The panel's *width* is the field's (`useFloating`'s `matchWidth`), so there is no
1336
+ width clamp to go with it, unlike the select popover's pair. */
1337
+ @utility eldra-search-panel-height {
1338
+ max-height: min(var(--eldra-search-panel-max-height, 32rem), 70vh);
1339
+ }
1340
+
1341
+ /* --- Variant picker --------------------------------------------------------------------------- */
1342
+
1343
+ /* The legend's own text (spec "Variant picker" → Sizes, Legend row): "0.875rem; name 600, value
1344
+ 400 muted". Deliberately no weight in the shorthand, for the same reason `text-counter` and
1345
+ `text-field-note` have none: the name run and the value run need two different weights of the
1346
+ *same* size, and layering a `font-weight` utility after a shorthand `font` property that already
1347
+ bakes one in is order-dependent (see `text-counter`'s own comment above this component's
1348
+ utilities in the earlier "Sizes" section). So the component pairs this with the stock
1349
+ `font-semibold`/`font-normal` utilities instead, exactly as those two already do. The size reuses
1350
+ the body-sm token; the line ratio has no token of its own, so it is a per-component variable with
1351
+ a literal default, the same shape as `text-card-title`'s 1.4. */
1352
+ @utility text-variant-legend {
1353
+ font-family: var(--eldra-font-body);
1354
+ font-size: var(--eldra-text-body-sm-size);
1355
+ line-height: var(--eldra-variant-legend-line, 1.4);
1356
+ }
1357
+
1358
+ /* A pill option's own text (spec "Variant picker" → Sizes, Pill row): "0.9375rem, 500 (600
1359
+ selected)". Same reasoning as `text-variant-legend` above — one size, two weights depending on
1360
+ selection — so no weight in the shorthand; the component pairs this with `font-medium`/
1361
+ `font-semibold`. The size and line reuse the same control-font variables `text-control` already
1362
+ reads, so a pill's text sits at the same size as an Input's. */
1363
+ @utility text-variant-pill {
1364
+ font-family: var(--eldra-font-body);
1365
+ font-size: var(--eldra-control-font-size, 0.9375rem);
1366
+ line-height: var(--eldra-control-line-height, 1.5rem);
1367
+ }
1368
+
1369
+ /* A pill's own boundary (spec "Variant picker" → States): "1px" in every row but one. The width is
1370
+ a variable rather than Tailwind's `border`, the same shape as `eldra-field-border` and
1371
+ `eldra-checkbox-border` above: the "sold out + selected" row's own 2px line (below) is inset by
1372
+ exactly this much. */
1373
+ @utility eldra-variant-pill-border {
1374
+ border-width: var(--eldra-variant-pill-border-width, 1px);
1375
+ }
1376
+
1377
+ /* The sold-out-and-selected pill's boundary (spec "Variant picker" → States, "Sold out + selected"
1378
+ row): "**2px** solid `text`" — the only pill row whose border is thicker than the other four.
1379
+ The same technique as `eldra-radio-card-selected`: the real border
1380
+ stays `eldra-variant-pill-border`'s 1px in every state, so a pill never resizes (and its row
1381
+ neighbours never reflow) the moment it becomes both sold out and selected, and a second 1px
1382
+ inset line does the rest. */
1383
+ @utility eldra-variant-pill-selected-line {
1384
+ position: relative;
1385
+ &::after {
1386
+ content: '';
1387
+ position: absolute;
1388
+ inset: var(--eldra-variant-pill-border-width, 1px);
1389
+ border: var(--eldra-variant-pill-border-width, 1px) solid
1390
+ var(--eldra-variant-pill-selected-color, var(--eldra-color-text));
1391
+ border-radius: calc(
1392
+ var(--eldra-variant-pill-radius, var(--eldra-radius-md)) -
1393
+ var(--eldra-variant-pill-border-width, 1px)
1394
+ );
1395
+ pointer-events: none;
1396
+ }
1397
+ }
1398
+
1399
+ /* A sold-out pill's diagonal line (spec "Variant picker" → Anatomy: "sold out: dashed border +
1400
+ diagonal line"; → States, Sold out row: "a 1px diagonal `border-strong` line (bottom-left to
1401
+ top-right)"). Drawn in `VariantPicker.vue` as an inline `<svg viewBox="0 0 100 100"
1402
+ preserveAspectRatio="none">` stretched over the pill, with `vector-effect="non-scaling-stroke"`
1403
+ on its `<line>` — the SVG spec's own way to keep a stroke a constant screen-pixel width no
1404
+ matter how non-uniformly its coordinate system is scaled. A `background: linear-gradient`
1405
+ diagonal was tried first and rejected: its stripe is measured along the gradient line, whose
1406
+ length shrinks as a box gets wider relative to its height, so the same "1px" stop distance
1407
+ inflates into a visibly thick band on a long pill (`LongLabels` story) while staying correct on
1408
+ a short one — exactly what a pill's variable, label-dependent width guarantees will happen.
1409
+ Nothing in `tailwind.css` needs to know the pill's own colour class here: the `<svg>` reads
1410
+ `currentColor` (`text-border-strong`, set alongside it in the component), so it never needs a
1411
+ custom utility of its own; only the `<line>`'s literal `stroke-width="1"` (the spec's own
1412
+ number) lives outside a class, the same way `Checkbox`'s tick mark carries its own literal
1413
+ `stroke-width` and path. Real borders stay real borders in forced-colours mode (spec "Actions
1414
+ and forms" → Forced colours): the line sits *beside* the pill's own real
1415
+ `eldra-variant-pill-border`, which is what stays visible there; the two together are how the
1416
+ spec tells "sold out" from "selected" without colour alone (1.4.1). */
1417
+
1418
+ /* The swatch's own ring (spec "Variant picker" → Sizes, Swatch row): "a 2px ring (transparent at
1419
+ rest), then a 3px gap, then the colour disc". The ring is drawn as a real `border` on the
1420
+ outer 2.75rem shape — the same element the proxy focus ring sits on — kept at this one constant
1421
+ width in every state (spec: "transparent at rest"; hover and selected only ever recolour it, in
1422
+ `VariantPicker.vue`), so the swatch never resizes when it gains a ring. The 3px gap between the
1423
+ ring and the disc is the shape's own padding (`p-0.75`, `--spacing` × 0.75 = 0.1875rem = 3px —
1424
+ the same dynamic-spacing technique `RadioGroup`'s `mt-0.75` and `gap-x-2.5` already use), which
1425
+ is also what lets the inner disc fill the remaining space with a plain `size-full` rather than a
1426
+ second literal measurement. */
1427
+ @utility eldra-variant-swatch-ring {
1428
+ border-width: var(--eldra-variant-swatch-ring-width, 2px);
1429
+ }
1430
+
1431
+ /* The colour disc's own edge (spec "Variant picker" → Sizes, Swatch row: "the colour disc with a
1432
+ 1px inner `border-strong` edge"; → Accessibility: "The disc edge uses `border-strong`, so pale
1433
+ swatches (Ecru, Chalk) keep a 3:1 boundary (1.4.11)"). A real `border`, not `eldra-select-
1434
+ swatch`'s inset `box-shadow` (that one is this package's *other* swatch, the 1rem one inside a
1435
+ `Select` option row) — forced-colours mode can drop a decorative shadow, and the spec's own
1436
+ "Forced colours: borders stay as real borders" rule is written for exactly this boundary, the
1437
+ one WCAG 1.4.11 is about. Box-sizing keeps the disc's outer size unchanged by its own border, so
1438
+ it still fills the ring's padded interior exactly via `size-full`. */
1439
+ @utility eldra-variant-swatch-edge {
1440
+ border-width: var(--eldra-variant-swatch-edge-width, 1px);
1441
+ }
1442
+
1443
+ /* The live "No image" placeholder's hatching (spec "Image" → Sizes, "Placeholder hatching" row:
1444
+ "1px diagonal lines (135°) every 0.75rem in `border` at 70% strength over `surface`"). A
1445
+ `repeating-linear-gradient` rather than an SVG or a `background-image` data URI: it is one flat
1446
+ colour repeated, which a gradient expresses exactly and without shipping a raster/vector asset
1447
+ for a one-pixel line. "70% strength" is `border` mixed with 30% transparency, the same
1448
+ `color-mix(in oklab, …, transparent <n>%)` shape `eldra-skeleton`'s shimmer above already uses
1449
+ for its own "at 60% strength" fill. The repeat distance is a variable with the spec's own
1450
+ 0.75rem as its default rather than a literal in the gradient stops, so a consumer who wants a
1451
+ finer or coarser hatch does not have to redeclare the whole gradient. */
1452
+ @utility eldra-image-placeholder-hatch {
1453
+ --eldra-image-hatch-gap: 0.75rem;
1454
+ background-color: var(--eldra-color-surface);
1455
+ background-image: repeating-linear-gradient(
1456
+ 135deg,
1457
+ color-mix(in oklab, var(--eldra-color-border), transparent 30%) 0,
1458
+ color-mix(in oklab, var(--eldra-color-border), transparent 30%) 1px,
1459
+ transparent 1px,
1460
+ transparent var(--eldra-image-hatch-gap)
1461
+ );
1462
+ }
1463
+
1464
+ /* A sold-out swatch's diagonal line (spec "Variant picker" → States, Sold out row: "2px diagonal
1465
+ line in `text` with a 1.5px `background` halo, from 4px inside the top to 4px inside the bottom,
1466
+ rotated 45°") is drawn in `VariantPicker.vue` as an inline `<svg>`, not a class-only utility —
1467
+ the same reasoning as the pill's line above, and for an even sharper reason here: a first
1468
+ version drew it with `background-color` (the line) plus a `box-shadow` (the halo), and *both*
1469
+ properties are exactly the ones forced-colours mode empties out — the line vanished completely
1470
+ under `forced-colors: active`, the one mode this indicator exists to survive (spec "Actions and
1471
+ forms" → Forced colours; WCAG 1.4.1). An SVG `<line stroke="currentColor">` does not have that
1472
+ problem: forced-colours remaps a stroke the same way it remaps a real border. Two stacked
1473
+ `<line>`s (a wider one in `background`, first, then the spec's own 2px in `text`) draw the halo
1474
+ and the line together, at the endpoints the spec's "4px inside the top … rotated 45°" geometry
1475
+ actually produces — worked out once in that component's own comment rather than re-derived by a
1476
+ consumer reading a CSS transform. */
1477
+
1478
+ /* --- Avatar ---------------------------------------------------------------------------------- */
1479
+
1480
+ /* Avatar initials/"+N" type (spec "Avatar" → Sizes: the Initials column is "38% of diameter" —
1481
+ 0.76rem/0.95rem/1.33rem/2.28rem at sm/md/lg/xl, none of which matches a token in tokens.json —
1482
+ plus "Initials weight 600, letter-spacing 0.02em" from the paragraph under the table). Weight
1483
+ reuses `--eldra-text-label-weight` (600, the same token every other 600-weight utility in this
1484
+ file reads); the size and the 0.02em tracking have no token of their own, so — like
1485
+ `text-button-lg`'s 1.0625rem — each is a per-component CSS variable with the spec's own number
1486
+ as its literal default. One line (`/ 1`): initials are a single short run, never a wrapped
1487
+ paragraph, so there is no ratio to name. `AvatarGroup`'s "+N" counter reuses the same size at
1488
+ `sm` (`Avatar.vue`'s own comment) rather than a fifth type style, since the spec's States table
1489
+ gives it the identical treatment ("Initials / '+N' … `text`"). */
1490
+ @utility text-avatar-initials-sm {
1491
+ font-family: var(--eldra-font-body);
1492
+ font-size: var(--eldra-avatar-initials-size-sm, 0.76rem);
1493
+ line-height: 1;
1494
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
1495
+ letter-spacing: var(--eldra-avatar-initials-tracking, 0.02em);
1496
+ }
1497
+ @utility text-avatar-initials-md {
1498
+ font-family: var(--eldra-font-body);
1499
+ font-size: var(--eldra-avatar-initials-size-md, 0.95rem);
1500
+ line-height: 1;
1501
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
1502
+ letter-spacing: var(--eldra-avatar-initials-tracking, 0.02em);
1503
+ }
1504
+ @utility text-avatar-initials-lg {
1505
+ font-family: var(--eldra-font-body);
1506
+ font-size: var(--eldra-avatar-initials-size-lg, 1.33rem);
1507
+ line-height: 1;
1508
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
1509
+ letter-spacing: var(--eldra-avatar-initials-tracking, 0.02em);
1510
+ }
1511
+ @utility text-avatar-initials-xl {
1512
+ font-family: var(--eldra-font-body);
1513
+ font-size: var(--eldra-avatar-initials-size-xl, 2.28rem);
1514
+ line-height: 1;
1515
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
1516
+ letter-spacing: var(--eldra-avatar-initials-tracking, 0.02em);
1517
+ }
1518
+
1519
+ /* The user-icon fallback's size (spec "Avatar" → Sizes, closing paragraph: "Icon: 1.5rem in lg
1520
+ (scale proportionally)"). Only `lg` is given a literal number; the other three are that same
1521
+ icon-to-diameter ratio (1.5 / 3.5, the `lg` diameter) applied to their own diameter (2rem,
1522
+ 2.5rem, 6rem) and rounded to three decimal places — precise enough for a stroke this thin, and
1523
+ consistent with how every other one-off number in this file is a per-component variable with a
1524
+ literal default rather than a class-level arbitrary value. Registered in the `size` class group
1525
+ in `src/utils/mergeClass.ts` (the same group `size-*` itself belongs to), so `classes.icon: 'size-6'`
1526
+ replaces one of these instead of landing beside it. */
1527
+ @utility eldra-avatar-icon-sm {
1528
+ width: var(--eldra-avatar-icon-size-sm, 0.857rem);
1529
+ height: var(--eldra-avatar-icon-size-sm, 0.857rem);
1530
+ }
1531
+ @utility eldra-avatar-icon-md {
1532
+ width: var(--eldra-avatar-icon-size-md, 1.071rem);
1533
+ height: var(--eldra-avatar-icon-size-md, 1.071rem);
1534
+ }
1535
+ @utility eldra-avatar-icon-lg {
1536
+ width: var(--eldra-avatar-icon-size-lg, 1.5rem);
1537
+ height: var(--eldra-avatar-icon-size-lg, 1.5rem);
1538
+ }
1539
+ @utility eldra-avatar-icon-xl {
1540
+ width: var(--eldra-avatar-icon-size-xl, 2.571rem);
1541
+ height: var(--eldra-avatar-icon-size-xl, 2.571rem);
1542
+ }
1543
+
1544
+ /* --- Container and section -------------------------------------------------------------------- */
1545
+
1546
+ /* Spec "Container and section" → Do/Don't: "Do alternate none and surface between neighbouring
1547
+ blocks instead of adding divider lines" and the acceptance criterion this rule is actually for —
1548
+ two adjacent same-background `Section`s read as one continuous band, not as two spacing bands
1549
+ stacked with a visible seam. `Section.vue` marks its own ground on every background (including
1550
+ `none`) with `data-section-bg`, and a second `Section` immediately after one with the same value
1551
+ drops its own top padding (`Section` splits its spacing into separate `pt-*`/`pb-*` utilities
1552
+ instead of the `py-*` shorthand for exactly this: only the top half is ever touched, so the
1553
+ bottom edge — what the *next* sibling's own top-drop reads against — never moves).
1554
+
1555
+ This is plain CSS, not `@utility`, and deliberately outside every `@layer`: Tailwind's utilities
1556
+ compile into `@layer utilities` (`@import 'tailwindcss'` declares the layer order), and a rule
1557
+ with no layer at all always wins the cascade over every layered rule regardless of selector
1558
+ specificity or source order (CSS Cascade Layers) — which is what lets `Section`'s own `spacing`
1559
+ stay an ordinary, always-overridable `pt-*`/`pb-*` utility while this one rule still beats it
1560
+ whenever two matching grounds are adjacent. `src/__tests__/sectionAdjacentBackground.spec.ts`
1561
+ compiles this file and asserts the built rule wins. Five explicit pairs, not a single generic
1562
+ attribute selector, because CSS has no "same value as the previous sibling" selector — only an
1563
+ exact value can be matched on each side. */
1564
+ [data-section-bg='none'] + [data-section-bg='none'],
1565
+ [data-section-bg='surface'] + [data-section-bg='surface'],
1566
+ [data-section-bg='surface-strong'] + [data-section-bg='surface-strong'],
1567
+ [data-section-bg='primary'] + [data-section-bg='primary'],
1568
+ [data-section-bg='accent'] + [data-section-bg='accent'] {
1569
+ padding-top: 0;
1570
+ }
1571
+
1572
+ /* --- Dialog ---------------------------------------------------------------------------------- */
1573
+
1574
+ /* The title (spec "Dialog" → Sizes): "heading font, 1.25rem / 1.3, weight 600, letter-spacing
1575
+ -0.01em." Weight and tracking already read `h3`'s own tokens exactly (600, -0.01em — the same
1576
+ reuse `text-logo-wordmark` makes for its own weight/tracking); only the 1.25rem size and 1.3 line
1577
+ sit between two type styles with no token of their own, so, like `Button`'s `lg` size, they are
1578
+ per-component variables with the spec's literals as defaults. */
1579
+ @utility text-dialog-title {
1580
+ font-family: var(--eldra-font-heading);
1581
+ font-size: var(--eldra-dialog-title-size, 1.25rem);
1582
+ line-height: var(--eldra-dialog-title-line, 1.3);
1583
+ font-weight: var(--tw-font-weight, var(--eldra-text-h3-weight));
1584
+ letter-spacing: var(--eldra-text-h3-tracking);
1585
+ }
1586
+
1587
+ /* The panel's own box (spec "Dialog" → Sizes): "Width min(32rem, 100vw − 2rem) (sm: min(24rem,
1588
+ 100vw − 2rem))" and "Max height 100vh − 4rem; content beyond that scrolls inside the dialog." The
1589
+ width pair keep the viewport clamp inside the utility itself, unlike `eldra-select-panel-width`'s
1590
+ `min()` — a Dialog's own width is a fixed spec number a consumer can override with
1591
+ `--eldra-dialog-width(-sm)`, and the clamp must still apply to whatever that override is, not
1592
+ only to the default. Each is in Tailwind's own `w`/`max-h` group (`src/utils/mergeClass.ts`), so a
1593
+ consumer's `classes.panel: 'w-full'` replaces the clamp instead of landing beside it. */
1594
+ @utility eldra-dialog-width {
1595
+ width: min(var(--eldra-dialog-width, 32rem), calc(100vw - 2rem));
1596
+ }
1597
+ @utility eldra-dialog-width-sm {
1598
+ width: min(var(--eldra-dialog-width-sm, 24rem), calc(100vw - 2rem));
1599
+ }
1600
+ @utility eldra-dialog-max-height {
1601
+ max-height: var(--eldra-dialog-max-height, calc(100vh - 4rem));
1602
+ }
1603
+
1604
+ /* The dialog's own entrance (spec "Dialog" → Behaviour & motion): "Enter: opacity 0 -> 1, 0.5rem
1605
+ rise and scale 0.98 -> 1, duration-slow (250ms) ease-out. Exit: instant." The house pattern is
1606
+ `eldra-popover-in` above — fade plus scale over a token duration, nothing to do for reduced
1607
+ motion because the duration token itself zeroes — but Dialog's own reduced-motion row is not
1608
+ "nothing moves, so the token collapsing to 0ms already reads as done": the spec asks for "a plain
1609
+ fade over duration-base (200ms), linear," a real, *visible* fade, the same exception
1610
+ `animate-eldra-pulse` makes for the Button spinner and for the same reason — reading
1611
+ `--eldra-duration-base` here would zero it too and the dialog would just snap into view with no
1612
+ fade at all. So the reduced-motion state is a second keyframe set with its own literal, always-on
1613
+ 200ms, applied through `motion-reduce:` (`Dialog.vue`: `animate-eldra-dialog-in
1614
+ motion-reduce:animate-eldra-dialog-in-reduced`) rather than through the zeroing token — exactly
1615
+ the two-utility shape `animate-eldra-spin`/`animate-eldra-pulse` already uses, registered in the
1616
+ same `animate` merge group in `src/utils/mergeClass.ts`. Exit needs no utility at all: the spec's own
1617
+ "instant by default" is simply not animating the close. */
1618
+ @keyframes eldra-dialog-in {
1619
+ from {
1620
+ opacity: 0;
1621
+ transform: translateY(0.5rem) scale(0.98);
1622
+ }
1623
+ to {
1624
+ opacity: 1;
1625
+ transform: none;
1626
+ }
1627
+ }
1628
+ @keyframes eldra-dialog-in-reduced {
1629
+ from {
1630
+ opacity: 0;
1631
+ }
1632
+ to {
1633
+ opacity: 1;
1634
+ }
1635
+ }
1636
+ @utility animate-eldra-dialog-in {
1637
+ animation: eldra-dialog-in var(--eldra-duration-slow) var(--eldra-ease-out);
1638
+ }
1639
+ @utility animate-eldra-dialog-in-reduced {
1640
+ animation: eldra-dialog-in-reduced 200ms linear;
1641
+ }
1642
+ /* --- Tabs ---------------------------------------------------------------------------------- */
1643
+
1644
+ /* Spec "Tabs" → Anatomy, point 1: "scrolls horizontally when the tabs overflow (never wraps),
1645
+ scrollbar hidden." Tailwind has no stock utility for hiding a scrollbar — `overflow-x-auto`
1646
+ alone still shows the browser's own bar — so this is one small utility rather than an arbitrary
1647
+ value repeated at the call site. Registered in `src/utils/mergeClass.ts` under its own class group (see
1648
+ `custom-utility-coverage.spec.ts`), the same shape as `target-min`/`target-touch` above: no stock
1649
+ Tailwind group covers "show/hide a scrollbar" either. */
1650
+ @utility eldra-scrollbar-hide {
1651
+ scrollbar-width: none;
1652
+ -ms-overflow-style: none;
1653
+ &::-webkit-scrollbar {
1654
+ display: none;
1655
+ }
1656
+ }
1657
+
1658
+ /* --- Drawer ----------------------------------------------------------------------------------- */
1659
+
1660
+ /* The title (spec "Drawer" → Sizes): "heading font, 1.25rem / 1.3, weight 600, letter-spacing
1661
+ -0.01em" — the exact same numbers as `text-dialog-title` above, but its own variable pair
1662
+ rather than a shared one: a consumer restyling one component's title should not have to think
1663
+ about whether the other one moves with it. */
1664
+ @utility text-drawer-title {
1665
+ font-family: var(--eldra-font-heading);
1666
+ font-size: var(--eldra-drawer-title-size, 1.25rem);
1667
+ line-height: var(--eldra-drawer-title-line, 1.3);
1668
+ font-weight: var(--tw-font-weight, var(--eldra-text-h3-weight));
1669
+ letter-spacing: var(--eldra-text-h3-tracking);
1670
+ }
1671
+
1672
+ /* The panel's own width (spec "Drawer" → Properties, `width` row: "Maximum width; always capped
1673
+ at 100% of the viewport") plus the full-screen mobile variant (spec "Drawer" → Mobile: "On any
1674
+ viewport narrower than the drawer's width, the drawer is full width and full height"; Global
1675
+ Constraints: the full-screen variants of Drawer, Lightbox and Search modal are one of only two
1676
+ rules in the whole spec measured on the **viewport**, not a container — operator decision,
1677
+ 2026-09-25). `--eldra-drawer-width` is a literal per-component variable (the spec's own 28rem
1678
+ default sits between two tokens and has none of its own, the same shape as `--eldra-dialog-
1679
+ width`), set from the `width` prop on the panel's own inline style; the viewport cap lives
1680
+ inside the utility itself so it still applies to whatever a consumer sets that variable to, not
1681
+ only to the default. The `48rem` edge below is a plain `@media` query — Tailwind's own `md`
1682
+ *viewport* breakpoint, the same one `max-md:text-control-mobile` above measures — never a
1683
+ `@container` query: this is one of the two rules in the whole design spec that measures the
1684
+ viewport on purpose, not the enclosing block. */
1685
+ @utility eldra-drawer-width {
1686
+ width: min(var(--eldra-drawer-width, 28rem), 100vw);
1687
+ @media (width < 48rem) {
1688
+ width: 100vw;
1689
+ }
1690
+ }
1691
+
1692
+ /* Drawer: the side gutter and the header row's least height from their variables, and the edge paddings, each with
1693
+ the device's safe area added (zero unless the page sets `viewport-fit=cover`). One property per utility, so a
1694
+ consumer's `px-*`, `pt-*`, `pb-*` or `min-h-*` replaces exactly the one it names. */
1695
+ @utility eldra-drawer-gutter {
1696
+ padding-inline: calc(
1697
+ var(--eldra-drawer-gutter, var(--eldra-space-6)) +
1698
+ max(env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px))
1699
+ );
1700
+ }
1701
+
1702
+ @utility eldra-drawer-header-height {
1703
+ min-height: calc(
1704
+ var(--eldra-drawer-header-height, var(--eldra-space-16)) + env(safe-area-inset-top, 0px)
1705
+ );
1706
+ }
1707
+
1708
+ @utility eldra-drawer-header-top {
1709
+ padding-top: calc(
1710
+ var(--eldra-drawer-header-padding, var(--eldra-space-4)) + env(safe-area-inset-top, 0px)
1711
+ );
1712
+ }
1713
+
1714
+ @utility eldra-drawer-header-bottom {
1715
+ padding-bottom: var(--eldra-drawer-header-padding, var(--eldra-space-4));
1716
+ }
1717
+
1718
+ @utility eldra-drawer-body-bottom {
1719
+ padding-bottom: calc(var(--eldra-space-6) + env(safe-area-inset-bottom, 0px));
1720
+ }
1721
+
1722
+ @utility eldra-drawer-footer-bottom {
1723
+ padding-bottom: calc(var(--eldra-space-5) + env(safe-area-inset-bottom, 0px));
1724
+ }
1725
+
1726
+ /* The drawer's own entrance (spec "Drawer" → Behaviour & motion): "Enter: slides in from its edge
1727
+ (translateX(100%) -> 0 for right, -100% -> 0 for left), duration-slow (250ms) ease-out. Exit:
1728
+ instant." Applied to the `<dialog>` root itself (`Drawer.vue`: `animate-eldra-drawer-in-{side}
1729
+ motion-reduce:animate-eldra-dialog-in-reduced`), the same placement `Dialog`'s own
1730
+ `animate-eldra-dialog-in` uses — the root is a full-viewport transparent flex box that only
1731
+ docks its (opaque) panel child to one edge, so translating the root by a full 100% of its own
1732
+ (viewport) width slides the panel fully off-screen and back regardless of the panel's own
1733
+ width, while the `::backdrop` (a sibling box, not a descendant) is untouched by the transform
1734
+ and simply stays put. Reduced motion reuses `Dialog`'s own `eldra-dialog-in-reduced` keyframe
1735
+ rather than a third one of its own: the spec's "plain fade over duration-base (200ms), linear"
1736
+ is the identical opacity-only fade Dialog's reduced-motion state already draws, so a second
1737
+ keyframe with the same two declarations would only be a second name for the same rule. Exit
1738
+ needs no utility at all, matching "instant by default" the same way Dialog's own exit does. */
1739
+ @keyframes eldra-drawer-in-right {
1740
+ from {
1741
+ transform: translateX(100%);
1742
+ }
1743
+ to {
1744
+ transform: translateX(0);
1745
+ }
1746
+ }
1747
+ @keyframes eldra-drawer-in-left {
1748
+ from {
1749
+ transform: translateX(-100%);
1750
+ }
1751
+ to {
1752
+ transform: translateX(0);
1753
+ }
1754
+ }
1755
+ @utility animate-eldra-drawer-in-right {
1756
+ animation: eldra-drawer-in-right var(--eldra-duration-slow) var(--eldra-ease-out);
1757
+ }
1758
+ @utility animate-eldra-drawer-in-left {
1759
+ animation: eldra-drawer-in-left var(--eldra-duration-slow) var(--eldra-ease-out);
1760
+ }
1761
+
1762
+ /* --- Search modal ------------------------------------------------------------------------------ */
1763
+
1764
+ /* The field's own type (spec "Search modal" → Sizes, Field row): "1.0625rem text" (desktop and
1765
+ tablet); mobile reuses `text-control-mobile`'s existing 1rem (`Input`'s own "the field text is
1766
+ 1rem below 48rem, so iOS never zooms into a focused field" rule applies here too), composed
1767
+ alongside this one the same way `Input`'s own `FIELD_TEXT.md` pairs `text-control` with
1768
+ `max-md:text-control-mobile` — two whole utilities, not one bundling a media query, because the
1769
+ mobile number already has a name. 1.0625rem sits between two type-scale steps with no token of
1770
+ its own, so, like `text-button-lg`'s identical number, it is a per-component variable with the
1771
+ spec's literal as its default. */
1772
+ @utility text-search-modal-field {
1773
+ font-family: var(--eldra-font-body);
1774
+ font-size: var(--eldra-search-modal-field-size, 1.0625rem);
1775
+ line-height: var(--eldra-control-line-height, 1.5rem);
1776
+ font-weight: var(--tw-font-weight, var(--eldra-text-body-weight));
1777
+ }
1778
+
1779
+ /* The foot's own text (spec "Search modal" → Sizes, Foot row): "0.75rem `muted` text on `surface`".
1780
+ Plain body weight and family — unlike `text-overline` (also 0.75rem), this is sentence-case hint
1781
+ copy, not an uppercase, tracked label — so it is its own utility rather than that one plus an
1782
+ override. */
1783
+ @utility text-search-modal-foot {
1784
+ font-family: var(--eldra-font-body);
1785
+ font-size: var(--eldra-search-modal-foot-size, 0.75rem);
1786
+ line-height: var(--eldra-search-modal-foot-line, 1.4);
1787
+ font-weight: var(--tw-font-weight, var(--eldra-text-body-weight));
1788
+ }
1789
+
1790
+ /* The foot's key caps (spec, same row): "monospace 0.6875rem, min-width 1.25rem" — smaller than
1791
+ `text-search-kbd` (the Search bar's own inline `/` chip, 0.75rem), for a denser row of three
1792
+ hints. */
1793
+ @utility text-search-modal-kbd {
1794
+ font-family: var(--eldra-font-mono);
1795
+ font-size: var(--eldra-search-modal-kbd-size, 0.6875rem);
1796
+ line-height: 1rem;
1797
+ font-weight: var(--tw-font-weight, var(--eldra-text-body-weight));
1798
+ }
1799
+
1800
+ /* The dialog's own box (spec "Search modal" → Sizes, Dialog row): "min(40rem, 100vw − 2rem) wide;
1801
+ max-height min(40rem, 100vh − 6rem); top margin 8vh, centred horizontally … radius-lg, 1px
1802
+ border, shadow-md" on desktop and tablet (viewport ≥ 48rem); "Full screen: 100% × 100%, no
1803
+ margin, radius or border" below it. One utility per CSS property — the same shape as `eldra-
1804
+ dialog-width`/`-max-height` — each bundling its own `@media (width < 48rem)` override, the exact
1805
+ technique `eldra-drawer-width` above already documents and this file's own
1806
+ `search-modal.spec.ts` compiles and asserts directly, rather than a class-level arbitrary value:
1807
+ a consumer overriding `classes.root` then replaces the desktop clamp *and* its full-screen
1808
+ exception together, never just one half of the rule. The radius/border/shadow removal below
1809
+ 48rem is plain `max-md:` utilities in `SearchModal.vue` instead — three independent, already-
1810
+ token-driven stock groups (`rounded`, `border-w`, `shadow`) that do not need a fourth bundled
1811
+ name of their own the way the three interdependent geometry numbers here do. */
1812
+ @utility eldra-search-modal-width {
1813
+ width: min(var(--eldra-search-modal-width, 40rem), calc(100vw - 2rem));
1814
+ @media (width < 48rem) {
1815
+ width: 100vw;
1816
+ }
1817
+ }
1818
+ @utility eldra-search-modal-max-height {
1819
+ max-height: min(var(--eldra-search-modal-max-height, 40rem), calc(100vh - 6rem));
1820
+ @media (width < 48rem) {
1821
+ max-height: 100vh;
1822
+ }
1823
+ }
1824
+ @utility eldra-search-modal-position {
1825
+ margin: 8vh auto auto;
1826
+ @media (width < 48rem) {
1827
+ margin: 0;
1828
+ }
1829
+ }
1830
+
1831
+ /* --- Toast ------------------------------------------------------------------------------------ */
1832
+
1833
+ /* The region's own width (spec "Toast" -> Sizes, "Region" row): "min(24rem, 100vw - 2rem) wide ...
1834
+ 1rem from the right and bottom edges." Same shape as `eldra-dialog-width`: the viewport clamp
1835
+ lives inside the utility itself, so a consumer's `--eldra-toast-width` override still gets
1836
+ capped on a narrow screen. In Tailwind's own `w` group (`src/utils/mergeClass.ts`), so `classes.root:
1837
+ 'w-full'` replaces the clamp instead of landing beside it. */
1838
+ @utility eldra-toast-width {
1839
+ width: min(var(--eldra-toast-width, 24rem), calc(100vw - 2rem));
1840
+ }
1841
+
1842
+ /* The title (spec "Toast" -> Sizes, "Title" row): "0.9375rem, weight 600." The weight already
1843
+ reads the label token (600, the same reuse `text-stock-status` makes for its own weight); the
1844
+ size sits between two type-scale steps with none of its own — the same shape as `text-price-sm`'s
1845
+ 0.9375rem and `text-dialog-title`'s 1.25rem — so it is a per-component variable with that literal
1846
+ default. No line-height is given, so, like `text-stock-status`'s 1.4, it gets one too. */
1847
+ @utility text-toast-title {
1848
+ font-family: var(--eldra-font-body);
1849
+ font-size: var(--eldra-toast-title-size, 0.9375rem);
1850
+ line-height: var(--eldra-toast-title-line, 1.4);
1851
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
1852
+ }
1853
+
1854
+ /* The toast's own entrance (spec "Toast" -> Behaviour & motion): "Enter: fade in with a 0.5rem
1855
+ rise, duration-base (200ms) ease-out." Unlike `Dialog`, the spec's reduced-motion row here only
1856
+ asks that toasts "appear and disappear without movement" — not, as `Dialog`'s own row demands, a
1857
+ still-visible fade at a literal duration — so the ordinary zeroing `--eldra-duration-base`
1858
+ already satisfies it (an instant appearance has no movement to speak of) and this needs no
1859
+ second `-reduced` keyframe. Exit is not animated (no CSS at all): the spec asks for a 150ms fade
1860
+ out on removal, but animating a `v-for` departure needs Vue's `<TransitionGroup>`, which nothing
1861
+ else in this package uses and which is difficult to drive reliably under `vi.useFakeTimers()`;
1862
+ `Toaster` removes a dismissed toast from the DOM immediately, the same "instant by default"
1863
+ call `Dialog`'s own exit makes (see its Deviations entry) for the equivalent trade-off. */
1864
+ @keyframes eldra-toast-in {
1865
+ from {
1866
+ opacity: 0;
1867
+ transform: translateY(0.5rem);
1868
+ }
1869
+ to {
1870
+ opacity: 1;
1871
+ transform: none;
1872
+ }
1873
+ }
1874
+ @utility animate-eldra-toast-in {
1875
+ animation: eldra-toast-in var(--eldra-duration-base) var(--eldra-ease-out);
1876
+ }
1877
+ /* --- Carousel -------------------------------------------------------------------------------- */
1878
+
1879
+ /* A slide's own width (spec "Carousel" → Sizes, "Slide width" row): "default 80% of the track;
1880
+ product rows `(100% − 3 × 1rem) / 4` from 64rem block width, 3 per view from 48rem, ~80% below
1881
+ 48rem (peek); single-slide galleries 100%" — one formula, `(100% - (perView - 1) * gap) /
1882
+ perView`, covers every row of that table: `perView: 1` gives 100%, `perView: 4` with a 1rem gap
1883
+ gives the product-row formula verbatim, and the default `perView: 1.25` gives "~80%" (literally
1884
+ 80% minus a fifth of the gap, which is what the spec's own "~" already concedes).
1885
+ `--eldra-carousel-per-view` is set per container-query breakpoint by `eldra-carousel-track`
1886
+ below, from the three inline custom properties `carouselPerViewStyle` (`useCarousel.ts`) binds
1887
+ on the track — this utility only ever reads the one resolved variable, so `Carousel.vue` and
1888
+ `Lightbox` share one definition. The gap defaults to
1889
+ `--eldra-space-4` (1rem), the same token `gap-4` on the track itself resolves to, so the two
1890
+ numbers in the formula can never drift apart even if a consumer overrides one. */
1891
+ @utility eldra-carousel-slide {
1892
+ flex: none;
1893
+ scroll-snap-align: start;
1894
+ width: calc(
1895
+ (100% - (var(--eldra-carousel-per-view, 1) - 1) *
1896
+ var(--eldra-carousel-gap, var(--eldra-space-4))) /
1897
+ var(--eldra-carousel-per-view, 1)
1898
+ );
1899
+ }
1900
+
1901
+ /* The track's own per-view switch: picks one of the three inline custom properties
1902
+ `carouselPerViewStyle` (`useCarousel.ts`) binds on the track into the single
1903
+ `--eldra-carousel-per-view` its slides read above.
1904
+
1905
+ The values arrive as an inline style rather than as Tailwind arbitrary-property classes on
1906
+ purpose (bug, fixed 2026-09-27 — see `carouselPerViewStyle`'s own comment, the README's
1907
+ Deviations entry and the CHANGELOG): a class name built by interpolating a number is never in
1908
+ the text Tailwind scans, so a consumer's build emitted no rule for it and every carousel
1909
+ rendered one full-width slide. Keeping the *breakpoints* here, in static CSS, is the other half
1910
+ of that fix: nothing about this rule depends on what a component happened to render.
1911
+
1912
+ 48rem and 64rem are written out, not `var(--container-tablet)`/`var(--container-content)`,
1913
+ for the reason this file's own header states: a `@container` condition may not contain `var()`.
1914
+ They are the same two edges Tailwind's own `@tablet:`/`@content:` variants compile to, and
1915
+ `src/__tests__/containerQueryBreakpoints.spec.ts` is what keeps the pair in step.
1916
+
1917
+ The `var()` fallback chains repeat, in CSS, the narrowest-first resolution
1918
+ `carouselPerViewStyle` already does in JavaScript (which always writes all three): they are what
1919
+ makes a consumer setting only `--eldra-carousel-per-view-base` by hand behave the same way. */
1920
+ @utility eldra-carousel-track {
1921
+ --eldra-carousel-per-view: var(--eldra-carousel-per-view-base, 1);
1922
+ @container (width >= 48rem) {
1923
+ --eldra-carousel-per-view: var(
1924
+ --eldra-carousel-per-view-md,
1925
+ var(--eldra-carousel-per-view-base, 1)
1926
+ );
1927
+ }
1928
+ @container (width >= 64rem) {
1929
+ --eldra-carousel-per-view: var(
1930
+ --eldra-carousel-per-view-lg,
1931
+ var(--eldra-carousel-per-view-md, var(--eldra-carousel-per-view-base, 1))
1932
+ );
1933
+ }
1934
+ }
1935
+
1936
+ /* A dot's own visual (spec "Carousel" → Sizes, Dot row: "1.5rem square target; visible dot 0.5rem
1937
+ circle with a 1.5px ring; current: 1.25rem × 0.5rem pill; no gap between dot targets"). The
1938
+ 1.5rem target itself is a plain `size-6` button in `Carousel.vue`; this utility is only the
1939
+ dot's *visible* inner shape, switched by the button's own `aria-current` — a shape change as
1940
+ well as a colour change (spec → States: "shape change, not colour alone", 1.4.1), so the
1941
+ component computes no separate "current" class. The ring's width has no stock Tailwind border
1942
+ step (1.5px sits between `border-1`'s 1px and `border-2`'s 2px), so — like `eldra-field-border`'s
1943
+ own width — it is a per-component variable with that literal default. Motion: width and colour
1944
+ change over `duration-fast` `ease-out` (spec → Behaviour & motion), nothing under reduced
1945
+ motion — a shape/colour swap has no "motion" to remove, only a transition to skip. */
1946
+ @utility eldra-carousel-dot {
1947
+ display: block;
1948
+ width: var(--eldra-carousel-dot-size, 0.5rem);
1949
+ height: var(--eldra-carousel-dot-size, 0.5rem);
1950
+ border-radius: var(--eldra-radius-full);
1951
+ background-color: transparent;
1952
+ box-shadow: inset 0 0 0 var(--eldra-carousel-dot-ring, 1.5px) var(--eldra-color-border-strong);
1953
+ transition:
1954
+ width var(--eldra-duration-fast) var(--eldra-ease-out),
1955
+ background-color var(--eldra-duration-fast) var(--eldra-ease-out),
1956
+ box-shadow var(--eldra-duration-fast) var(--eldra-ease-out);
1957
+ @media (prefers-reduced-motion: reduce) {
1958
+ transition: none;
1959
+ }
1960
+ [aria-current='true'] > & {
1961
+ width: 1.25rem;
1962
+ background-color: var(--eldra-color-text);
1963
+ box-shadow: inset 0 0 0 var(--eldra-carousel-dot-ring, 1.5px) var(--eldra-color-text);
1964
+ }
1965
+ @media (forced-colors: active) {
1966
+ box-shadow: none;
1967
+ border: var(--eldra-carousel-dot-ring, 1.5px) solid CanvasText;
1968
+ [aria-current='true'] > & {
1969
+ background-color: CanvasText;
1970
+ }
1971
+ }
1972
+ }
1973
+
1974
+ /* --- Lightbox ----------------------------------------------------------------------------- */
1975
+
1976
+ /* The viewer's own entrance (spec "Lightbox" → Behaviour & motion: "Enter: fade in over
1977
+ duration-slow (250ms) ease-out. Moving between images scrolls smoothly." / "Reduced motion: the
1978
+ viewer fades in over duration-base (200ms) with no movement, and image changes are instant.").
1979
+ Unlike `Dialog`'s own entrance, there is no rise or scale here — the spec gives the Lightbox a
1980
+ plain fade, full stop, so this needs its own (simpler) keyframe rather than reusing
1981
+ `eldra-dialog-in`. The reduced-motion state, though, is the exact "plain opacity fade over
1982
+ duration-base (200ms), linear" `eldra-dialog-in-reduced` already draws for `Dialog` and `Drawer`
1983
+ — reused rather than given a third identical keyframe, the same call `Drawer`'s own comment on
1984
+ that utility makes. */
1985
+ @keyframes eldra-lightbox-in {
1986
+ from {
1987
+ opacity: 0;
1988
+ }
1989
+ to {
1990
+ opacity: 1;
1991
+ }
1992
+ }
1993
+ @utility animate-eldra-lightbox-in {
1994
+ animation: eldra-lightbox-in var(--eldra-duration-slow) var(--eldra-ease-out);
1995
+ }
1996
+
1997
+ /* --- Range slider ----------------------------------------------------------------------------- */
1998
+
1999
+ /* The gutter that keeps a thumb — its focus ring and its pointer target included — inside the
2000
+ control (spec "Range slider" → Anatomy): a thumb is centred on its value, so the one at `min`
2001
+ hangs half its own width past the start of the track, and **two** things hang further still. Its
2002
+ ring reaches `--eldra-focus-offset` + `--eldra-focus-width` past the circle; its 2.5.8 target
2003
+ (the `::after` box below) is centred on the circle too, so it reaches half the target from the
2004
+ thumb's centre — 22px of it below the tablet width, where that target is `--eldra-target-touch`.
2005
+
2006
+ The gutter is therefore the **larger** of the two reaches, per side. With only the ring's
2007
+ allowance, the maximum thumb at `max` pushed its target 8px past the end of the document at a
2008
+ 320px viewport: a horizontal scrollbar on a phone with nothing to pan to, against WCAG 1.4.10
2009
+ and the spec section's own 320px acceptance line (`__tests__/rangeSliderRing.browser.spec.ts`
2010
+ measures `scrollWidth` against `clientWidth` there, which is the condition the criterion states).
2011
+ Clipping the control is not the alternative: that would cut the focus ring, which is the other
2012
+ thing this reservation exists to protect.
2013
+
2014
+ Sized from the variables themselves, never from the numbers they happen to hold today: a
2015
+ consumer enlarging the thumb or the targets moves the gutter with them, and so does a raised ring
2016
+ token — a `Carousel` sets `--eldra-focus-offset: 4px` for its slides and a plain custom property
2017
+ inherits into everything inside it (the same lesson as `Tabs`' own list reservation).
2018
+
2019
+ `48rem` is written out for the reason this file's header states, and it is the same edge the
2020
+ target itself switches on below, so the two can never disagree about which target is in force. */
2021
+ @utility eldra-range-gutter {
2022
+ padding-inline: max(
2023
+ calc(
2024
+ var(--eldra-range-thumb-size, 1.25rem) / 2 + var(--eldra-focus-offset) +
2025
+ var(--eldra-focus-width)
2026
+ ),
2027
+ calc(var(--eldra-target-min) / 2)
2028
+ );
2029
+ @container (width < 48rem) {
2030
+ padding-inline: max(
2031
+ calc(
2032
+ var(--eldra-range-thumb-size, 1.25rem) / 2 + var(--eldra-focus-offset) +
2033
+ var(--eldra-focus-width)
2034
+ ),
2035
+ calc(var(--eldra-target-touch) / 2)
2036
+ );
2037
+ }
2038
+ }
2039
+
2040
+ /* The gutter a filter panel's price range uses instead (spec "Filter panel" → Sizes, Histogram
2041
+ and Range rows: "inset 0.625rem on each side"): the thumb's own radius plus the focus ring's
2042
+ reach — never the target half, which is what pushed the track to two thirds of a 15rem sidebar.
2043
+ The ring reach stays so a focused end thumb is not clipped by a scrolling drawer body, which
2044
+ makes the inset 0.875rem rather than the spec's 0.625rem; the README's Deviations entry says so. */
2045
+ @utility eldra-range-gutter-thumb {
2046
+ padding-inline: calc(
2047
+ var(--eldra-range-thumb-size, 1.25rem) / 2 + var(--eldra-focus-offset) +
2048
+ var(--eldra-focus-width)
2049
+ );
2050
+ }
2051
+
2052
+ /* The rail: the band a pointer press lands in (spec "Range slider" → Sizes, Rail row: "`target-
2053
+ touch` (2.75rem) below the tablet breakpoint, `target-min` (1.5rem) from it"). The touch size is
2054
+ on the *band*, not on the thumb alone, so there is a 44px-tall target across the whole control
2055
+ rather than two 44px circles that overlap — and therefore fight — when the range is narrow.
2056
+
2057
+ `48rem` is written out rather than `var(--container-tablet)` for the reason this file's header
2058
+ states: a `@container` condition may not contain `var()`. It is the same edge Tailwind's own
2059
+ `@max-tablet:` variant compiles to, measured against the component's own root (`RangeSlider.vue`
2060
+ is a `@container`), which is the spec's own breakpoint rule — the width of the block the control
2061
+ sits in, not the viewport. */
2062
+ @utility eldra-range-rail {
2063
+ min-height: var(--eldra-target-min);
2064
+ @container (width < 48rem) {
2065
+ min-height: var(--eldra-target-touch);
2066
+ }
2067
+ }
2068
+
2069
+ /* The track and the filled range share one height (spec → Anatomy items 3 and 4: "0.375rem tall,
2070
+ `radius-full`"). A literal per-component variable, like `--eldra-carousel-dot-size`: the spec's
2071
+ 0.375rem is a bar thickness, which no shared token carries. */
2072
+ @utility eldra-range-track {
2073
+ height: var(--eldra-range-track-height, 0.375rem);
2074
+ }
2075
+
2076
+ /* A thumb (spec → Anatomy item 5: "1.25rem, `background` fill, 1.5px `border-strong` edge,
2077
+ `shadow-sm`", and → States for the hover and dragging halo). Three things live here rather than
2078
+ in the component's classes, because each of them is a literal the spec gives and a variable a
2079
+ consumer should be able to move: the circle's size, its 1.5px edge (no stock Tailwind border step
2080
+ sits between 1px and 2px — the same call `eldra-carousel-dot`'s ring makes), and the halo.
2081
+
2082
+ `::before` is the halo, drawn outside the circle and faded in on hover and while dragging — an
2083
+ outline or a box-shadow would collide with `eldra-focus`, which owns this element's `outline`
2084
+ *and* its `box-shadow`. `::after` is the pointer target, centred on the thumb at `target-min`
2085
+ and growing to `target-touch` below the tablet breakpoint, so the thumb itself satisfies 2.5.8
2086
+ at every width (the rail above is the band that satisfies it across the whole control). Neither
2087
+ pseudo-element paints anything the thumb's own shape does not already say, so both are invisible
2088
+ to assistive technology by construction. */
2089
+ @utility eldra-range-thumb {
2090
+ width: var(--eldra-range-thumb-size, 1.25rem);
2091
+ height: var(--eldra-range-thumb-size, 1.25rem);
2092
+ border-width: var(--eldra-range-thumb-border-width, 1.5px);
2093
+ &::before {
2094
+ content: '';
2095
+ position: absolute;
2096
+ inset: calc(-1 * var(--eldra-range-thumb-halo, 0.25rem));
2097
+ border-radius: var(--eldra-radius-full);
2098
+ background-color: color-mix(in oklab, var(--eldra-color-text), transparent 92%);
2099
+ opacity: 0;
2100
+ transition: opacity var(--eldra-duration-fast) var(--eldra-ease-out);
2101
+ }
2102
+ &:hover::before {
2103
+ opacity: 1;
2104
+ }
2105
+ &[data-dragging='true']::before {
2106
+ opacity: 1;
2107
+ background-color: color-mix(in oklab, var(--eldra-color-text), transparent 86%);
2108
+ }
2109
+ &[aria-disabled='true']::before {
2110
+ display: none;
2111
+ }
2112
+ &::after {
2113
+ content: '';
2114
+ position: absolute;
2115
+ top: 50%;
2116
+ left: 50%;
2117
+ width: var(--eldra-target-min);
2118
+ height: var(--eldra-target-min);
2119
+ translate: -50% -50%;
2120
+ }
2121
+ @container (width < 48rem) {
2122
+ &::after {
2123
+ width: var(--eldra-target-touch);
2124
+ height: var(--eldra-target-touch);
2125
+ }
2126
+ }
2127
+ @media (prefers-reduced-motion: reduce) {
2128
+ &::before {
2129
+ transition: none;
2130
+ }
2131
+ }
2132
+ }
2133
+
2134
+ /* --- Filter panel ----------------------------------------------------------------------------- */
2135
+
2136
+ /* A size-system sub-heading (spec "Filter panel" → Sizes, Size-system sub-heading row: "0.75rem
2137
+ weight 600, uppercase, 0.06em letter spacing, `muted`"). It is nearly `text-overline` — same
2138
+ size, same weight, same transform — and differs only in tracking: the overline token's 0.12em is
2139
+ a label over a section, and the same spacing inside a 15rem sidebar pushes "SOCKS (EU)" onto two
2140
+ lines. So the size, line and weight read the existing tokens and the tracking is a
2141
+ per-component variable with the spec's own 0.06em as its default. */
2142
+ @utility text-filter-subheading {
2143
+ font-family: var(--eldra-font-body);
2144
+ font-size: var(--eldra-text-overline-size);
2145
+ line-height: var(--eldra-text-overline-line);
2146
+ font-weight: var(--tw-font-weight, var(--eldra-text-label-weight));
2147
+ letter-spacing: var(--eldra-filter-subheading-tracking, 0.06em);
2148
+ text-transform: uppercase;
2149
+ }
2150
+
2151
+ /* A swatch tile's count (spec → Sizes, Swatch tile row: "count 0.75rem"). The one 0.75rem number
2152
+ in the panel, and the overline token is the only type style at that size — but an overline is
2153
+ uppercase with 0.12em of tracking, which on a column of tabular digits reads as a gap between
2154
+ them. So it borrows that token's size, the caption's line ratio and the body weight, and adds
2155
+ neither transform nor tracking of its own. */
2156
+ @utility text-filter-tile-count {
2157
+ font-family: var(--eldra-font-body);
2158
+ font-size: var(--eldra-text-overline-size);
2159
+ line-height: var(--eldra-text-caption-line);
2160
+ font-weight: var(--tw-font-weight, var(--eldra-text-body-weight));
2161
+ }
2162
+
2163
+ /* A colour swatch's own edge (spec → Sizes, Swatch row: "Swatch 1.5rem circle with a 1px inner
2164
+ edge of `text` at 22%"). A real `border`, not a `box-shadow`, for the reason
2165
+ `eldra-variant-swatch-edge` records: forced-colours mode drops a decorative shadow and keeps a
2166
+ real border, and this boundary is the one WCAG 1.4.11 is about — a pale swatch has no other edge.
2167
+
2168
+ The width and the colour are bundled in one utility because they are one decision: the colour is
2169
+ not a token role (it is `text` at a fraction) and nothing else in the package draws it, so a
2170
+ consumer moves it through `--eldra-filter-swatch-edge-width` or replaces the whole rule through
2171
+ `classes.swatch`. Deliberately not `border-strong`, which `VariantPicker`'s own disc uses: a
2172
+ filter panel draws these at 1.5rem in a dense column where the stronger line reads as a second
2173
+ ring beside the selected one. */
2174
+ @utility eldra-filter-swatch-edge {
2175
+ border-width: var(--eldra-filter-swatch-edge-width, 1px);
2176
+ border-color: color-mix(in oklab, var(--eldra-color-text), transparent 78%);
2177
+ }
2178
+
2179
+ /* The ring a selected swatch gains (spec → Sizes, Selected swatch ring: "A 2px `background` gap,
2180
+ then a 1.5px `text` ring around the swatch"). The gap is the shape's own padding and the ring is
2181
+ a real border on it, kept at this one constant width in **every** state — transparent at rest —
2182
+ so the swatch never resizes when it is picked and the column never shifts under the pointer. The
2183
+ same shape `eldra-variant-swatch-ring` has, at this panel's own 1.5px rather than that
2184
+ component's 2px. */
2185
+ @utility eldra-filter-swatch-ring {
2186
+ border-width: var(--eldra-filter-swatch-ring-width, 1.5px);
2187
+ }
2188
+
2189
+ /* One histogram bar (spec → Sizes, Histogram row: "Bar min height 2px, top corners 1px"). The
2190
+ minimum height is what keeps an empty bucket visible as an empty bucket rather than as nothing
2191
+ at all, which is the difference between "no products here" and "no data"; the 1px top corners
2192
+ are the only rounding, because the bars sit on the histogram's own baseline. Two literals with
2193
+ no token between them — a bar is thinner than any radius or spacing step the scale carries — so
2194
+ each is a per-component variable with the spec's number as its default. */
2195
+ @utility eldra-filter-histogram-bar {
2196
+ min-height: var(--eldra-filter-histogram-bar-min, 2px);
2197
+ border-start-start-radius: var(--eldra-filter-histogram-bar-radius, 1px);
2198
+ border-start-end-radius: var(--eldra-filter-histogram-bar-radius, 1px);
2199
+ }
2200
+
2201
+ /* --- Nav menu --------------------------------------------------------------------------------- */
2202
+
2203
+ /* The gap under the bar is the panel's own padding, so a hovering pointer never leaves the menu. */
2204
+ @utility eldra-nav-menu-panel {
2205
+ padding-top: var(--eldra-nav-menu-offset, var(--eldra-space-2));
2206
+ }
2207
+
2208
+ @utility eldra-nav-menu-dropdown {
2209
+ width: max-content;
2210
+ min-width: var(--eldra-nav-menu-dropdown-min, 14rem);
2211
+ max-width: min(var(--eldra-nav-menu-dropdown-max, 24rem), calc(100vw - 2rem));
2212
+ }
2213
+
2214
+ @utility eldra-nav-menu-columns {
2215
+ grid-template-columns: repeat(
2216
+ auto-fit,
2217
+ minmax(min(100%, var(--eldra-nav-menu-column-min, 12rem)), 1fr)
2218
+ );
2219
+ }
2220
+
2221
+ /* NavMenu's phone menu: every top-level row's least height, and a panel's links indented beneath their row. */
2222
+ @utility eldra-nav-menu-drawer-row {
2223
+ min-height: var(--eldra-nav-menu-drawer-row-height, --spacing(14));
2224
+ }
2225
+
2226
+ @utility eldra-nav-menu-drawer-nest {
2227
+ padding-inline-start: var(--eldra-nav-menu-drawer-indent, var(--eldra-space-4));
2228
+ }