@stnd/styles 0.5.2 → 0.5.4

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.
@@ -1,5 +1,42 @@
1
1
  @use "standard-00-variables" as *;
2
2
 
3
+ /**
4
+ * @component Color System
5
+ * @category Foundation
6
+ * @description Seed-first OKLCH color engine. Set one thing — your light
7
+ * foreground color — and a full light/dark palette, ten semantic hues, and
8
+ * a shadow/elevation scale all derive from it via `oklch(from <seed> ...)`
9
+ * relative color syntax. Override at three depths: set `--color-light-foreground`
10
+ * alone (everything else follows); set individual `--color-light-*` /
11
+ * `--color-dark-*` tokens for per-scheme control; or theme fully via
12
+ * `[data-theme]` selectors, which re-resolve the whole token set at any
13
+ * element, not just `:root`.
14
+ *
15
+ * @property --color-light-foreground The primary light foreground seed. Change this alone and dark mode, all ten chromatic hues, and derived surfaces/borders/shadows follow.
16
+ * @property --color-light-background The root light background seed (default `white`).
17
+ * @property --color-dark-foreground Derived dark reading foreground (default ~85% lightness matching foreground hue).
18
+ * @property --color-dark-background Derived dark background (default ~20% lightness matching foreground hue).
19
+ * @property --color-background Active scheme background token.
20
+ * @property --color-foreground Active scheme foreground token.
21
+ * @property --color-accent Active accent color token (defaults to triadic +120°).
22
+ * @property --color-border Active border color token.
23
+ * @property --color-surface Active elevated surface background.
24
+ * @property --color-muted Active muted text color (~60% opacity).
25
+ * @property --color-subtle Active subtle UI text color (~40% opacity).
26
+ * @property --color-link Semantic link color token.
27
+ * @property --color-success Semantic success status color (`--color-green`).
28
+ * @property --color-warning Semantic warning status color (`--color-orange`).
29
+ * @property --color-error Semantic error status color (`--color-red`).
30
+ * @property --color-info Semantic info status color (`--color-blue`).
31
+ * @property --color-light Polarity alias resolving to the lighter tone of the active scheme.
32
+ * @property --color-dark Polarity alias resolving to the darker tone of the active scheme.
33
+ * @property --shadow Primary ambient shadow preset.
34
+ * @property .theme-light Forces light token set and color scheme on any subtree.
35
+ * @property .theme-dark Forces dark token set and color scheme on any subtree.
36
+ * @property .inverse Flips scheme to whichever mode is not currently active.
37
+ * @property [data-color-mode] Attribute forcing `"light"` or `"dark"` scheme mode.
38
+ */
39
+
3
40
  /* ==========================================================================
4
41
  STANDARD COLOR SYSTEM — Seed-First Architecture
5
42
 
@@ -42,18 +79,15 @@
42
79
  /* Tell browser we support both color schemes */
43
80
  color-scheme: light dark;
44
81
 
45
- /* ===================================================================
46
- STAGE 1: DARK SEED DERIVATION
47
- The ink's soul carries into darkness.
48
- Both dark seeds inherit hue from the light foreground — warm brown
49
- ink begets a warm dark background and a warm soft foreground.
50
- Themes override --color-dark-background / --color-dark-foreground
51
- at [data-theme] specificity for a distinct dark mood.
52
-
53
- Light fg #442f1c → oklch(0.30, 0.07, H≈60) warm brown ink
54
- Dark bg derived → oklch(0.20, 0.02, H≈60) same hue, very dark, muted
55
- Dark fg derived → oklch(0.85, 0.04, H≈60) same hue, soft reading brightness
56
- =================================================================== */
82
+ /**
83
+ * @component Dark Seed Derivation
84
+ * @category Foundation
85
+ * @description Both dark seeds inherit hue from the light foreground seed.
86
+ * Warm ink begets a warm dark background and a warm soft reading foreground.
87
+ *
88
+ * @property --color-dark-background Dark background matching foreground hue at ~20% lightness and muted chroma.
89
+ * @property --color-dark-foreground Dark foreground matching foreground hue at ~85% lightness for soft reading brightness.
90
+ */
57
91
 
58
92
  /* Dark background: foreground's hue at very low lightness, muted chroma */
59
93
  --color-dark-background: oklch(
@@ -71,17 +105,27 @@
71
105
  /* same hue — the vibe persists */
72
106
  );
73
107
 
74
- /* ===================================================================
75
- STAGE 2: LIGHT PALETTE
76
- Full spectrum generated from light foreground seed via inline
77
- relative color syntax. Each color is a self-contained transform:
78
- oklch(from <seed> <safe-L> <safe-C> calc(h + offset))
79
-
80
- Channel keywords l, c, h resolve inside the function scope.
81
- No extraction into intermediate custom properties needed.
82
- Safety: clamp(0.65, l, 0.70) for bright vibrant tones, max(0.12, c) for saturation.
83
- Achromatic seeds (h = none) → none treated as 0 in calc() per spec.
84
- =================================================================== */
108
+ /**
109
+ * @component Light Palette
110
+ * @category Foundation
111
+ * @description Full 10-hue chromatic spectrum generated from light foreground seed via inline relative color syntax.
112
+ *
113
+ * @property --color-light-red Error / Red (+25° hue offset).
114
+ * @property --color-light-orange Attention / Orange (+55° hue offset).
115
+ * @property --color-light-yellow Warning / Yellow (+85° hue offset).
116
+ * @property --color-light-green Success / Green (+145° hue offset).
117
+ * @property --color-light-cyan Info / Cyan (+190° hue offset).
118
+ * @property --color-light-blue Link / Blue (+240° hue offset).
119
+ * @property --color-light-magenta Magic / Magenta (+300° hue offset).
120
+ * @property --color-light-purple Purple (+270° hue offset).
121
+ * @property --color-light-pink Pink (+350° hue offset).
122
+ * @property --color-light-brown Brown (+60° hue offset).
123
+ * @property --color-light-accent-complementary Complementary accent (+180°).
124
+ * @property --color-light-accent-analogous Analogous accent (+30°).
125
+ * @property --color-light-accent-triadic Triadic accent (+120°).
126
+ * @property --color-light-accent-auto Default accent strategy (triadic).
127
+ * @property --color-light-accent Active light mode accent color.
128
+ */
85
129
 
86
130
  /* Error / Red — foreground hue + 25° */
87
131
  --color-light-red: oklch(
@@ -162,14 +206,27 @@
162
206
  --color-light-accent-auto: var(--color-light-accent-triadic);
163
207
  --color-light-accent: var(--color-light-accent-auto);
164
208
 
165
- /* ===================================================================
166
- STAGE 2B: DARK PALETTE
167
- Full spectrum generated from dark foreground seed.
168
- NOT a simple lightening of the light palette — independent vibe.
169
- A warm dark-foreground seed gives warm darks. A cool one gives
170
- cool darks. Two different seeds, two different moods.
171
- Safety: clamp(0.55, l, 0.70) for softer tones on dark surfaces.
172
- =================================================================== */
209
+ /**
210
+ * @component Dark Palette
211
+ * @category Foundation
212
+ * @description Full 10-hue chromatic spectrum generated from dark foreground seed for comfortable dark surfaces.
213
+ *
214
+ * @property --color-dark-red Dark mode red (+25° hue offset).
215
+ * @property --color-dark-orange Dark mode orange (+55° hue offset).
216
+ * @property --color-dark-yellow Dark mode yellow (+85° hue offset).
217
+ * @property --color-dark-green Dark mode green (+145° hue offset).
218
+ * @property --color-dark-cyan Dark mode cyan (+190° hue offset).
219
+ * @property --color-dark-blue Dark mode blue (+240° hue offset).
220
+ * @property --color-dark-magenta Dark mode magenta (+300° hue offset).
221
+ * @property --color-dark-purple Dark mode purple (+270° hue offset).
222
+ * @property --color-dark-pink Dark mode pink (+350° hue offset).
223
+ * @property --color-dark-brown Dark mode brown (+60° hue offset).
224
+ * @property --color-dark-accent-complementary Dark complementary accent (+180°).
225
+ * @property --color-dark-accent-analogous Dark analogous accent (+30°).
226
+ * @property --color-dark-accent-triadic Dark triadic accent (+120°).
227
+ * @property --color-dark-accent-auto Default dark accent strategy.
228
+ * @property --color-dark-accent Active dark mode accent color.
229
+ */
173
230
 
174
231
  /* Error / Red — dark foreground hue + 25° */
175
232
  --color-dark-red: oklch(
@@ -246,10 +303,25 @@
246
303
  /* On-accent (text drawn on accent surfaces) */
247
304
  --color-dark-on-accent: var(--color-dark-background);
248
305
 
249
- /* ===================================================================
250
- STAGE 2C: COMPUTED PALETTES
251
- Always available for explicit "light-in-dark" or "dark-in-light" UI.
252
- =================================================================== */
306
+ /**
307
+ * @component Computed Palettes
308
+ * @category Foundation
309
+ * @description Computed scheme-specific tints for muted text, subtle UI elements, borders, and shadows.
310
+ *
311
+ * @property --color-light-muted Light muted text color (~60% opacity).
312
+ * @property --color-light-subtle Light subtle text color (~40% opacity).
313
+ * @property --color-light-border Light border color (~10% opacity).
314
+ * @property --color-light-surface Light surface background (3% foreground mixed with background).
315
+ * @property --color-light-on-accent Text color drawn on light accent backgrounds.
316
+ * @property --color-dark-muted Dark muted text color (~65% opacity).
317
+ * @property --color-dark-subtle Dark subtle text color (~45% opacity).
318
+ * @property --color-dark-border Dark border color.
319
+ * @property --color-dark-surface Dark surface background.
320
+ * @property --color-light-shadow-base Base shadow seed for light mode.
321
+ * @property --color-light-highlight Base specular highlight for light mode.
322
+ * @property --color-dark-shadow-base Base shadow seed for dark mode.
323
+ * @property --color-dark-highlight Base specular highlight for dark mode.
324
+ */
253
325
 
254
326
  /* Light Computed Palette */
255
327
  --color-light-muted: oklch(from var(--color-light-foreground) l c h / 0.6);
@@ -293,12 +365,32 @@
293
365
  from var(--color-dark-foreground) min(1, calc(l + 0.05)) c h / 0.11
294
366
  );
295
367
 
296
- /* ===================================================================
297
- STAGE 3: SEMANTIC TOKENS (Default → Light Palette)
298
- These are the tokens components actually consume.
299
- Never reference --color-light-* or --color-dark-* in components.
300
- Always use --color-red, --color-background, etc.
301
- =================================================================== */
368
+ /**
369
+ * @component Semantic Tokens
370
+ * @category Foundation
371
+ * @description Semantic color tokens consumed across all components and styles.
372
+ *
373
+ * @property --color-background Active scheme root background.
374
+ * @property --color-foreground Active scheme text foreground.
375
+ * @property --color-accent Active scheme primary accent color.
376
+ * @property --color-header Heading text color.
377
+ * @property --color-red Semantic red hue.
378
+ * @property --color-orange Semantic orange hue.
379
+ * @property --color-yellow Semantic yellow hue.
380
+ * @property --color-green Semantic green hue.
381
+ * @property --color-cyan Semantic cyan hue.
382
+ * @property --color-blue Semantic blue hue.
383
+ * @property --color-magenta Semantic magenta hue.
384
+ * @property --color-purple Semantic purple hue.
385
+ * @property --color-pink Semantic pink hue.
386
+ * @property --color-brown Semantic brown hue.
387
+ * @property --color-success Status color for success states (`--color-green`).
388
+ * @property --color-warning Status color for warnings (`--color-orange`).
389
+ * @property --color-error Status color for errors (`--color-red`).
390
+ * @property --color-info Status color for informative notices (`--color-blue`).
391
+ * @property --color-link Active scheme link color.
392
+ * @property --color-on-accent Text color for elements over accent backgrounds.
393
+ */
302
394
  --color-background: var(--color-light-background);
303
395
  --color-foreground: var(--color-light-foreground);
304
396
  --color-accent: var(--color-light-accent);
@@ -331,11 +423,20 @@
331
423
  variants in all three dark-mode contexts, plus added missing
332
424
  non-OKLCH fallbacks. */
333
425
 
334
- /* ===================================================================
335
- STAGE 4: COMPUTED SEMANTIC COLORS
336
- Derived from the scheme-aware --color-foreground/--color-background.
337
- auto-adapt when the scheme switches.
338
- =================================================================== */
426
+ /**
427
+ * @component Computed Semantics
428
+ * @category Foundation
429
+ * @description Scheme-aware computed colors derived from active foreground and background seeds.
430
+ *
431
+ * @property --color-muted Secondary text color (~60% alpha).
432
+ * @property --color-subtle Tertiary text and decorative icon color (~40% alpha).
433
+ * @property --color-border Standard structural border color (~10% alpha).
434
+ * @property --color-surface Elevated surface and card background.
435
+ * @property --color-light Polarity alias resolving to lighter color of active scheme.
436
+ * @property --color-dark Polarity alias resolving to darker color of active scheme.
437
+ * @property --color-darker Dark overlay tint.
438
+ * @property --color-glass Frosted glassmorphism background color (~80% alpha).
439
+ */
339
440
  --color-muted: var(--color-light-muted);
340
441
  --color-subtle: var(--color-light-subtle);
341
442
  --color-border: var(--color-light-border);
@@ -348,43 +449,25 @@
348
449
 
349
450
  --color-glass: oklch(from var(--color-background) l c h / 0.8);
350
451
 
351
- /* ===================================================================
352
- STAGE 5: SHADOWS & SURFACES
353
- OKLCH-based for perceptually uniform elevation.
354
- All derived from semantic pointers — auto-adapt to dark mode.
355
- =================================================================== */
452
+ /**
453
+ * @component Surfaces & Elevation Colors
454
+ * @category Foundation
455
+ * @description Semantic elevation color seeds and surface hierarchy using perceptual OKLCH color spaces.
456
+ *
457
+ * @property --color-shadow Active base shadow color.
458
+ * @property --color-highlight Active specular highlight color.
459
+ * @property --color-surface-lowest Deepest recessed surface step.
460
+ * @property --color-surface-lower Sub-surface step mixed with transparency.
461
+ * @property --color-surface-low Low elevation surface step.
462
+ * @property --color-surface Base surface color.
463
+ * @property --color-surface-high Elevated surface step.
464
+ * @property --color-surface-highest Highest surface elevation step.
465
+ */
356
466
 
357
467
  /* Semantic Shadow Seeds */
358
468
  --color-shadow: var(--color-light-shadow-base);
359
469
  --color-highlight: var(--color-light-highlight);
360
470
 
361
- /* Shadow building blocks — compose freely */
362
- --shadow-ambient: 0 1px 1px var(--color-shadow); /* Felt more than seen */
363
-
364
- /* This one pop a bit */
365
- --shadow-lift:
366
- 0 4px 6px -1px var(--color-shadow), 0 2px 4px -2px var(--color-shadow);
367
- /* Organicaly grows */
368
- --shadow-glow: 0 4px var(--space) oklch(from var(--color-shadow) l c h / 0.15);
369
- --shadow-inset:
370
- inset 0 1px 3px var(--color-shadow), inset 0 -1px 0 0 var(--color-highlight);
371
- --shadow-ring:
372
- inset 0px 1px 1px var(--color-border),
373
- inset 1px 0px 1px var(--color-border),
374
- inset -1px 0px 1px var(--color-border),
375
- inset 0px -1px 1px var(--color-border);
376
-
377
- /* shadcn-style raised effect: inner highlight + border + shadow */
378
- --shadow-raised:
379
- inset 0 1px 0 0 var(--color-highlight), 0 0 0 1px var(--color-border),
380
- var(--shadow-ambient);
381
-
382
- /* Composed presets. Fixed 2026-07-14 — was accidentally doubled, now
383
- matches the --shadow-lg/-xl progressive pattern (one layer). */
384
- --shadow: var(--shadow-ambient);
385
- --shadow-lg: var(--shadow-ambient), var(--shadow-lift);
386
- --shadow-xl: var(--shadow-ambient), var(--shadow-lift), var(--shadow-glow);
387
-
388
471
  /* Surface elevation scale */
389
472
  --color-surface-low: color-mix(
390
473
  in srgb,
@@ -409,13 +492,23 @@
409
492
  var(--color-surface-high)
410
493
  );
411
494
  --color-surface-higher: color-mix(in srgb, white 50%, transparent);
412
- /* ===================================================================
413
- STAGE 6: DESIGN TOKENS (Border Shorthands)
414
- =================================================================== */
495
+ /**
496
+ * @component Border Shorthands
497
+ * @category Foundation
498
+ * @description Pre-composed border shorthand tokens for clean layout boundaries.
499
+ *
500
+ * @property --border Standard border shorthand (`var(--stroke-width) solid var(--color-border)`).
501
+ * @property --border-accent Tinted accent border shorthand (`var(--stroke-width) solid oklch(...)`).
502
+ * @property --border-transparent Transparent layout placeholder border.
503
+ */
415
504
  --border-transparent: var(--stroke-width) solid transparent;
416
505
  --border-accent: var(--stroke-width) solid
417
506
  oklch(from var(--color-accent) l c h / 0.07);
418
- --border: none;
507
+ /* Regressed to `0 solid transparent` at some point, then a prior audit
508
+ correctly flagged it as dead code but "fixed" it to `none` instead of
509
+ restoring the real value. Git history confirms the intended value —
510
+ unchanged across many commits before the regression — was this. */
511
+ --border: var(--stroke-width) solid var(--color-border);
419
512
  }
420
513
 
421
514
  /* =====================================================================
@@ -494,10 +587,19 @@
494
587
  }
495
588
  }
496
589
 
497
- /* =====================================================================
498
- STAGE 7B: THEME UTILITIES (.inverse, .theme-dark, .theme-light)
499
- Provides explicit control and local context switching.
500
- ===================================================================== */
590
+ /**
591
+ * @component Theme Classes & Mixins
592
+ * @category Foundation
593
+ * @description Utilities and classes for forcing color modes and contextual inversion on subtrees.
594
+ *
595
+ * @property .theme-light Forces light color scheme and tokens on the applied container.
596
+ * @property .theme-dark Forces dark color scheme and tokens on the applied container.
597
+ * @property .inverse Contextually inverts color scheme relative to current background mode.
598
+ * @property [data-theme] Scoped theme attribute allowing local theme switching on cards or panels.
599
+ * @property [data-color-mode] Attribute setting explicit `"light"` or `"dark"` mode.
600
+ * @property @mixin theme-light-tokens Mixin stamping active light palette tokens into a selector.
601
+ * @property @mixin theme-dark-tokens Mixin stamping active dark palette tokens into a selector.
602
+ */
501
603
 
502
604
  @mixin theme-light-tokens {
503
605
  --color-background: var(--color-light-background);
@@ -6,6 +6,27 @@
6
6
  * @description Fine-art typography system using variable fonts, OpenType features,
7
7
  * and mathematical scaling. Implements classical typography rules with modern web capabilities.
8
8
  * Supports multiple font families, optical sizing, and locale-specific rules.
9
+ *
10
+ * @property --font-sans Sans-serif font stack (`"Inter", "Instrument Sans Variable", system-ui, -apple-system, sans-serif`).
11
+ * @property --font-serif Serif font stack (`"Source Serif 4", "Newsreader", "Instrument Serif", serif`).
12
+ * @property --font-monospace Monospace font stack (`"IBM Plex Mono", ui-monospace, monospace`).
13
+ * @property --font-text Semantic body font family (defaults to `--font-sans`).
14
+ * @property --font-header Semantic heading font family (defaults to `"Inter"`).
15
+ * @property --font-interface Semantic UI font family (defaults to `--font-sans`).
16
+ * @property --font-inter-feature OpenType stylistic feature set for Inter font.
17
+ * @property --font-instrument-feature OpenType stylistic feature set for Instrument Sans.
18
+ * @property --font-weight Normal text font weight (`400`).
19
+ * @property --font-weight-bold Bold text font weight (`600`).
20
+ * @property --font-header-weight Heading font weight anchor (`700`).
21
+ * @property --font-weight-h1 Level 1 heading weight.
22
+ * @property --font-weight-h2 Level 2 heading weight.
23
+ * @property --font-weight-h3 Level 3 heading weight.
24
+ * @property --font-weight-h4 Level 4 heading weight.
25
+ * @property --font-weight-h5 Level 5 heading weight.
26
+ * @property --font-weight-h6 Level 6 heading weight.
27
+ * @property --font-letter-spacing Body letter spacing default (`normal`).
28
+ * @property --font-header-letter-spacing Heading letter spacing default (`normal`).
29
+ * @property --list-indent Default list item indentation (`var(--space)`).
9
30
  */
10
31
 
11
32
  #{$stnd-theme-scope} {
@@ -38,7 +59,11 @@
38
59
  --font-weight-bold: 600;
39
60
  --font-letter-spacing: normal;
40
61
  --font-header-letter-spacing: normal;
41
- --font-header-line-height: 1;
62
+ /* Intentionally unset: leaving this undefined lets grid-line-height()'s
63
+ per-level $tightness (h1 1.05, h2/h3 1.15, h4-6 1.3) act as the real
64
+ default. A theme or note can still override by setting this explicitly —
65
+ but defining it here to a literal value would shadow every level's
66
+ tightness with the same number, which is the bug this avoids. */
42
67
  --font-header-weight: 700;
43
68
 
44
69
  /* Interface Tokens */
@@ -146,7 +171,23 @@ h6 {
146
171
  line-height: var(--line-height);
147
172
  }
148
173
 
149
- /* Typography Patterns */
174
+ /**
175
+ * @component Typography Elements & Patterns
176
+ * @category Typography
177
+ * @description Headings, inline styling, small-caps overlines, keycaps, marks, and blockquotes.
178
+ *
179
+ * @property .overline Small-caps letterspaced kicker label with top border rule.
180
+ * @property .bold Strong bold text weight utility.
181
+ * @property .menu UI interface font role application.
182
+ * @property .ui UI interface font role application.
183
+ * @property .interface UI interface font role application.
184
+ * @property .font-interface Explicit interface font family utility.
185
+ * @property .font-mono Monospace font family utility.
186
+ * @property mark Highlight mark element with optical trim padding and theme tinting.
187
+ * @property kbd Keyboard keycap with raised shadow and monospace font.
188
+ * @property a:hover Color and underline accent transition for hyperlinks.
189
+ * @property a[target="_blank"] External link with automatic arrow indicator (`↗`).
190
+ */
150
191
  .overline {
151
192
  font-variant-caps: small-caps;
152
193
  letter-spacing: 0.04em;
@@ -231,67 +272,11 @@ pre,
231
272
  font-variation-settings: var(--font-monospace-variation);
232
273
  }
233
274
 
234
- .stnd-code-block {
235
- position: relative;
236
- background: var(--color-surface-low);
237
- border-radius: var(--radius-sm);
238
- box-shadow: var(--shadow-inset), var(--shadow-ring);
239
- transition: all var(--transition);
240
-
241
- pre {
242
- margin: 0 !important;
243
- background: transparent !important;
244
- box-shadow: none !important;
245
- border: none !important;
246
- padding: var(--space-d2);
247
- overflow-x: auto;
248
- position: static;
249
- }
250
-
251
- &:hover .copy-button {
252
- opacity: 1;
253
- }
254
- }
255
-
256
- .copy-button {
257
- position: absolute;
258
- top: var(--leading);
259
- right: var(--leading);
260
- opacity: 0;
261
-
262
- &:hover {
263
- opacity: 1 !important;
264
- color: var(--color-on-accent);
265
- background-color: var(--color-accent);
266
- }
267
-
268
- &.copied {
269
- color: var(--color-success, #22c55e) !important;
270
- }
271
-
272
- &.failed {
273
- color: var(--color-error, #ef4444) !important;
274
- }
275
- }
276
-
277
- pre {
278
- line-height: var(--line-height-compact);
279
-
280
- code {
281
- opacity: 0.75;
282
- transition: opacity var(--transition);
283
- }
284
-
285
- &:hover code {
286
- opacity: 1;
287
- }
288
- }
289
-
290
275
  blockquote {
291
276
  font-style: italic;
292
277
  color: var(--color-muted);
293
278
  padding: var(--space);
294
- border-left: var(--stroke-width-l) solid var(--color-border);
279
+ border-left: var(--stroke-width-lg, 2px) solid var(--color-border);
295
280
 
296
281
  cite {
297
282
  display: block;
@@ -300,7 +285,7 @@ blockquote {
300
285
  }
301
286
  }
302
287
 
303
- /* Utilities */
288
+ /* Utilities & Inline Elements */
304
289
  small {
305
290
  font-size: var(--size-sm);
306
291
  }
@@ -326,77 +311,54 @@ em {
326
311
  font-style: italic;
327
312
  }
328
313
 
314
+ /* Mark highlighting */
315
+ mark {
316
+ background: oklch(from var(--color-yellow) l c h / 0.3);
317
+ color: color-mix(in oklch, var(--color-yellow) 30%, var(--color-foreground));
318
+ padding: var(--trim);
319
+ padding-top: 0.1em;
320
+ }
321
+
322
+ /* Keycaps */
323
+ kbd {
324
+ background-color: var(--color-surface);
325
+ background-image: var(--effect-grain);
326
+ border: none;
327
+ border-radius: var(--radius);
328
+ box-shadow: var(--shadow-raised);
329
+ padding: var(--space-d6) var(--space-d3);
330
+ font-family: var(--font-monospace);
331
+ font-size: var(--size-xs);
332
+ pointer-events: none;
333
+ }
334
+
329
335
  /**
330
- * @component Design Tokens
331
- * @category Foundation
332
- * @description Primitive design tokens forming the foundation of the design system.
333
- * Includes "Self-Aware" fluid typography that scales based on the Optical Ratio.
336
+ * @component Heading Rhythm & Grid Snapping
337
+ * @category Typography
338
+ * @description Half-baseline rhythm snapping mixin for heading hierarchy.
334
339
  *
335
- * This block redeclares --font-size and --line-height, silently superseding
336
- * the flat --font-size: 1rem set in _standard-01-token.scss (same selector,
337
- * this file loads later in standard.scss's @use order, so this wins) —
338
- * deliberate layering (naive default → fluid enhancement), not a conflict,
339
- * but non-obvious without reading both files.
340
+ * @property @mixin grid-line-height Heading line-height mixin snapping leading to half-baseline rhythm increments.
340
341
  */
341
342
 
342
- #{$stnd-theme-scope} {
343
- /* ===== 2. THE META-COGNITION (Fluid Slopes) =====
344
- Instead of magic numbers, we use the Ratio to determine "Physics".
345
-
346
- Slope: (Ratio - 1).
347
- - Golden (0.618) -> steep slope (fast growth).
348
- - Silver (0.414) -> moderate slope.
349
- */
350
- --physics-slope: calc(var(--optical-ratio) - 1);
351
-
352
- /* Growth Factor: How aggressive is the resizing?
353
- We multiply the slope by 1vw to create a viewport-relative unit. */
354
- --fluid-growth: calc(var(--physics-slope) * 0.5vw);
355
-
356
- /* Tension Factor: How much do we tighten leading as we grow?
357
- Higher ratios need more tension to keep large text readable. */
358
- --fluid-tension: calc(var(--physics-slope) * 0.3vw);
359
-
360
- /* ===== 3. FLUID TYPOGRAPHY =====
361
- Base size starts at 1rem and grows according to the Physics Slope.
362
- */
363
- --base-size: var(--font-text-size, 1rem);
364
-
365
- --font-size: clamp(
366
- var(--base-size),
367
- calc(var(--base-size) + var(--fluid-growth)),
368
- calc(var(--base-size) * 1.5)
369
- );
370
-
371
- /* ===== 4. FLUID LINE HEIGHT =====
372
- This is the "Next Level" logic.
373
- Start with the Optical Ratio as the base breathing room (in ems).
374
- As the screen (and font) grows, SUBTRACT the Tension Factor.
375
-
376
- Why? Large text (Desktop) needs TIGHTER leading than small text (Mobile).
377
- A steep ratio (Golden) creates huge text, so it applies MORE tension.
378
- */
379
- --line-height: clamp(
380
- 1.15,
381
- calc(var(--optical-ratio) - (var(--fluid-tension) / 1vw)),
382
- 1.65
383
- );
384
- }
385
-
386
343
  @mixin grid-line-height($tightness: 1.1) {
387
344
  /* The "Target" is simply the font-size * tightness, unless a note
388
345
  overrides it via --font-header-line-height in frontmatter */
389
346
  --target-lh: calc(1em * var(--font-header-line-height, #{$tightness}));
390
347
 
391
- /* The Snap: Force it to be a multiple of --baseline */
392
- line-height: round(up, var(--target-lh), var(--baseline)) !important;
348
+ /* The Snap: force it to be a multiple of *half* a baseline, not a whole
349
+ one. Whole-baseline snapping wastes up to ~1 baseline in the worst case
350
+ (target just above a multiple) — brutal on smaller headings whose
351
+ font-size is close to or under one baseline (e.g. h2/h3). Half-baseline
352
+ halves that worst case while still landing on the page's rhythm every
353
+ two headings. */
354
+ line-height: round(up, var(--target-lh), calc(var(--baseline) / 2)) !important;
393
355
 
394
356
  /* Why 'up'?
395
357
  'nearest' might snap down and cause letters to clash.
396
358
  'up' ensures we always have *at least* enough room. */
397
359
  }
398
360
 
399
- /* Usage in your Header sizes */
361
+ /* Usage in Header sizes */
400
362
  h1 {
401
363
  /* Giant text needs very tight leading (1.05x), then snap up */
402
364
  @include grid-line-height(1.05);
@@ -8,14 +8,18 @@
8
8
  * asymmetric layouts, gap variants (compact/normal/wide), and responsive column changes.
9
9
  * All gaps align to the vertical rhythm system.
10
10
  *
11
- * @prop {class} .grid 12-column grid container
12
- * @prop {class} .col-1 through .col-12 Column span modifiers (direct children of .grid)
13
- * @prop {class} .sm\:col-* Responsive columns at max-width 768px (mobile)
14
- * @prop {class} .lg\:col-* Responsive columns at min-width 1024px (desktop)
15
- * @prop {class} .start-{n} Start column position (1-12)
16
- * @prop {class} .grid.no-gap Removes row-gap
17
- * @prop {class} .grid.compact Compact gap (--trim)
18
- * @prop {class} .grid.relaxed Wide gap (--space)
11
+ * @property .grid 12-column Swiss-style responsive grid container with automatic column flow.
12
+ * @property .grid-row Grid container with row flow.
13
+ * @property .grid-{n} Explicit n-column grid container (1 to 12 columns).
14
+ * @property .col-{n} Column span modifiers (1 to 12 columns, direct children of .grid).
15
+ * @property .start-{n} Column start position (1 to 12).
16
+ * @property .grid.no-gap Removes grid row gap.
17
+ * @property .grid.compact Compact gap variant aligned to `--trim`.
18
+ * @property .grid.relaxed Relaxed gap variant aligned to `--space`.
19
+ * @property .sm:col-{n} Responsive column spans at mobile viewport (<=768px).
20
+ * @property .sm:grid-{n} Responsive column grid count at mobile viewport (<=768px).
21
+ * @property .lg:col-{n} Responsive column spans at desktop viewport (>=1024px).
22
+ * @property .lg:grid-{n} Responsive column grid count at desktop viewport (>=1024px).
19
23
  *
20
24
  * @example
21
25
  * // Basic 12-column grid with equal width columns