How This Site Uses Design Tokens
How this site's layered design tokens keep color, typography, motion, focus, and expressive pages consistent without replacing Tailwind utilities.
Design tokens are useful when they capture a decision, not just a value.
This site uses tokens to keep its quiet editorial baseline consistent across light and dark themes. Tailwind utilities still do most of the layout and component styling. The tokens give those utilities a shared vocabulary.
Start With Foundations
The first layer describes the visual ingredients: ink, paper, surface, supporting text colors, borders, and the cyan, violet, and magenta palette.
These values live in Tailwind’s @theme block, so they work as both CSS custom properties and utilities:
<p class="text-muted">Supporting copy</p>
<div class="border border-line bg-surface">A quiet surface</div>
Each color has a dependable fallback. Browsers with wide-gamut support receive OKLCH versions, and dark mode overrides the same token names. Components do not need separate light and dark classes.
Name the Role When It Matters
A palette name explains what a color is. A semantic name explains what it does.
The site therefore adds a small role-based layer on top of the palette:
--color-link: var(--color-cyan);
--color-focus: var(--color-cyan);
--color-control-bg: var(--color-surface);
--color-control-border: var(--color-line-strong);
--color-on-accent: var(--color-paper);
That distinction matters for interactive elements. A link can use text-link because its role is stable even if the accent color changes later. Decorative cyan details can continue to use cyan directly because their color is the decision.
The semantic layer stays deliberately small. Naming every possible combination would make the system harder to understand than the raw values.
Keep Tailwind as the Working Language
Tokens do not replace utilities here. Page composition remains visible in the templates through classes such as grid, gap-6, max-w-6xl, and text-pretty.
Only four frequently repeated patterns have shared component classes:
page-shellsets the standard page width, gutters, and vertical padding.site-linkapplies the shared link color and underline treatment.panelcreates the common bordered surface.icon-buttonshares circular control, hover, and focus behavior.
Those classes are built with @apply. Size, placement, and context still stay in the template as Tailwind utilities. The abstraction removes repetition without hiding the page structure.
Tokenize Behavior, Too
Color is only one part of the system. Motion and focus need consistency just as much.
Ordinary interactions use a short duration scale:
--duration-instant: 120ms;
--duration-fast: 160ms;
--duration-moderate: 220ms;
--duration-slow: 320ms;
Page transitions keep separate, purpose-specific durations because navigation choreography is not the same as a hover state.
Focus outlines share width, offset, halo size, and color tokens. This keeps keyboard feedback consistent across native controls, custom icon buttons, and more expressive interactive demos.
Typography follows the same approach. Heading tracking and leading are named decisions, while article copy uses a 17px prose size, 1.75 line height, and 68ch measure through Tailwind theme tokens.
Let Expressive Pages Extend the System
The GSAP animation playground is intentionally louder than the rest of the site. Forcing all of its carnival styling into the global theme would make both systems worse.
Instead, the page defines scoped tokens for amber, cream, nighttime stages, pill geometry, and signature animation timing. Shared roles still come from the global system:
- Links and controls use the semantic interaction colors.
- Standard hover transitions use the global motion scale.
- Keyboard outlines use the global focus primitives.
- Carnival colors, irregular shapes, and theatrical shadows remain local.
This creates a useful boundary: global tokens describe the site; scoped tokens describe the experience.
Know What Not to Tokenize
Not every number deserves a name. A value should usually become a token when it is repeated, theme-dependent, meaningful across components, or likely to change as one decision.
One-off layout adjustments, optical corrections, and expressive effects can stay where they are used. Turning those details into global tokens would add indirection without adding consistency.
The practical rule is simple: tokenize decisions that should move together.
That keeps the design system small enough to remember, flexible enough for unusual pages, and close enough to the markup that the site remains easy to work on.