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.

--color-bg 1.00:1 · failvs bg
--color-surface 1.06:1 · failvs bg
--color-surface-raised 1.12:1 · failvs bg
--color-surface-high 1.21:1 · failvs bg
--color-border 1.20:1 · failvs bg
--color-border-strong 1.45:1 · failvs bg
--color-text 16.38:1 · AAAvs bg
--color-text-muted 7.53:1 · AAAvs bg
--color-text-dim 4.08:1 · AA-lgvs bg
--color-accent 11.90:1 · AAAvs bg
--color-accent-2 15.57:1 · AAAvs bg
--color-accent-soft 1.31:1 · failvs bg
--color-accent-glow 2.37:1 · failvs bg
--color-on-accent 10.02:1 · AAAvs accent
--color-danger 6.97:1 · AAvs bg
--color-danger-soft 1.18:1 · failvs bg
--color-warn 10.97:1 · AAAvs bg
--color-warn-soft 1.28:1 · failvs bg
--color-info 11.61:1 · AAAvs bg
--color-info-soft 1.31:1 · failvs bg
--color-link 9.01:1 · AAAvs bg

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.

--fs-display
Aa
Aa
--fs-h1
The quick fox.
v0.1.0
--fs-h2
The quick fox.
v0.1.0
--fs-h3
The quick fox.
v0.1.0
--fs-h4
The quick fox.
v0.1.0
--fs-lg
The quick brown fox jumps over the lazy dog.
const x = 42; // large mono
--fs-body
The quick brown fox jumps over the lazy dog.
const x = 42; // body mono
--fs-caption
Small print — timestamps, hints, footnotes.
[2026-07-14 12:00:00Z] ok

03 Space scale 8pt grid

--space-1 through --space-12 as horizontal bars. Bar length = value; the whole layout hangs off this scale.

--space-1 4px
--space-2 8px
--space-3 12px
--space-4 16px
--space-5 24px
--space-6 32px
--space-7 48px
--space-8 64px
--space-9 96px
--space-10 128px
--space-11 192px
--space-12 256px

04 Radii, shadows & motion

Corners, elevation, and time — the three ambient design signals.

Radii

--radius-sm · 6px
--radius-md · 10px
--radius-lg · 14px
--radius-xl · 20px
--radius-full · 999px

Shadows

--shadow-1
--shadow-2
--shadow-3
--color-shadow
--color-shadow-hover

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.

--dur-fast · 120ms
--dur-base · 200ms
--dur-slow · 380ms
--dur-slower · 620ms
--ease-emphasized
--ease-decel

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.

.btn--primary
.btn--ghost
.btn--danger
size modifiers
as anchor (<a class="btn">)
forced :focus-visible

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.

--color-bg
--color-surface
--color-surface-raised
--color-surface-high

07 Tags & badges

Tags describe (neutral pill on a raised surface). Badges assert state (filled, mono, uppercase). Choose by intent.

tag tag--label chip badge ok warn danger

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.

A native dialog, tokenized

Shape from --radius-lg, elevation from --color-shadow-hover, backdrop from --alpha-black-50 + backdrop-filter. No custom overlay component required — the browser owns focus trap and Escape-to-close.