Skip to main content

Styling

Rendered from corpus/wiki/styling.md · updated 2026-10-21

This page is generated from the project corpus and rewritten on every docs build. Edit the source in corpus/, not here.

Tailwind v4 plus a small amount of hand-written CSS, and the interaction between them is load-bearing. Get the cascade wrong and rules silently stop applying.

The layer order, and why page classes are unlayered​

src/styles/theme.css declares @layer theme, base, components, utilities; up front. Layers rank by first appearance, and styles.css opens an @layer base further down the load order — without that declaration the base block would outrank utilities and the problem it exists to solve would be inverted.

  • Element defaults (body, a, ::selection) live in @layer base, below utilities. That is the point: a { color: … } is what a link looks like unless told otherwise. While that block was unlayered it beat every text-* utility and turned a whole nav ink-black.
  • Page classes stay unlayered, so they beat any utility on the same element. That is why a handful of rules are deliberately still CSS: .grule's spacing must survive a utility, and a utility handed to a component cannot be relied on to beat the utility it is overriding.
  • Give an element page classes or utilities — not both.

Tailwind's Preflight is not imported. The reset strips default table borders, heading sizes and list markers, and this site's prose is the trip data — ~7,000 lines of JSX with thousands of unclassed <h3>, <p> and <li> elements styled by element selectors. Only the theme and the utilities are pulled in.

Which stylesheet a rule belongs in​

theme.css is the only place a colour, font, radius or shadow is defined. Every stylesheet spells the token out (var(--color-ink)); the short aliases styles.css once kept (--ink, --paper-2, --radius) were scaffolding and are gone, so a value cannot be defined twice.

FileWhat it holds
src/styles/theme.cssThe palette as @theme tokens, and the layer order
src/styles/styles.cssOnly what is the site's: element defaults, the shared measure (.shell), footer, two global media queries. No page classes
src/app/shell.cssThe 42px institutional bar, its chapter row and the destination tab — imported by the two files that draw a bar
src/features/<chapter>/*.cssOne per chapter that needs CSS a utility cannot express: itinerary, guide, pricing, poster

The test for where a rule goes: who writes this class? One page ⇒ it lives beside that page. Guide and pricing ship theirs in their own route chunk, so a train time looked up on a platform does not download the drop-cap rules for an essay. footer is the deliberate exception that stayed global — the poster renders outside the shell and writes .poster-foot as an override of it.

A rule kept as CSS rather than utilities should say why in a comment. The existing ones are honest about it: a <Table> whose cell utilities have to be overridden per column (.plan, .pricecol), a 720px reflow that turns <tr> into a grid, ::first-letter for a drop cap, and -webkit-line-clamp.

One consequence of the redesign worth knowing before hunting for a rule: the itinerary is now mostly CSS rather than utilities, and deliberately so. It is a table with column and state variants, two sticky elements whose offsets have to agree, and three reflows — the kind of thing a class attribute states badly.

Colour has four jobs​

The ink is the interface, red is the imperative, a trip's areas[].color means place, and parties[].color means who. Before adding a colour, work out which job it is doing; if the answer is "two", it is wrong. Full reasoning in design.md — read it before changing anything visual.

Gold used to hold the interface job and the must-see mark, and is gone. --color-mark names the interface job and resolves to --color-ink; there is no --color-gold, and a text-gold in a diff is a rule that has not been migrated.

The ground is #faf6ef cream (plaster, #e8e9e6, until 2026-10-21), and --color-paper is a sheet laid on it, one step lighter. The pastel on the itinerary is not a token per area: it is color-mix(in oklab, var(--wing) var(--tint-wing), var(--color-paper)), written where a thing belongs to an area, with --tint-wing the one number. A color-mix of tokens is not a literal; a hex in a stylesheet still is.

Radii are --radius-card, --radius-pill and --radius-pin (rounded-card, rounded-pill); a derived corner such as calc(var(--radius-card) - 4px) is fine, a bare 8px is not. The map's pins are styled in itinerary.css (.pin), not inline in MapView, so they read the tokens too.

There is also no --font-serif: the body face is --font-body (Archivo) and the Tailwind utility is font-body. --font-black (Archivo Black) was removed on 2026-10-21 with its two numerals.

Proving a styling change changed nothing​

Use the harness, not your eyes:

npm run dev
FP_BASE=http://localhost:5173/trips npm run fp -- before # then make the change
FP_BASE=http://localhost:5173/trips npm run fp -- after
npm run fp:diff -- before after

FP_BASE is no longer needed against npm run dev — the harness defaults to 5173 — but it is still how you point it at the poster's own server on 5199, at npm run preview, or at a deployed copy.

To get a baseline after the fact, run the "before" capture against a pristine git worktree of HEAD on a second port rather than stashing the work. The poster route is excluded from the harness on purpose; npm run poster is its check, and the self-contained HTML can be diffed against a previous render once the inlined data: URIs are stripped.