# Design rules — Stripe

<!-- source: https://stripe.com/ · generated by lewitt from dna.json · do not edit -->

## Hard constraints (from Restraint principles — check these first)

### MUST NOT — Colour is a once-per-page event
_One full-bleed gradient band in the hero; below it every surface is white or a pale blue tint._

- Forbidden class patterns: `(?:^|[^a-z0-9-])bg-(?:gradient-to-|linear-to-|radial-to-|conic-to-)`, `shadow-(?!(?:none|sm|inner)\b)[a-z0-9]+`
- Upper bound: `border-width` ≤ 1px
- Why: Readers need to trust the screenshots more than the scenery; once colour stops, the product becomes the subject.
- Note: Gradients outside the hero band and any non-ring shadow class are violations; hairlines (1px) are the intended depth signal.

### MUST NOT — One indigo, only where you can click
_Indigo only on the filled CTA, the outlined CTA border, and linked words; everything else is ink or tint._

- Forbidden class patterns: `(?:^|[^a-z0-9-])bg-(?:indigo|violet|purple)-(?:4|5|6|7)\d\d$`, `(?:^|[^a-z0-9-])bg-(?:gradient-to-|linear-to-|radial-to-|conic-to-)`
- Why: At ~0.2% of the surface, indigo always means 'do something'; a larger share would make the page a brand poster and slow scanning.
- Note: Allowed on buttons/links only; never on a section or card background.

## Design principles

### Colour is a once-per-page event [restraint]
- Making a payments brand feel alive without breaking legibility of dense product shots. → **a single decorative gradient confined to the hero** over _gradient text, gradient buttons, and gradient section backgrounds (the common fintech treatment)_
- Because: Readers need to trust the screenshots more than the scenery; once colour stops, the product becomes the subject.
- Evidence: e-hero-band, e-canvas-light, e-sections-tinted

### One indigo, only where you can click [restraint]
- Deciding how much of a light page the brand colour may occupy. → **indigo restricted to actions and links** over _indigo section backgrounds, indigo icons, and indigo headings_
- Because: At ~0.2% of the surface, indigo always means 'do something'; a larger share would make the page a brand poster and slow scanning.
- Evidence: e-purple, e-canvas-light

### Light weights carry the headline [craft]
- Setting a 48px headline beside a saturated gradient. → **variable 300 at every display size** over _600-700 headline weights with a 1.33x type ramp_
- Because: A light face over a heavy gradient leaves the gradient as the loudest thing; bold type would fight the artwork and the screenshots.
- Evidence: e-weights, e-h1, e-h2, e-h3

### Blue-black ink instead of grey [craft]
- Choosing text colours for a white page with a cold indigo accent. → **blue-tinted neutrals** over _pure greys (#111, #666) or neutral-warm text_
- Because: Grey text on a white page beside indigo reads as unfinished; shared hue makes the colour look chosen rather than added.
- Evidence: e-ink, e-ink-body

### Motion is tiered by job [system]
- Animating a page with hover states, colour changes and a reveal. → **three job-specific durations** over _one global 200ms ease on everything_
- Because: Colour has to feel immediate on hover while a layout reveal needs room to read; one duration would make one of them wrong.
- Evidence: e-motion, e-motion-support

## System rules

- **Text is blue-black, never grey**: Headings #061B31 and body #50617A sit on a blue hue axis; muted text is a lighter blue, not a neutral.
- **One indigo for actions and linked words only**: rgb(83,58,253) covers ~0.2% of the surface: filled CTA, 1px outlined CTA, inline links. No indigo surfaces, headers or decoration.
- **One gradient, spent on the hero**: A single full-bleed pink/orange/lilac band covers the hero; every section below is flat white or a pale tint.
- **Light weights at every size**: 300 carries display and body (x302 home, x506 pricing); 400 for UI, 425/500 only inside pricing controls.
- **Controls small, cards large**: Buttons and chips 4-6px; cards 16.5px on pricing and 8px elsewhere. No pill buttons in the primary flow.
- **Shadows tinted to the canvas, not black**: Elevation uses rgba(50,50,93,·) plus a second layer, mostly 1-2px tight, with 13-16px blur on floats.
- **Three motion tiers by job**: 0.24s for opacity, 0.3s for colour, 0.4s for the grid reveal; reduced-motion and focus-visible are present on the pricing stylesheet.
- **Fixed 128px section rhythm on inner pages**: Product pages repeat a 128px gap seven times; the home page uses 160px then a 408px break around the logos.

## Tokens (copy values from tokens.css; never retype numbers)

Use the semantic and component layers; reach for a primitive only when no role fits.

### Semantic — roles to use

- `var(--lw-canvas)` — color/canvas (color, observed)
- `var(--lw-canvas-tint)` — color/canvas-tint (color, observed)
- `var(--lw-surface-subtle)` — color/surface-subtle (color, observed)
- `var(--lw-text-heading)` — color/text/heading (color, observed)
- `var(--lw-text-body)` — color/text/body (color, observed)
- `var(--lw-text-muted)` — color/text/muted (color, observed)
- `var(--lw-action-bg)` — color/action/bg (color, observed)
- `var(--lw-action-bg-alt)` — color/action/bg-alt (color, observed)
- `var(--lw-action-fg)` — color/action/fg (color, observed)
- `var(--lw-link)` — color/link (color, observed)
- `var(--lw-font-body)` — font/body (fontFamily, observed)
- `var(--lw-font-code)` — font/code (fontFamily, observed)
- `var(--lw-radius-control)` — radius/control (dimension, observed)
- `var(--lw-radius-control-alt)` — radius/control-alt (dimension, observed)
- `var(--lw-radius-card)` — radius/card (dimension, observed)

### Component — reusable parts

- `var(--lw-type-hero)` — type/hero (dimension, observed)
- `var(--lw-type-h2)` — type/h2 (dimension, observed)
- `var(--lw-type-h3)` — type/h3 (dimension, observed)
- `var(--lw-type-body)` — type/body (dimension, observed)
- `var(--lw-type-ui)` — type/ui (dimension, observed)
- `var(--lw-type-caption)` — type/caption (dimension, observed)
- `var(--lw-tracking-hero)` — tracking/hero (dimension, observed)
- `var(--lw-tracking-h2)` — tracking/h2 (dimension, observed)
- `var(--lw-leading-prose)` — leading/prose (number, observed)
- `var(--lw-depth-float)` — depth/float (shadow, observed)
- `var(--lw-depth-float-strong)` — depth/float-strong (shadow, observed)
- `var(--lw-depth-ring)` — depth/ring (shadow, observed)
- `var(--lw-depth-ring-inset)` — depth/ring-inset (shadow, observed)
- `var(--lw-space-section)` — space/section (dimension, observed)
- `var(--lw-layout-container)` — layout/container (dimension, inferred)

### Primitives — raw values, last resort

- `var(--lw-ink-900)` — color/ink/900 (color, observed)
- `var(--lw-ink-700)` — color/ink/700 (color, observed)
- `var(--lw-ink-600)` — color/ink/600 (color, observed)
- `var(--lw-tint-100)` — color/blue-tint/100 (color, observed)
- `var(--lw-tint-50)` — color/blue-tint/50 (color, observed)
- `var(--lw-page-tint)` — color/blue-tint/25 (color, observed)
- `var(--lw-white)` — color/white (color, observed)
- `var(--lw-indigo-600)` — color/indigo/600 (color, observed)
- `var(--lw-indigo-500)` — color/indigo/500 (color, observed)
- `var(--lw-font-sans)` — font/sans (fontFamily, observed)
- `var(--lw-font-mono)` — font/mono (fontFamily, observed)
- `var(--lw-weight-light)` — weight/light (fontWeight, observed)
- `var(--lw-weight-regular)` — weight/regular (fontWeight, observed)
- `var(--lw-weight-ui-strong)` — weight/ui-strong (fontWeight, observed)
- `var(--lw-motion-fast)` — motion/fast (duration, observed)
- `var(--lw-motion-base)` — motion/base (duration, observed)
- `var(--lw-motion-reveal)` — motion/reveal (duration, observed)
- `var(--lw-easing-in-out)` — motion/easing-in-out (easing, observed)
- `var(--lw-easing-out)` — motion/easing-out (easing, observed)

## Interaction Delta (measured)

Forced with a real mouse (CDP `Input.dispatchMouseEvent`) and `element.focus()`; only these properties are diffed: `background-color`, `color`, `border-color`, `box-shadow`, `outline`, `transform`.

### button — `button.hds-button.CookieSettings_CookieSettings__HelmButton__69vhe`
- Status: Observed / 实测 · evidence: e-buttons, e-purple
- **hover**: `color`: `rgb(83, 58, 253)` → `rgb(46, 43, 140)`; `border-color`: `rgb(214, 217, 252)` → `rgb(64, 50, 200)`
- **focus**: `outline`: `0px solid rgba(0, 0, 0, 0)` → `3px solid rgba(84, 82, 251, 0.75)`

### button — `button.hds-ui-button.announcement-bar__dismiss`
- Status: Observed / 实测 · evidence: e-buttons
- **hover**: none (no computed change on the icon-only dismiss button)
- **focus**: `outline`: `0px solid rgba(0, 0, 0, 0)` → `3px solid rgba(0, 0, 0, 0)`

### card — `div.payments-graphic__checkout-item-card`
- Status: Inferred / 推断 · evidence: e-shadow-soft
- **hover**: none (No computed change; the card sits inside an animated illustration, so observed ≠ no hover style exists)
- **focus**: none (Not focusable)

## Verification

Live specimens and motion replay: `preview.html` (single file, opens in any browser).

Run before shipping UI built from these rules:

```sh
python3 scripts/lint_output.py --dest <dest_dir> --check-code <ui_dir>
```
