Spacing

Proximity signals relationship; distance signals importance. The spacing scale encodes this — small gaps within components, large gaps between sections.

Space Scale

Base unit is 12px. All tokens are multiples of 12, except --space-xs (6px = half-unit).

TokenrempxUse
--space-xs0.375rem6pxIcon-to-label gap, tag padding
--space-sm0.75rem12pxTight grouping within a component
--space-md1.5rem24pxStandard gap — when in doubt, start here
--space-lg2.25rem36pxBetween distinct content blocks
--space-xl3rem48pxSection breathing room, major transitions
--space-2xl3.75rem60pxBetween page sections
--space-3xl4.5rem72pxHero padding, top-of-page breathing room
--space-4xl6rem96pxMaximum section gap — use sparingly

Usage Rules

Layout Widths

TokenValueUse
--width-content1080pxOuter page container
--width-prose70chBody copy, articles, long-form text
--width-narrow640pxForms, focused UI, modals

The page container can be wide (--width-content), but readable text should always be constrained to ~70ch (--width-prose). These two values operate independently.

Page Structure

[site header / nav]       — sticky or static, full-width
[hero / page header]      — padding-top: --space-3xl
[content sections]        — gap between sections: --space-2xl
  [section heading]
  [section body]          — max-width: --width-prose or --width-content
[site footer]             — padding: --space-xl top

Grid Pattern

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-md); /* 24px */
}

Use CSS Grid for two-dimensional layouts, flexbox for one-dimensional. Never go beyond 3 columns at --width-content.

Border Radius

Each radius maps to a specific element type. The progression creates implicit hierarchy — larger surfaces have larger radii.

TokenValueUse
--radius-sm4pxBadges, tags, nav link focus ring, checkboxes
--radius-md6pxButtons, inputs, selects, textarea, icon containers
--radius-lg8pxCards, dropdowns, popovers, drawers
--radius-xl12pxLarge panels, featured sections
--radius-full9999pxAvatar circles (one-off use — not for badges)

A badge (4px) sits inside a card (8px) — the radius difference signals containment without needing a border. The system does not use pill-shaped badges.

Z-index Scale

Always reference a token — never use raw numbers. Never skip levels.

TokenValueUse
--z-base0Default page content
--z-raised1Sticky elements in flow (sub-nav tab row)
--z-dropdown100Dropdowns, popovers
--z-sticky200Sticky nav bar, fixed header
--z-overlay300Overlays, mobile nav drawer
--z-modal400Modals
--z-toast500Toast notifications

The nav (--z-sticky: 200) sits below overlays (--z-overlay: 300) — dropdowns triggered inside the nav render correctly above it without adjustment.

Responsive Breakpoints

BreakpointBehaviour
Mobile < 640pxSingle column. Horizontal padding: --space-md (24px)
Tablet 640–1079pxSingle column, centered. Horizontal padding: --space-lg (36px)
Desktop ≥ 1080pxCentered container at --width-content, auto horizontal margins

Avoid fixed pixel breakpoints inside components — use min(), max(), and clamp() where the content dictates the reflow point.