# Layout

Layout combines fluid viewport scaling from `320px` to `1920px` with three grid tiers (`4 · 8 · 12` columns) and fixed maximum widths (`1440px` page, `68ch` prose).

## Grid tiers and constraints

| Tier | Min width | Columns | Gutter | Margin |
| --- | --- | --- | --- | --- |
| sm | 320px (20rem) | 4 | 16px (1rem) | 16px (1rem) |
| md | 768px (48rem) | 8 | 24px (1.5rem) | 32px (2rem) |
| lg | 1024px (64rem) | 12 | 32px (2rem) | 64px (4rem) |

| Constraint | Value | Token / utility |
| --- | --- | --- |
| Breakpoints | 320px · 640px · 768px · 1024px · 1280px · 1536px | sm / md / lg / xl / 2xl |
| Page max width | 1440px (90rem) | --page-max-width / container-page |
| Prose max width | 68ch | --prose-max-width / max-w-prose |

Use the `container-page` and `grid-page` utilities to apply the active tier's columns, gutter, and outer margin automatically.

Toggle the overlay to inspect how the active viewport tier distributes columns, gutters, and outer page margins.

## Usage

Compose page sections with `container-page`, `grid-page`, and `max-w-prose`:

```tsx
<main className="container-page grid-page py-16">
  <article className="col-span-4 md:col-span-6 lg:col-span-8">
    <h1 className="font-display text-h1">Page title</h1>
    <p className="mt-4 max-w-prose font-sans text-body">
      Long-form copy caps at 68ch for comfortable line length.
    </p>
  </article>
</main>
```

```css
.page-shell {
  width: 100%;
  max-width: var(--page-max-width);
  margin-inline: auto;
  padding-inline: var(--grid-margin);
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), minmax(0, 1fr));
  column-gap: var(--grid-gutter);
}
```

## Do and don't

- **Do: Cap reading measure at 68ch** — Apply max-w-prose (--prose-max-width) to paragraphs and documentation columns inside wider 12-column grids.
- **Don't: Stretch prose across the full 1440px container** — Do not let body text span all 12 columns on desktop because lines exceeding 75 characters slow reading and hinder tracking.

## Accessibility

- Keep the grid overlay strictly decorative (`aria-hidden="true"`, `pointer-events-none`) so it never blocks keyboard or pointer interaction.
- Maintain `16px` minimum outer margins on `320px` viewports so content never clips against screen edges.

## Rationale

Three responsive grid tiers align page structure across mobile, tablet, and desktop without per-breakpoint custom CSS in components.
