@slotted/styles 0.1.0-beta.3 → 0.1.0-beta.31

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 (205) hide show
  1. package/package.json +13 -1
  2. package/src/accordion/accordion.css +11 -11
  3. package/src/action-bar/action-bar.css +47 -44
  4. package/src/action-bar/action-bar.tokens.json +1 -0
  5. package/src/action-sheet/action-sheet.css +39 -39
  6. package/src/alert/alert.css +97 -97
  7. package/src/alert/alert.tokens.json +6 -1
  8. package/src/app-shell/app-shell.css +456 -329
  9. package/src/app-shell/app-shell.tokens.json +6 -3
  10. package/src/aspect-ratio/aspect-ratio.css +9 -9
  11. package/src/attachment/attachment.css +118 -114
  12. package/src/avatar/avatar.css +96 -66
  13. package/src/avatar/avatar.tokens.json +7 -0
  14. package/src/avatar-group/avatar-group.css +22 -23
  15. package/src/badge/badge.css +54 -46
  16. package/src/badge/badge.tokens.json +5 -0
  17. package/src/breadcrumb/breadcrumb.css +52 -52
  18. package/src/button/button.css +137 -89
  19. package/src/button/button.tokens.json +5 -0
  20. package/src/button-group/button-group.css +80 -79
  21. package/src/button-group/button-group.tokens.json +1 -0
  22. package/src/calendar/calendar.css +139 -109
  23. package/src/calendar/calendar.tokens.json +5 -1
  24. package/src/card/card.css +70 -67
  25. package/src/card/card.tokens.json +1 -0
  26. package/src/carousel/carousel.css +158 -169
  27. package/src/cascader/cascader.css +161 -159
  28. package/src/cascader/cascader.tokens.json +2 -0
  29. package/src/chart/chart.css +288 -267
  30. package/src/chart/chart.tokens.json +4 -0
  31. package/src/checkbox/checkbox.css +143 -148
  32. package/src/checkbox-group/checkbox-group.css +7 -7
  33. package/src/code-block/code-block.css +85 -89
  34. package/src/collapsible/collapsible.css +81 -80
  35. package/src/collapsible/collapsible.tokens.json +1 -0
  36. package/src/color-picker/color-picker.css +106 -114
  37. package/src/column-manager/column-manager.css +111 -119
  38. package/src/combobox/combobox.css +206 -132
  39. package/src/combobox/combobox.tokens.json +4 -0
  40. package/src/command-palette/command-palette.css +155 -102
  41. package/src/command-palette/command-palette.tokens.json +2 -0
  42. package/src/container/container.css +27 -27
  43. package/src/context-menu/context-menu.css +9 -9
  44. package/src/currency-field/currency-field.css +119 -119
  45. package/src/currency-field/currency-field.tokens.json +1 -0
  46. package/src/dashboard-grid/dashboard-grid.css +204 -115
  47. package/src/data-grid/data-grid.css +598 -496
  48. package/src/data-grid/data-grid.tokens.json +5 -1
  49. package/src/data-list/data-list.css +82 -71
  50. package/src/data-list/data-list.tokens.json +2 -1
  51. package/src/date-field/date-field.css +62 -57
  52. package/src/date-field/date-field.tokens.json +1 -0
  53. package/src/date-picker/date-picker.css +117 -58
  54. package/src/date-picker/date-picker.tokens.json +5 -0
  55. package/src/date-range-picker/date-range-picker.css +157 -127
  56. package/src/date-range-picker/date-range-picker.tokens.json +4 -0
  57. package/src/datetime-field/datetime-field.css +90 -90
  58. package/src/datetime-field/datetime-field.tokens.json +1 -0
  59. package/src/datetime-picker/datetime-picker.css +123 -70
  60. package/src/datetime-picker/datetime-picker.tokens.json +4 -1
  61. package/src/datetime-range-picker/datetime-range-picker.css +191 -163
  62. package/src/datetime-range-picker/datetime-range-picker.tokens.json +4 -0
  63. package/src/description-list/description-list.css +105 -75
  64. package/src/description-list/description-list.tokens.json +1 -0
  65. package/src/detail-panel/detail-panel.css +86 -71
  66. package/src/detail-panel/detail-panel.tokens.json +2 -0
  67. package/src/dialog/dialog.css +435 -199
  68. package/src/dialog/dialog.tokens.json +9 -0
  69. package/src/divider/divider.css +20 -20
  70. package/src/drawer/drawer.css +598 -237
  71. package/src/drawer/drawer.tokens.json +14 -0
  72. package/src/entity-picker/entity-picker.css +326 -272
  73. package/src/entity-picker/entity-picker.tokens.json +4 -0
  74. package/src/event-calendar/event-calendar.css +357 -399
  75. package/src/field/field.css +106 -93
  76. package/src/field/field.tokens.json +2 -0
  77. package/src/field-group/field-group.css +43 -33
  78. package/src/field-group/field-group.tokens.json +3 -0
  79. package/src/filter-bar/filter-bar.css +200 -216
  80. package/src/form/form.css +100 -26
  81. package/src/form/form.tokens.json +6 -1
  82. package/src/fullscreen/fullscreen.css +26 -27
  83. package/src/grid/grid.css +29 -29
  84. package/src/highlight/highlight.css +11 -11
  85. package/src/hover-card/hover-card.css +9 -9
  86. package/src/icon/icon.css +67 -20
  87. package/src/icon/icon.tokens.json +1 -0
  88. package/src/image/image.css +42 -42
  89. package/src/import-export-center/import-export-center.css +147 -168
  90. package/src/import-export-center/import-export-center.tokens.json +1 -0
  91. package/src/inline/inline.css +28 -28
  92. package/src/inline-message/inline-message.css +162 -86
  93. package/src/inline-message/inline-message.tokens.json +4 -0
  94. package/src/kbd/kbd.css +62 -50
  95. package/src/kbd/kbd.tokens.json +3 -0
  96. package/src/link/link.css +54 -33
  97. package/src/link/link.tokens.json +4 -0
  98. package/src/list/list.css +23 -23
  99. package/src/list-item/list-item.css +89 -75
  100. package/src/list-item/list-item.tokens.json +7 -0
  101. package/src/listbox/listbox.css +71 -70
  102. package/src/listbox/listbox.tokens.json +0 -1
  103. package/src/loading-overlay/loading-overlay.css +86 -103
  104. package/src/markdown/markdown.css +20 -20
  105. package/src/media-viewer/media-viewer.css +790 -0
  106. package/src/media-viewer/media-viewer.tokens.json +53 -0
  107. package/src/menu/menu.css +166 -83
  108. package/src/menu/menu.tokens.json +3 -1
  109. package/src/menubar/menubar.css +16 -16
  110. package/src/message/message.css +1253 -1246
  111. package/src/message/message.tokens.json +5 -0
  112. package/src/message-scroller/message-scroller.css +323 -320
  113. package/src/multi-select/multi-select.css +233 -174
  114. package/src/multi-select/multi-select.tokens.json +3 -0
  115. package/src/navigation-menu/navigation-menu.css +170 -191
  116. package/src/navigation-menu/navigation-menu.tokens.json +1 -0
  117. package/src/notification-center/notification-center.css +155 -163
  118. package/src/notification-center/notification-center.tokens.json +4 -0
  119. package/src/number-field/number-field.css +93 -93
  120. package/src/number-field/number-field.tokens.json +1 -0
  121. package/src/otp-input/otp-input.css +74 -64
  122. package/src/otp-input/otp-input.tokens.json +1 -0
  123. package/src/page/page.css +41 -27
  124. package/src/page/page.tokens.json +1 -0
  125. package/src/page-header/page-header.css +342 -287
  126. package/src/page-header/page-header.tokens.json +6 -1
  127. package/src/pagination/pagination.css +75 -79
  128. package/src/popover/popover.css +85 -65
  129. package/src/popover/popover.tokens.json +2 -0
  130. package/src/progress-indicator/progress-indicator.css +192 -136
  131. package/src/progress-indicator/progress-indicator.tokens.json +1 -0
  132. package/src/prompt-composer/prompt-composer.css +260 -113
  133. package/src/prompt-composer/prompt-composer.tokens.json +15 -0
  134. package/src/prose/prose.css +77 -82
  135. package/src/radio-group/radio-group.css +107 -112
  136. package/src/rating/rating.css +146 -142
  137. package/src/rating/rating.tokens.json +1 -0
  138. package/src/result-state/result-state.css +95 -102
  139. package/src/result-state/result-state.tokens.json +1 -0
  140. package/src/runtime-properties.mjs +19 -6
  141. package/src/saved-views/saved-views.css +43 -49
  142. package/src/scroll-area/scroll-area.css +50 -37
  143. package/src/section/section.css +179 -44
  144. package/src/section/section.tokens.json +9 -3
  145. package/src/segmented-control/segmented-control.css +210 -133
  146. package/src/segmented-control/segmented-control.tokens.json +7 -11
  147. package/src/select/select.css +213 -149
  148. package/src/select/select.tokens.json +4 -0
  149. package/src/side-navigation/side-navigation.css +201 -198
  150. package/src/side-navigation/side-navigation.tokens.json +1 -0
  151. package/src/skeleton/skeleton.css +57 -58
  152. package/src/slider/slider.css +101 -103
  153. package/src/sparkline/sparkline.css +75 -53
  154. package/src/sparkline/sparkline.tokens.json +2 -0
  155. package/src/spinner/spinner.css +83 -180
  156. package/src/spinner/spinner.tokens.json +0 -1
  157. package/src/split-button/split-button.css +34 -35
  158. package/src/split-button/split-button.tokens.json +1 -0
  159. package/src/splitter/splitter.css +47 -48
  160. package/src/stack/stack.css +25 -25
  161. package/src/stat-card/stat-card.css +415 -245
  162. package/src/stat-card/stat-card.tokens.json +8 -0
  163. package/src/status-indicator/status-indicator.css +124 -100
  164. package/src/status-indicator/status-indicator.tokens.json +0 -3
  165. package/src/stepper/stepper.css +78 -82
  166. package/src/switch/switch.css +100 -106
  167. package/src/table/table.css +270 -198
  168. package/src/table/table.tokens.json +2 -0
  169. package/src/table-of-contents/table-of-contents.css +60 -59
  170. package/src/table-of-contents/table-of-contents.tokens.json +1 -0
  171. package/src/tabs/tabs.css +327 -294
  172. package/src/tabs/tabs.tokens.json +7 -1
  173. package/src/tag/tag.css +109 -88
  174. package/src/tag/tag.tokens.json +10 -0
  175. package/src/tags-input/tags-input.css +152 -87
  176. package/src/tags-input/tags-input.tokens.json +7 -1
  177. package/src/text-field/text-field.css +146 -148
  178. package/src/text-field/text-field.tokens.json +1 -0
  179. package/src/textarea/textarea.css +38 -33
  180. package/src/textarea/textarea.tokens.json +1 -0
  181. package/src/time-field/time-field.css +82 -77
  182. package/src/time-field/time-field.tokens.json +1 -0
  183. package/src/time-picker/time-picker.css +116 -64
  184. package/src/time-picker/time-picker.tokens.json +4 -1
  185. package/src/time-range-picker/time-range-picker.css +168 -140
  186. package/src/time-range-picker/time-range-picker.tokens.json +4 -0
  187. package/src/timeline/timeline.css +280 -292
  188. package/src/timeline/timeline.tokens.json +5 -0
  189. package/src/toast/toast.css +139 -122
  190. package/src/toast/toast.tokens.json +7 -0
  191. package/src/toggle/toggle.css +34 -38
  192. package/src/toggle-group/toggle-group.css +73 -77
  193. package/src/toolbar/toolbar.css +33 -38
  194. package/src/tooltip/tooltip.css +65 -39
  195. package/src/tooltip/tooltip.tokens.json +1 -0
  196. package/src/top-navigation/top-navigation.css +252 -268
  197. package/src/tour/tour.css +68 -74
  198. package/src/tour/tour.tokens.json +1 -0
  199. package/src/transfer/transfer.css +164 -168
  200. package/src/tree/tree.css +113 -121
  201. package/src/typography/typography.css +42 -38
  202. package/src/typography/typography.tokens.json +1 -0
  203. package/src/upload/upload.css +256 -257
  204. package/src/visually-hidden/visually-hidden.css +1 -1
  205. package/src/wizard/wizard.css +187 -199
@@ -10,7 +10,7 @@
10
10
  * in: a container cannot change its own tracks
11
11
  * (`docs/build-briefing.md`, _Decisions already taken_).
12
12
  */
13
- [data-ui='stat-card'] {
13
+ [data-ui-stat-card] {
14
14
  --_edge-width: var(--slotted-stat-card-border-width, var(--slotted-border-width-thin, 1px));
15
15
  --_radius: var(--slotted-stat-card-radius, var(--slotted-radius-lg, 8px));
16
16
  --_inset-block: var(--slotted-stat-card-padding-block, var(--slotted-space-6, 1rem));
@@ -28,6 +28,13 @@
28
28
  --slotted-stat-card-trend-inline-size,
29
29
  calc(var(--slotted-space-12, 4rem) * 1.5)
30
30
  );
31
+ /* The trend's height when it takes the last row and the card's whole
32
+ width: one step above the sparkline's own, because a line as wide as
33
+ the card at the sparkline's height reads flat. */
34
+ --_trend-block: var(--slotted-stat-card-trend-block-size, var(--slotted-space-11, 3rem));
35
+ /* The least height of a trend beside the figure, which otherwise takes
36
+ the figure's height: the sparkline's own step. */
37
+ --_trend-floor: var(--slotted-sparkline-block-size, var(--slotted-space-9, 2rem));
31
38
 
32
39
  --_surface: var(--slotted-stat-card-background, var(--slotted-surface-raised, Canvas));
33
40
  --_edge: var(--slotted-stat-card-border-color, var(--slotted-border-subtle, ButtonBorder));
@@ -87,7 +94,7 @@
87
94
  }
88
95
 
89
96
  /* The edge, out of flow, so a frame that changes width moves no text. */
90
- [data-ui='stat-card']::before {
97
+ [data-ui-stat-card]::before {
91
98
  border: var(--_edge-width) solid var(--_edge);
92
99
  border-radius: inherit;
93
100
  content: '';
@@ -96,12 +103,14 @@
96
103
  position: absolute;
97
104
  }
98
105
 
99
- [data-ui='stat-card'][data-size='sm'] {
106
+ [data-ui-stat-card][data-size='sm'] {
100
107
  --_inset-block: var(--slotted-stat-card-padding-block-sm, var(--slotted-space-5, 0.75rem));
101
108
  --_inset-inline: var(--slotted-stat-card-padding-inline-sm, var(--slotted-space-5, 0.75rem));
102
109
  --_region-gap: var(--slotted-stat-card-region-gap-sm, var(--slotted-space-2, 0.25rem));
103
110
  --_trend-gap: var(--slotted-stat-card-trend-gap-sm, var(--slotted-space-5, 0.75rem));
104
111
  --_trend-size: var(--slotted-stat-card-trend-inline-size-sm, var(--slotted-space-12, 4rem));
112
+ --_trend-block: var(--slotted-stat-card-trend-block-size-sm, var(--slotted-space-9, 2rem));
113
+ --_trend-floor: var(--slotted-sparkline-block-size-sm, var(--slotted-space-7, 1.25rem));
105
114
  --_value-size: var(
106
115
  --slotted-stat-card-value-font-size-sm,
107
116
  var(--slotted-font-size-2xl, 1.25rem)
@@ -126,7 +135,7 @@
126
135
  --_value-line-narrow: var(--slotted-line-height-xl, 1.45);
127
136
  }
128
137
 
129
- [data-ui='stat-card'][data-size='lg'] {
138
+ [data-ui-stat-card][data-size='lg'] {
130
139
  --_inset-block: var(--slotted-stat-card-padding-block-lg, var(--slotted-space-8, 1.5rem));
131
140
  --_inset-inline: var(--slotted-stat-card-padding-inline-lg, var(--slotted-space-8, 1.5rem));
132
141
  --_region-gap: var(--slotted-stat-card-region-gap-lg, var(--slotted-space-4, 0.5rem));
@@ -135,6 +144,8 @@
135
144
  --slotted-stat-card-trend-inline-size-lg,
136
145
  calc(var(--slotted-space-12, 4rem) * 2)
137
146
  );
147
+ --_trend-block: var(--slotted-stat-card-trend-block-size-lg, var(--slotted-space-12, 4rem));
148
+ --_trend-floor: var(--slotted-sparkline-block-size-lg, var(--slotted-space-11, 3rem));
138
149
  --_value-size: var(--slotted-stat-card-value-font-size-lg, var(--slotted-font-size-4xl, 2rem));
139
150
  --_value-line: var(
140
151
  --slotted-stat-card-value-line-height-lg,
@@ -170,11 +181,11 @@
170
181
 
171
182
  /* ── Fill: the three frames a card has, and none ─────────────────────── */
172
183
 
173
- [data-ui='stat-card'][data-fill='elevated'] {
184
+ [data-ui-stat-card][data-fill='elevated'] {
174
185
  --_shadow: var(--slotted-stat-card-shadow-elevated, var(--slotted-shadow-md));
175
186
  }
176
187
 
177
- [data-ui='stat-card'][data-fill='subtle'] {
188
+ [data-ui-stat-card][data-fill='subtle'] {
178
189
  --_surface: var(--slotted-stat-card-background-subtle, var(--slotted-surface-sunken, Canvas));
179
190
  }
180
191
 
@@ -183,7 +194,7 @@
183
194
  * of metrics separated by dividers, inside a card that is already a card.
184
195
  * It keeps no inset either, because the host's inset is the inset.
185
196
  */
186
- [data-ui='stat-card'][data-fill='plain'] {
197
+ [data-ui-stat-card][data-fill='plain'] {
187
198
  --_surface: transparent;
188
199
  --_edge: transparent;
189
200
  --_shadow: none;
@@ -192,6 +203,33 @@
192
203
  --_radius: var(--slotted-radius-none, 0px);
193
204
  }
194
205
 
206
+ /* ── Attention: a figure past a threshold the product states ─────────── */
207
+
208
+ /**
209
+ * The value and the edge take the tone; the delta keeps the tone of its
210
+ * change, and the trend the root's `tone`. The binding writes the
211
+ * attribute on a ready value only. A `plain` card has no edge to paint.
212
+ */
213
+ [data-ui-stat-card][data-attention='warning'] {
214
+ --_attention-ink: var(--slotted-stat-card-attention-ink, var(--slotted-tone-warning-text));
215
+ --_attention-edge: var(
216
+ --slotted-stat-card-attention-border-color,
217
+ var(--slotted-tone-warning-border)
218
+ );
219
+ }
220
+
221
+ [data-ui-stat-card][data-attention='danger'] {
222
+ --_attention-ink: var(--slotted-stat-card-attention-ink, var(--slotted-tone-danger-text));
223
+ --_attention-edge: var(
224
+ --slotted-stat-card-attention-border-color,
225
+ var(--slotted-tone-danger-border)
226
+ );
227
+ }
228
+
229
+ [data-ui-stat-card][data-attention]:not([data-fill='plain']) {
230
+ --_edge: var(--_attention-edge);
231
+ }
232
+
195
233
  /* ── The body ─────────────────────────────────────────────────────────── */
196
234
 
197
235
  /**
@@ -218,28 +256,32 @@
218
256
  * number is broken only when it is wider than the card itself. A floor on
219
257
  * the trend was tried and pushed the trend through the card's edge.
220
258
  */
221
- [data-ui='stat-card'] [data-part='body'] {
222
- column-gap: var(--_trend-gap);
223
- display: grid;
224
- flex: 1 1 auto;
225
- grid-template-areas:
226
- 'header header'
227
- 'figure trend'
228
- 'message message';
229
- grid-template-columns: minmax(min-content, 1fr) minmax(0, var(--_trend-size));
230
- grid-template-rows: auto minmax(0, 1fr) auto;
231
- min-inline-size: 0;
232
- row-gap: var(--_region-gap);
233
- }
234
-
235
- [data-ui='stat-card'][data-layout='stacked'] [data-part='body'] {
236
- grid-template-areas:
237
- 'header'
238
- 'figure'
239
- 'trend'
240
- 'message';
241
- grid-template-columns: minmax(0, 1fr);
242
- grid-template-rows: auto minmax(0, 1fr) auto auto;
259
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
260
+ :scope [data-part-body] {
261
+ column-gap: var(--_trend-gap);
262
+ display: grid;
263
+ flex: 1 1 auto;
264
+ grid-template-areas:
265
+ 'header header'
266
+ 'figure trend'
267
+ 'message message';
268
+ grid-template-columns: minmax(min-content, 1fr) minmax(0, var(--_trend-size));
269
+ grid-template-rows: auto minmax(0, 1fr) auto;
270
+ min-inline-size: 0;
271
+ row-gap: var(--_region-gap);
272
+ }
273
+ }
274
+
275
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
276
+ :scope[data-layout='stacked'] [data-part-body] {
277
+ grid-template-areas:
278
+ 'header'
279
+ 'figure'
280
+ 'message'
281
+ 'trend';
282
+ grid-template-columns: minmax(0, 1fr);
283
+ grid-template-rows: auto minmax(0, 1fr) auto auto;
284
+ }
243
285
  }
244
286
 
245
287
  /**
@@ -250,15 +292,19 @@
250
292
  * inline axis gives these regions no intrinsic width: the figure alone
251
293
  * decides the column, and the text is cut or wrapped by the card's width.
252
294
  */
253
- [data-ui='stat-card'] [data-part='header'] {
254
- contain: inline-size;
255
- grid-area: header;
295
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
296
+ :scope [data-part-header] {
297
+ contain: inline-size;
298
+ grid-area: header;
299
+ }
256
300
  }
257
301
 
258
- [data-ui='stat-card'] [data-part='figure'] {
259
- align-self: start;
260
- grid-area: figure;
261
- min-inline-size: 0;
302
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
303
+ :scope [data-part-figure] {
304
+ align-self: start;
305
+ grid-area: figure;
306
+ min-inline-size: 0;
307
+ }
262
308
  }
263
309
 
264
310
  /**
@@ -268,32 +314,62 @@
268
314
  * width is the space a wide value left, which a query on the card cannot
269
315
  * see.
270
316
  */
271
- [data-ui='stat-card'] [data-part='trend'] {
272
- /* The marker's ring is the card's ground, not the page's. */
273
- --slotted-sparkline-ring-color: var(--_surface);
274
-
275
- align-self: center;
276
- container-name: stat-card-trend;
277
- container-type: inline-size;
278
- grid-area: trend;
279
- inline-size: 100%;
280
- min-inline-size: 0;
317
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
318
+ :scope [data-part-trend] {
319
+ /* The marker's ring is the card's ground, not the page's. */
320
+ --slotted-sparkline-ring-color: var(--_surface);
321
+
322
+ align-self: stretch;
323
+ container-name: stat-card-trend;
324
+ container-type: inline-size;
325
+ grid-area: trend;
326
+ inline-size: 100%;
327
+ min-inline-size: 0;
328
+ }
281
329
  }
282
330
 
283
331
  @container stat-card-trend (max-width: 39px) {
284
- [data-ui='stat-card'] [data-part='trend'] > * {
285
- visibility: hidden;
332
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
333
+ :scope [data-part-trend] > * {
334
+ visibility: hidden;
335
+ }
286
336
  }
287
337
  }
288
338
 
289
- [data-ui='stat-card'][data-layout='stacked'] [data-part='trend'] {
290
- align-self: end;
291
- margin-block-start: var(--slotted-space-2, 0.25rem);
339
+ /**
340
+ * On the last row the trend reaches the card's edges: its sides and its
341
+ * bottom bleed through the inset, and the card's corners round it. A line
342
+ * drawn inside the inset ends a gutter short of each edge and reads as a
343
+ * picture placed in the card; a line that runs to the frame reads as the
344
+ * card's ground. The edge is drawn over it, out of flow. A plain card has
345
+ * no inset, so the margins are nought there.
346
+ */
347
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
348
+ :scope[data-layout='stacked'] [data-part-trend] {
349
+ align-self: end;
350
+ border-end-end-radius: calc(var(--_radius) - var(--_edge-width));
351
+ border-end-start-radius: calc(var(--_radius) - var(--_edge-width));
352
+ margin-block-end: calc(-1 * var(--_inset-block));
353
+ margin-block-start: var(--slotted-space-2, 0.25rem);
354
+ margin-inline: calc(-1 * var(--_inset-inline));
355
+ overflow: clip;
356
+ /* The region is wider than the column by the two insets. */
357
+ inline-size: auto;
358
+ }
292
359
  }
293
360
 
294
- [data-ui='stat-card'] [data-part='message'] {
295
- contain: inline-size;
296
- grid-area: message;
361
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
362
+ :scope[data-layout='stacked'] [data-part-trend] > * {
363
+ block-size: var(--_trend-block);
364
+ min-block-size: 0;
365
+ }
366
+ }
367
+
368
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
369
+ :scope [data-part-message] {
370
+ contain: inline-size;
371
+ grid-area: message;
372
+ }
297
373
  }
298
374
 
299
375
  /**
@@ -303,47 +379,71 @@
303
379
  * (`docs/token-foundation.md`, rule 4).
304
380
  */
305
381
  @container stat-card (max-width: 219px) {
306
- [data-ui='stat-card'] [data-part='body'] {
307
- grid-template-areas:
308
- 'header'
309
- 'figure'
310
- 'trend'
311
- 'message';
312
- grid-template-columns: minmax(0, 1fr);
313
- grid-template-rows: auto minmax(0, 1fr) auto auto;
382
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
383
+ :scope [data-part-body] {
384
+ grid-template-areas:
385
+ 'header'
386
+ 'figure'
387
+ 'message'
388
+ 'trend';
389
+ grid-template-columns: minmax(0, 1fr);
390
+ grid-template-rows: auto minmax(0, 1fr) auto auto;
391
+ }
314
392
  }
315
393
 
316
- [data-ui='stat-card'] [data-part='trend'] {
317
- align-self: end;
318
- margin-block-start: var(--slotted-space-2, 0.25rem);
394
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
395
+ :scope [data-part-trend] {
396
+ align-self: end;
397
+ border-end-end-radius: calc(var(--_radius) - var(--_edge-width));
398
+ border-end-start-radius: calc(var(--_radius) - var(--_edge-width));
399
+ margin-block-end: calc(-1 * var(--_inset-block));
400
+ margin-block-start: var(--slotted-space-2, 0.25rem);
401
+ margin-inline: calc(-1 * var(--_inset-inline));
402
+ overflow: clip;
403
+ /* The region is wider than the column by the two insets. */
404
+ inline-size: auto;
405
+ }
319
406
  }
320
407
 
321
- [data-ui='stat-card'] [data-part='value'] {
322
- font-size: var(--_value-size-narrow);
323
- line-height: var(--_value-line-narrow);
408
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
409
+ :scope [data-part-trend] > * {
410
+ block-size: var(--_trend-block);
411
+ min-block-size: 0;
412
+ }
413
+ }
414
+
415
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
416
+ :scope [data-part-value] {
417
+ font-size: var(--_value-size-narrow);
418
+ line-height: var(--_value-line-narrow);
419
+ }
324
420
  }
325
421
 
326
422
  /* The value steps down here, and so does the line its placeholder keeps. */
327
- [data-ui='stat-card'][data-loading] [data-part='value'] {
328
- min-block-size: calc(var(--_value-size-narrow) * var(--_value-line-narrow));
423
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
424
+ :scope[data-loading] [data-part-value] {
425
+ min-block-size: calc(var(--_value-size-narrow) * var(--_value-line-narrow));
426
+ }
329
427
  }
330
428
  }
331
429
 
332
430
  /* ── Header: the name, a status beside it, an action at the end ──────── */
333
431
 
334
432
  /**
335
- * On the baseline rather than centred: a label that wraps to two lines
433
+ * On the baseline rather than centerd: a label that wraps to two lines
336
434
  * keeps its status and its action on its first line, where the eye reads
337
435
  * them as part of the name, instead of floating them at the middle of the
338
436
  * block.
339
437
  */
340
- [data-ui='stat-card'] [data-part='header'] {
341
- align-items: baseline;
342
- column-gap: var(--slotted-space-3, 0.375rem);
343
- display: flex;
344
- flex-wrap: wrap;
345
- min-inline-size: 0;
346
- row-gap: var(--slotted-space-2, 0.25rem);
438
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
439
+ :scope [data-part-header] {
440
+ align-items: baseline;
441
+ column-gap: var(--slotted-space-3, 0.375rem);
442
+ display: flex;
443
+ flex-wrap: wrap;
444
+ min-inline-size: 0;
445
+ row-gap: var(--slotted-space-2, 0.25rem);
446
+ }
347
447
  }
348
448
 
349
449
  /**
@@ -355,49 +455,60 @@
355
455
  * proportion of the type rather than a scale step: it is a width of
356
456
  * words, and it scales with them.
357
457
  */
358
- [data-ui='stat-card'] [data-part='label'] {
359
- color: var(--_ink-muted);
360
- flex: 1 1 0%;
361
- font-size: var(--_label-size);
362
- font-weight: var(--slotted-font-weight-medium, 500);
363
- line-height: var(--_label-line);
364
- margin: 0;
365
- min-inline-size: min(100%, 10rem);
366
- overflow-wrap: break-word;
458
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
459
+ :scope [data-part-label] {
460
+ color: var(--_ink-muted);
461
+ flex: 1 1 0%;
462
+ font-size: var(--_label-size);
463
+ font-weight: var(--slotted-font-weight-medium, 500);
464
+ line-height: var(--_label-line);
465
+ margin: 0;
466
+ min-inline-size: min(100%, 10rem);
467
+ overflow-wrap: break-word;
468
+ }
367
469
  }
368
470
 
369
- [data-ui='stat-card'] [data-part='status'] {
370
- display: inline-flex;
371
- flex: none;
471
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
472
+ :scope [data-part-status] {
473
+ display: inline-flex;
474
+ flex: none;
475
+ }
372
476
  }
373
477
 
374
478
  /* The action takes the end of the header's first line and stays there
375
479
  when the label wraps: it is the one thing on the card the reader presses,
376
480
  and a corner is where a control is looked for. */
377
- [data-ui='stat-card'] [data-part='action'] {
378
- flex: none;
379
- /* The label's line, so a link here is as tall in the fallback face as in
380
- the web face and the header does not grow when the font arrives. */
381
- font-size: var(--_label-size);
382
- line-height: var(--_label-line);
383
- margin-inline-start: auto;
481
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
482
+ :scope [data-part-action] {
483
+ /* An action slot states one size for the links it holds. */
484
+ --slotted-link-font-size: var(--slotted-font-size-sm, 0.8125rem);
485
+
486
+ flex: none;
487
+ /* The label's line, so a link here is as tall in the fallback face as in
488
+ the web face and the header does not grow when the font arrives. */
489
+ font-size: var(--_label-size);
490
+ line-height: var(--_label-line);
491
+ margin-inline-start: auto;
492
+ }
384
493
  }
385
494
 
386
495
  /* On a finger the card's one control is a full target among 44-pixel
387
- controls: a transparent `::before` centred on the link or button — the
496
+ controls: a transparent `::before` centerd on the link or button — the
388
497
  part itself when `render` made it one — reaches
389
498
  the comfortable size in both axes, and the header keeps its height. */
390
499
  @media (pointer: coarse) {
391
- [data-ui='stat-card']
392
- :is([data-part='action']:is(a, button), [data-part='action'] > :is(a, button)) {
393
- position: relative;
500
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
501
+ :scope :is([data-part-action]:is(a, button), [data-part-action] > :is(a, button)) {
502
+ position: relative;
503
+ }
394
504
  }
395
505
 
396
- [data-ui='stat-card']
397
- :is([data-part='action']:is(a, button), [data-part='action'] > :is(a, button))::before {
398
- content: '';
399
- inset: min(0px, calc((100% - var(--slotted-target-comfortable, 44px)) / 2));
400
- position: absolute;
506
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
507
+ :scope :is([data-part-action]:is(a, button), [data-part-action] > :is(a, button))::before {
508
+ content: '';
509
+ inset: min(0px, calc((100% - var(--slotted-target-comfortable, 44px)) / 2));
510
+ position: absolute;
511
+ }
401
512
  }
402
513
  }
403
514
 
@@ -409,17 +520,21 @@
409
520
  * so a delta that does not fit beside a wide number drops under it rather
410
521
  * than pushing the number.
411
522
  */
412
- [data-ui='stat-card'] [data-part='figure'] {
413
- align-items: baseline;
414
- column-gap: var(--slotted-space-3, 0.375rem);
415
- display: flex;
416
- flex-wrap: wrap;
417
- row-gap: 0;
523
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
524
+ :scope [data-part-figure] {
525
+ align-items: baseline;
526
+ column-gap: var(--slotted-space-3, 0.375rem);
527
+ display: flex;
528
+ flex-wrap: wrap;
529
+ row-gap: 0;
530
+ }
418
531
  }
419
532
 
420
- [data-ui='stat-card'] [data-part='comparison'] {
421
- contain: inline-size;
422
- flex: 1 1 100%;
533
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
534
+ :scope [data-part-comparison] {
535
+ contain: inline-size;
536
+ flex: 1 1 100%;
537
+ }
423
538
  }
424
539
 
425
540
  /**
@@ -432,40 +547,50 @@
432
547
  * to pull a large numeral's counters back together, and it is the same
433
548
  * fraction at every size.
434
549
  */
435
- [data-ui='stat-card'] [data-part='value'] {
436
- /* The figure and its unit are two flex items on one baseline — the text
437
- node is an item of its own — so the gap spaces the unit from the digit
438
- on whichever side it stands. A margin on the unit, reset by
439
- `:first-child` for a leading unit, hugged a trailing one: after a bare
440
- figure the unit is the first element child. */
441
- align-items: baseline;
442
- color: var(--_ink);
443
- display: inline-flex;
444
- flex-wrap: wrap;
445
- gap: 0.15em;
446
- font-size: var(--_value-size);
447
- font-variant-numeric: proportional-nums;
448
- font-weight: var(--slotted-font-weight-semibold, 600);
449
- /* The figure is set at the 3xl or 4xl step, where the theme's tighter
450
- tracking applies. */
451
- letter-spacing: var(--slotted-letter-spacing-tighter, -0.03em);
452
- unicode-bidi: plaintext;
453
- line-height: var(--_value-line);
454
- margin: 0;
455
- min-inline-size: 0;
456
- /* A number is never truncated: a value wider than its column breaks
457
- rather than clips, and a consumer who wants it whole formats it
458
- compact or stacks the card. */
459
- overflow-wrap: break-word;
550
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
551
+ :scope [data-part-value] {
552
+ /* The figure and its unit are two flex items on one baseline — the text
553
+ node is an item of its own — so the gap spaces the unit from the digit
554
+ on whichever side it stands. A margin on the unit, reset by
555
+ `:first-child` for a leading unit, hugged a trailing one: after a bare
556
+ figure the unit is the first element child. */
557
+ align-items: baseline;
558
+ color: var(--_ink);
559
+ display: inline-flex;
560
+ flex-wrap: wrap;
561
+ gap: 0.15em;
562
+ font-size: var(--_value-size);
563
+ font-variant-numeric: proportional-nums;
564
+ font-weight: var(--slotted-font-weight-semibold, 600);
565
+ /* The figure is set at the 3xl or 4xl step, where the theme's tighter
566
+ tracking applies. */
567
+ letter-spacing: var(--slotted-letter-spacing-tighter, -0.03em);
568
+ unicode-bidi: plaintext;
569
+ line-height: var(--_value-line);
570
+ margin: 0;
571
+ min-inline-size: 0;
572
+ /* A number is never truncated: a value wider than its column breaks
573
+ rather than clips, and a consumer who wants it whole formats it
574
+ compact or stacks the card. */
575
+ overflow-wrap: break-word;
576
+ }
577
+ }
578
+
579
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
580
+ :scope[data-attention] [data-part-value] {
581
+ color: var(--_attention-ink);
582
+ }
460
583
  }
461
584
 
462
585
  /* The unit is in the value's own line, a step down in size and weight, so
463
586
  `$` and `%` read as annotation of the number rather than as digits. */
464
- [data-ui='stat-card'] [data-part='unit'] {
465
- color: var(--_ink-muted);
466
- font-size: var(--_delta-size);
467
- font-weight: var(--slotted-font-weight-medium, 500);
468
- letter-spacing: 0;
587
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
588
+ :scope [data-part-unit] {
589
+ color: var(--_ink-muted);
590
+ font-size: var(--_delta-size);
591
+ font-weight: var(--slotted-font-weight-medium, 500);
592
+ letter-spacing: 0;
593
+ }
469
594
  }
470
595
 
471
596
  /**
@@ -474,44 +599,62 @@
474
599
  * metrics, and the tone's text role already clears the reading ratio on
475
600
  * the surface. It sits on the value's baseline.
476
601
  */
477
- [data-ui='stat-card'] [data-part='delta'] {
478
- align-items: center;
479
- color: var(--_tone-text);
480
- column-gap: var(--slotted-space-1, 0.125rem);
481
- display: inline-flex;
482
- font-size: var(--_delta-size);
483
- font-variant-numeric: tabular-nums;
484
- font-weight: var(--slotted-font-weight-semibold, 600);
485
- line-height: 1;
486
- /* A signed number is a run of its own: in a right-to-left document the
487
- sign of `+12.4%` is a neutral character and drifts to the far end of
488
- the run, so the run is laid out by its own content. */
489
- unicode-bidi: plaintext;
490
- white-space: nowrap;
491
- }
492
-
493
- [data-ui='stat-card'] [data-part='delta'][data-tone='neutral'] {
494
- --_tone-text: var(--_ink-muted);
602
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
603
+ :scope [data-part-delta] {
604
+ align-items: center;
605
+ color: var(--_tone-text);
606
+ column-gap: var(--slotted-space-1, 0.125rem);
607
+ display: inline-flex;
608
+ font-size: var(--_delta-size);
609
+ font-variant-numeric: tabular-nums;
610
+ font-weight: var(--slotted-font-weight-semibold, 600);
611
+ line-height: 1;
612
+ /* A signed number is a run of its own: in a right-to-left document the
613
+ sign of `+12.4%` is a neutral character and drifts to the far end of
614
+ the run, so the run is laid out by its own content. */
615
+ unicode-bidi: plaintext;
616
+ white-space: nowrap;
617
+ }
618
+ }
619
+
620
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
621
+ :scope [data-part-delta][data-tone='neutral'] {
622
+ --_tone-text: var(--_ink-muted);
623
+ }
495
624
  }
496
625
 
497
- [data-ui='stat-card'] [data-part='delta'][data-tone='accent'] {
498
- --_tone-text: var(--slotted-tone-accent-text);
626
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
627
+ :scope [data-part-delta][data-tone='accent'] {
628
+ --_tone-text: var(--slotted-tone-accent-text);
629
+ }
499
630
  }
500
631
 
501
- [data-ui='stat-card'] [data-part='delta'][data-tone='secondary'] {
502
- --_tone-text: var(--slotted-tone-secondary-text);
632
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
633
+ :scope [data-part-delta][data-tone='secondary'] {
634
+ --_tone-text: var(--slotted-tone-secondary-text);
635
+ }
503
636
  }
504
637
 
505
- [data-ui='stat-card'] [data-part='delta'][data-tone='success'] {
506
- --_tone-text: var(--slotted-tone-success-text);
638
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
639
+ :scope [data-part-delta][data-tone='success'] {
640
+ --_tone-text: var(--slotted-tone-success-text);
641
+ }
642
+
643
+ :scope [data-part-delta][data-tone='info'] {
644
+ --_tone-text: var(--slotted-tone-info-text);
645
+ }
507
646
  }
508
647
 
509
- [data-ui='stat-card'] [data-part='delta'][data-tone='warning'] {
510
- --_tone-text: var(--slotted-tone-warning-text);
648
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
649
+ :scope [data-part-delta][data-tone='warning'] {
650
+ --_tone-text: var(--slotted-tone-warning-text);
651
+ }
511
652
  }
512
653
 
513
- [data-ui='stat-card'] [data-part='delta'][data-tone='danger'] {
514
- --_tone-text: var(--slotted-tone-danger-text);
654
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
655
+ :scope [data-part-delta][data-tone='danger'] {
656
+ --_tone-text: var(--slotted-tone-danger-text);
657
+ }
515
658
  }
516
659
 
517
660
  /**
@@ -522,38 +665,43 @@
522
665
  * change draws `minus`. The binding renders the glyph inside the icon box;
523
666
  * the part hands the box its size, and the box inherits the delta's ink.
524
667
  */
525
- [data-ui='stat-card'] [data-part='indicator'] {
526
- --slotted-icon-size: var(--_indicator-size);
668
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
669
+ :scope [data-part-indicator] {
670
+ --slotted-icon-size: var(--_indicator-size);
527
671
 
528
- display: inline-flex;
529
- flex: none;
672
+ display: inline-flex;
673
+ flex: none;
674
+ }
530
675
  }
531
676
 
532
677
  /* A reflection across the horizontal axis, not motion: nothing travels when
533
678
  a rise becomes a fall. Time runs from the right in a right-to-left
534
679
  document, so the rise points the other way there, as the sparkline beside
535
680
  it does — the `directional` icon box the binding draws does that. */
536
- [data-ui='stat-card']
537
- [data-part='delta'][data-trend='down']
538
- [data-part='indicator']
539
- > [data-ui='icon'] {
540
- rotate: x 180deg;
681
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
682
+ :scope [data-part-delta][data-trend='down'] [data-part-indicator] > [data-ui-icon] {
683
+ rotate: x 180deg;
684
+ }
541
685
  }
542
686
 
543
687
  /* ── Comparison: the prose under the figure ───────────────────────────── */
544
688
 
545
- [data-ui='stat-card'] [data-part='comparison'] {
546
- color: var(--_ink-muted);
547
- font-size: var(--_prose-size);
548
- line-height: var(--_prose-line);
549
- margin-block-start: var(--_region-gap);
550
- margin: 0;
551
- min-inline-size: 0;
552
- overflow-wrap: anywhere;
689
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
690
+ :scope [data-part-comparison] {
691
+ color: var(--_ink-muted);
692
+ font-size: var(--_prose-size);
693
+ line-height: var(--_prose-line);
694
+ margin-block-start: var(--_region-gap);
695
+ margin: 0;
696
+ min-inline-size: 0;
697
+ overflow-wrap: anywhere;
698
+ }
553
699
  }
554
700
 
555
- [data-ui='stat-card'] [data-part='period'] {
556
- color: var(--_ink-muted);
701
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
702
+ :scope [data-part-period] {
703
+ color: var(--_ink-muted);
704
+ }
557
705
  }
558
706
 
559
707
  /* ── Trend: where a sparkline goes ────────────────────────────────────── */
@@ -566,64 +714,105 @@
566
714
  * — a card with no delta, or a metric with no valence, draws its trend in
567
715
  * the theme's blue and not in grey.
568
716
  */
569
- [data-ui='stat-card'] [data-part='trend'] {
570
- align-self: center;
571
- display: flex;
717
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
718
+ :scope [data-part-trend] {
719
+ display: flex;
720
+ }
572
721
  }
573
722
 
574
- [data-ui='stat-card'][data-tone='success'] [data-part='trend'] {
575
- --slotted-sparkline-color: var(--slotted-tone-success-text);
723
+ /**
724
+ * Beside the figure the trend is as tall as the figure — the value, the
725
+ * delta and the comparison under them — so its last point is read level
726
+ * with the number it ends at, and no gap opens above or below a line of a
727
+ * fixed height centerd on a taller column. The sparkline's own step is the
728
+ * floor, for a figure with no comparison.
729
+ */
730
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
731
+ :scope [data-part-trend] > * {
732
+ block-size: auto;
733
+ /* No height of its own to give the row: the drawing would otherwise
734
+ make the figure's row taller than the figure. */
735
+ contain: size;
736
+ min-block-size: var(--_trend-floor);
737
+ }
576
738
  }
577
739
 
578
- [data-ui='stat-card'][data-tone='danger'] [data-part='trend'] {
579
- --slotted-sparkline-color: var(--slotted-tone-danger-text);
740
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
741
+ :scope[data-tone='success'] [data-part-trend] {
742
+ --slotted-sparkline-color: var(--slotted-tone-success-text);
743
+ }
744
+
745
+ :scope[data-tone='info'] [data-part-trend] {
746
+ --slotted-sparkline-color: var(--slotted-tone-info-text);
747
+ }
580
748
  }
581
749
 
582
- [data-ui='stat-card'][data-tone='warning'] [data-part='trend'] {
583
- --slotted-sparkline-color: var(--slotted-tone-warning-text);
750
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
751
+ :scope[data-tone='danger'] [data-part-trend] {
752
+ --slotted-sparkline-color: var(--slotted-tone-danger-text);
753
+ }
584
754
  }
585
755
 
586
- [data-ui='stat-card'][data-tone='accent'] [data-part='trend'] {
587
- --slotted-sparkline-color: var(--slotted-tone-accent-text);
756
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
757
+ :scope[data-tone='warning'] [data-part-trend] {
758
+ --slotted-sparkline-color: var(--slotted-tone-warning-text);
759
+ }
588
760
  }
589
761
 
590
- [data-ui='stat-card'][data-tone='secondary'] [data-part='trend'] {
591
- --slotted-sparkline-color: var(--slotted-tone-secondary-text);
762
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
763
+ :scope[data-tone='accent'] [data-part-trend] {
764
+ --slotted-sparkline-color: var(--slotted-tone-accent-text);
765
+ }
766
+ }
767
+
768
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
769
+ :scope[data-tone='secondary'] [data-part-trend] {
770
+ --slotted-sparkline-color: var(--slotted-tone-secondary-text);
771
+ }
592
772
  }
593
773
 
594
- [data-ui='stat-card'][data-fill='plain'] [data-part='trend'] {
595
- --slotted-sparkline-ring-color: var(--slotted-surface-raised, Canvas);
774
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
775
+ :scope[data-fill='plain'] [data-part-trend] {
776
+ --slotted-sparkline-ring-color: var(--slotted-surface-raised, Canvas);
777
+ }
596
778
  }
597
779
 
598
780
  /* ── Message: what stands in for a value that is missing or failed ────── */
599
781
 
600
- [data-ui='stat-card'] [data-part='message'] {
601
- color: var(--_ink-muted);
602
- font-size: var(--_prose-size);
603
- line-height: var(--_prose-line);
604
- margin: 0;
605
- min-inline-size: 0;
606
- overflow-wrap: anywhere;
782
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
783
+ :scope [data-part-message] {
784
+ color: var(--_ink-muted);
785
+ font-size: var(--_prose-size);
786
+ line-height: var(--_prose-line);
787
+ margin: 0;
788
+ min-inline-size: 0;
789
+ overflow-wrap: anywhere;
790
+ }
607
791
  }
608
792
 
609
- [data-ui='stat-card'][data-status='error'] [data-part='message'] {
610
- color: var(--slotted-tone-danger-text);
793
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
794
+ :scope[data-status='error'] [data-part-message] {
795
+ color: var(--slotted-tone-danger-text);
796
+ }
611
797
  }
612
798
 
613
799
  /* A value that is not there is a dash in the muted step, at the value's
614
800
  own size, so the row keeps its height and its rhythm. */
615
- [data-ui='stat-card'][data-status='empty'] [data-part='value'],
616
- [data-ui='stat-card'][data-status='error'] [data-part='value'] {
617
- color: var(--_ink-muted);
801
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
802
+ :scope[data-status='empty'] [data-part-value],
803
+ :scope[data-status='error'] [data-part-value] {
804
+ color: var(--_ink-muted);
805
+ }
618
806
  }
619
807
 
620
808
  /* ── Loading ──────────────────────────────────────────────────────────── */
621
809
 
622
810
  /**
623
811
  * The binding renders a `skeleton` in place of each text part and a block
624
- * in the trend, each the height of what it stands for; the sheet only has
625
- * to keep the trend's box at the sparkline's height so the card does not
626
- * change size when the line arrives.
812
+ * in the trend. The block is the trend region's child, so the rules that
813
+ * size a sparkline there size it too: the figure's height beside the
814
+ * figure, the card's width and `--_trend-block` on the last row. The card
815
+ * does not change size when the line arrives.
627
816
  */
628
817
  /**
629
818
  * The value's box is an inline flex line, so its height is its content's.
@@ -634,28 +823,9 @@
634
823
  * arrived. The floor is one line of the value's own type, so the two states
635
824
  * occupy the same box.
636
825
  */
637
- [data-ui='stat-card'][data-loading] [data-part='value'] {
638
- min-block-size: calc(var(--_value-size) * var(--_value-line));
639
- }
640
-
641
- [data-ui='stat-card'][data-loading] [data-part='trend'] {
642
- --slotted-skeleton-block-size: var(
643
- --slotted-sparkline-block-size,
644
- var(--slotted-space-9, 2rem)
645
- );
646
- }
647
-
648
- [data-ui='stat-card'][data-loading][data-size='sm'] [data-part='trend'] {
649
- --slotted-skeleton-block-size: var(
650
- --slotted-sparkline-block-size-sm,
651
- var(--slotted-space-7, 1.25rem)
652
- );
653
- }
654
-
655
- [data-ui='stat-card'][data-loading][data-size='lg'] [data-part='trend'] {
656
- --slotted-skeleton-block-size: var(
657
- --slotted-sparkline-block-size-lg,
658
- var(--slotted-space-11, 3rem)
659
- );
826
+ @scope ([data-ui-stat-card]) to (:scope [data-ui] > *) {
827
+ :scope[data-loading] [data-part-value] {
828
+ min-block-size: calc(var(--_value-size) * var(--_value-line));
829
+ }
660
830
  }
661
831
  }