Design-system styleguide
01 Palette semantic tokens
Every semantic token from design/tokens.css,
rendered as a swatch with its computed value and contrast ratio
against --color-bg. Values and
ratios are computed at runtime from the live cascade, so they
reflect whatever theme is active.
Ratios are computed with the WCAG 2.x relative-luminance formula against the current
--color-bg. A badge marked AA
clears 4.5:1 for body text; AAA clears 7:1. Alpha tokens
are composited over --color-bg before measurement.
02 Type scale fluid clamp()
Every --fs-* size, rendered in
the sans and mono families. The preview column resizes fluidly
with the viewport — the values are clamp()s,
not fixed steps.
03 Space scale 8pt grid
--space-1 through
--space-12 as horizontal bars.
Bar length = value; the whole layout hangs off this scale.
04 Radii, shadows & motion
Corners, elevation, and time — the three ambient design signals.
Radii
Shadows
Motion
Dots slide back and forth using each token's duration.
Respects prefers-reduced-motion — the
--dur-* values collapse to
~0ms in that mode via a single override in tokens.css.
05 Buttons .btn family
Every variant and every state. Focus rings appear when you tab onto a button — try it. Disabled buttons keep their shape but suppress interaction cues.
06 Cards & surfaces
Surfaces stack from --color-bg
(page) → --color-surface (card)
→ --color-surface-raised (card
on card) → --color-surface-high
(nested inside raised).
.card
Standard surface. Border + radius + shadow-1. Hover flips the
border to --color-accent.
.card.card--raised
Same shape, elevated background. Use inside another card or when you need visual weight without another border.
Nested surfaces
A raised card inside a card. Border tokens are alpha-tinted so they blend against any surface.
07 Tags & badges
Tags describe (neutral pill on a raised surface). Badges assert state (filled, mono, uppercase). Choose by intent.
08 Code & kbd
Inline code--inline for short
references inside body copy; .code
for standalone blocks. Horizontal scroll on overflow so long
lines don't stretch the layout.
// Consume a semantic token, never a primitive.
button {
background: var(--color-accent);
color: var(--color-on-accent);
border-radius: var(--radius-md);
transition: background var(--dur-fast) var(--ease-standard);
}
Press ? for shortcuts, or Ctrl + K to open the command palette. Reviewers press T to flip the theme.
09 Section headers & nav
The numbered 00 — heading with
a thin underline is the site's spine. Both the legacy
.h-idx and the new BEM
.section-header__idx class
produce the same visual.
00 Legacy — .h-idx since v0
00 New — .section-header__idx BEM
10 Dialog native <dialog>
The .dialog class styles the
native <dialog> element.
Open via .showModal(); close on
Escape or the close button.