Preview brand Custom

Spacing and layout

A 4 px base, a short scale, and one content width. Consistent gaps are what make a page feel calm.

Spacing scale

Steps are multiples of 4 px. Smaller steps space things inside a component; larger steps separate components and sections.

TokenValueSize
0px
4px
8px
12px
16px
20px
24px
32px
40px
48px
56px
64px

Widths and breakpoints

TokenValueUse
1120px
20px
70ch
56ch
68pxFallback; kept in sync by JS in Base.astro
820pxHero text width on home and listing pages
600px
760px
900px
  • Container: content sits in a 1120 px column with 20 px gutters. Full-bleed media can break out of it; text never does.
  • Measure: hero text is capped at 820 px and body text at about 70 characters. Long lines are tiring to read.
  • Breakpoints: three, at 600, 760 and 900 px. Layouts collapse to one column below 900 px and type steps up below 760 px. The header switches to its menu button below 800 px, where its links stop fitting.

Running text

Articles, case studies, legal pages and these docs all space their text with the same four flow tokens, so a paragraph or a heading sits the same distance from its neighbours wherever it appears.

TokenValueUse
16pxBetween paragraphs, lists, figures and other blocks
12pxFrom a heading to the text under it
24pxAbove an h3
32pxAbove an h2

Page sections

Pages built from sections (a home page, a landing page) space them with one token, so the gap between two sections is the same on every page and every site, whatever their style: plain, a full-width band or a dark panel. Each section takes it as padding above its content and adds none below; the next section supplies the gap. A band with a background also takes it inside, top and bottom.

TokenValueUse
clamp(56px, 8vw, 96px)Between page sections, and inside a full-width band

Screens and forms

App screens, forms and dialogs (Somnia CMS, a contact page) space their parts with three stack tokens, through .sn-stack. The gap is the rhythm: the parts inside set no margins of their own, so a new screen spaces like every other.

ClassTokenValueUse
.sn-stack16pxBetween fields, and from a field to a suggestion under it
.sn-stack--group24pxBetween groups: filters, then the list they filter
.sn-stack--section32pxBetween a screen's parts: its bar, adding, finding

Rows of cards

Cards side by side are one height, whatever their words: put them in .sn-tiles (a grid that fills the width with cards at least --sn-tile-min wide, 180 px unless set). Each card fills its cell, so a short name never leaves its card shorter than its neighbour's, and its parts line up along the row. Grids of cards built another way give each card height:100% in a grid that stretches its rows.

Page openings

Every page opens the same way: an optional breadcrumb, heading, lede, with 16 px gaps set by tokens. The gaps attach to the structure (a breadcrumb directly followed by a heading), so a new page gets them without anyone copying CSS. A build-time check warns if a page breaks the pattern. See Page hero.