hydrateless 0.8.0 → 0.10.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 (45) hide show
  1. package/README.md +120 -0
  2. package/dist/accordion.css +20 -8
  3. package/dist/alert.css +69 -8
  4. package/dist/avatar.css +8 -14
  5. package/dist/badge.css +9 -1
  6. package/dist/breadcrumb.css +7 -3
  7. package/dist/button.css +48 -28
  8. package/dist/card.css +8 -5
  9. package/dist/checkbox.css +36 -22
  10. package/dist/combobox.css +43 -15
  11. package/dist/command-palette.css +123 -0
  12. package/dist/components.css +1351 -571
  13. package/dist/disclosure.css +27 -29
  14. package/dist/drawer.css +76 -48
  15. package/dist/dropdown.css +138 -22
  16. package/dist/field.css +5 -4
  17. package/dist/hydrateless.css +1581 -1330
  18. package/dist/hydrateless.min.css +1 -1
  19. package/dist/input.css +20 -17
  20. package/dist/kbd.css +4 -3
  21. package/dist/menu.css +106 -45
  22. package/dist/modal.css +63 -14
  23. package/dist/pagination.css +20 -11
  24. package/dist/popover.css +34 -12
  25. package/dist/progress.css +23 -12
  26. package/dist/{radio.css → radio-group.css} +23 -16
  27. package/dist/reset.css +7 -2
  28. package/dist/{segmented.css → segmented-control.css} +24 -12
  29. package/dist/select.css +28 -22
  30. package/dist/separator.css +9 -9
  31. package/dist/skeleton.css +18 -10
  32. package/dist/skip-link.css +13 -8
  33. package/dist/slider.css +66 -25
  34. package/dist/spinner.css +17 -14
  35. package/dist/switch.css +55 -18
  36. package/dist/table.css +100 -15
  37. package/dist/tabs.css +35 -11
  38. package/dist/textarea.css +26 -12
  39. package/dist/theme.css +5 -24
  40. package/dist/toast.css +40 -36
  41. package/dist/toc.css +17 -4
  42. package/dist/tokens.css +208 -183
  43. package/dist/tooltip.css +74 -17
  44. package/package.json +4 -4
  45. package/dist/command.css +0 -102
@@ -2,66 +2,64 @@
2
2
  /**
3
3
  * Disclosure: a styled native `<details>`. The class and the `data-hl-disclosure`
4
4
  * attribute (which also opts into the state enhancer) are interchangeable, so
5
- * plain HTML needs only one of them. Exclusive groups need no JavaScript:
6
- * give related disclosures the same `name` attribute.
5
+ * plain HTML needs only one of them.
6
+ *
7
+ * No-JS baseline: fully functional; exclusive groups need only a shared `name`
8
+ * attribute. The enhancer mirrors open state into its API and reads no other
9
+ * attributes.
7
10
  */
8
11
  @layer components {
9
- details.hl-disclosure, details[data-hl-disclosure] {
10
- border: 1px solid var(--hl-border);
12
+ details:is(.hl-disclosure, [data-hl-disclosure]) {
13
+ border: var(--hl-border-width) solid var(--hl-border);
11
14
  border-radius: var(--hl-radius-lg);
12
15
  background: var(--hl-surface);
13
16
  }
14
17
 
15
- details.hl-disclosure > summary, details[data-hl-disclosure] > summary {
18
+ details:is(.hl-disclosure, [data-hl-disclosure]) > summary {
19
+ display: flex;
20
+ align-items: center;
21
+ gap: var(--hl-space-2);
16
22
  list-style: none;
17
23
  cursor: pointer;
18
24
  padding: var(--hl-space-3) var(--hl-space-4);
19
25
  }
20
26
 
21
- details.hl-disclosure > summary::-webkit-details-marker {
22
- display: none;
23
- }
24
-
25
- details[data-hl-disclosure] > summary::-webkit-details-marker {
27
+ details:is(.hl-disclosure, [data-hl-disclosure]) > summary::-webkit-details-marker {
26
28
  display: none;
27
29
  }
28
30
 
29
- details.hl-disclosure > summary:focus-visible {
31
+ details:is(.hl-disclosure, [data-hl-disclosure]) > summary:focus-visible {
30
32
  outline: var(--hl-focus-ring);
31
- outline-offset: 2px;
33
+ outline-offset: var(--hl-focus-offset);
32
34
  }
33
35
 
34
- details[data-hl-disclosure] > summary:focus-visible {
35
- outline: var(--hl-focus-ring);
36
- outline-offset: 2px;
37
- }
38
-
39
- details.hl-disclosure > summary::after {
36
+ /* The marker sits at the inline end so it lands on the left under RTL. */
37
+ details:is(.hl-disclosure, [data-hl-disclosure]) > summary::after {
40
38
  content: '\25B8';
41
- float: right;
42
- transition: transform var(--hl-duration-fast) var(--hl-ease-standard);
39
+ margin-inline-start: auto;
40
+ transition: rotate var(--hl-duration-fast) var(--hl-ease-standard);
43
41
  }
44
42
 
45
- details[data-hl-disclosure] > summary::after {
46
- content: '\25B8';
47
- float: right;
48
- transition: transform var(--hl-duration-fast) var(--hl-ease-standard);
43
+ details:is(.hl-disclosure, [data-hl-disclosure])[open] > summary::after {
44
+ rotate: 90deg;
49
45
  }
50
46
 
51
- details.hl-disclosure[open] > summary::after {
52
- transform: rotate(90deg);
47
+ /* Mirror the marker under RTL so it points into the reading direction, and
48
+ rotate the other way so the open state still points down. */
49
+ details:is(.hl-disclosure, [data-hl-disclosure]):dir(rtl) > summary::after {
50
+ scale: -1 1;
53
51
  }
54
52
 
55
- details[data-hl-disclosure][open] > summary::after {
56
- transform: rotate(90deg);
53
+ details:is(.hl-disclosure, [data-hl-disclosure])[open]:dir(rtl) > summary::after {
54
+ rotate: -90deg;
57
55
  }
58
56
 
59
- details.hl-disclosure > .hl-disclosure-panel, details[data-hl-disclosure] > .hl-disclosure-panel {
57
+ details:is(.hl-disclosure, [data-hl-disclosure]) > .hl-disclosure-panel {
60
58
  padding: var(--hl-space-3) var(--hl-space-4) var(--hl-space-4);
61
59
  }
62
60
  }
63
61
  /**
64
- * Tabs. Two markups are supported and styled together:
62
+ * Tabs: `<div data-hl-tabs>`. Two markups are supported and styled together:
65
63
  *
66
64
  * - CSS-only baseline: `.hl-tablist` of `<label class="hl-tab">` wrapping a
67
65
  * radio, then a `.hl-tabpanels` of `.hl-tabpanel`s. `:has(input:checked)`
@@ -69,6 +67,10 @@
69
67
  * - Enhanced: the enhancer adds `role="tab"`/`tabpanel`, roving focus, and
70
68
  * `aria-selected`, toggles `[hidden]` on panels, and marks the root
71
69
  * `data-hl-ready`, at which point the no-JS rules below stand down.
70
+ * data-hl-tabs: root
71
+ * data-hl-ready: set by the enhancer
72
+ * `aria-orientation="vertical"` on the tablist stacks the tabs at the
73
+ * inline start of the panels.
72
74
  */
73
75
  @layer components {
74
76
  [data-hl-tabs] {
@@ -81,15 +83,23 @@
81
83
  display: flex;
82
84
  gap: var(--hl-space-2);
83
85
  padding: var(--hl-space-2);
84
- border-bottom: var(--hl-border-width) solid var(--hl-border);
86
+ border-block-end: var(--hl-border-width) solid var(--hl-border);
87
+ }
88
+
89
+ [data-hl-tabs]:has(> [role='tablist'][aria-orientation='vertical']) {
90
+ display: flex;
91
+ }
92
+
93
+ [data-hl-tabs] [role='tablist'][aria-orientation='vertical'] {
94
+ flex-direction: column;
95
+ border-block-end: 0;
96
+ border-inline-end: var(--hl-border-width) solid var(--hl-border);
85
97
  }
86
98
 
87
99
  .hl-tab,
88
100
  [data-hl-tabs] [role='tab'] {
89
101
  position: relative;
90
- -webkit-appearance: none;
91
- -moz-appearance: none;
92
- appearance: none;
102
+ appearance: none;
93
103
  display: inline-flex;
94
104
  align-items: center;
95
105
  background: transparent;
@@ -104,10 +114,7 @@
104
114
  /* The baseline keeps selection in a visually hidden radio per tab label. */
105
115
  .hl-tab > input[type='radio'] {
106
116
  position: absolute;
107
- top: 0;
108
- right: 0;
109
- bottom: 0;
110
- left: 0;
117
+ inset: 0;
111
118
  margin: 0;
112
119
  opacity: 0;
113
120
  cursor: pointer;
@@ -121,13 +128,13 @@
121
128
  .hl-tab:has(input:focus-visible),
122
129
  [data-hl-tabs] [role='tab']:focus-visible {
123
130
  outline: var(--hl-focus-ring);
124
- outline-offset: 2px;
131
+ outline-offset: var(--hl-focus-offset);
125
132
  }
126
133
 
127
134
  .hl-tab:has(input:disabled),
128
135
  [data-hl-tabs] [role='tab'][disabled],
129
136
  [data-hl-tabs] [role='tab'][aria-disabled='true'] {
130
- opacity: 0.5;
137
+ opacity: var(--hl-disabled-opacity);
131
138
  cursor: not-allowed;
132
139
  }
133
140
 
@@ -186,22 +193,49 @@
186
193
  [data-hl-tabs]:not([data-hl-ready]) [role='tabpanel'] ~ [role='tabpanel'] {
187
194
  display: none;
188
195
  }
196
+
197
+ /* Selection is a fill, which forced colors flatten; use the system highlight
198
+ and give every tab an edge. */
199
+ @media (forced-colors: active) {
200
+ .hl-tab,
201
+ [data-hl-tabs] [role='tab'] {
202
+ border: var(--hl-border-width) solid ButtonBorder;
203
+ }
204
+
205
+ .hl-tab:has(input:checked),
206
+ [data-hl-tabs] [role='tab'][aria-selected='true'] {
207
+ background: Highlight;
208
+ color: HighlightText;
209
+ }
210
+ }
189
211
  }
212
+ /**
213
+ * Accordion: `<div data-hl-accordion>` of native `<details>` items, each with a
214
+ * `<summary>` header and an `.hl-accordion-panel` body.
215
+ *
216
+ * No-JS baseline: `<details>` opens and closes on its own; exclusive groups
217
+ * need only a shared `name` attribute. The enhancer adds arrow-key movement
218
+ * between headers and the value API, and reads nothing else from the markup.
219
+ * data-hl-accordion: root (opts into the enhancer)
220
+ */
190
221
  @layer components {
191
222
  [data-hl-accordion] {
192
- border: 1px solid var(--hl-border);
223
+ border: var(--hl-border-width) solid var(--hl-border);
193
224
  border-radius: var(--hl-radius-lg);
194
225
  }
195
226
 
196
227
  [data-hl-accordion] > details {
197
- border-top: 1px solid var(--hl-border);
228
+ border-block-start: var(--hl-border-width) solid var(--hl-border);
198
229
  }
199
230
 
200
231
  [data-hl-accordion] > details:first-child {
201
- border-top: 0;
232
+ border-block-start: 0;
202
233
  }
203
234
 
204
235
  [data-hl-accordion] > details > summary {
236
+ display: flex;
237
+ align-items: center;
238
+ gap: var(--hl-space-2);
205
239
  list-style: none;
206
240
  cursor: pointer;
207
241
  padding: var(--hl-space-3) var(--hl-space-4);
@@ -213,27 +247,34 @@
213
247
 
214
248
  [data-hl-accordion] > details > summary:focus-visible {
215
249
  outline: var(--hl-focus-ring);
216
- outline-offset: 2px;
250
+ outline-offset: var(--hl-focus-offset);
217
251
  }
218
252
 
253
+ /* The chevron sits at the inline end so it lands on the left under RTL. */
219
254
  [data-hl-accordion] > details > summary::after {
220
255
  content: '\25BE';
221
- float: right;
222
- transform: rotate(0deg);
223
- transition: transform var(--hl-duration-fast) var(--hl-ease-standard);
256
+ margin-inline-start: auto;
257
+ transition: rotate var(--hl-duration-fast) var(--hl-ease-standard);
224
258
  }
225
259
 
226
260
  [data-hl-accordion] > details[open] > summary::after {
227
- transform: rotate(180deg);
261
+ rotate: 180deg;
228
262
  }
229
263
 
230
264
  [data-hl-accordion] > details > .hl-accordion-panel {
231
265
  padding: var(--hl-space-3) var(--hl-space-4) var(--hl-space-4);
232
266
  }
233
267
  }
268
+ /**
269
+ * Table of contents: `<nav data-hl-toc>` with nested `<ul>` lists of anchor
270
+ * links. With no JavaScript it is a plain link list; the enhancer marks the
271
+ * link for the heading in view with `aria-current="true"`.
272
+ * data-hl-toc: the nav
273
+ * data-hl-content-selector: optional element whose headings are observed
274
+ */
234
275
  @layer components {
235
276
  nav[data-hl-toc] {
236
- border: 1px solid var(--hl-border);
277
+ border: var(--hl-border-width) solid var(--hl-border);
237
278
  border-radius: var(--hl-radius-lg);
238
279
  padding: var(--hl-space-3);
239
280
  }
@@ -254,13 +295,12 @@
254
295
  padding: var(--hl-space-1) var(--hl-space-2);
255
296
  border-radius: var(--hl-radius-sm);
256
297
  color: inherit;
257
- -webkit-text-decoration: none;
258
298
  text-decoration: none;
259
299
  }
260
300
 
261
301
  nav[data-hl-toc] a:focus-visible {
262
302
  outline: var(--hl-focus-ring);
263
- outline-offset: -2px;
303
+ outline-offset: calc(var(--hl-focus-offset) * -1);
264
304
  }
265
305
 
266
306
  nav[data-hl-toc] a[aria-current='true'] {
@@ -268,9 +308,22 @@
268
308
  }
269
309
 
270
310
  nav[data-hl-toc] ul ul {
271
- padding-left: var(--hl-space-3);
311
+ padding-inline-start: var(--hl-space-3);
312
+ }
313
+
314
+ @media (forced-colors: active) {
315
+ nav[data-hl-toc] a[aria-current='true'] {
316
+ background: Highlight;
317
+ color: HighlightText;
318
+ }
272
319
  }
273
320
  }
321
+ /**
322
+ * Breadcrumb: `<nav data-hl-breadcrumb aria-label="Breadcrumb">` wrapping an
323
+ * `<ol>` of links; the current page carries `aria-current="page"`. Pure CSS;
324
+ * there is no enhancer. Order follows the writing direction, so the trail
325
+ * reads right to left under RTL.
326
+ */
274
327
  @layer components {
275
328
  nav[data-hl-breadcrumb] ol {
276
329
  display: flex;
@@ -295,19 +348,17 @@
295
348
 
296
349
  nav[data-hl-breadcrumb] a {
297
350
  color: var(--hl-primary);
298
- -webkit-text-decoration: none;
299
351
  text-decoration: none;
300
352
  border-radius: var(--hl-radius-sm);
301
353
  }
302
354
 
303
355
  nav[data-hl-breadcrumb] a:hover {
304
- -webkit-text-decoration: underline;
305
356
  text-decoration: underline;
306
357
  }
307
358
 
308
359
  nav[data-hl-breadcrumb] a:focus-visible {
309
360
  outline: var(--hl-focus-ring);
310
- outline-offset: 2px;
361
+ outline-offset: var(--hl-focus-offset);
311
362
  }
312
363
 
313
364
  nav[data-hl-breadcrumb] [aria-current='page'] {
@@ -317,7 +368,8 @@
317
368
  /**
318
369
  * Pagination: `<nav class="hl-pagination" aria-label="Pagination">` wrapping a
319
370
  * list of `.hl-pagination-item` links/buttons; mark the active page with
320
- * `aria-current="page"` and use `.hl-pagination-ellipsis` for gaps.
371
+ * `aria-current="page"` and use `.hl-pagination-ellipsis` for gaps. Pure CSS;
372
+ * there is no enhancer. Item order follows the writing direction.
321
373
  */
322
374
  @layer components {
323
375
  .hl-pagination ul {
@@ -335,17 +387,15 @@
335
387
  align-items: center;
336
388
  justify-content: center;
337
389
  gap: var(--hl-space-1);
338
- min-width: 2.25rem;
339
- height: 2.25rem;
340
- padding-left: var(--hl-space-2);
341
- padding-right: var(--hl-space-2);
390
+ min-inline-size: var(--hl-control-block-size);
391
+ block-size: var(--hl-control-block-size);
392
+ padding-inline: var(--hl-space-2);
342
393
  border: var(--hl-border-width) solid transparent;
343
394
  border-radius: var(--hl-radius-md);
344
395
  background: transparent;
345
396
  color: var(--hl-fg);
346
397
  font: inherit;
347
398
  font-size: var(--hl-text-sm);
348
- -webkit-text-decoration: none;
349
399
  text-decoration: none;
350
400
  cursor: pointer;
351
401
  transition: background-color var(--hl-duration-fast) var(--hl-ease-standard);
@@ -357,7 +407,7 @@
357
407
 
358
408
  .hl-pagination-item:focus-visible {
359
409
  outline: var(--hl-focus-ring);
360
- outline-offset: 2px;
410
+ outline-offset: var(--hl-focus-offset);
361
411
  }
362
412
 
363
413
  .hl-pagination-item[aria-current='page'] {
@@ -368,7 +418,7 @@
368
418
 
369
419
  .hl-pagination-item[aria-disabled='true'],
370
420
  .hl-pagination-item:disabled {
371
- opacity: 0.45;
421
+ opacity: var(--hl-disabled-opacity);
372
422
  pointer-events: none;
373
423
  }
374
424
 
@@ -376,17 +426,29 @@
376
426
  display: inline-flex;
377
427
  align-items: center;
378
428
  justify-content: center;
379
- min-width: 2.25rem;
380
- height: 2.25rem;
429
+ min-inline-size: var(--hl-control-block-size);
430
+ block-size: var(--hl-control-block-size);
381
431
  color: var(--hl-fg-subtle);
382
432
  -webkit-user-select: none;
383
- -moz-user-select: none;
384
433
  user-select: none;
385
434
  }
435
+
436
+ @media (forced-colors: active) {
437
+ .hl-pagination-item[aria-current='page'] {
438
+ border-color: Highlight;
439
+ }
440
+
441
+ .hl-pagination-item[aria-disabled='true'],
442
+ .hl-pagination-item:disabled {
443
+ color: GrayText;
444
+ }
445
+ }
386
446
  }
387
447
  /**
388
448
  * Separator: `<hr class="hl-separator">` or
389
449
  * `<div class="hl-separator" role="separator" aria-orientation="vertical">`.
450
+ * Pure CSS; there is no enhancer.
451
+ * data-hl-orientation: vertical (alternative to aria-orientation)
390
452
  */
391
453
  @layer components {
392
454
  .hl-separator {
@@ -395,157 +457,239 @@
395
457
  background: var(--hl-border);
396
458
  }
397
459
 
398
- .hl-separator:not([aria-orientation='vertical']):not([data-hl-orientation='vertical']) {
399
- width: 100%;
400
- height: var(--hl-border-width);
401
- margin-top: var(--hl-space-4);
402
- margin-bottom: var(--hl-space-4);
460
+ .hl-separator:not([aria-orientation='vertical'], [data-hl-orientation='vertical']) {
461
+ inline-size: 100%;
462
+ block-size: var(--hl-border-width);
463
+ margin-block: var(--hl-space-4);
403
464
  }
404
465
 
405
466
  .hl-separator[aria-orientation='vertical'],
406
467
  .hl-separator[data-hl-orientation='vertical'] {
407
468
  align-self: stretch;
408
- width: var(--hl-border-width);
409
- min-height: 1rem;
410
- margin-left: var(--hl-space-4);
411
- margin-right: var(--hl-space-4);
469
+ inline-size: var(--hl-border-width);
470
+ min-block-size: 1rem;
471
+ margin-inline: var(--hl-space-4);
412
472
  }
413
473
  }
414
474
  /* Overlays */
475
+ /**
476
+ * Modal: a native `<dialog class="hl-modal">` (or `<dialog data-hl-modal>`)
477
+ * with optional `.hl-modal-header`, `.hl-modal-body`, and `.hl-modal-footer`.
478
+ *
479
+ * No-JS baseline: `<button command="show-modal" commandfor="id">` opens it and
480
+ * `command="close"` closes it; Escape and the backdrop are native. The
481
+ * enhancer only adds focus return, backdrop dismiss, and the open API, and
482
+ * reads nothing beyond `data-hl-modal`.
483
+ */
415
484
  @layer components {
416
- .hl-modal {
485
+ :is(.hl-modal, dialog[data-hl-modal]) {
486
+ inline-size: min(90vi, var(--hl-modal-inline-size));
487
+ max-inline-size: none;
488
+ padding: 0;
417
489
  border: none;
418
490
  border-radius: var(--hl-radius-lg);
419
- padding: 0;
420
- max-width: min(90vw, 640px);
421
- width: 100%;
422
491
  background: var(--hl-surface);
423
492
  color: var(--hl-fg);
424
493
  box-shadow: var(--hl-overlay-shadow);
494
+ transition:
495
+ opacity var(--hl-duration-base) var(--hl-ease-standard),
496
+ translate var(--hl-duration-base) var(--hl-ease-standard),
497
+ display var(--hl-duration-base) allow-discrete,
498
+ overlay var(--hl-duration-base) allow-discrete;
499
+ }
500
+
501
+ /* Closed state doubles as the exit target of the transition. */
502
+ :is(.hl-modal, dialog[data-hl-modal]):not([open]) {
503
+ opacity: 0;
504
+ translate: 0 var(--hl-space-2);
425
505
  }
426
506
 
427
- .hl-modal::backdrop {
507
+ @starting-style {
508
+ :is(.hl-modal, dialog[data-hl-modal])[open] {
509
+ opacity: 0;
510
+ translate: 0 var(--hl-space-2);
511
+ }
512
+ }
513
+
514
+ :is(.hl-modal, dialog[data-hl-modal])::backdrop {
428
515
  background: var(--hl-scrim);
516
+ opacity: 0;
517
+ transition:
518
+ opacity var(--hl-duration-base) var(--hl-ease-standard),
519
+ display var(--hl-duration-base) allow-discrete,
520
+ overlay var(--hl-duration-base) allow-discrete;
521
+ }
522
+
523
+ :is(.hl-modal, dialog[data-hl-modal])[open]::backdrop {
524
+ opacity: 1;
525
+ }
526
+
527
+ @starting-style {
528
+ :is(.hl-modal, dialog[data-hl-modal])[open]::backdrop {
529
+ opacity: 0;
530
+ }
429
531
  }
430
532
 
431
- .hl-modal .hl-modal-header,
432
- .hl-modal .hl-modal-body,
433
- .hl-modal .hl-modal-footer {
533
+ :is(.hl-modal, dialog[data-hl-modal]) :is(.hl-modal-header, .hl-modal-body, .hl-modal-footer) {
434
534
  padding: var(--hl-space-4);
435
535
  }
436
536
 
437
- .hl-modal .hl-modal-header {
438
- border-bottom: 1px solid var(--hl-border);
537
+ :is(.hl-modal, dialog[data-hl-modal]) .hl-modal-header {
538
+ border-block-end: var(--hl-border-width) solid var(--hl-border);
439
539
  }
440
540
 
441
- .hl-modal .hl-modal-footer {
442
- border-top: 1px solid var(--hl-border);
541
+ :is(.hl-modal, dialog[data-hl-modal]) .hl-modal-footer {
542
+ border-block-start: var(--hl-border-width) solid var(--hl-border);
443
543
  }
444
544
 
445
- .hl-modal [command='close']:focus-visible {
545
+ /* Interactive children inside the dialog get the standard ring. */
546
+ :is(.hl-modal, dialog[data-hl-modal])
547
+ :is(a, button, input, select, textarea, [tabindex]):focus-visible {
446
548
  outline: var(--hl-focus-ring);
447
- outline-offset: 2px;
549
+ outline-offset: var(--hl-focus-offset);
550
+ }
551
+
552
+ /* The dialog loses its shadow in forced colors; a border keeps its edge. */
553
+ @media (forced-colors: active) {
554
+ :is(.hl-modal, dialog[data-hl-modal]) {
555
+ border: var(--hl-border-width) solid CanvasText;
556
+ }
448
557
  }
449
558
  }
559
+ /**
560
+ * Drawer: a native `<dialog class="hl-drawer">` (or `<dialog data-hl-drawer>`)
561
+ * pinned to one inline edge of the viewport, with optional `.hl-drawer-header`,
562
+ * `.hl-drawer-body`, and `.hl-drawer-footer`.
563
+ *
564
+ * No-JS baseline: `<button command="show-modal" commandfor="id">` opens it and
565
+ * `command="close"` closes it; Escape is native. The enhancer only adds focus
566
+ * return, backdrop dismiss, and the open API.
567
+ * data-hl-side: start | end (default). Logical edges, so they flip under RTL.
568
+ */
450
569
  @layer components {
451
- dialog.hl-drawer {
452
- border: none;
453
- padding: 0;
454
- width: min(90vw, 360px);
455
- max-height: 100dvh;
570
+ :is(.hl-drawer, dialog[data-hl-drawer]) {
571
+ --_slide: 100%;
572
+
573
+ inset-block: 0;
574
+ inset-inline: auto 0;
575
+ inline-size: min(90vi, var(--hl-overlay-inline-size));
576
+ block-size: 100dvb;
577
+ max-block-size: 100dvb;
578
+ max-inline-size: none;
456
579
  margin: 0;
580
+ padding: 0;
581
+ border: none;
457
582
  background: var(--hl-surface);
458
583
  color: var(--hl-fg);
459
584
  box-shadow: var(--hl-overlay-shadow);
585
+ transition:
586
+ translate var(--hl-duration-slow) var(--hl-ease-emphasized),
587
+ display var(--hl-duration-slow) allow-discrete,
588
+ overlay var(--hl-duration-slow) allow-discrete;
460
589
  }
461
590
 
462
- dialog.hl-drawer::backdrop {
463
- background: var(--hl-scrim);
464
- }
591
+ :is(.hl-drawer, dialog[data-hl-drawer])[data-hl-side='start'] {
592
+ --_slide: -100%;
465
593
 
466
- .hl-drawer[open] {
467
- animation: hl-drawer-in-right var(--hl-duration-base) var(--hl-ease-standard);
594
+ inset-inline: 0 auto;
468
595
  }
469
596
 
470
- @keyframes hl-drawer-in-right {
471
- from {
472
- transform: translateX(100%);
473
- }
597
+ /* `translate` is physical, so the slide direction mirrors under RTL. */
598
+ :is(.hl-drawer, dialog[data-hl-drawer]):dir(rtl) {
599
+ --_slide: -100%;
600
+ }
474
601
 
475
- to {
476
- transform: translateX(0%);
477
- }
602
+ :is(.hl-drawer, dialog[data-hl-drawer])[data-hl-side='start']:dir(rtl) {
603
+ --_slide: 100%;
478
604
  }
479
605
 
480
- @keyframes hl-drawer-in-left {
481
- from {
482
- transform: translateX(-100%);
483
- }
606
+ /* Closed state doubles as the exit target of the slide. */
607
+ :is(.hl-drawer, dialog[data-hl-drawer]):not([open]) {
608
+ translate: var(--_slide) 0;
609
+ }
484
610
 
485
- to {
486
- transform: translateX(0%);
487
- }
611
+ /* A column so the body scrolls between a fixed header and footer. */
612
+ :is(.hl-drawer, dialog[data-hl-drawer])[open] {
613
+ display: flex;
614
+ flex-direction: column;
488
615
  }
489
616
 
490
- @media (prefers-reduced-motion: reduce) {
491
- .hl-drawer[open] {
492
- animation: none;
617
+ @starting-style {
618
+ :is(.hl-drawer, dialog[data-hl-drawer])[open] {
619
+ translate: var(--_slide) 0;
493
620
  }
494
621
  }
495
622
 
496
- .hl-drawer[data-side='left'] {
497
- width: auto;
498
- top: 0;
499
- right: auto;
500
- bottom: 0;
501
- left: 0;
623
+ :is(.hl-drawer, dialog[data-hl-drawer])::backdrop {
624
+ background: var(--hl-scrim);
625
+ opacity: 0;
626
+ transition:
627
+ opacity var(--hl-duration-slow) var(--hl-ease-standard),
628
+ display var(--hl-duration-slow) allow-discrete,
629
+ overlay var(--hl-duration-slow) allow-discrete;
502
630
  }
503
631
 
504
- .hl-drawer[data-side='left'][open] {
505
- animation-name: hl-drawer-in-left;
632
+ :is(.hl-drawer, dialog[data-hl-drawer])[open]::backdrop {
633
+ opacity: 1;
506
634
  }
507
635
 
508
- .hl-drawer[data-side='right'] {
509
- width: auto;
510
- top: 0;
511
- right: 0;
512
- bottom: 0;
513
- left: auto;
636
+ @starting-style {
637
+ :is(.hl-drawer, dialog[data-hl-drawer])[open]::backdrop {
638
+ opacity: 0;
639
+ }
514
640
  }
515
641
 
516
- .hl-drawer .hl-drawer-header,
517
- .hl-drawer .hl-drawer-body,
518
- .hl-drawer .hl-drawer-footer {
642
+ :is(.hl-drawer, dialog[data-hl-drawer])
643
+ :is(.hl-drawer-header, .hl-drawer-body, .hl-drawer-footer) {
519
644
  padding: var(--hl-space-4);
520
645
  }
521
646
 
522
- .hl-drawer .hl-drawer-header {
523
- border-bottom: 1px solid var(--hl-border);
647
+ :is(.hl-drawer, dialog[data-hl-drawer]) .hl-drawer-body {
648
+ flex: 1 1 auto;
649
+ overflow-y: auto;
524
650
  }
525
651
 
526
- .hl-drawer .hl-drawer-footer {
527
- border-top: 1px solid var(--hl-border);
652
+ :is(.hl-drawer, dialog[data-hl-drawer]) .hl-drawer-header {
653
+ border-block-end: var(--hl-border-width) solid var(--hl-border);
654
+ }
655
+
656
+ :is(.hl-drawer, dialog[data-hl-drawer]) .hl-drawer-footer {
657
+ border-block-start: var(--hl-border-width) solid var(--hl-border);
658
+ }
659
+
660
+ /* Interactive children inside the drawer get the standard ring. */
661
+ :is(.hl-drawer, dialog[data-hl-drawer])
662
+ :is(a, button, input, select, textarea, [tabindex]):focus-visible {
663
+ outline: var(--hl-focus-ring);
664
+ outline-offset: var(--hl-focus-offset);
528
665
  }
529
666
  }
530
667
  /**
531
668
  * Popover: a `[popover] [data-hl-popover]` surface opened by a
532
- * `<button popovertarget="…">` (or `command="toggle-popover"`). The browser
533
- * owns the top layer, light-dismiss, and Escape with no JavaScript; the
534
- * enhancer only mirrors `aria-expanded`, adds optional hover, and runs the JS
535
- * positioning fallback on engines without CSS anchor positioning.
669
+ * `<button popovertarget="...">` (or `command="toggle-popover"`).
670
+ *
671
+ * No-JS baseline: the browser owns the top layer, light dismiss, and Escape,
672
+ * so the popover is fully usable with `popover` and `popovertarget` in the
673
+ * markup. The enhancer only mirrors `aria-expanded`, adds optional hover, and
674
+ * runs the JS positioning fallback on engines without CSS anchor positioning.
675
+ * data-hl-popover: the surface (opts into the enhancer)
536
676
  */
537
677
  @layer components {
538
678
  [data-hl-popover] {
539
679
  margin: 0;
540
- width: -moz-max-content;
541
- width: max-content;
542
- max-width: min(92vw, 22rem);
680
+ inline-size: max-content;
681
+ max-inline-size: min(92vi, 22rem);
543
682
  border: var(--hl-border-width) solid var(--hl-border);
544
683
  border-radius: var(--hl-radius-lg);
545
684
  padding: var(--hl-space-3);
546
685
  background: var(--hl-surface);
547
686
  color: var(--hl-fg);
548
687
  box-shadow: var(--hl-overlay-shadow);
688
+ transition:
689
+ opacity var(--hl-duration-fast) var(--hl-ease-standard),
690
+ translate var(--hl-duration-fast) var(--hl-ease-standard),
691
+ display var(--hl-duration-fast) allow-discrete,
692
+ overlay var(--hl-duration-fast) allow-discrete;
549
693
  }
550
694
 
551
695
  /* Until the `popover` attribute is present (author omitted it and JS hasn't
@@ -554,10 +698,21 @@
554
698
  display: none;
555
699
  }
556
700
 
557
- /* Engines without the Popover API can't promote it to the top layer, so the
558
- JS fallback positions it; give it a stacking context to land above content. */
701
+ /* Closed state and exit target. Engines without the Popover API can't
702
+ promote it to the top layer, so the JS fallback positions it; the z-index
703
+ lands it above content. Those engines drop this rule, so nothing is
704
+ hidden by accident. */
559
705
  [data-hl-popover]:not(:popover-open) {
560
706
  z-index: var(--hl-z-popover);
707
+ opacity: 0;
708
+ translate: 0 -0.25rem;
709
+ }
710
+
711
+ @starting-style {
712
+ [data-hl-popover]:popover-open {
713
+ opacity: 0;
714
+ translate: 0 -0.25rem;
715
+ }
561
716
  }
562
717
 
563
718
  /* Modern placement: anchor to the invoking control (the popover's implicit
@@ -566,21 +721,33 @@
566
721
  @supports (position-area: block-end) {
567
722
  [data-hl-popover] {
568
723
  position: fixed;
569
- inset-area: block-end;
570
724
  position-area: block-end;
571
725
  position-try-fallbacks: flip-block, flip-inline;
572
- margin-top: var(--hl-space-1);
573
- margin-bottom: var(--hl-space-1);
726
+ margin-block: var(--hl-space-1);
574
727
  }
575
728
  }
729
+
730
+ /* Interactive children inside the surface get the standard ring. */
731
+ [data-hl-popover] :is(a, button, input, select, textarea, [tabindex]):focus-visible {
732
+ outline: var(--hl-focus-ring);
733
+ outline-offset: var(--hl-focus-offset);
734
+ }
576
735
  }
577
736
  /**
578
737
  * Tooltip: a `[role="tooltip"]` element described by a `[data-hl-tooltip]`
579
- * trigger. With no JavaScript it shows on the trigger's `:hover`/`:focus-visible`
580
- * (the tip must be the trigger's next sibling). When the enhancer runs it marks
581
- * the trigger `data-hl-tooltip-managed` and drives visibility through
582
- * `data-hl-tooltip-open` instead, adding show/hide delays, a grace period, and
583
- * Escape-to-dismiss.
738
+ * trigger.
739
+ *
740
+ * No-JS baseline: the tip (the trigger's next sibling, carrying `hidden`)
741
+ * shows on the trigger's `:hover`/`:focus-visible`. When the enhancer runs it
742
+ * marks the trigger `data-hl-tooltip-managed`, promotes the tip to a
743
+ * `popover="manual"` in the top layer where available (otherwise toggles
744
+ * `hidden`), and drives visibility through `data-hl-tooltip-open` with show
745
+ * and hide delays, a grace period, and Escape to dismiss.
746
+ * data-hl-tooltip: the trigger
747
+ * data-hl-placement: top (default) | bottom | start | end, on the trigger
748
+ * data-hl-side: the resolved side, set on the tip by the enhancer
749
+ * data-hl-tooltip-managed: set on the trigger by the enhancer
750
+ * data-hl-tooltip-open: set on the tip while shown
584
751
  */
585
752
  @layer components {
586
753
  [role='tooltip'] {
@@ -588,47 +755,106 @@
588
755
  engines without CSS anchor positioning. */
589
756
  position: absolute;
590
757
  z-index: var(--hl-z-tooltip);
591
- width: -moz-max-content;
592
- width: max-content;
593
- max-width: 32ch;
758
+ inline-size: max-content;
759
+ max-inline-size: 32ch;
594
760
  margin: 0;
595
761
  padding: var(--hl-space-1) var(--hl-space-2);
762
+ border: 0;
596
763
  border-radius: var(--hl-radius-sm);
597
764
  background: var(--hl-fg);
598
765
  color: var(--hl-surface);
599
766
  font-size: var(--hl-text-sm);
767
+ opacity: 0;
768
+ translate: 0 0.25rem;
769
+ transition:
770
+ opacity var(--hl-duration-fast) var(--hl-ease-standard),
771
+ translate var(--hl-duration-fast) var(--hl-ease-standard),
772
+ display var(--hl-duration-fast) allow-discrete,
773
+ overlay var(--hl-duration-fast) allow-discrete;
600
774
  }
601
775
 
602
776
  [role='tooltip'][hidden] {
603
777
  display: none;
604
778
  }
605
779
 
606
- /* No-JS baseline: reveal while the adjacent trigger is hovered or focused.
607
- Suppressed once the enhancer takes over (trigger gains -managed). */
608
- [data-hl-tooltip]:not([data-hl-tooltip-managed]):hover + [role='tooltip'],
609
- [data-hl-tooltip]:not([data-hl-tooltip-managed]):focus-visible + [role='tooltip'] {
780
+ /* Shown states: the enhanced popover, the enhanced `hidden` fallback, and
781
+ the no-JS hover/focus baseline (suppressed once the trigger is managed). */
782
+ [role='tooltip']:is(:popover-open, [data-hl-tooltip-open]),
783
+ [data-hl-tooltip]:not([data-hl-tooltip-managed]):is(:hover, :focus-visible) + [role='tooltip'] {
610
784
  display: block;
785
+ opacity: 1;
786
+ translate: 0 0;
787
+ }
788
+
789
+ @starting-style {
790
+ [role='tooltip']:is(:popover-open, [data-hl-tooltip-open]),
791
+ [data-hl-tooltip]:not([data-hl-tooltip-managed]):is(:hover, :focus-visible) + [role='tooltip'] {
792
+ opacity: 0;
793
+ translate: 0 0.25rem;
794
+ }
611
795
  }
612
796
 
613
- /* Modern placement: pin above the trigger via the anchor-name the enhancer
614
- sets, flipping below when there's no room. */
797
+ /* Modern placement: pin to the requested side of the trigger via the
798
+ anchor-name the enhancer sets, flipping when there's no room. The side
799
+ comes from `data-hl-side` on the tip (enhanced) or `data-hl-placement` on
800
+ the preceding trigger (no-JS baseline). */
615
801
  @supports (anchor-name: --x) {
616
802
  [role='tooltip'] {
617
803
  position: fixed;
618
- inset-area: block-start;
804
+ inset: auto;
619
805
  position-area: block-start;
620
806
  position-try-fallbacks: flip-block;
621
- margin-top: var(--hl-space-1);
622
- margin-bottom: var(--hl-space-1);
807
+ margin-block: var(--hl-space-1);
808
+ }
809
+
810
+ [role='tooltip'][data-hl-side='bottom'],
811
+ [data-hl-tooltip][data-hl-placement^='bottom'] + [role='tooltip'] {
812
+ position-area: block-end;
813
+ }
814
+
815
+ [role='tooltip']:is([data-hl-side='start'], [data-hl-side='end']),
816
+ [data-hl-tooltip]:is([data-hl-placement^='start'], [data-hl-placement^='end'])
817
+ + [role='tooltip'] {
818
+ position-try-fallbacks: flip-inline;
819
+ margin-block: 0;
820
+ margin-inline: var(--hl-space-1);
821
+ translate: 0 0;
822
+ }
823
+
824
+ [role='tooltip'][data-hl-side='start'],
825
+ [data-hl-tooltip][data-hl-placement^='start'] + [role='tooltip'] {
826
+ position-area: inline-start;
827
+ }
828
+
829
+ [role='tooltip'][data-hl-side='end'],
830
+ [data-hl-tooltip][data-hl-placement^='end'] + [role='tooltip'] {
831
+ position-area: inline-end;
832
+ }
833
+ }
834
+
835
+ /* Inverted colors flatten away; keep a visible edge on the system canvas. */
836
+ @media (forced-colors: active) {
837
+ [role='tooltip'] {
838
+ border: var(--hl-border-width) solid CanvasText;
623
839
  }
624
840
  }
625
841
  }
626
842
  /**
627
843
  * Dropdown menu button: `<div data-hl-dropdown>` wrapping a
628
- * `[data-hl-dropdown-trigger]` button and a `[data-hl-dropdown-menu]` list. The
629
- * enhancer turns the menu into a native `popover` the trigger controls through
630
- * `popovertarget`, so opening, Escape, and light-dismiss need no JavaScript;
631
- * the menu lives in the top layer and is placed with CSS anchor positioning.
844
+ * `[data-hl-dropdown-trigger]` button and a `[data-hl-dropdown-menu]` list.
845
+ *
846
+ * No-JS baseline: the menu is a native `popover` and the trigger points at it
847
+ * with `popovertarget`, so opening, Escape, and light dismiss work before any
848
+ * script runs; both attributes must be in the markup. The enhancer adds arrow
849
+ * keys, typeahead, checkable items, and focus return, and reads:
850
+ * data-hl-dropdown: root
851
+ * data-hl-dropdown-trigger: the button
852
+ * data-hl-dropdown-menu: the `<ul>` (or any list) of items
853
+ * data-hl-value: an item's value for `hl:select`
854
+ * Items are `role="menuitem"`, `menuitemcheckbox`, or `menuitemradio`, either
855
+ * directly in the list, inside `<li>`, or inside `<li><ul role="group">`. An
856
+ * item followed by a sibling `<ul role="menu">` (or `[data-hl-submenu]`) opens
857
+ * it as a nested submenu to the inline-end side.
632
858
  */
633
859
  @layer components {
634
860
  [data-hl-dropdown] {
@@ -637,72 +863,188 @@
637
863
 
638
864
  [data-hl-dropdown-menu] {
639
865
  margin: 0;
640
- min-width: 10rem;
866
+ min-inline-size: 10rem;
641
867
  border: var(--hl-border-width) solid var(--hl-border);
642
868
  border-radius: var(--hl-radius-lg);
643
869
  background: var(--hl-surface);
644
870
  box-shadow: var(--hl-overlay-shadow);
645
871
  padding: var(--hl-space-1);
646
872
  list-style: none;
873
+ transition:
874
+ opacity var(--hl-duration-fast) var(--hl-ease-standard),
875
+ translate var(--hl-duration-fast) var(--hl-ease-standard),
876
+ display var(--hl-duration-fast) allow-discrete,
877
+ overlay var(--hl-duration-fast) allow-discrete;
647
878
  }
648
879
 
649
- /* Before the menu is promoted to a popover (JS not yet loaded), hide it. */
650
- [data-hl-dropdown-menu]:not([popover]) {
651
- display: none;
652
- }
653
-
880
+ /* Closed state doubles as the exit target. Engines without the Popover API
881
+ drop this rule, so nothing is hidden by accident. */
654
882
  [data-hl-dropdown-menu]:not(:popover-open) {
655
883
  z-index: var(--hl-z-dropdown);
884
+ opacity: 0;
885
+ translate: 0 -0.25rem;
886
+ }
887
+
888
+ @starting-style {
889
+ [data-hl-dropdown-menu]:popover-open {
890
+ opacity: 0;
891
+ translate: 0 -0.25rem;
892
+ }
656
893
  }
657
894
 
658
895
  /* Open below the trigger, start-aligned, flipping when cramped. */
659
896
  @supports (position-area: block-end) {
660
897
  [data-hl-dropdown-menu] {
661
898
  position: fixed;
662
- inset-area: block-end span-inline-end;
663
899
  position-area: block-end span-inline-end;
664
900
  position-try-fallbacks: flip-block, flip-inline;
665
- margin-top: var(--hl-space-1);
666
- margin-bottom: var(--hl-space-1);
901
+ margin-block: var(--hl-space-1);
667
902
  }
668
903
  }
669
904
 
670
- [data-hl-dropdown-menu] [role='menuitem'] {
671
- display: block;
672
- width: 100%;
905
+ [data-hl-dropdown-menu] [role='group'] {
906
+ margin: 0;
907
+ padding: 0;
908
+ list-style: none;
909
+ }
910
+
911
+ /* Nested submenus share the panel styling and sit beside their trigger. */
912
+ [data-hl-dropdown-menu] li {
913
+ position: relative;
914
+ }
915
+
916
+ [data-hl-dropdown-menu] :is([role='menu'], [data-hl-submenu]) {
917
+ position: absolute;
918
+ inset-block-start: 0;
919
+ inset-inline-start: calc(100% + var(--hl-space-1));
920
+ z-index: var(--hl-z-dropdown);
921
+ min-inline-size: 10rem;
922
+ margin: 0;
923
+ padding: var(--hl-space-1);
924
+ list-style: none;
925
+ border: var(--hl-border-width) solid var(--hl-border);
926
+ border-radius: var(--hl-radius-lg);
927
+ background: var(--hl-surface);
928
+ box-shadow: var(--hl-overlay-shadow);
929
+ }
930
+
931
+ [data-hl-dropdown-menu]
932
+ :is([role='menu'], [data-hl-submenu]):is([hidden], [popover]:not(:popover-open)) {
933
+ display: none;
934
+ }
935
+
936
+ [data-hl-dropdown-menu] :is([role='menu'], [data-hl-submenu])[popover] {
937
+ position: fixed;
938
+ inset: auto;
939
+ }
940
+
941
+ @supports (position-area: block-end) {
942
+ [data-hl-dropdown-menu] :is([role='menu'], [data-hl-submenu])[popover] {
943
+ position-area: inline-end span-block-end;
944
+ position-try-fallbacks: flip-inline, flip-block;
945
+ margin-inline: var(--hl-space-1);
946
+ }
947
+ }
948
+
949
+ /* Submenu chevron: a rotated square corner at the inline end. */
950
+ [data-hl-dropdown-menu] [role^='menuitem'][aria-haspopup='menu']::after {
951
+ content: '';
952
+ inline-size: 0.4rem;
953
+ block-size: 0.4rem;
954
+ margin-inline-start: auto;
955
+ border-inline-end: 1.5px solid currentcolor;
956
+ border-block-end: 1.5px solid currentcolor;
957
+ rotate: -45deg;
958
+ opacity: 0.6;
959
+ }
960
+
961
+ [data-hl-dropdown-menu] [role^='menuitem'][aria-expanded='true'] {
962
+ background: var(--hl-surface-2);
963
+ }
964
+
965
+ [data-hl-dropdown-menu] [role^='menuitem'] {
966
+ display: flex;
967
+ align-items: center;
968
+ gap: var(--hl-space-2);
969
+ inline-size: 100%;
673
970
  padding: var(--hl-space-2) var(--hl-space-3);
674
971
  border: none;
675
972
  border-radius: var(--hl-radius-sm);
676
973
  background: transparent;
677
- text-align: left;
974
+ text-align: start;
678
975
  cursor: pointer;
679
976
  color: inherit;
680
977
  font: inherit;
681
978
  }
682
979
 
683
- [data-hl-dropdown-menu] [role='menuitem']:hover,
684
- [data-hl-dropdown-menu] [role='menuitem'][data-hl-active] {
980
+ [data-hl-dropdown-menu] [role^='menuitem']:hover {
685
981
  background: var(--hl-surface-2);
686
982
  }
687
983
 
688
- [data-hl-dropdown-menu] [role='menuitem']:focus-visible {
984
+ [data-hl-dropdown-menu] [role^='menuitem']:focus-visible {
689
985
  outline: var(--hl-focus-ring);
690
- outline-offset: -2px;
986
+ outline-offset: calc(var(--hl-focus-offset) * -1);
987
+ }
988
+
989
+ /* Checkable items reserve room for a mark so labels line up. */
990
+ [data-hl-dropdown-menu] :is([role='menuitemcheckbox'], [role='menuitemradio'])::before {
991
+ content: '';
992
+ flex: none;
993
+ inline-size: 1em;
994
+ block-size: 1em;
995
+ line-height: 1;
996
+ text-align: center;
997
+ color: var(--hl-primary);
998
+ }
999
+
1000
+ [data-hl-dropdown-menu] [role='menuitemcheckbox'][aria-checked='true']::before {
1001
+ content: '\2713';
1002
+ }
1003
+
1004
+ [data-hl-dropdown-menu] [role='menuitemradio'][aria-checked='true']::before {
1005
+ background: currentcolor;
1006
+ border-radius: var(--hl-radius-full);
1007
+ scale: 0.5;
1008
+ }
1009
+
1010
+ [data-hl-dropdown-menu] [role^='menuitem']:is(:disabled, [aria-disabled='true']) {
1011
+ opacity: var(--hl-disabled-opacity);
1012
+ cursor: not-allowed;
691
1013
  }
692
1014
 
693
1015
  [data-hl-dropdown-menu] [role='separator'] {
694
- height: 1px;
1016
+ block-size: var(--hl-border-width);
695
1017
  margin: var(--hl-space-1) 0;
696
1018
  background: var(--hl-border);
697
1019
  border: none;
698
1020
  }
1021
+
1022
+ @media (forced-colors: active) {
1023
+ [data-hl-dropdown-menu] [role^='menuitem']:is(:disabled, [aria-disabled='true']) {
1024
+ color: GrayText;
1025
+ }
1026
+
1027
+ [data-hl-dropdown-menu] [role='separator'] {
1028
+ background: CanvasText;
1029
+ }
1030
+ }
699
1031
  }
700
1032
  /**
701
- * Menubar / navigation menu: `<ul data-hl-menu role="menubar">` with optional
702
- * single-level submenus (`<ul role="menu" data-hl-menu-submenu>`). The enhancer
703
- * handles roving focus, arrow navigation, and open/close, promoting each
704
- * submenu to a native popover so it renders in the top layer, anchored to its
705
- * trigger with CSS anchor positioning.
1033
+ * Menubar / navigation menu: `<ul data-hl-menu role="menubar">` of `<li>`
1034
+ * items, each optionally holding a trigger and a submenu (`<ul role="menu">`
1035
+ * or `[data-hl-submenu]`) as siblings inside the `<li>`. Submenus nest: an
1036
+ * item inside a submenu may itself be followed by a submenu, which opens to
1037
+ * its inline-end side.
1038
+ *
1039
+ * No-JS baseline: a submenu shows while its `<li>` is hovered or has focus
1040
+ * within it, so every link stays reachable by mouse and keyboard. The enhancer
1041
+ * marks the root `data-hl-ready`, after which it owns visibility (`hidden`
1042
+ * plus a top-layer `popover`) and adds roving focus, arrow keys, typeahead,
1043
+ * and checkable items. It reads:
1044
+ * data-hl-menu: root; `aria-orientation="vertical"` stacks it
1045
+ * data-hl-submenu: a submenu without `role="menu"`
1046
+ * data-hl-value: a top-level trigger's value for `hl:change`
1047
+ * data-hl-ready: set by the enhancer
706
1048
  */
707
1049
  @layer components {
708
1050
  [data-hl-menu] {
@@ -724,11 +1066,11 @@
724
1066
  position: relative;
725
1067
  }
726
1068
 
727
- [data-hl-menu] [role='menuitem'] {
1069
+ [data-hl-menu] [role^='menuitem'] {
728
1070
  display: flex;
729
1071
  align-items: center;
730
1072
  gap: var(--hl-space-2);
731
- width: 100%;
1073
+ inline-size: 100%;
732
1074
  padding: var(--hl-space-2) var(--hl-space-3);
733
1075
  border: 0;
734
1076
  border-radius: var(--hl-radius-md);
@@ -736,43 +1078,51 @@
736
1078
  color: var(--hl-fg);
737
1079
  font: inherit;
738
1080
  font-size: var(--hl-text-sm);
739
- text-align: left;
740
- -webkit-text-decoration: none;
1081
+ text-align: start;
741
1082
  text-decoration: none;
742
1083
  white-space: nowrap;
743
1084
  cursor: pointer;
744
1085
  }
745
1086
 
746
- [data-hl-menu] [role='menuitem']:hover {
1087
+ [data-hl-menu] [role^='menuitem']:hover,
1088
+ [data-hl-menu] [role^='menuitem'][aria-expanded='true'] {
747
1089
  background: var(--hl-surface-2);
748
1090
  }
749
1091
 
750
- [data-hl-menu] [role='menuitem']:focus-visible {
1092
+ [data-hl-menu] [role^='menuitem']:focus-visible {
751
1093
  outline: var(--hl-focus-ring);
752
- outline-offset: -2px;
1094
+ outline-offset: calc(var(--hl-focus-offset) * -1);
753
1095
  }
754
1096
 
755
- [data-hl-menu] [role='menuitem'][aria-expanded='true'] {
756
- background: var(--hl-surface-2);
1097
+ [data-hl-menu] [role^='menuitem']:is(:disabled, [aria-disabled='true']) {
1098
+ opacity: var(--hl-disabled-opacity);
1099
+ cursor: not-allowed;
757
1100
  }
758
1101
 
759
- [data-hl-menu] [role='menuitem'][aria-haspopup]::after {
1102
+ /* Submenu chevron: a rotated square corner at the inline end. */
1103
+ [data-hl-menu] [role^='menuitem'][aria-haspopup]::after {
760
1104
  content: '';
761
- width: 0.4rem;
762
- height: 0.4rem;
763
- margin-left: auto;
764
- border-right: 1.5px solid currentcolor;
765
- border-bottom: 1.5px solid currentcolor;
766
- transform: rotate(45deg);
1105
+ inline-size: 0.4rem;
1106
+ block-size: 0.4rem;
1107
+ margin-inline-start: auto;
1108
+ border-inline-end: 1.5px solid currentcolor;
1109
+ border-block-end: 1.5px solid currentcolor;
1110
+ rotate: 45deg;
767
1111
  opacity: 0.6;
768
1112
  }
769
1113
 
770
- [data-hl-menu] [role='menu'] {
1114
+ /* Submenus that open to the side point their chevron that way. */
1115
+ [data-hl-menu][aria-orientation='vertical'] [role^='menuitem'][aria-haspopup]::after,
1116
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu]) [role^='menuitem'][aria-haspopup]::after {
1117
+ rotate: -45deg;
1118
+ }
1119
+
1120
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu]) {
771
1121
  position: absolute;
772
- top: calc(100% + var(--hl-space-1));
773
- left: 0;
1122
+ inset-block-start: calc(100% + var(--hl-space-1));
1123
+ inset-inline-start: 0;
774
1124
  z-index: var(--hl-z-dropdown);
775
- min-width: 12rem;
1125
+ min-inline-size: 12rem;
776
1126
  margin: 0;
777
1127
  padding: var(--hl-space-1);
778
1128
  list-style: none;
@@ -780,65 +1130,122 @@
780
1130
  border: var(--hl-border-width) solid var(--hl-border);
781
1131
  border-radius: var(--hl-radius-lg);
782
1132
  box-shadow: var(--hl-overlay-shadow);
1133
+ transition:
1134
+ opacity var(--hl-duration-fast) var(--hl-ease-standard),
1135
+ translate var(--hl-duration-fast) var(--hl-ease-standard),
1136
+ display var(--hl-duration-fast) allow-discrete,
1137
+ overlay var(--hl-duration-fast) allow-discrete;
1138
+ }
1139
+
1140
+ /* Vertical menubars and every nested level open to the inline-end side. */
1141
+ [data-hl-menu][aria-orientation='vertical'] :is([role='menu'], [data-hl-submenu]),
1142
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu]) :is([role='menu'], [data-hl-submenu]) {
1143
+ inset-block-start: 0;
1144
+ inset-inline-start: calc(100% + var(--hl-space-1));
783
1145
  }
784
1146
 
785
- [data-hl-menu][aria-orientation='vertical'] [role='menu'] {
786
- top: 0;
787
- left: calc(100% + var(--hl-space-1));
1147
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu]) li {
1148
+ position: relative;
788
1149
  }
789
1150
 
790
- [data-hl-menu] [role='menu'][hidden] {
1151
+ /* Closed states: `hidden` (enhancer without Popover API), a closed popover
1152
+ (enhancer with it), and the no-JS baseline below. Each is also the exit
1153
+ target of the transition. */
1154
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu]):is([hidden], [popover]:not(:popover-open)),
1155
+ [data-hl-menu]:not([data-hl-ready]) :is([role='menu'], [data-hl-submenu]) {
791
1156
  display: none;
1157
+ opacity: 0;
1158
+ translate: 0 -0.25rem;
1159
+ }
1160
+
1161
+ /* No-JS baseline: reveal on hover or focus within the parent item. */
1162
+ [data-hl-menu]:not([data-hl-ready])
1163
+ li:is(:hover, :focus-within)
1164
+ > :is([role='menu'], [data-hl-submenu]) {
1165
+ display: block;
1166
+ opacity: 1;
1167
+ translate: 0 0;
1168
+ }
1169
+
1170
+ @starting-style {
1171
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu]) {
1172
+ opacity: 0;
1173
+ translate: 0 -0.25rem;
1174
+ }
792
1175
  }
793
1176
 
794
1177
  /* Enhanced path: the submenu is a native popover in the top layer, anchored
795
1178
  to its trigger. The absolute-position rules above stay as the fallback for
796
1179
  engines without the Popover API. */
797
- [data-hl-menu] [role='menu'][popover] {
1180
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu])[popover] {
798
1181
  position: fixed;
799
- top: auto;
800
- right: auto;
801
- bottom: auto;
802
- left: auto;
1182
+ inset: auto;
803
1183
  }
804
1184
 
805
1185
  @supports (position-area: block-end) {
806
- [data-hl-menu] [role='menu'][popover] {
807
- inset-area: block-end span-inline-end;
1186
+ [data-hl-menu] :is([role='menu'], [data-hl-submenu])[popover] {
808
1187
  position-area: block-end span-inline-end;
809
1188
  position-try-fallbacks: flip-block, flip-inline;
810
- margin-top: var(--hl-space-1);
811
- margin-bottom: var(--hl-space-1);
1189
+ margin-block: var(--hl-space-1);
812
1190
  }
813
1191
 
814
- [data-hl-menu][aria-orientation='vertical'] [role='menu'][popover] {
815
- inset-area: inline-end span-block-end;
1192
+ [data-hl-menu][aria-orientation='vertical'] :is([role='menu'], [data-hl-submenu])[popover],
1193
+ [data-hl-menu]
1194
+ :is([role='menu'], [data-hl-submenu])
1195
+ :is([role='menu'], [data-hl-submenu])[popover] {
816
1196
  position-area: inline-end span-block-end;
817
1197
  position-try-fallbacks: flip-inline, flip-block;
818
- margin-top: 0;
819
- margin-bottom: 0;
820
- margin-left: var(--hl-space-1);
821
- margin-right: var(--hl-space-1);
1198
+ margin-block: 0;
1199
+ margin-inline: var(--hl-space-1);
822
1200
  }
823
1201
  }
824
1202
 
825
1203
  [data-hl-menu] [role='separator'] {
826
- height: var(--hl-border-width);
1204
+ block-size: var(--hl-border-width);
827
1205
  margin: var(--hl-space-1) 0;
828
1206
  background: var(--hl-border);
829
1207
  }
1208
+
1209
+ @media (forced-colors: active) {
1210
+ [data-hl-menu] [role^='menuitem'][aria-expanded='true'] {
1211
+ background: Highlight;
1212
+ color: HighlightText;
1213
+ }
1214
+
1215
+ [data-hl-menu] [role^='menuitem']:is(:disabled, [aria-disabled='true']) {
1216
+ color: GrayText;
1217
+ }
1218
+
1219
+ [data-hl-menu] [role='separator'] {
1220
+ background: CanvasText;
1221
+ }
1222
+ }
830
1223
  }
1224
+ /**
1225
+ * Toast: a `[data-hl-toast-region]` live region fixed to the end corner of the
1226
+ * viewport, holding `[data-hl-toast]` notifications with an optional
1227
+ * `[data-hl-toast-close]` button.
1228
+ *
1229
+ * Toasts are inherently script-driven; with no JavaScript the region is simply
1230
+ * empty. The enhancer creates the toasts and reads:
1231
+ * data-hl-toast-region: the container
1232
+ * data-hl-toast: one notification (created by the enhancer)
1233
+ * data-hl-intent: info (default) | success | warning | danger, on a toast
1234
+ * data-hl-toast-close: dismiss button inside a toast
1235
+ * data-hl-toast-trigger, data-hl-toast-intent, data-hl-toast-duration:
1236
+ * declarative trigger buttons anywhere in the page
1237
+ */
831
1238
  @layer components {
832
1239
  [data-hl-toast-region] {
833
1240
  position: fixed;
834
1241
  z-index: var(--hl-z-toast);
835
- bottom: var(--hl-space-4);
836
- right: var(--hl-space-4);
1242
+ inset-block-end: var(--hl-space-4);
1243
+ inset-inline-end: var(--hl-space-4);
837
1244
  display: flex;
838
1245
  flex-direction: column-reverse;
839
1246
  gap: var(--hl-space-2);
840
1247
  pointer-events: none;
841
- max-width: min(90vw, 24rem);
1248
+ max-inline-size: min(90vi, 24rem);
842
1249
  }
843
1250
 
844
1251
  [data-hl-toast] {
@@ -846,40 +1253,48 @@
846
1253
  display: flex;
847
1254
  align-items: flex-start;
848
1255
  gap: var(--hl-space-3);
849
- border: 1px solid var(--hl-border);
1256
+ border: var(--hl-border-width) solid var(--hl-border);
850
1257
  border-radius: var(--hl-radius-lg);
851
1258
  padding: var(--hl-space-3) var(--hl-space-4);
852
1259
  background: var(--hl-surface);
853
1260
  box-shadow: var(--hl-overlay-shadow);
854
- animation: hl-toast-in var(--hl-duration-base) var(--hl-ease-standard);
1261
+ transition:
1262
+ opacity var(--hl-duration-base) var(--hl-ease-standard),
1263
+ translate var(--hl-duration-base) var(--hl-ease-standard);
855
1264
  }
856
1265
 
857
- [data-hl-toast][data-hl-variant='success'] {
858
- border-left: 3px solid var(--hl-success);
1266
+ /* Toasts are inserted by script, so the entry runs from @starting-style. */
1267
+ @starting-style {
1268
+ [data-hl-toast] {
1269
+ opacity: 0;
1270
+ translate: 0 var(--hl-space-2);
1271
+ }
859
1272
  }
860
1273
 
861
- [data-hl-toast][data-hl-variant='warning'] {
862
- border-left: 3px solid var(--hl-warning);
1274
+ [data-hl-toast][data-hl-intent='success'] {
1275
+ border-inline-start: 3px solid var(--hl-success);
863
1276
  }
864
1277
 
865
- [data-hl-toast][data-hl-variant='danger'] {
866
- border-left: 3px solid var(--hl-danger);
1278
+ [data-hl-toast][data-hl-intent='warning'] {
1279
+ border-inline-start: 3px solid var(--hl-warning);
867
1280
  }
868
1281
 
869
- [data-hl-toast][data-hl-variant='info'] {
870
- border-left: 3px solid var(--hl-info);
1282
+ [data-hl-toast][data-hl-intent='danger'] {
1283
+ border-inline-start: 3px solid var(--hl-danger);
1284
+ }
1285
+
1286
+ [data-hl-toast][data-hl-intent='info'] {
1287
+ border-inline-start: 3px solid var(--hl-info);
871
1288
  }
872
1289
 
873
1290
  [data-hl-toast-close] {
874
- -webkit-appearance: none;
875
- -moz-appearance: none;
876
- appearance: none;
1291
+ appearance: none;
877
1292
  border: none;
878
1293
  background: transparent;
879
1294
  cursor: pointer;
880
1295
  padding: var(--hl-space-1);
881
1296
  color: var(--hl-fg-muted);
882
- margin-left: auto;
1297
+ margin-inline-start: auto;
883
1298
  flex-shrink: 0;
884
1299
  font: inherit;
885
1300
  }
@@ -890,52 +1305,43 @@
890
1305
 
891
1306
  [data-hl-toast-close]:focus-visible {
892
1307
  outline: var(--hl-focus-ring);
893
- outline-offset: 2px;
1308
+ outline-offset: var(--hl-focus-offset);
894
1309
  border-radius: var(--hl-radius-sm);
895
1310
  }
896
-
897
- @keyframes hl-toast-in {
898
- from {
899
- opacity: 0;
900
- transform: translateY(0.5rem);
901
- }
902
-
903
- to {
904
- opacity: 1;
905
- transform: translateY(0);
906
- }
907
- }
908
-
909
- @media (prefers-reduced-motion: reduce) {
910
- [data-hl-toast] {
911
- animation: none;
912
- }
913
- }
914
1311
  }
915
1312
  /**
916
1313
  * Command palette: `<div data-hl-command>` containing a search input
917
- * (`[data-hl-command-input]`), an empty state (`[data-hl-command-empty]`), and a
918
- * `[data-hl-command-list] role="listbox"` of grouped `[role="option"]` items.
919
- * Often placed inside a `<dialog class="hl-modal">`.
1314
+ * (`.hl-command-input` or `[data-hl-command-input]`), an empty state
1315
+ * (`[data-hl-command-empty]`), and a `[data-hl-command-list] role="listbox"` of
1316
+ * grouped `[role="option"]` items. Often placed inside a `<dialog class="hl-modal">`.
1317
+ *
1318
+ * No-JS baseline: every item is listed and the empty state stays hidden,
1319
+ * since nothing can filter yet. The enhancer marks the root `data-hl-ready`
1320
+ * and then toggles `hidden` on items, groups, and the empty state.
1321
+ * data-hl-command: root
1322
+ * data-hl-command-input: filter field
1323
+ * data-hl-command-list: listbox
1324
+ * data-hl-command-group: a group wrapper (hidden when all its items are)
1325
+ * data-hl-command-empty: "no results" message
1326
+ * data-hl-ready: set by the enhancer
920
1327
  */
921
1328
  @layer components {
922
1329
  [data-hl-command] {
923
1330
  display: flex;
924
1331
  flex-direction: column;
925
- min-height: 0;
1332
+ min-block-size: 0;
926
1333
  overflow: hidden;
927
1334
  background: var(--hl-overlay);
928
1335
  border-radius: var(--hl-radius-lg);
929
1336
  }
930
1337
 
931
- [data-hl-command-input] {
1338
+ :is(.hl-command-input, [data-hl-command-input]) {
932
1339
  flex: none;
933
- width: 100%;
934
- height: var(--hl-control-height-lg);
935
- padding-left: var(--hl-space-4);
936
- padding-right: var(--hl-space-4);
1340
+ inline-size: 100%;
1341
+ block-size: var(--hl-control-height-lg);
1342
+ padding-inline: var(--hl-space-4);
937
1343
  border: 0;
938
- border-bottom: var(--hl-border-width) solid var(--hl-border);
1344
+ border-block-end: var(--hl-border-width) solid var(--hl-border);
939
1345
  border-radius: 0;
940
1346
  background: transparent;
941
1347
  color: var(--hl-fg);
@@ -943,21 +1349,19 @@
943
1349
  font-size: var(--hl-text-base);
944
1350
  }
945
1351
 
946
- [data-hl-command-input]:focus-visible {
947
- outline: none;
948
- }
949
-
950
- [data-hl-command-input]::-moz-placeholder {
951
- color: var(--hl-fg-subtle);
1352
+ /* The field is flush with the palette edge, so the ring is drawn inward. */
1353
+ :is(.hl-command-input, [data-hl-command-input]):focus-visible {
1354
+ outline: var(--hl-focus-ring);
1355
+ outline-offset: calc(var(--hl-focus-offset) * -1);
952
1356
  }
953
1357
 
954
- [data-hl-command-input]::placeholder {
1358
+ :is(.hl-command-input, [data-hl-command-input])::placeholder {
955
1359
  color: var(--hl-fg-subtle);
956
1360
  }
957
1361
 
958
1362
  [data-hl-command-list] {
959
1363
  flex: 1 1 auto;
960
- max-height: 24rem;
1364
+ max-block-size: 24rem;
961
1365
  overflow-y: auto;
962
1366
  padding: var(--hl-space-2);
963
1367
  }
@@ -996,9 +1400,14 @@
996
1400
  color: var(--hl-primary-subtle-fg);
997
1401
  }
998
1402
 
1403
+ [data-hl-command] [role='option'][aria-disabled='true'] {
1404
+ opacity: var(--hl-disabled-opacity);
1405
+ pointer-events: none;
1406
+ }
1407
+
999
1408
  [data-hl-command] [role='option'] svg {
1000
- width: 1.1em;
1001
- height: 1.1em;
1409
+ inline-size: 1.1em;
1410
+ block-size: 1.1em;
1002
1411
  flex: none;
1003
1412
  opacity: 0.7;
1004
1413
  }
@@ -1010,23 +1419,34 @@
1010
1419
  color: var(--hl-fg-muted);
1011
1420
  }
1012
1421
 
1013
- [data-hl-command-empty][hidden] {
1422
+ /* No-JS baseline: there is no filtering, so there are never "no results". */
1423
+ [data-hl-command-empty][hidden],
1424
+ [data-hl-command]:not([data-hl-ready]) [data-hl-command-empty] {
1014
1425
  display: none;
1015
1426
  }
1427
+
1428
+ @media (forced-colors: active) {
1429
+ [data-hl-command] [role='option'][aria-selected='true'] {
1430
+ background: Highlight;
1431
+ color: HighlightText;
1432
+ }
1433
+ }
1016
1434
  }
1017
1435
  /* Forms */
1018
1436
  /**
1019
- * Button: `<button class="hl-button">` (works on `<a>`/`<input>` too).
1437
+ * Button: `<button class="hl-button">` (works on `<a>`/`<input>` too). Pure
1438
+ * CSS; there is no enhancer.
1020
1439
  *
1021
1440
  * Color is driven by a small set of local custom properties so the
1022
- * intent × variant matrix stays DRY: `data-hl-intent` swaps the accent set,
1441
+ * intent by variant matrix stays DRY: `data-hl-intent` swaps the accent set,
1023
1442
  * `data-hl-variant` decides how those values are applied.
1024
1443
  *
1025
1444
  * data-hl-variant: solid (default) | soft | outline | ghost | link
1026
1445
  * data-hl-intent: neutral (default) | primary | danger | success | warning | info
1027
1446
  * data-hl-size: sm | md (default) | lg
1028
- * data-hl-block: stretch to container width
1447
+ * data-hl-block: stretch to the container's inline size
1029
1448
  * data-hl-icon: square, icon-only
1449
+ * data-hl-loading: shows a spinner and blocks interaction
1030
1450
  */
1031
1451
  @layer components {
1032
1452
  .hl-button {
@@ -1046,9 +1466,8 @@
1046
1466
  align-items: center;
1047
1467
  justify-content: center;
1048
1468
  gap: var(--_gap);
1049
- height: var(--_height);
1050
- padding-left: var(--_pad-x);
1051
- padding-right: var(--_pad-x);
1469
+ block-size: var(--_height);
1470
+ padding-inline: var(--_pad-x);
1052
1471
  border: var(--hl-border-width) solid transparent;
1053
1472
  border-radius: var(--hl-radius-md);
1054
1473
  font-family: inherit;
@@ -1056,16 +1475,17 @@
1056
1475
  font-weight: var(--hl-font-medium);
1057
1476
  line-height: 1;
1058
1477
  white-space: nowrap;
1059
- -webkit-text-decoration: none;
1060
1478
  text-decoration: none;
1061
1479
  cursor: pointer;
1062
1480
  -webkit-user-select: none;
1063
- -moz-user-select: none;
1064
1481
  user-select: none;
1065
1482
  background: var(--_solid-bg);
1066
1483
  color: var(--_solid-fg);
1067
1484
  transition:
1068
- background-color var(--hl-duration-fast) var(--hl-ease-standard), border-color var(--hl-duration-fast) var(--hl-ease-standard), color var(--hl-duration-fast) var(--hl-ease-standard), box-shadow var(--hl-duration-fast) var(--hl-ease-standard);
1485
+ background-color var(--hl-duration-fast) var(--hl-ease-standard),
1486
+ border-color var(--hl-duration-fast) var(--hl-ease-standard),
1487
+ color var(--hl-duration-fast) var(--hl-ease-standard),
1488
+ box-shadow var(--hl-duration-fast) var(--hl-ease-standard);
1069
1489
  }
1070
1490
 
1071
1491
  .hl-button:hover {
@@ -1078,14 +1498,14 @@
1078
1498
 
1079
1499
  .hl-button:focus-visible {
1080
1500
  outline: var(--hl-focus-ring);
1081
- outline-offset: 2px;
1501
+ outline-offset: var(--hl-focus-offset);
1082
1502
  }
1083
1503
 
1084
1504
  .hl-button:disabled,
1085
1505
  .hl-button[aria-disabled='true'],
1086
1506
  .hl-button[data-hl-loading] {
1087
1507
  cursor: not-allowed;
1088
- opacity: 0.55;
1508
+ opacity: var(--hl-disabled-opacity);
1089
1509
  }
1090
1510
 
1091
1511
  .hl-button[data-hl-loading] {
@@ -1172,12 +1592,11 @@
1172
1592
  }
1173
1593
 
1174
1594
  .hl-button[data-hl-variant='link'] {
1175
- height: auto;
1595
+ block-size: auto;
1176
1596
  padding: 0;
1177
1597
  background: transparent;
1178
1598
  color: var(--_accent);
1179
1599
  border-color: transparent;
1180
- -webkit-text-decoration: underline;
1181
1600
  text-decoration: underline;
1182
1601
  text-underline-offset: 0.2em;
1183
1602
  }
@@ -1206,34 +1625,34 @@
1206
1625
 
1207
1626
  .hl-button[data-hl-block] {
1208
1627
  display: flex;
1209
- width: 100%;
1628
+ inline-size: 100%;
1210
1629
  }
1211
1630
 
1212
1631
  .hl-button[data-hl-icon] {
1213
- width: var(--_height);
1214
- padding-left: 0;
1215
- padding-right: 0;
1632
+ inline-size: var(--_height);
1633
+ padding-inline: 0;
1216
1634
  }
1217
1635
 
1218
1636
  .hl-button > svg {
1219
- width: 1.1em;
1220
- height: 1.1em;
1637
+ inline-size: 1.1em;
1638
+ block-size: 1.1em;
1221
1639
  flex: none;
1222
1640
  }
1223
1641
 
1224
1642
  .hl-button[data-hl-loading]::before {
1225
1643
  content: '';
1226
- width: 1em;
1227
- height: 1em;
1644
+ inline-size: 1em;
1645
+ block-size: 1em;
1228
1646
  border: 2px solid currentcolor;
1229
- border-top-color: transparent;
1647
+ border-block-start-color: transparent;
1230
1648
  border-radius: var(--hl-radius-full);
1231
1649
  animation: hl-button-spin 0.6s linear infinite;
1232
1650
  }
1233
1651
 
1652
+ /* A static arc still reads as "busy" without continuous motion. */
1234
1653
  @media (prefers-reduced-motion: reduce) {
1235
1654
  .hl-button[data-hl-loading]::before {
1236
- animation-duration: 1.4s;
1655
+ animation: none;
1237
1656
  }
1238
1657
  }
1239
1658
 
@@ -1252,26 +1671,45 @@
1252
1671
  }
1253
1672
 
1254
1673
  .hl-button-group > .hl-button:not(:first-child) {
1255
- margin-left: calc(var(--hl-border-width) * -1);
1674
+ margin-inline-start: calc(var(--hl-border-width) * -1);
1256
1675
  }
1257
1676
 
1258
1677
  .hl-button-group > .hl-button:first-child {
1259
- border-top-left-radius: var(--hl-radius-md);
1260
- border-bottom-left-radius: var(--hl-radius-md);
1678
+ border-start-start-radius: var(--hl-radius-md);
1679
+ border-end-start-radius: var(--hl-radius-md);
1261
1680
  }
1262
1681
 
1263
1682
  .hl-button-group > .hl-button:last-child {
1264
- border-top-right-radius: var(--hl-radius-md);
1265
- border-bottom-right-radius: var(--hl-radius-md);
1683
+ border-start-end-radius: var(--hl-radius-md);
1684
+ border-end-end-radius: var(--hl-radius-md);
1266
1685
  }
1267
1686
 
1268
1687
  .hl-button-group > .hl-button:hover,
1269
1688
  .hl-button-group > .hl-button:focus-visible {
1270
1689
  z-index: 1;
1271
1690
  }
1691
+
1692
+ /* Forced colors flatten every fill to Canvas, so the border alone tells a
1693
+ button apart from text; the link variant keeps reading as a link. */
1694
+ @media (forced-colors: active) {
1695
+ .hl-button {
1696
+ border-color: ButtonBorder;
1697
+ }
1698
+
1699
+ .hl-button[data-hl-variant='link'] {
1700
+ border-color: transparent;
1701
+ color: LinkText;
1702
+ }
1703
+
1704
+ .hl-button:disabled,
1705
+ .hl-button[aria-disabled='true'] {
1706
+ color: GrayText;
1707
+ border-color: GrayText;
1708
+ }
1709
+ }
1272
1710
  }
1273
1711
  /**
1274
- * Text input: `<input class="hl-input">`.
1712
+ * Text input: `<input class="hl-input">`. Pure CSS; there is no enhancer.
1275
1713
  * data-hl-size: sm | md (default) | lg
1276
1714
  * data-hl-invalid: error styling (pair with aria-invalid)
1277
1715
  */
@@ -1282,10 +1720,9 @@
1282
1720
  --_font: var(--hl-text-sm);
1283
1721
 
1284
1722
  display: block;
1285
- width: 100%;
1286
- height: var(--_height);
1287
- padding-left: var(--_pad-x);
1288
- padding-right: var(--_pad-x);
1723
+ inline-size: 100%;
1724
+ block-size: var(--_height);
1725
+ padding-inline: var(--_pad-x);
1289
1726
  border: var(--hl-border-width) solid var(--hl-border-strong);
1290
1727
  border-radius: var(--hl-radius-md);
1291
1728
  background: var(--hl-surface);
@@ -1294,30 +1731,27 @@
1294
1731
  font-size: var(--_font);
1295
1732
  line-height: var(--hl-leading-normal);
1296
1733
  transition:
1297
- border-color var(--hl-duration-fast) var(--hl-ease-standard), box-shadow var(--hl-duration-fast) var(--hl-ease-standard);
1298
- }
1299
-
1300
- .hl-input::-moz-placeholder {
1301
- color: var(--hl-fg-subtle);
1734
+ border-color var(--hl-duration-fast) var(--hl-ease-standard),
1735
+ box-shadow var(--hl-duration-fast) var(--hl-ease-standard);
1302
1736
  }
1303
1737
 
1304
1738
  .hl-input::placeholder {
1305
1739
  color: var(--hl-fg-subtle);
1306
1740
  }
1307
1741
 
1308
- .hl-input:hover:not(:disabled):not(:focus) {
1742
+ .hl-input:hover:not(:disabled, :focus) {
1309
1743
  border-color: var(--hl-fg-subtle);
1310
1744
  }
1311
1745
 
1312
1746
  .hl-input:focus-visible {
1313
1747
  outline: none;
1314
1748
  border-color: var(--hl-ring);
1315
- box-shadow: 0 0 0 3px color-mix(in oklab, var(--hl-ring) 30%, transparent);
1749
+ box-shadow: var(--hl-focus-shadow);
1316
1750
  }
1317
1751
 
1318
1752
  .hl-input:disabled {
1319
1753
  cursor: not-allowed;
1320
- opacity: 0.6;
1754
+ opacity: var(--hl-disabled-opacity);
1321
1755
  background: var(--hl-surface-2);
1322
1756
  }
1323
1757
 
@@ -1346,25 +1780,34 @@
1346
1780
  }
1347
1781
 
1348
1782
  .hl-input[type='file'] {
1349
- height: auto;
1350
- padding-top: var(--hl-space-2);
1351
- padding-bottom: var(--hl-space-2);
1783
+ block-size: auto;
1784
+ padding-block: var(--hl-space-2);
1352
1785
  }
1353
1786
 
1354
1787
  .hl-input[type='color'] {
1355
- width: var(--_height);
1788
+ inline-size: var(--_height);
1356
1789
  padding: var(--hl-space-1);
1357
1790
  }
1791
+
1792
+ /* Box shadows are dropped in forced colors, so focus falls back to an outline. */
1793
+ @media (forced-colors: active) {
1794
+ .hl-input:focus-visible {
1795
+ outline: var(--hl-focus-ring);
1796
+ outline-offset: var(--hl-focus-offset);
1797
+ }
1798
+ }
1358
1799
  }
1359
1800
  /**
1360
- * Multi-line text input: `<textarea class="hl-textarea">`.
1361
- * data-hl-invalid: error styling (pair with aria-invalid)
1801
+ * Multi-line text input: `<textarea class="hl-textarea">`. Pure CSS; there is
1802
+ * no enhancer.
1803
+ * data-hl-invalid: error styling (pair with aria-invalid)
1804
+ * data-hl-autosize: grows with its content where `field-sizing` is supported
1362
1805
  */
1363
1806
  @layer components {
1364
1807
  .hl-textarea {
1365
1808
  display: block;
1366
- width: 100%;
1367
- min-height: calc(var(--hl-control-height-md) * 2);
1809
+ inline-size: 100%;
1810
+ min-block-size: calc(var(--hl-control-height-md) * 2);
1368
1811
  padding: var(--hl-space-2) var(--hl-space-3);
1369
1812
  border: var(--hl-border-width) solid var(--hl-border-strong);
1370
1813
  border-radius: var(--hl-radius-md);
@@ -1375,30 +1818,27 @@
1375
1818
  line-height: var(--hl-leading-normal);
1376
1819
  resize: vertical;
1377
1820
  transition:
1378
- border-color var(--hl-duration-fast) var(--hl-ease-standard), box-shadow var(--hl-duration-fast) var(--hl-ease-standard);
1379
- }
1380
-
1381
- .hl-textarea::-moz-placeholder {
1382
- color: var(--hl-fg-subtle);
1821
+ border-color var(--hl-duration-fast) var(--hl-ease-standard),
1822
+ box-shadow var(--hl-duration-fast) var(--hl-ease-standard);
1383
1823
  }
1384
1824
 
1385
1825
  .hl-textarea::placeholder {
1386
1826
  color: var(--hl-fg-subtle);
1387
1827
  }
1388
1828
 
1389
- .hl-textarea:hover:not(:disabled):not(:focus) {
1829
+ .hl-textarea:hover:not(:disabled, :focus) {
1390
1830
  border-color: var(--hl-fg-subtle);
1391
1831
  }
1392
1832
 
1393
1833
  .hl-textarea:focus-visible {
1394
1834
  outline: none;
1395
1835
  border-color: var(--hl-ring);
1396
- box-shadow: 0 0 0 3px color-mix(in oklab, var(--hl-ring) 30%, transparent);
1836
+ box-shadow: var(--hl-focus-shadow);
1397
1837
  }
1398
1838
 
1399
1839
  .hl-textarea:disabled {
1400
1840
  cursor: not-allowed;
1401
- opacity: 0.6;
1841
+ opacity: var(--hl-disabled-opacity);
1402
1842
  background: var(--hl-surface-2);
1403
1843
  }
1404
1844
 
@@ -1412,11 +1852,26 @@
1412
1852
  border-color: var(--hl-danger);
1413
1853
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--hl-danger) 30%, transparent);
1414
1854
  }
1855
+
1856
+ /* Native autosize; engines without it keep the fixed minimum and a resizer. */
1857
+ @supports (field-sizing: content) {
1858
+ .hl-textarea[data-hl-autosize] {
1859
+ field-sizing: content;
1860
+ max-block-size: 60vb;
1861
+ }
1862
+ }
1863
+
1864
+ @media (forced-colors: active) {
1865
+ .hl-textarea:focus-visible {
1866
+ outline: var(--hl-focus-ring);
1867
+ outline-offset: var(--hl-focus-offset);
1868
+ }
1869
+ }
1415
1870
  }
1416
1871
  /**
1417
1872
  * Native select: `<span class="hl-select-wrapper"><select class="hl-select">`.
1418
1873
  * The wrapper draws a custom caret while the native control keeps full
1419
- * keyboard/mobile behavior.
1874
+ * keyboard and mobile behavior. Pure CSS; there is no enhancer.
1420
1875
  * data-hl-size: sm | md (default) | lg
1421
1876
  * data-hl-invalid: error styling (pair with aria-invalid)
1422
1877
  */
@@ -1424,19 +1879,22 @@
1424
1879
  .hl-select-wrapper {
1425
1880
  position: relative;
1426
1881
  display: inline-flex;
1427
- width: 100%;
1882
+ inline-size: 100%;
1428
1883
  }
1429
1884
 
1885
+ /* The caret is a rotated square corner; it sits at the inline end so it
1886
+ moves to the left under RTL along with the select's end padding. */
1430
1887
  .hl-select-wrapper::after {
1431
1888
  content: '';
1432
1889
  position: absolute;
1433
- top: 50%;
1434
- right: var(--hl-space-3);
1435
- width: 0.5rem;
1436
- height: 0.5rem;
1437
- border-right: 2px solid var(--hl-fg-muted);
1438
- border-bottom: 2px solid var(--hl-fg-muted);
1439
- transform: translateY(-65%) rotate(45deg);
1890
+ inset-block-start: 50%;
1891
+ inset-inline-end: var(--hl-space-3);
1892
+ inline-size: 0.5rem;
1893
+ block-size: 0.5rem;
1894
+ border-inline-end: 2px solid var(--hl-fg-muted);
1895
+ border-block-end: 2px solid var(--hl-fg-muted);
1896
+ translate: 0 -65%;
1897
+ rotate: 45deg;
1440
1898
  pointer-events: none;
1441
1899
  }
1442
1900
 
@@ -1444,15 +1902,10 @@
1444
1902
  --_height: var(--hl-control-height-md);
1445
1903
  --_font: var(--hl-text-sm);
1446
1904
 
1447
- -webkit-appearance: none;
1448
-
1449
- -moz-appearance: none;
1450
-
1451
- appearance: none;
1452
- width: 100%;
1453
- height: var(--_height);
1454
- padding-left: var(--hl-space-3);
1455
- padding-right: var(--hl-space-8);
1905
+ appearance: none;
1906
+ inline-size: 100%;
1907
+ block-size: var(--_height);
1908
+ padding-inline: var(--hl-space-3) var(--hl-space-8);
1456
1909
  border: var(--hl-border-width) solid var(--hl-border-strong);
1457
1910
  border-radius: var(--hl-radius-md);
1458
1911
  background: var(--hl-surface);
@@ -1462,22 +1915,23 @@
1462
1915
  line-height: var(--hl-leading-normal);
1463
1916
  cursor: pointer;
1464
1917
  transition:
1465
- border-color var(--hl-duration-fast) var(--hl-ease-standard), box-shadow var(--hl-duration-fast) var(--hl-ease-standard);
1918
+ border-color var(--hl-duration-fast) var(--hl-ease-standard),
1919
+ box-shadow var(--hl-duration-fast) var(--hl-ease-standard);
1466
1920
  }
1467
1921
 
1468
- .hl-select:hover:not(:disabled):not(:focus) {
1922
+ .hl-select:hover:not(:disabled, :focus) {
1469
1923
  border-color: var(--hl-fg-subtle);
1470
1924
  }
1471
1925
 
1472
1926
  .hl-select:focus-visible {
1473
1927
  outline: none;
1474
1928
  border-color: var(--hl-ring);
1475
- box-shadow: 0 0 0 3px color-mix(in oklab, var(--hl-ring) 30%, transparent);
1929
+ box-shadow: var(--hl-focus-shadow);
1476
1930
  }
1477
1931
 
1478
1932
  .hl-select:disabled {
1479
1933
  cursor: not-allowed;
1480
- opacity: 0.6;
1934
+ opacity: var(--hl-disabled-opacity);
1481
1935
  background: var(--hl-surface-2);
1482
1936
  }
1483
1937
 
@@ -1497,11 +1951,23 @@
1497
1951
  --_height: var(--hl-control-height-lg);
1498
1952
  --_font: var(--hl-text-base);
1499
1953
  }
1954
+
1955
+ @media (forced-colors: active) {
1956
+ .hl-select:focus-visible {
1957
+ outline: var(--hl-focus-ring);
1958
+ outline-offset: var(--hl-focus-offset);
1959
+ }
1960
+ }
1500
1961
  }
1501
1962
  /**
1502
- * Checkbox: `<label class="hl-checkbox"><input type="checkbox"><span>…</span></label>`.
1503
- * The native input is restyled (appearance:none) with a CSS checkmark, keeping
1504
- * full keyboard + form semantics.
1963
+ * Checkbox: `<label class="hl-checkbox"><input type="checkbox"><span>...</span></label>`.
1964
+ * The native input is restyled (appearance: none) with a CSS checkmark, keeping
1965
+ * full keyboard and form semantics. A single checkbox needs no JavaScript; the
1966
+ * `data-hl-checkbox-group` enhancer adds a `data-hl-checkbox-all` master box
1967
+ * (checked/indeterminate follows the group) and `data-hl-indeterminate` for an
1968
+ * initial mixed state, both styled here through `:indeterminate`.
1969
+ * data-hl-checkbox-group: wrapper around related boxes for the enhancer
1970
+ * data-hl-checkbox-all: the master "select all" box inside the group
1505
1971
  */
1506
1972
  @layer components {
1507
1973
  .hl-checkbox {
@@ -1514,34 +1980,33 @@
1514
1980
  }
1515
1981
 
1516
1982
  .hl-checkbox > input[type='checkbox'] {
1517
- -webkit-appearance: none;
1518
- -moz-appearance: none;
1519
- appearance: none;
1983
+ appearance: none;
1520
1984
  flex: none;
1521
- width: 1.15rem;
1522
- height: 1.15rem;
1985
+ inline-size: 1.15rem;
1986
+ block-size: 1.15rem;
1523
1987
  margin: 0;
1524
1988
  border: var(--hl-border-width-2) solid var(--hl-border-strong);
1525
1989
  border-radius: var(--hl-radius-sm);
1526
1990
  background: var(--hl-surface);
1527
1991
  display: grid;
1528
- align-content: center;
1529
- justify-content: center;
1530
1992
  place-content: center;
1531
1993
  cursor: pointer;
1532
1994
  transition:
1533
- background-color var(--hl-duration-fast) var(--hl-ease-standard), border-color var(--hl-duration-fast) var(--hl-ease-standard);
1995
+ background-color var(--hl-duration-fast) var(--hl-ease-standard),
1996
+ border-color var(--hl-duration-fast) var(--hl-ease-standard);
1534
1997
  }
1535
1998
 
1999
+ /* The mark is a rotated L drawn with two borders; direction-neutral. */
1536
2000
  .hl-checkbox > input[type='checkbox']::after {
1537
2001
  content: '';
1538
- width: 0.34rem;
1539
- height: 0.62rem;
2002
+ inline-size: 0.34rem;
2003
+ block-size: 0.62rem;
1540
2004
  border: solid var(--hl-primary-fg);
1541
2005
  border-width: 0 2px 2px 0;
1542
- margin-top: -2px;
1543
- transform: rotate(45deg) scale(0);
1544
- transition: transform var(--hl-duration-fast) var(--hl-ease-emphasized);
2006
+ margin-block-start: -2px;
2007
+ rotate: 45deg;
2008
+ scale: 0;
2009
+ transition: scale var(--hl-duration-fast) var(--hl-ease-emphasized);
1545
2010
  }
1546
2011
 
1547
2012
  .hl-checkbox > input[type='checkbox']:checked,
@@ -1551,35 +2016,48 @@
1551
2016
  }
1552
2017
 
1553
2018
  .hl-checkbox > input[type='checkbox']:checked::after {
1554
- transform: rotate(45deg) scale(1);
2019
+ scale: 1;
1555
2020
  }
1556
2021
 
1557
2022
  .hl-checkbox > input[type='checkbox']:indeterminate::after {
1558
- width: 0.6rem;
1559
- height: 0;
2023
+ inline-size: 0.6rem;
2024
+ block-size: 0;
1560
2025
  margin: 0;
1561
2026
  border-width: 0 0 2px;
1562
- transform: none;
2027
+ rotate: none;
2028
+ scale: 1;
1563
2029
  }
1564
2030
 
1565
2031
  .hl-checkbox > input[type='checkbox']:focus-visible {
1566
2032
  outline: var(--hl-focus-ring);
1567
- outline-offset: 2px;
2033
+ outline-offset: var(--hl-focus-offset);
1568
2034
  }
1569
2035
 
1570
2036
  .hl-checkbox > input[type='checkbox']:disabled {
1571
2037
  cursor: not-allowed;
1572
- opacity: 0.55;
2038
+ opacity: var(--hl-disabled-opacity);
1573
2039
  }
1574
2040
 
1575
2041
  .hl-checkbox:has(> input:disabled) {
1576
2042
  cursor: not-allowed;
1577
2043
  color: var(--hl-fg-subtle);
1578
2044
  }
2045
+
2046
+ /* The custom-drawn mark must keep its own colors to stay visible on the
2047
+ Highlight fill; everything else follows the system palette. */
2048
+ @media (forced-colors: active) {
2049
+ .hl-checkbox > input[type='checkbox']::after {
2050
+ forced-color-adjust: none;
2051
+ border-color: HighlightText;
2052
+ }
2053
+ }
1579
2054
  }
1580
2055
  /**
1581
- * Radio: `<label class="hl-radio"><input type="radio"><span>…</span></label>`,
1582
- * grouped in `<div class="hl-radio-group" role="radiogroup">`.
2056
+ * Radio group: `<label class="hl-radio"><input type="radio"><span>...</span></label>`
2057
+ * items grouped in `<div class="hl-radio-group" role="radiogroup">`. Native
2058
+ * radios provide selection and arrow-key movement; pure CSS, there is no
2059
+ * enhancer.
2060
+ * data-hl-orientation: vertical (default) | horizontal (on the group)
1583
2061
  */
1584
2062
  @layer components {
1585
2063
  .hl-radio-group {
@@ -1604,19 +2082,15 @@
1604
2082
  }
1605
2083
 
1606
2084
  .hl-radio > input[type='radio'] {
1607
- -webkit-appearance: none;
1608
- -moz-appearance: none;
1609
- appearance: none;
2085
+ appearance: none;
1610
2086
  flex: none;
1611
- width: 1.15rem;
1612
- height: 1.15rem;
2087
+ inline-size: 1.15rem;
2088
+ block-size: 1.15rem;
1613
2089
  margin: 0;
1614
2090
  border: var(--hl-border-width-2) solid var(--hl-border-strong);
1615
2091
  border-radius: var(--hl-radius-full);
1616
2092
  background: var(--hl-surface);
1617
2093
  display: grid;
1618
- align-content: center;
1619
- justify-content: center;
1620
2094
  place-content: center;
1621
2095
  cursor: pointer;
1622
2096
  transition: border-color var(--hl-duration-fast) var(--hl-ease-standard);
@@ -1624,12 +2098,12 @@
1624
2098
 
1625
2099
  .hl-radio > input[type='radio']::after {
1626
2100
  content: '';
1627
- width: 0.6rem;
1628
- height: 0.6rem;
2101
+ inline-size: 0.6rem;
2102
+ block-size: 0.6rem;
1629
2103
  border-radius: var(--hl-radius-full);
1630
2104
  background: var(--hl-primary);
1631
- transform: scale(0);
1632
- transition: transform var(--hl-duration-fast) var(--hl-ease-emphasized);
2105
+ scale: 0;
2106
+ transition: scale var(--hl-duration-fast) var(--hl-ease-emphasized);
1633
2107
  }
1634
2108
 
1635
2109
  .hl-radio > input[type='radio']:checked {
@@ -1637,60 +2111,82 @@
1637
2111
  }
1638
2112
 
1639
2113
  .hl-radio > input[type='radio']:checked::after {
1640
- transform: scale(1);
2114
+ scale: 1;
1641
2115
  }
1642
2116
 
1643
2117
  .hl-radio > input[type='radio']:focus-visible {
1644
2118
  outline: var(--hl-focus-ring);
1645
- outline-offset: 2px;
2119
+ outline-offset: var(--hl-focus-offset);
1646
2120
  }
1647
2121
 
1648
2122
  .hl-radio > input[type='radio']:disabled {
1649
2123
  cursor: not-allowed;
1650
- opacity: 0.55;
2124
+ opacity: var(--hl-disabled-opacity);
1651
2125
  }
1652
2126
 
1653
2127
  .hl-radio:has(> input:disabled) {
1654
2128
  cursor: not-allowed;
1655
2129
  color: var(--hl-fg-subtle);
1656
2130
  }
2131
+
2132
+ /* The dot is custom-drawn, so it opts out of forced-color flattening. */
2133
+ @media (forced-colors: active) {
2134
+ .hl-radio > input[type='radio']::after {
2135
+ forced-color-adjust: none;
2136
+ background: Highlight;
2137
+ }
2138
+ }
1657
2139
  }
2140
+ /**
2141
+ * Switch: `<label data-hl-switch><input type="checkbox" role="switch"> Label</label>`.
2142
+ * The native checkbox is restyled as a track and thumb, so state, keyboard,
2143
+ * and form submission stay native. Pure CSS; there is no enhancer.
2144
+ * data-hl-switch: the label wrapper
2145
+ */
1658
2146
  @layer components {
1659
2147
  [data-hl-switch] {
2148
+ --_track-inline: 2.25rem;
2149
+ --_track-block: 1.25rem;
2150
+ --_gap: 2px;
2151
+ --_thumb: calc(var(--_track-block) - var(--_gap) * 2);
2152
+ --_travel: calc(var(--_track-inline) - var(--_track-block));
2153
+
1660
2154
  display: inline-flex;
1661
2155
  align-items: center;
1662
2156
  gap: var(--hl-space-2);
1663
2157
  }
1664
2158
 
1665
2159
  [data-hl-switch] input[type='checkbox'] {
1666
- -webkit-appearance: none;
1667
- -moz-appearance: none;
1668
- appearance: none;
1669
- width: 2.25rem;
1670
- height: 1.25rem;
1671
- border-radius: 1.25rem;
1672
- background: var(--hl-border-strong);
2160
+ appearance: none;
1673
2161
  position: relative;
1674
- outline-offset: 2px;
2162
+ inline-size: var(--_track-inline);
2163
+ block-size: var(--_track-block);
2164
+ margin: 0;
2165
+ border-radius: var(--hl-radius-full);
2166
+ background: var(--hl-border-strong);
1675
2167
  transition: background-color var(--hl-duration-fast) var(--hl-ease-standard);
1676
2168
  }
1677
2169
 
2170
+ /* The thumb rests at the inline start and travels toward the inline end,
2171
+ so it is placed logically and slides left under RTL. */
1678
2172
  [data-hl-switch] input[type='checkbox']::after {
1679
2173
  content: '';
1680
2174
  position: absolute;
1681
- top: 2px;
1682
- right: auto;
1683
- bottom: auto;
1684
- left: 2px;
1685
- width: calc(1.25rem - 4px);
1686
- height: calc(1.25rem - 4px);
1687
- border-radius: 50%;
2175
+ inset-block-start: var(--_gap);
2176
+ inset-inline-start: var(--_gap);
2177
+ inline-size: var(--_thumb);
2178
+ block-size: var(--_thumb);
2179
+ border-radius: var(--hl-radius-full);
1688
2180
  background: var(--hl-surface);
1689
- transition: transform var(--hl-duration-fast) var(--hl-ease-standard);
2181
+ transition: translate var(--hl-duration-fast) var(--hl-ease-standard);
1690
2182
  }
1691
2183
 
1692
2184
  [data-hl-switch] input[type='checkbox']:checked::after {
1693
- transform: translateX(1rem);
2185
+ translate: var(--_travel) 0;
2186
+ }
2187
+
2188
+ [data-hl-switch] input[type='checkbox']:checked:dir(rtl)::after {
2189
+ translate: calc(var(--_travel) * -1) 0;
1694
2190
  }
1695
2191
 
1696
2192
  [data-hl-switch] input[type='checkbox']:checked {
@@ -1699,10 +2195,11 @@
1699
2195
 
1700
2196
  [data-hl-switch] input[type='checkbox']:focus-visible {
1701
2197
  outline: var(--hl-focus-ring);
2198
+ outline-offset: var(--hl-focus-offset);
1702
2199
  }
1703
2200
 
1704
2201
  [data-hl-switch] input[type='checkbox']:disabled {
1705
- opacity: 0.5;
2202
+ opacity: var(--hl-disabled-opacity);
1706
2203
  cursor: not-allowed;
1707
2204
  }
1708
2205
 
@@ -1710,11 +2207,35 @@
1710
2207
  opacity: 0.7;
1711
2208
  cursor: not-allowed;
1712
2209
  }
2210
+
2211
+ /* The track needs an edge once its fill is flattened, and the custom-drawn
2212
+ thumb keeps its own colors so it stays visible on both states. */
2213
+ @media (forced-colors: active) {
2214
+ [data-hl-switch] input[type='checkbox'] {
2215
+ border: var(--hl-border-width) solid ButtonBorder;
2216
+ }
2217
+
2218
+ [data-hl-switch] input[type='checkbox']:checked {
2219
+ background: Highlight;
2220
+ border-color: Highlight;
2221
+ }
2222
+
2223
+ [data-hl-switch] input[type='checkbox']::after {
2224
+ forced-color-adjust: none;
2225
+ background: ButtonText;
2226
+ }
2227
+
2228
+ [data-hl-switch] input[type='checkbox']:checked::after {
2229
+ background: HighlightText;
2230
+ }
2231
+ }
1713
2232
  }
1714
2233
  /**
1715
2234
  * Field, accessible form-control layout: `.hl-field` stacks a `.hl-label`,
1716
2235
  * the control, `.hl-help`, and `.hl-error`. `.hl-fieldset` + `.hl-legend`
1717
- * group related fields.
2236
+ * group related fields. Pure CSS; there is no enhancer.
2237
+ * data-hl-required: on `.hl-label`, appends an asterisk
2238
+ * data-hl-invalid: on `.hl-field`, colors the label as an error
1718
2239
  */
1719
2240
  @layer components {
1720
2241
  .hl-field {
@@ -1731,7 +2252,7 @@
1731
2252
 
1732
2253
  .hl-label[data-hl-required]::after {
1733
2254
  content: '*';
1734
- margin-left: var(--hl-space-1);
2255
+ margin-inline-start: var(--hl-space-1);
1735
2256
  color: var(--hl-danger);
1736
2257
  }
1737
2258
 
@@ -1763,8 +2284,7 @@
1763
2284
  }
1764
2285
 
1765
2286
  .hl-legend {
1766
- padding-left: var(--hl-space-2);
1767
- padding-right: var(--hl-space-2);
2287
+ padding-inline: var(--hl-space-2);
1768
2288
  font-size: var(--hl-text-sm);
1769
2289
  font-weight: var(--hl-font-semibold);
1770
2290
  color: var(--hl-fg);
@@ -1772,8 +2292,14 @@
1772
2292
  }
1773
2293
  /**
1774
2294
  * Combobox: `<div data-hl-combobox>` wrapping an `<input>` and a
1775
- * `<ul role="listbox">` of `<li role="option">`. The enhancer toggles the
1776
- * listbox and manages `aria-activedescendant`.
2295
+ * `<ul role="listbox">` of `<li role="option">`.
2296
+ *
2297
+ * No-JS baseline: the listbox is hidden until the root has focus within it,
2298
+ * so the options are at least reachable and readable. The enhancer marks the
2299
+ * root `data-hl-ready` and then owns visibility through `hidden`, filtering,
2300
+ * and `aria-activedescendant`.
2301
+ * data-hl-combobox: root
2302
+ * data-hl-ready: set by the enhancer; the baseline rules stand down
1777
2303
  */
1778
2304
  @layer components {
1779
2305
  [data-hl-combobox] {
@@ -1783,11 +2309,10 @@
1783
2309
 
1784
2310
  [data-hl-combobox] [role='listbox'] {
1785
2311
  position: absolute;
1786
- top: calc(100% + var(--hl-space-1));
1787
- left: 0;
1788
- right: 0;
2312
+ inset-block-start: calc(100% + var(--hl-space-1));
2313
+ inset-inline: 0;
1789
2314
  z-index: var(--hl-z-dropdown);
1790
- max-height: 16rem;
2315
+ max-block-size: 16rem;
1791
2316
  margin: 0;
1792
2317
  padding: var(--hl-space-1);
1793
2318
  overflow-y: auto;
@@ -1803,16 +2328,11 @@
1803
2328
  @supports (anchor-name: --x) {
1804
2329
  [data-hl-combobox] [role='listbox'] {
1805
2330
  position: fixed;
1806
- top: auto;
1807
- right: auto;
1808
- bottom: auto;
1809
- left: auto;
1810
- width: anchor-size(width);
1811
- inset-area: block-end;
2331
+ inset: auto;
2332
+ inline-size: anchor-size(width);
1812
2333
  position-area: block-end;
1813
2334
  position-try-fallbacks: flip-block;
1814
- margin-top: var(--hl-space-1);
1815
- margin-bottom: var(--hl-space-1);
2335
+ margin-block: var(--hl-space-1);
1816
2336
  }
1817
2337
  }
1818
2338
 
@@ -1820,6 +2340,23 @@
1820
2340
  display: none;
1821
2341
  }
1822
2342
 
2343
+ /* No-JS baseline: reveal the list while the field has focus. */
2344
+ [data-hl-combobox]:not([data-hl-ready]) [role='listbox'] {
2345
+ display: none;
2346
+ }
2347
+
2348
+ [data-hl-combobox]:not([data-hl-ready]):focus-within [role='listbox'] {
2349
+ display: block;
2350
+ }
2351
+
2352
+ /* The input may be a plain `<input>` rather than `.hl-input`; make sure it
2353
+ still shows a focus ring. */
2354
+ [data-hl-combobox] > input:focus-visible {
2355
+ outline: none;
2356
+ border-color: var(--hl-ring);
2357
+ box-shadow: var(--hl-focus-shadow);
2358
+ }
2359
+
1823
2360
  [data-hl-combobox] [role='option'] {
1824
2361
  display: flex;
1825
2362
  align-items: center;
@@ -1842,15 +2379,28 @@
1842
2379
  }
1843
2380
 
1844
2381
  [data-hl-combobox] [role='option'][aria-disabled='true'] {
1845
- opacity: 0.5;
2382
+ opacity: var(--hl-disabled-opacity);
1846
2383
  pointer-events: none;
1847
2384
  }
2385
+
2386
+ @media (forced-colors: active) {
2387
+ [data-hl-combobox] [role='option'][aria-selected='true'] {
2388
+ background: Highlight;
2389
+ color: HighlightText;
2390
+ }
2391
+
2392
+ [data-hl-combobox] [role='option'][aria-disabled='true'] {
2393
+ color: GrayText;
2394
+ }
2395
+ }
1848
2396
  }
1849
2397
  /**
1850
2398
  * Segmented control: `<div class="hl-segmented" role="radiogroup">` of
1851
- * `<label class="hl-segmented-item"><input type="radio">…</label>` segments.
2399
+ * `<label class="hl-segmented-item"><input type="radio">...</label>` segments.
1852
2400
  * Radio inputs give free keyboard navigation; the checked segment is raised.
1853
- * A button variant using `aria-pressed="true"` is also supported.
2401
+ * A button variant is also supported: with the enhancer (`data-hl-segmented`)
2402
+ * buttons become a `role="radio"` group with `aria-checked` and arrow keys;
2403
+ * without it, mark the active button `aria-pressed="true"`.
1854
2404
  * data-hl-size: sm | md (default) | lg
1855
2405
  */
1856
2406
  @layer components {
@@ -1881,18 +2431,15 @@
1881
2431
  white-space: nowrap;
1882
2432
  cursor: pointer;
1883
2433
  -webkit-user-select: none;
1884
- -moz-user-select: none;
1885
2434
  user-select: none;
1886
2435
  transition:
1887
- background-color var(--hl-duration-fast) var(--hl-ease-standard), color var(--hl-duration-fast) var(--hl-ease-standard);
2436
+ background-color var(--hl-duration-fast) var(--hl-ease-standard),
2437
+ color var(--hl-duration-fast) var(--hl-ease-standard);
1888
2438
  }
1889
2439
 
1890
2440
  .hl-segmented-item > input {
1891
2441
  position: absolute;
1892
- top: 0;
1893
- right: 0;
1894
- bottom: 0;
1895
- left: 0;
2442
+ inset: 0;
1896
2443
  margin: 0;
1897
2444
  opacity: 0;
1898
2445
  cursor: pointer;
@@ -1903,21 +2450,21 @@
1903
2450
  }
1904
2451
 
1905
2452
  .hl-segmented-item:has(input:checked),
1906
- .hl-segmented-item[aria-pressed='true'] {
2453
+ .hl-segmented-item:is([aria-pressed='true'], [aria-checked='true']) {
1907
2454
  background: var(--hl-surface);
1908
2455
  color: var(--hl-fg);
1909
2456
  box-shadow: var(--hl-shadow-sm);
1910
2457
  }
1911
2458
 
1912
2459
  .hl-segmented-item:has(input:focus-visible),
1913
- .hl-segmented-item[aria-pressed]:focus-visible {
2460
+ .hl-segmented-item:is([aria-pressed], [aria-checked]):focus-visible {
1914
2461
  outline: var(--hl-focus-ring);
1915
- outline-offset: 2px;
2462
+ outline-offset: var(--hl-focus-offset);
1916
2463
  }
1917
2464
 
1918
2465
  .hl-segmented-item:has(input:disabled),
1919
2466
  .hl-segmented-item:disabled {
1920
- opacity: 0.5;
2467
+ opacity: var(--hl-disabled-opacity);
1921
2468
  cursor: not-allowed;
1922
2469
  }
1923
2470
 
@@ -1930,64 +2477,110 @@
1930
2477
  padding: var(--hl-space-2) var(--hl-space-4);
1931
2478
  font-size: var(--hl-text-base);
1932
2479
  }
2480
+
2481
+ /* The raised segment relies on a shadow, which forced colors remove. */
2482
+ @media (forced-colors: active) {
2483
+ .hl-segmented-item {
2484
+ border: var(--hl-border-width) solid ButtonBorder;
2485
+ }
2486
+
2487
+ .hl-segmented-item:has(input:checked),
2488
+ .hl-segmented-item:is([aria-pressed='true'], [aria-checked='true']) {
2489
+ background: Highlight;
2490
+ color: HighlightText;
2491
+ }
2492
+ }
1933
2493
  }
1934
2494
  /**
1935
2495
  * Slider: native `<input type="range" class="hl-slider">`. Restyled track and
1936
- * thumb across WebKit/Blink and Firefox while keeping native keyboard support.
2496
+ * thumb across WebKit/Blink and Firefox while keeping native keyboard support
2497
+ * and RTL direction. Firefox paints the filled part of the track natively
2498
+ * (`::-moz-range-progress`); other engines get it from the
2499
+ * `--hl-slider-progress` custom property the enhancer keeps in sync when the
2500
+ * input sits inside a `[data-hl-slider]` wrapper (with an optional `<output>`).
2501
+ * data-hl-slider: wrapper around the input (and output) for the enhancer
1937
2502
  */
1938
2503
  @layer components {
1939
2504
  .hl-slider {
1940
2505
  --_track: 0.375rem;
1941
2506
  --_thumb: 1.15rem;
1942
2507
 
1943
- -webkit-appearance: none;
1944
-
1945
- -moz-appearance: none;
1946
-
1947
- appearance: none;
1948
- width: 100%;
1949
- height: 1.15rem;
1950
- height: var(--_thumb);
2508
+ appearance: none;
2509
+ inline-size: 100%;
2510
+ block-size: var(--_thumb);
1951
2511
  margin: 0;
1952
2512
  background: transparent;
1953
2513
  cursor: pointer;
1954
2514
  }
1955
2515
 
1956
2516
  .hl-slider::-webkit-slider-runnable-track {
1957
- height: var(--_track);
2517
+ block-size: var(--_track);
1958
2518
  border-radius: var(--hl-radius-full);
1959
2519
  background: var(--hl-surface-3);
1960
2520
  }
1961
2521
 
2522
+ /* Fill up to the thumb once the enhancer publishes the progress. */
2523
+ .hl-slider[style*='--hl-slider-progress']::-webkit-slider-runnable-track {
2524
+ background: linear-gradient(
2525
+ to right,
2526
+ var(--hl-primary) var(--hl-slider-progress),
2527
+ var(--hl-surface-3) var(--hl-slider-progress)
2528
+ );
2529
+ }
2530
+
2531
+ :is(
2532
+ [dir='rtl'] .hl-slider,
2533
+ .hl-slider:dir(rtl)
2534
+ )[style*='--hl-slider-progress']::-webkit-slider-runnable-track {
2535
+ background: linear-gradient(
2536
+ to left,
2537
+ var(--hl-primary) var(--hl-slider-progress),
2538
+ var(--hl-surface-3) var(--hl-slider-progress)
2539
+ );
2540
+ }
2541
+
2542
+ [data-hl-slider] {
2543
+ display: flex;
2544
+ align-items: center;
2545
+ gap: var(--hl-space-3);
2546
+ }
2547
+
2548
+ [data-hl-slider] > output {
2549
+ min-inline-size: 3ch;
2550
+ font-size: var(--hl-text-sm);
2551
+ font-variant-numeric: tabular-nums;
2552
+ color: var(--hl-fg-muted);
2553
+ text-align: end;
2554
+ }
2555
+
1962
2556
  .hl-slider::-moz-range-track {
1963
- height: var(--_track);
2557
+ block-size: var(--_track);
1964
2558
  border-radius: var(--hl-radius-full);
1965
2559
  background: var(--hl-surface-3);
1966
2560
  }
1967
2561
 
1968
2562
  .hl-slider::-moz-range-progress {
1969
- height: var(--_track);
2563
+ block-size: var(--_track);
1970
2564
  border-radius: var(--hl-radius-full);
1971
2565
  background: var(--hl-primary);
1972
2566
  }
1973
2567
 
1974
2568
  .hl-slider::-webkit-slider-thumb {
1975
- -webkit-appearance: none;
1976
- appearance: none;
1977
- width: var(--_thumb);
1978
- height: var(--_thumb);
1979
- margin-top: calc((var(--_track) - var(--_thumb)) / 2);
2569
+ appearance: none;
2570
+ inline-size: var(--_thumb);
2571
+ block-size: var(--_thumb);
2572
+ margin-block-start: calc((var(--_track) - var(--_thumb)) / 2);
1980
2573
  border: 2px solid var(--hl-surface);
1981
2574
  border-radius: var(--hl-radius-full);
1982
2575
  background: var(--hl-primary);
1983
2576
  box-shadow: var(--hl-shadow-sm);
1984
- -webkit-transition: transform var(--hl-duration-fast) var(--hl-ease-standard);
1985
- transition: transform var(--hl-duration-fast) var(--hl-ease-standard);
2577
+ -webkit-transition: scale var(--hl-duration-fast) var(--hl-ease-standard);
2578
+ transition: scale var(--hl-duration-fast) var(--hl-ease-standard);
1986
2579
  }
1987
2580
 
1988
2581
  .hl-slider::-moz-range-thumb {
1989
- width: var(--_thumb);
1990
- height: var(--_thumb);
2582
+ inline-size: var(--_thumb);
2583
+ block-size: var(--_thumb);
1991
2584
  border: 2px solid var(--hl-surface);
1992
2585
  border-radius: var(--hl-radius-full);
1993
2586
  background: var(--hl-primary);
@@ -1995,7 +2588,7 @@
1995
2588
  }
1996
2589
 
1997
2590
  .hl-slider:active::-webkit-slider-thumb {
1998
- transform: scale(1.1);
2591
+ scale: 1.1;
1999
2592
  }
2000
2593
 
2001
2594
  .hl-slider:focus-visible {
@@ -2003,23 +2596,36 @@
2003
2596
  }
2004
2597
 
2005
2598
  .hl-slider:focus-visible::-webkit-slider-thumb {
2006
- box-shadow: 0 0 0 4px color-mix(in oklab, var(--hl-ring) 35%, transparent);
2599
+ box-shadow: var(--hl-focus-shadow);
2007
2600
  }
2008
2601
 
2009
2602
  .hl-slider:focus-visible::-moz-range-thumb {
2010
- box-shadow: 0 0 0 4px color-mix(in oklab, var(--hl-ring) 35%, transparent);
2603
+ box-shadow: var(--hl-focus-shadow);
2011
2604
  }
2012
2605
 
2013
2606
  .hl-slider:disabled {
2014
2607
  cursor: not-allowed;
2015
- opacity: 0.6;
2608
+ opacity: var(--hl-disabled-opacity);
2609
+ }
2610
+
2611
+ /* Shadows vanish in forced colors, so focus falls back to an outline. */
2612
+ @media (forced-colors: active) {
2613
+ .hl-slider:focus-visible {
2614
+ outline: var(--hl-focus-ring);
2615
+ outline-offset: var(--hl-focus-offset);
2616
+ }
2016
2617
  }
2017
2618
  }
2018
2619
  /* Feedback & data display */
2019
2620
  /**
2020
- * Alert: `<div class="hl-alert" role="alert" data-hl-intent="…">` with an
2021
- * optional icon, `.hl-alert-title`, and body content.
2022
- * data-hl-intent: info (default) | success | warning | danger | neutral
2621
+ * Alert: `<div class="hl-alert" role="alert" data-hl-intent="...">` with an
2622
+ * optional icon, `.hl-alert-title`, and body content. Add `data-hl-alert` and
2623
+ * a `[data-hl-dismiss]` button for the dismiss enhancer, which fades the alert
2624
+ * out (`data-hl-alert-closing`) before hiding it.
2625
+ * data-hl-intent: info (default) | success | warning | danger | neutral
2626
+ * data-hl-alert: opt in to the dismiss enhancer
2627
+ * data-hl-dismiss: the dismiss button inside the alert
2628
+ * data-hl-alert-closing: set by the enhancer during the exit transition
2023
2629
  */
2024
2630
  @layer components {
2025
2631
  .hl-alert {
@@ -2031,12 +2637,61 @@
2031
2637
  gap: var(--hl-space-3);
2032
2638
  padding: var(--hl-space-3) var(--hl-space-4);
2033
2639
  border: var(--hl-border-width) solid transparent;
2034
- border-left: 3px solid var(--_accent);
2640
+ border-inline-start: 3px solid var(--_accent);
2035
2641
  border-radius: var(--hl-radius-md);
2036
2642
  background: var(--_bg);
2037
2643
  color: var(--_fg);
2038
2644
  font-size: var(--hl-text-sm);
2039
2645
  line-height: var(--hl-leading-normal);
2646
+ transition:
2647
+ opacity var(--hl-duration-base) var(--hl-ease-standard),
2648
+ translate var(--hl-duration-base) var(--hl-ease-standard);
2649
+ }
2650
+
2651
+ .hl-alert[data-hl-alert-closing] {
2652
+ opacity: 0;
2653
+ translate: 0 -0.25rem;
2654
+ }
2655
+
2656
+ /* `display: flex` above would otherwise beat the user agent's `[hidden]`. */
2657
+ .hl-alert[hidden] {
2658
+ display: none;
2659
+ }
2660
+
2661
+ .hl-alert [data-hl-dismiss] {
2662
+ display: inline-flex;
2663
+ align-items: center;
2664
+ justify-content: center;
2665
+ flex: none;
2666
+ inline-size: 1.5rem;
2667
+ block-size: 1.5rem;
2668
+ margin-inline-start: auto;
2669
+ margin-block-start: -0.125rem;
2670
+ padding: 0;
2671
+ border: 0;
2672
+ border-radius: var(--hl-radius-sm);
2673
+ background: transparent;
2674
+ color: inherit;
2675
+ font: inherit;
2676
+ line-height: 1;
2677
+ cursor: pointer;
2678
+ opacity: 0.7;
2679
+ }
2680
+
2681
+ .hl-alert [data-hl-dismiss]:hover {
2682
+ opacity: 1;
2683
+ background: color-mix(in oklab, currentcolor 10%, transparent);
2684
+ }
2685
+
2686
+ .hl-alert [data-hl-dismiss]:focus-visible {
2687
+ outline: var(--hl-focus-ring);
2688
+ outline-offset: var(--hl-focus-offset);
2689
+ opacity: 1;
2690
+ }
2691
+
2692
+ .hl-alert [data-hl-dismiss]:empty::before {
2693
+ content: '\00D7';
2694
+ font-size: var(--hl-text-lg);
2040
2695
  }
2041
2696
 
2042
2697
  .hl-alert[data-hl-intent='success'] {
@@ -2065,9 +2720,9 @@
2065
2720
 
2066
2721
  .hl-alert > svg:first-child {
2067
2722
  flex: none;
2068
- width: 1.25rem;
2069
- height: 1.25rem;
2070
- margin-top: 0.1rem;
2723
+ inline-size: 1.25rem;
2724
+ block-size: 1.25rem;
2725
+ margin-block-start: 0.1rem;
2071
2726
  color: var(--_accent);
2072
2727
  }
2073
2728
 
@@ -2075,7 +2730,7 @@
2075
2730
  display: flex;
2076
2731
  flex-direction: column;
2077
2732
  gap: var(--hl-space-1);
2078
- min-width: 0;
2733
+ min-inline-size: 0;
2079
2734
  }
2080
2735
 
2081
2736
  .hl-alert-title {
@@ -2087,9 +2742,17 @@
2087
2742
  .hl-alert p {
2088
2743
  margin: 0;
2089
2744
  }
2745
+
2746
+ /* Fills are flattened in forced colors, so the outline carries the shape. */
2747
+ @media (forced-colors: active) {
2748
+ .hl-alert {
2749
+ border-color: CanvasText;
2750
+ }
2751
+ }
2090
2752
  }
2091
2753
  /**
2092
- * Badge: `<span class="hl-badge" data-hl-intent="…" data-hl-variant="…">`.
2754
+ * Badge: `<span class="hl-badge" data-hl-intent="..." data-hl-variant="...">`.
2755
+ * Pure CSS; there is no enhancer.
2093
2756
  * data-hl-intent: neutral (default) | primary | danger | success | warning | info
2094
2757
  * data-hl-variant: soft (default) | solid | outline
2095
2758
  * data-hl-size: sm | md (default)
@@ -2171,10 +2834,18 @@
2171
2834
  padding: 0 var(--hl-space-1-5);
2172
2835
  font-size: 0.6875rem;
2173
2836
  }
2837
+
2838
+ /* Soft and solid fills disappear in forced colors; keep the pill outline. */
2839
+ @media (forced-colors: active) {
2840
+ .hl-badge {
2841
+ border-color: CanvasText;
2842
+ }
2843
+ }
2174
2844
  }
2175
2845
  /**
2176
2846
  * Card: `<div class="hl-card">` with optional `.hl-card-header`,
2177
2847
  * `.hl-card-body`, `.hl-card-footer`, `.hl-card-title`, `.hl-card-description`.
2848
+ * Pure CSS; there is no enhancer.
2178
2849
  * data-hl-interactive: hover/active elevation for clickable cards
2179
2850
  */
2180
2851
  @layer components {
@@ -2193,7 +2864,7 @@
2193
2864
  flex-direction: column;
2194
2865
  gap: var(--hl-space-1);
2195
2866
  padding: var(--hl-space-4) var(--hl-space-5);
2196
- border-bottom: var(--hl-border-width) solid var(--hl-border);
2867
+ border-block-end: var(--hl-border-width) solid var(--hl-border);
2197
2868
  }
2198
2869
 
2199
2870
  .hl-card-body {
@@ -2206,7 +2877,7 @@
2206
2877
  align-items: center;
2207
2878
  gap: var(--hl-space-2);
2208
2879
  padding: var(--hl-space-4) var(--hl-space-5);
2209
- border-top: var(--hl-border-width) solid var(--hl-border);
2880
+ border-block-start: var(--hl-border-width) solid var(--hl-border);
2210
2881
  background: var(--hl-surface-2);
2211
2882
  }
2212
2883
 
@@ -2226,7 +2897,9 @@
2226
2897
  .hl-card[data-hl-interactive] {
2227
2898
  cursor: pointer;
2228
2899
  transition:
2229
- border-color var(--hl-duration-fast) var(--hl-ease-standard), box-shadow var(--hl-duration-base) var(--hl-ease-standard), transform var(--hl-duration-base) var(--hl-ease-standard);
2900
+ border-color var(--hl-duration-fast) var(--hl-ease-standard),
2901
+ box-shadow var(--hl-duration-base) var(--hl-ease-standard),
2902
+ translate var(--hl-duration-base) var(--hl-ease-standard);
2230
2903
  }
2231
2904
 
2232
2905
  .hl-card[data-hl-interactive]:hover {
@@ -2236,16 +2909,17 @@
2236
2909
 
2237
2910
  .hl-card[data-hl-interactive]:focus-within {
2238
2911
  outline: var(--hl-focus-ring);
2239
- outline-offset: 2px;
2912
+ outline-offset: var(--hl-focus-offset);
2240
2913
  }
2241
2914
 
2242
2915
  .hl-card[data-hl-interactive]:active {
2243
- transform: translateY(1px);
2916
+ translate: 0 1px;
2244
2917
  }
2245
2918
  }
2246
2919
  /**
2247
2920
  * Avatar: `<span class="hl-avatar">` containing an `<img>` or fallback
2248
- * initials/icon. Stack with `<div class="hl-avatar-group">`.
2921
+ * initials/icon. Stack with `<div class="hl-avatar-group">`. Pure CSS; there
2922
+ * is no enhancer.
2249
2923
  * data-hl-size: xs | sm | md (default) | lg | xl
2250
2924
  * data-hl-shape: square
2251
2925
  */
@@ -2255,25 +2929,19 @@
2255
2929
 
2256
2930
  position: relative;
2257
2931
  display: inline-grid;
2258
- align-items: center;
2259
- justify-items: center;
2260
2932
  place-items: center;
2261
2933
  flex: none;
2262
- width: 2.5rem;
2263
- width: var(--_size);
2264
- height: 2.5rem;
2265
- height: var(--_size);
2934
+ inline-size: var(--_size);
2935
+ block-size: var(--_size);
2266
2936
  border-radius: var(--hl-radius-full);
2267
2937
  overflow: hidden;
2268
2938
  background: var(--hl-surface-3);
2269
2939
  color: var(--hl-fg-muted);
2270
- font-size: calc(2.5rem * 0.4);
2271
2940
  font-size: calc(var(--_size) * 0.4);
2272
2941
  font-weight: var(--hl-font-medium);
2273
2942
  line-height: 1;
2274
2943
  text-transform: uppercase;
2275
2944
  -webkit-user-select: none;
2276
- -moz-user-select: none;
2277
2945
  user-select: none;
2278
2946
  }
2279
2947
 
@@ -2282,10 +2950,9 @@
2282
2950
  }
2283
2951
 
2284
2952
  .hl-avatar > img {
2285
- width: 100%;
2286
- height: 100%;
2287
- -o-object-fit: cover;
2288
- object-fit: cover;
2953
+ inline-size: 100%;
2954
+ block-size: 100%;
2955
+ object-fit: cover;
2289
2956
  }
2290
2957
 
2291
2958
  .hl-avatar[data-hl-size='xs'] {
@@ -2314,12 +2981,12 @@
2314
2981
  }
2315
2982
 
2316
2983
  .hl-avatar-group > .hl-avatar:not(:first-child) {
2317
- margin-left: -0.6rem;
2984
+ margin-inline-start: -0.6rem;
2318
2985
  }
2319
2986
  }
2320
2987
  /**
2321
2988
  * Progress: native `<progress class="hl-progress" value max>`. Omit `value`
2322
- * for an indeterminate bar.
2989
+ * for an indeterminate bar. Pure CSS; there is no enhancer.
2323
2990
  * data-hl-intent: primary (default) | success | warning | danger | info
2324
2991
  * data-hl-size: sm | md (default) | lg
2325
2992
  */
@@ -2328,14 +2995,9 @@
2328
2995
  --_color: var(--hl-primary);
2329
2996
  --_height: 0.5rem;
2330
2997
 
2331
- -webkit-appearance: none;
2332
-
2333
- -moz-appearance: none;
2334
-
2335
- appearance: none;
2336
- width: 100%;
2337
- height: 0.5rem;
2338
- height: var(--_height);
2998
+ appearance: none;
2999
+ inline-size: 100%;
3000
+ block-size: var(--_height);
2339
3001
  border: 0;
2340
3002
  border-radius: var(--hl-radius-full);
2341
3003
  overflow: hidden;
@@ -2374,8 +3036,8 @@
2374
3036
  .hl-progress::-webkit-progress-value {
2375
3037
  background: var(--_color);
2376
3038
  border-radius: var(--hl-radius-full);
2377
- -webkit-transition: width var(--hl-duration-base) var(--hl-ease-standard);
2378
- transition: width var(--hl-duration-base) var(--hl-ease-standard);
3039
+ -webkit-transition: inline-size var(--hl-duration-base) var(--hl-ease-standard);
3040
+ transition: inline-size var(--hl-duration-base) var(--hl-ease-standard);
2379
3041
  }
2380
3042
 
2381
3043
  .hl-progress::-moz-progress-bar {
@@ -2405,15 +3067,32 @@
2405
3067
  }
2406
3068
  }
2407
3069
 
3070
+ /* A static partial bar still signals "in progress" without motion. */
2408
3071
  @media (prefers-reduced-motion: reduce) {
2409
3072
  .hl-progress:indeterminate {
2410
- animation-duration: 3s;
3073
+ animation: none;
3074
+ background-position: 30% 0;
3075
+ }
3076
+ }
3077
+
3078
+ @media (forced-colors: active) {
3079
+ .hl-progress {
3080
+ border: var(--hl-border-width) solid CanvasText;
3081
+ }
3082
+
3083
+ .hl-progress::-webkit-progress-value {
3084
+ background: Highlight;
3085
+ }
3086
+
3087
+ .hl-progress::-moz-progress-bar {
3088
+ background: Highlight;
2411
3089
  }
2412
3090
  }
2413
3091
  }
2414
3092
  /**
2415
3093
  * Spinner: `<span class="hl-spinner" role="status" aria-label="Loading">`.
2416
- * Inherits `currentColor`, so set `color` to theme it.
3094
+ * Inherits `currentColor`, so set `color` to theme it. Pure CSS; there is no
3095
+ * enhancer.
2417
3096
  * data-hl-size: sm | md (default) | lg | xl
2418
3097
  */
2419
3098
  @layer components {
@@ -2423,22 +3102,14 @@
2423
3102
 
2424
3103
  display: inline-block;
2425
3104
  flex: none;
2426
- width: 1.25rem;
2427
- width: var(--_size);
2428
- height: 1.25rem;
2429
- height: var(--_size);
2430
- border: 2px solid color-mix(in oklab, currentcolor 25%, transparent);
2431
- border-top-color: currentcolor;
3105
+ inline-size: var(--_size);
3106
+ block-size: var(--_size);
3107
+ border: var(--_width) solid color-mix(in oklab, currentcolor 25%, transparent);
3108
+ border-block-start-color: currentcolor;
2432
3109
  border-radius: var(--hl-radius-full);
2433
3110
  animation: hl-spinner-rotate 0.6s linear infinite;
2434
3111
  }
2435
3112
 
2436
- @supports (color: color-mix(in lch, red, blue)) {
2437
- .hl-spinner {
2438
- border: var(--_width) solid color-mix(in oklab, currentcolor 25%, transparent);
2439
- }
2440
- }
2441
-
2442
3113
  .hl-spinner[data-hl-size='sm'] {
2443
3114
  --_size: 1rem;
2444
3115
  }
@@ -2459,22 +3130,33 @@
2459
3130
  }
2460
3131
  }
2461
3132
 
3133
+ /* A static arc still reads as "loading" without continuous motion. */
2462
3134
  @media (prefers-reduced-motion: reduce) {
2463
3135
  .hl-spinner {
2464
- animation-duration: 1.4s;
3136
+ animation: none;
3137
+ }
3138
+ }
3139
+
3140
+ /* The faded ring is color-mixed, which forced colors flatten; keep the arc
3141
+ visible by drawing the rest of the ring in GrayText. */
3142
+ @media (forced-colors: active) {
3143
+ .hl-spinner {
3144
+ border-color: GrayText;
3145
+ border-block-start-color: CanvasText;
2465
3146
  }
2466
3147
  }
2467
3148
  }
2468
3149
  /**
2469
- * Skeleton: `<span class="hl-skeleton" data-hl-variant="…" aria-hidden="true">`
2470
- * placeholder shown while content loads.
2471
- * data-hl-variant: rect (default) | text | circle
3150
+ * Skeleton: `<span class="hl-skeleton" data-hl-shape="..." aria-hidden="true">`
3151
+ * placeholder shown while content loads. Pure CSS; there is no enhancer.
3152
+ * Size it with inline `inline-size`/`block-size`.
3153
+ * data-hl-shape: rect (default) | text | circle
2472
3154
  */
2473
3155
  @layer components {
2474
3156
  .hl-skeleton {
2475
3157
  display: block;
2476
- width: 100%;
2477
- height: 1rem;
3158
+ inline-size: 100%;
3159
+ block-size: 1rem;
2478
3160
  border-radius: var(--hl-radius-md);
2479
3161
  background: linear-gradient(
2480
3162
  90deg,
@@ -2486,14 +3168,14 @@
2486
3168
  animation: hl-skeleton-shimmer 1.4s var(--hl-ease-standard) infinite;
2487
3169
  }
2488
3170
 
2489
- .hl-skeleton[data-hl-variant='text'] {
2490
- height: 0.7em;
3171
+ .hl-skeleton[data-hl-shape='text'] {
3172
+ block-size: 0.7em;
2491
3173
  border-radius: var(--hl-radius-sm);
2492
3174
  }
2493
3175
 
2494
- .hl-skeleton[data-hl-variant='circle'] {
2495
- width: 2.5rem;
2496
- height: 2.5rem;
3176
+ .hl-skeleton[data-hl-shape='circle'] {
3177
+ inline-size: 2.5rem;
3178
+ block-size: 2.5rem;
2497
3179
  border-radius: var(--hl-radius-full);
2498
3180
  }
2499
3181
 
@@ -2513,20 +3195,28 @@
2513
3195
  background: var(--hl-surface-3);
2514
3196
  }
2515
3197
  }
3198
+
3199
+ /* Fills flatten to Canvas in forced colors; outline the placeholder instead. */
3200
+ @media (forced-colors: active) {
3201
+ .hl-skeleton {
3202
+ border: var(--hl-border-width) solid GrayText;
3203
+ }
3204
+ }
2516
3205
  }
2517
3206
  /**
2518
3207
  * Keyboard key: `<kbd class="hl-kbd">⌘</kbd>`. Combine inline, e.g.
2519
- * `<kbd class="hl-kbd">⌘</kbd><kbd class="hl-kbd">K</kbd>`.
3208
+ * `<kbd class="hl-kbd">⌘</kbd><kbd class="hl-kbd">K</kbd>`. Pure CSS; there
3209
+ * is no enhancer.
2520
3210
  */
2521
3211
  @layer components {
2522
3212
  .hl-kbd {
2523
3213
  display: inline-flex;
2524
3214
  align-items: center;
2525
3215
  justify-content: center;
2526
- min-width: 1.5rem;
3216
+ min-inline-size: 1.5rem;
2527
3217
  padding: 0.125rem 0.4rem;
2528
3218
  border: var(--hl-border-width) solid var(--hl-border-strong);
2529
- border-bottom-width: var(--hl-border-width-2);
3219
+ border-block-end-width: var(--hl-border-width-2);
2530
3220
  border-radius: var(--hl-radius-sm);
2531
3221
  background: var(--hl-surface-2);
2532
3222
  color: var(--hl-fg);
@@ -2537,33 +3227,47 @@
2537
3227
  }
2538
3228
  }
2539
3229
  /**
2540
- * Table: `<table class="hl-table">`. Semantic table styling with optional
2541
- * zebra striping and hover.
3230
+ * Table: `<table class="hl-table">`, optionally inside
3231
+ * `<div class="hl-table-wrapper">` so wide tables scroll instead of breaking
3232
+ * the layout. Add `data-hl-table` and mark headers `data-hl-sort` for the
3233
+ * sorting enhancer; it sets `aria-sort` on the active column.
2542
3234
  * data-hl-striped: zebra rows
2543
3235
  * data-hl-hover: highlight row on hover
3236
+ * data-hl-align: start (default) | center | end, on the table or a cell
3237
+ * data-hl-size: sm | md (default) | lg, cell padding density
3238
+ * data-hl-table: opt in to the sorting enhancer
3239
+ * data-hl-sort: a sortable header (value: the column key)
2544
3240
  */
2545
3241
  @layer components {
3242
+ .hl-table-wrapper {
3243
+ inline-size: 100%;
3244
+ overflow-x: auto;
3245
+ overscroll-behavior-x: contain;
3246
+ }
3247
+
2546
3248
  .hl-table {
2547
- width: 100%;
3249
+ --_pad-y: var(--hl-space-2);
3250
+ --_pad-x: var(--hl-space-3);
3251
+
3252
+ inline-size: 100%;
2548
3253
  border-collapse: collapse;
2549
3254
  font-size: var(--hl-text-sm);
2550
3255
  color: var(--hl-fg);
2551
3256
  }
2552
3257
 
2553
3258
  .hl-table caption {
2554
- padding-top: var(--hl-space-2);
2555
- padding-bottom: var(--hl-space-2);
3259
+ padding-block: var(--hl-space-2);
2556
3260
  color: var(--hl-fg-muted);
2557
- text-align: left;
3261
+ text-align: start;
2558
3262
  caption-side: bottom;
2559
3263
  }
2560
3264
 
2561
3265
  .hl-table th,
2562
3266
  .hl-table td {
2563
- padding: var(--hl-space-2) var(--hl-space-3);
2564
- text-align: left;
3267
+ padding: var(--_pad-y) var(--_pad-x);
3268
+ text-align: start;
2565
3269
  vertical-align: middle;
2566
- border-bottom: var(--hl-border-width) solid var(--hl-border);
3270
+ border-block-end: var(--hl-border-width) solid var(--hl-border);
2567
3271
  }
2568
3272
 
2569
3273
  .hl-table thead th {
@@ -2572,7 +3276,52 @@
2572
3276
  text-transform: uppercase;
2573
3277
  letter-spacing: 0.03em;
2574
3278
  color: var(--hl-fg-muted);
2575
- border-bottom-color: var(--hl-border-strong);
3279
+ border-block-end-color: var(--hl-border-strong);
3280
+ }
3281
+
3282
+ /* Sortable headers: a pointer cursor, a focus ring, and a direction glyph. */
3283
+ .hl-table th[data-hl-sort] {
3284
+ cursor: pointer;
3285
+ -webkit-user-select: none;
3286
+ user-select: none;
3287
+ }
3288
+
3289
+ .hl-table th[data-hl-sort]:hover {
3290
+ color: var(--hl-fg);
3291
+ }
3292
+
3293
+ .hl-table th[data-hl-sort]:focus-visible {
3294
+ outline: var(--hl-focus-ring);
3295
+ outline-offset: calc(var(--hl-focus-offset) * -1);
3296
+ }
3297
+
3298
+ .hl-table th[data-hl-sort]::after {
3299
+ content: '';
3300
+ display: inline-block;
3301
+ inline-size: 0.35em;
3302
+ block-size: 0.35em;
3303
+ margin-inline-start: var(--hl-space-1);
3304
+ border-inline-end: 1.5px solid currentcolor;
3305
+ border-block-end: 1.5px solid currentcolor;
3306
+ opacity: 0;
3307
+ translate: 0 -0.15em;
3308
+ rotate: 45deg;
3309
+ transition: opacity var(--hl-duration-fast) var(--hl-ease-standard);
3310
+ }
3311
+
3312
+ .hl-table th[data-hl-sort]:hover::after {
3313
+ opacity: 0.4;
3314
+ }
3315
+
3316
+ .hl-table th[aria-sort='ascending']::after,
3317
+ .hl-table th[aria-sort='descending']::after {
3318
+ opacity: 1;
3319
+ color: var(--hl-primary);
3320
+ }
3321
+
3322
+ .hl-table th[aria-sort='ascending']::after {
3323
+ rotate: 225deg;
3324
+ translate: 0 0.1em;
2576
3325
  }
2577
3326
 
2578
3327
  .hl-table tfoot td {
@@ -2588,32 +3337,63 @@
2588
3337
  background: color-mix(in oklab, var(--hl-primary) 8%, transparent);
2589
3338
  }
2590
3339
 
2591
- .hl-table td[data-hl-align='end'],
2592
- .hl-table th[data-hl-align='end'] {
2593
- text-align: right;
3340
+ .hl-table[data-hl-size='sm'] {
3341
+ --_pad-y: var(--hl-space-1);
3342
+ --_pad-x: var(--hl-space-2);
3343
+
3344
+ font-size: var(--hl-text-xs);
2594
3345
  }
2595
3346
 
2596
- .hl-table td[data-hl-align='center'],
2597
- .hl-table th[data-hl-align='center'] {
3347
+ .hl-table[data-hl-size='lg'] {
3348
+ --_pad-y: var(--hl-space-3);
3349
+ --_pad-x: var(--hl-space-4);
3350
+
3351
+ font-size: var(--hl-text-base);
3352
+ }
3353
+
3354
+ .hl-table[data-hl-align='start'] :is(th, td),
3355
+ .hl-table :is(th, td)[data-hl-align='start'] {
3356
+ text-align: start;
3357
+ }
3358
+
3359
+ .hl-table[data-hl-align='center'] :is(th, td),
3360
+ .hl-table :is(th, td)[data-hl-align='center'] {
2598
3361
  text-align: center;
2599
3362
  }
3363
+
3364
+ .hl-table[data-hl-align='end'] :is(th, td),
3365
+ .hl-table :is(th, td)[data-hl-align='end'] {
3366
+ text-align: end;
3367
+ }
3368
+
3369
+ @media (forced-colors: active) {
3370
+ .hl-table[data-hl-hover] tbody tr:hover {
3371
+ background: Highlight;
3372
+ color: HighlightText;
3373
+ }
3374
+ }
2600
3375
  }
2601
3376
  /* Navigation utilities */
3377
+ /**
3378
+ * Skip link: `<a class="hl-skip-link" href="#main">Skip to content</a>` placed
3379
+ * first in the body. Visually hidden until it receives keyboard focus, then
3380
+ * pinned to the start corner of the viewport. Pure CSS; there is no enhancer.
3381
+ */
2602
3382
  @layer components {
2603
3383
  .hl-skip-link {
2604
3384
  position: absolute;
2605
- left: -9999px;
2606
- top: auto;
2607
- width: 1px;
2608
- height: 1px;
3385
+ inset-inline-start: -9999px;
3386
+ inset-block-start: auto;
3387
+ inline-size: 1px;
3388
+ block-size: 1px;
2609
3389
  overflow: hidden;
2610
3390
  }
2611
3391
 
2612
3392
  .hl-skip-link:focus-visible {
2613
- left: 0;
2614
- top: 0;
2615
- width: auto;
2616
- height: auto;
3393
+ inset-inline-start: 0;
3394
+ inset-block-start: 0;
3395
+ inline-size: auto;
3396
+ block-size: auto;
2617
3397
  padding: var(--hl-space-2) var(--hl-space-3);
2618
3398
  background: var(--hl-fg);
2619
3399
  color: var(--hl-surface);