@eldrajs/ui 0.2.8 → 0.3.0

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