Layout and typography
Layout primitives only place boxes: the gaps and widths come from the space tokens, and each takes a public --nw-* input where a measure has to vary per page. The typography roles and the motif utilities finish the page.
.nw-container
Section titled “.nw-container”A centered column with gutters. --nw-container-max overrides the width of one container, --nw-container-pad its gutter.
<div class="nw-stack nw-stack-sm"> <div class="nw-container nw-container-xs" style="block-size: 2.5rem; background: var(--nw-canvas-sunken)">xs 32rem</div> <div class="nw-container nw-container-sm" style="block-size: 2.5rem; background: var(--nw-canvas-sunken)">sm 40rem</div> <div class="nw-container" style="block-size: 2.5rem; background: var(--nw-canvas-sunken)">md 72rem (default)</div> <div class="nw-container nw-container-xl" style="block-size: 2.5rem; background: var(--nw-canvas-sunken)">xl 90rem</div></div>| Class / property | Effect |
|---|---|
nw-container |
A centered column, min(72rem, 100% - 2 * 1rem). |
nw-container-xs … nw-container-xl |
32rem, 40rem, 56rem, 72rem (default) and 90rem. |
nw-container-prose |
A 68ch measure for reading pages. |
nw-container-fluid |
Full width, still centered (for a bounded strip). |
nw-container-start |
Left-aligned instead of centered. |
nw-container-flush |
No gutters, for a strip inside its own padding. |
--nw-container-max, --nw-container-pad |
One container’s width and gutter. |
.nw-stack and .nw-spacer
Section titled “.nw-stack and .nw-spacer”nw-stack is a column of boxes. nw-stack-split pushes the last child to the end; the alignment classes center or end it instead.
<div class="nw-stack"> <div class="nw-card nw-card-sm">First</div> <div class="nw-card nw-card-sm">Second</div> <div class="nw-card nw-card-sm">Last, pushed to the end by nw-stack-split</div></div><div class="nw-stack nw-stack-sm"> <div class="nw-card nw-card-sm">A small gap (0.5rem)</div> <div class="nw-card nw-card-sm">Between these two cards</div></div>| Class / property | Effect |
|---|---|
nw-stack |
A column with a 1rem gap. |
nw-stack-split |
The last child sits at the end (a footer in a sidebar). |
nw-stack-start, nw-stack-center, nw-stack-end |
Alignment of the children. |
nw-stack-xs … nw-stack-xl |
Gaps 0.25rem, 0.5rem, 1rem (default), 1.5rem and 2.5rem. |
nw-gap-none |
No gap, on any of the three primitives. |
nw-spacer |
flex: 1: an invisible child that pushes the rest apart. |
.nw-cluster
Section titled “.nw-cluster”nw-cluster is a wrapping row of boxes: controls, chips, metadata.
<div class="nw-cluster"> <span class="nw-badge nw-badge-soft">Wrapping</span> <span class="nw-badge nw-badge-soft">Row</span> <span class="nw-badge nw-badge-soft">Of</span> <span class="nw-badge nw-badge-soft">Boxes</span> <span class="nw-badge nw-badge-soft">That</span> <span class="nw-badge nw-badge-soft">Wrap</span></div><div class="nw-cluster nw-cluster-between"> <span>Between spreads</span> <span>its ends</span></div><div class="nw-cluster nw-cluster-top"> <span class="nw-card nw-card-sm">Top-aligned</span> <span class="nw-card">Taller box</span></div>| Class / property | Effect |
|---|---|
nw-cluster |
A wrapping, centered row with a 0.75rem gap. |
nw-cluster-start, -center, -end, -between |
Alignment of the row. |
nw-cluster-baseline |
Baseline-aligned (text rows of mixed sizes). |
nw-cluster-top |
Top-aligned. |
nw-cluster-nowrap |
One line, clipped at the end. |
nw-cluster-xs … nw-cluster-xl |
Gaps 0.25rem to 2.5rem. |
.nw-grid
Section titled “.nw-grid”nw-grid lays out as many equal columns as fit --nw-grid-min (16rem by default); a fixed count folds on narrow screens.
<div class="nw-grid"> <div class="nw-card nw-card-sm">A card</div> <div class="nw-card nw-card-sm">In a grid</div> <div class="nw-card nw-card-sm">That fits</div> <div class="nw-card nw-card-sm">As many</div> <div class="nw-card nw-card-sm">As the minimum allows</div></div><div class="nw-grid nw-grid-3 nw-grid-dense"> <div class="nw-card nw-card-sm">One</div> <div class="nw-card nw-card-sm nw-span-2">Two, spanning 2 columns</div> <div class="nw-card nw-card-sm nw-span-full">Full width, on its own row</div></div>| Class / property | Effect |
|---|---|
nw-grid |
repeat(auto-fit, minmax(min(100%, var(--nw-grid-min)), 1fr)). |
nw-grid-fill |
auto-fill instead: empty tracks count. |
nw-grid-2, -3, -4, -6 |
Fixed counts; 3 and 4 fold to fewer columns under 40rem. |
nw-grid-dense |
Backfills earlier rows. |
nw-grid-start, -center |
Alignment of items in their tracks. |
nw-span-2, nw-span-3, nw-span-full |
An item that spans tracks; spans fold under 40rem. |
nw-grid-xs … nw-grid-xl |
Gaps. |
--nw-grid-min |
The smallest column, per page or per grid. |
.nw-sidebar and .nw-center
Section titled “.nw-sidebar and .nw-center”nw-sidebar is a fixed-measure aside beside content that takes the rest, stacking when the content would fall under half the width. nw-center is a measure-limited, centered block.
A measure-limited, centered block: 60ch unless --nw-center-max says otherwise.
<div class="nw-sidebar"> <nav class="nw-sidenav" aria-label="Sections"> <span class="nw-sidenav-label">Filter</span> <ul class="nw-sidenav-list"> <li><a class="nw-sidenav-link" href="#nw-sidebar-and-nw-center" aria-current="page"><span class="nw-sidenav-text">All</span></a></li> <li><a class="nw-sidenav-link" href="#nw-sidebar-and-nw-center"><span class="nw-sidenav-text">Online</span></a></li> </ul> </nav> <div class="nw-stack"> <div class="nw-card nw-card-sm">Content takes the rest of the row.</div> <div class="nw-card nw-card-sm">The sidebar is 16rem unless --nw-sidebar-size says otherwise.</div> </div></div><div class="nw-center nw-center-text"> <p class="nw-lead">A measure-limited, centered block: 60ch unless --nw-center-max says otherwise.</p></div>| Class / property | Effect |
|---|---|
nw-sidebar |
A wrapping row: the first child at 16rem, the second takes the rest. |
nw-sidebar-end |
The aside on the inline-end side. |
nw-sidebar-top |
The aside aligns to the top instead of stretching. |
--nw-sidebar-size |
The aside’s measure. |
nw-center |
A centered block, at most 60ch. |
nw-center-text |
Centers the text too. |
nw-center-intrinsic, nw-center-xy |
Centers the children as a column; centers them in both axes. |
--nw-center-max |
The block’s measure. |
.nw-frame and .nw-shell
Section titled “.nw-frame and .nw-shell”A frame is a box with a fixed ratio whose media covers it. A shell is the app grid: navbar on top, sidenav at the side, main content, optional footer.
<div class="nw-cluster nw-cluster-top"> <div class="nw-frame"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 90'%3E%3Cdefs%3E%3ClinearGradient id='f' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%236d6bff'/%3E%3Cstop offset='1' stop-color='%23d36bff'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='160' height='90' fill='url(%23f)'/%3E%3C/svg%3E" alt="" width="160" height="90" /></div> <div class="nw-frame nw-frame-square"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 90 90'%3E%3Cdefs%3E%3ClinearGradient id='s' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23e6c017'/%3E%3Cstop offset='1' stop-color='%232fd658'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='90' height='90' fill='url(%23s)'/%3E%3C/svg%3E" alt="" width="90" height="90" /></div> <div class="nw-frame nw-frame-portrait" style="inline-size: 6rem"><img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 90 120'%3E%3Cdefs%3E%3ClinearGradient id='p' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23e6c017'/%3E%3Cstop offset='1' stop-color='%23d36bff'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='90' height='120' fill='url(%23p)'/%3E%3C/svg%3E" alt="" width="90" height="120" /></div></div>| Class / property | Effect |
|---|---|
nw-frame |
A 16/9 box; the media inside covers it. |
nw-frame-square, -portrait, -wide |
1/1, 3/4 and 21/9. |
--nw-frame-ratio |
Any other ratio. |
| Class | Effect |
|---|---|
nw-shell |
The app grid, at least one viewport tall: nav nav / side main / foot foot. |
nw-shell-nav, nw-shell-main |
The navbar row and the main cell (give main a nw-container). |
nw-shell-side, nw-shell-foot |
The side rail and the footer row. |
nw-shell-side-end |
The rail on the inline-end side. |
nw-shell-side-open, nw-shell-side[data-state="open"] |
Under 48rem the rail leaves the grid and comes back as an overlay while open, sliding by --nw-slide-distance. |
Typography classes
Section titled “Typography classes”Every heading level is one rule shared by the element and its class, so any tag can carry any role. The roles sit in the base layer, below every component, so a component’s own type wins.
Typography
Display
Heading 1
Heading 2
Heading 3
A lead paragraph introduces a page in the muted ink.
nw-mono is the Martian Mono face for code, keys and labels.
Text levels: muted, subtle, faint, disabled. Intent inks: primary, secondary, tertiary, info, success, warning, danger.
Pinned sizes: xs sm base lg 2xl
<div class="nw-stack nw-stack-sm"> <p class="nw-eyebrow">Typography</p> <h2 class="nw-display">Display</h2> <h3 class="nw-h1">Heading 1</h3> <h3 class="nw-h2">Heading 2</h3> <h3 class="nw-h3">Heading 3</h3> <p class="nw-lead">A lead paragraph introduces a page in the muted ink.</p> <p class="nw-mono">nw-mono is the Martian Mono face for code, keys and labels.</p> <p> Text levels: <span class="nw-text-muted">muted</span>, <span class="nw-text-subtle">subtle</span>, <span class="nw-text-faint">faint</span>, <span class="nw-text-disabled">disabled</span>. Intent inks: <span class="nw-text-primary">primary</span>, <span class="nw-text-secondary">secondary</span>, <span class="nw-text-tertiary">tertiary</span>, <span class="nw-text-info">info</span>, <span class="nw-text-success">success</span>, <span class="nw-text-warning">warning</span>, <span class="nw-text-danger">danger</span>. </p> <p>Pinned sizes: <span class="nw-text-xs">xs</span> <span class="nw-text-sm">sm</span> <span class="nw-text-base">base</span> <span class="nw-text-lg">lg</span> <span class="nw-text-2xl">2xl</span></p></div>| Class | Effect |
|---|---|
nw-display |
The page headline: a fluid clamp, weight 700, tight leading. |
nw-h1 … nw-h6 |
The six heading levels, on any element. |
nw-lead |
An intro paragraph: xl, relaxed, muted ink. |
nw-eyebrow |
The mono, uppercase, primary-colored kicker above a heading. |
nw-mono |
The Martian Mono face for code, keys and labels. |
nw-text-2xs … nw-text-7xl |
The type scale, as single-purpose utilities. |
nw-text-muted, -subtle, -faint, -disabled |
The four levels below the default foreground. |
nw-text-primary … -danger |
Intent inks for text. |
.nw-prose
Section titled “.nw-prose”nw-prose gives bare elements their rhythm for long-form content: heading levels, list markers in the primary ink, blockquotes with hairlines, code on a well, tables with rules. Its descendant selectors stay inside :where(), so a role class or a component inside prose always wins.
Long-form content
Bare elements get their rhythm: headings keep their levels, paragraphs relax, lists get markers in the primary ink, and code sits on a well.
A quoted line gets its hairline:
Every wire carries a story; ours carry packets.
- Markers are primary.
- Links keep the primary ink and brighten on hover.
- Term
- Its detail.
Small prose: 0.875rem, for sidebars and captions.
<div class="nw-prose"> <h2>Long-form content</h2> <p>Bare elements get their rhythm: headings keep their levels, paragraphs relax, lists get markers in the primary ink, and <code>code</code> sits on a well.</p> <p>A quoted line gets its hairline:</p> <blockquote><p>Every wire carries a story; ours carry packets.</p></blockquote> <ul> <li>Markers are primary.</li> <li><a href="#nw-prose">Links</a> keep the primary ink and brighten on hover.</li> </ul> <dl><dt>Term</dt><dd>Its detail.</dd></dl></div><div class="nw-prose nw-prose-sm"> <p>Small prose: 0.875rem, for sidebars and captions.</p></div>| Class | Effect |
|---|---|
nw-prose |
A 68ch measure, base size, relaxed leading, muted ink. |
nw-prose-sm, nw-prose-lg |
Smaller and larger prose. |
nw-prose-wide |
No measure limit. |
nw-prose-scroll |
A <pre> inside scrolls instead of widening the column. |
Effect utilities
Section titled “Effect utilities”The signature motifs, as standalone utilities. They sit in @layer utilities, so they win over component styles.
Cut corners
Section titled “Cut corners”nw-cut chamfers the top-right and bottom-left corners by --nw-cut (10px by default). The element paints its own chamfered fill through --nw-fill and stays unclipped, so focus outlines and child popovers are not cut; ::before adds the 1px edge from --nw-edge on top of the content. A cut element glows through a drop-shadow filter, because a box-shadow would trace the unclipped rectangle.
A cut element paints its own chamfered fill through --nw-fill and its edge through --nw-edge; --nw-cut sets the size.
<div class="nw-cluster"> <div class="nw-cut" style="padding: var(--nw-space-4); background: none; --nw-fill: var(--nw-panel); width: 10rem">nw-cut</div> <div class="nw-cut nw-wire" style="padding: var(--nw-space-4); --nw-fill: var(--nw-panel); width: 10rem">cut + wire</div> <div class="nw-cut nw-glow-md" style="padding: var(--nw-space-4); --nw-fill: var(--nw-panel); --nw-glow-color: var(--nw-secondary); width: 10rem">cut + glow</div></div><p>A cut element paints its own chamfered fill through <code class="nw-code">--nw-fill</code> and its edge through <code class="nw-code">--nw-edge</code>; <code class="nw-code">--nw-cut</code> sets the size.</p>| Class / property | Effect |
|---|---|
nw-cut |
Chamfered corners on any box. Replaced elements (img, video, canvas, svg, iframe) are clipped directly instead: they have no pseudo-elements and no fill to paint, so they cannot glow; wrap one to give it a glow. |
--nw-cut |
The cut size. |
--nw-fill |
The cut surface’s paint (a flat color). |
--nw-edge |
The cut edge’s paint (any paint, the line color by default). |
Wire edge
Section titled “Wire edge”nw-wire draws the 1px indigo-to-synth gradient border with the padding-box/border-box background trick, so its fill must be opaque. nw-wire-glow adds the bloom. On a cut surface the wire is the edge paint, which also works over a translucent fill.
<div class="nw-cluster"> <div class="nw-wire" style="padding: var(--nw-space-3) var(--nw-space-4)">nw-wire</div> <div class="nw-wire nw-wire-glow" style="padding: var(--nw-space-3) var(--nw-space-4)">nw-wire-glow</div></div><div class="nw-cluster"> <span class="nw-glow-sm" style="padding: var(--nw-space-2) var(--nw-space-3); background: var(--nw-panel)">glow-sm</span> <span class="nw-glow-md" style="padding: var(--nw-space-2) var(--nw-space-3); background: var(--nw-panel)">glow-md</span> <span class="nw-glow-lg" style="padding: var(--nw-space-2) var(--nw-space-3); background: var(--nw-panel)">glow-lg</span> <span class="nw-glow-danger" style="padding: var(--nw-space-2) var(--nw-space-3); background: var(--nw-panel)">glow-danger</span> <span class="nw-text-glow">text-glow</span></div>Neon glow
Section titled “Neon glow”| Class | Effect |
|---|---|
nw-glow-sm, nw-glow-md, nw-glow-lg |
A neon bloom in --nw-glow-color (primary by default). |
nw-glow-primary … nw-glow-danger |
Set the color in one class. |
nw-text-glow |
A bloom in the text’s own ink. |
nw-wire-glow |
The bloom on a wire edge. |
Glows are quieter in the lumen flavor: the shadows scale by --nw-flavor-dark, the flag the palette sets per flavor.
Scanlines, grid and glitch
Section titled “Scanlines, grid and glitch”nw-scanlines overlays the scanline pattern through ::after; nw-grid-bg paints the 32px circuit grid, with a node on every fourth crossing; nw-glitch plays one 480ms burst when its text, or the link or button around it, is hovered or focused. The glitch is disabled under prefers-reduced-motion: reduce.
One burst on hover or focus: nw-glitch
<div class="nw-cluster"> <div class="nw-scanlines" style="block-size: 4rem; inline-size: 14rem; background: var(--nw-canvas-sunken)">nw-scanlines</div> <div class="nw-grid-bg" style="block-size: 4rem; inline-size: 14rem; background-color: var(--nw-canvas)"></div></div><p>One burst on hover or focus: <span class="nw-glitch nw-mono">nw-glitch</span></p>| Class | Effect |
|---|---|
nw-scanlines |
The scanline overlay. Clip-path keeps it inside a cut element’s chamfer. |
nw-grid-bg |
The circuit grid. It paints background, so it does not combine with cut or wire on one element. |
nw-glitch |
One burst on hover or focus; no markup needed, the text is the input. |
Accessibility helpers
Section titled “Accessibility helpers”| Class / attribute | Effect |
|---|---|
nw-sr-only |
Visually hidden, still read by assistive technology. |
nw-motion-essential |
Keeps a component’s meaningful animation (a spinner, a progress sweep, a toast timer) running under prefers-reduced-motion: reduce. Everything decorative collapses instantly. |
@media (forced-colors: active) |
The cut and wire surfaces fall back to a plain system-colored box with a real border; the scanline and grid overlays are removed. |
Components own their own -cut, -wire, -glow and -scanlines modifiers (see buttons, surfaces and overlays): they compose the same recipes with the component’s own fill, edge and focus ring, so prefer those to the raw utilities inside a component.