Proportional Layout Scaling — Design Spec
Date: 2026-03-10 Status: Approved for overnight research run Predecessor: 2026-02-20 Font Enlargement Experiment (reverted)
Problem
The Almanack three-column layout has fragile, hardcoded breakpoints that don’t adapt when font sizes change. The 10% enlargement experiment (Feb 2026) revealed that pixel breakpoints, rem-based grid minimums, and fixed font sizes are tightly coupled but not explicitly related. Changing any one value breaks the others.
There is also a known bug: between 768px and 800px on non-touch devices,
margin columns are hidden (CSS max-width: 800px) but footnotes remain
visually clipped (CSS max-width: 768px), leaving footnote references
unreachable.
Goals
- Make the three-column layout survive as far down the viewport range as possible, escaping the Fallback (single-column, no-margins) mode quickly.
- Establish testable invariants that guarantee layout correctness at any viewport width and base font size.
- Enable future font-size changes (up or down) without cascading breakage.
- Fix the 768–800px footnote gap bug as a natural consequence of unifying breakpoints.
Layout Modes
Three named modes, down from the previous five-way split:
| Mode | Trigger | Character |
|---|---|---|
| Touch device, narrow viewport, JS enabled | Three swipeable 90vw columns with peek gutters. The intended mobile experience. | |
| Fallback | Narrow + no touch, or narrow + no JS | Single column, footnotes at bottom. Functional but diminished — escape as fast as possible. |
| Broadsheet | Viewport wide enough for three columns | Proportionally scaled three-column layout. Font and columns shrink together as viewport narrows. Freezes at max-width 72rem (Codex behaviour) on wide screens. |
The previous “Squeeze” zone (800–1000px) is absorbed into Broadsheet — the layout just gets smaller rather than entering a fragile intermediate state.
The Scaling Mechanism
Core idea
Scale the body font-size with the viewport using clamp(). Size grid minimums
in em (not rem) so they scale with the font. The result: the three-column
layout is self-similar at every width. Words-per-line stays constant because
both container widths and character widths shrink together.
CSS sketch
body {
font-size: clamp(
<floor>, /* discovered by testing — never smaller than this */
1.9vw, /* scales with viewport */
1.3rem /* current Broadsheet size (20.8px at 16px root) */
);
}
.margins-layout {
grid-template-columns:
minmax(10em, 0.33fr) /* em-based: scales with body font */
minmax(28em, 1fr)
minmax(10em, 0.33fr);
}
The 1.9vw coefficient is chosen so that at ~1095px the preferred value equals
the 1.3rem ceiling, and the layout transitions smoothly from scaled to fixed.
Margin font ratio: 80%
The margin font must be 80% of the body font to maintain a clear “two voices” hierarchy (main text vs. annotation). This was eyeball-tested at both 20.8px and 16px body sizes. Below 80%, the distinction blurs. Above 80%, the margin text is unnecessarily small.
.margin { font-size: 0.8em; } /* 80% of body — scales automatically */
The current ratio is 65% (0.85rem margin / 1.3rem body), which is smaller than needed. The new 80% ratio makes margins more readable, especially at narrow viewports where the font is already shrinking.
Margin internals: rem → em
All margin-box internal font sizes must be converted from rem to em
(relative to .margin parent) so a single .margin { font-size } change
scales everything inside. Known targets from the Feb experiment:
.margin-box: 0.9rem → em equivalent.subscribe-form: 0.85rem → em equivalent.video-chapter-toc: 0.8rem → em equivalent.video-chapter-toc-heading: 0.7rem → em equivalent
Breakpoint unification
The 768px / 800px split becomes a single threshold derived from the grid minimums:
three-col-min = 2 × margin-min-em + center-min-em + gaps + padding
This value (in pixels, at the current font-size for that viewport width)
determines when three columns can fit. Below it: Fallback or Pocket. The JS
CONFIG.minViewportWidth must match — ideally read from a CSS custom property
or computed from the same formula.
Readability Invariants
Seven properties that must hold at every viewport width and font size:
- No horizontal overflow —
document.body.scrollWidth ≤ window.innerWidth - Footnotes always reachable — every
a.footnote-reflinks to a visible, non-clipped target (sidenote in margin or inline footnote at bottom) - Center column ≥ 8 words/line — approximately ≥ 40 characters at body font size, when three columns are showing
- Margins ≥ 5 words/line — approximately ≥ 25 characters at margin font size, when margins are visible
- Body font ≥ accessibility floor — the computed body font-size never drops below a minimum (to be discovered, not assumed)
- Mode consistency — the page is in exactly one mode (Pocket, Fallback, or Broadsheet) with no mixed states
- Font hierarchy preserved — margin font is ~80% of body font (enough smaller to read as annotation, not so small as to be illegible)
Test Matrix
Sweep invariants across:
- Viewports: 320, 480, 640, 700, 768, 800, 850, 1000, 1200, 1440px
- Font sizes: current (1.3rem), clamp()-scaled, +10% (1.43rem), -10% (1.17rem)
- Device types:
pointer: fine(desktop),pointer: coarse(touch)
Research Phases
Phase 1: Write invariant tests
Playwright tests asserting the 6 invariants at 10+ viewport widths. Run against current (unmodified) CSS. Document which tests fail and where — this maps the current bug surface.
No CSS changes in this phase.
Phase 2: Convert rem → em
Switch grid minimums and margin-box internals from rem to em. No font-size
changes. Re-run invariant tests — should be a no-op at current sizes but
unblocks the scaling mechanism.
Phase 3: Add clamp() + unify breakpoints
Replace fixed font-size: 1.3rem with clamp(<floor>, 1.9vw, 1.3rem).
Unify the 768/800px split into a single derived breakpoint. Sync JS
CONFIG.minViewportWidth with the CSS threshold.
Phase 4: Sweep the matrix
Run invariant tests across the full viewport × font-size matrix. Find the font-size floor — the smallest value at which all invariants still pass. Report findings with screenshots at key widths.
Phase 5: Write up results
Document discovered relationships, floor values, and recommended CSS in a
critique doc (like critiques/2026-02-20-font-enlargement.md). Include
before/after comparison and the filled-in test matrix.
Tunability
The readability thresholds (8 words/line center, 5 words/line margins, 80% font ratio) are our current best guesses. The system must be built so these can be adjusted and the test suite re-run to find new sweet spots.
CSS side: Express the key relationships as custom properties on :root:
:root {
--margin-font-ratio: 0.8;
--body-font-max: 1.3rem;
--body-font-preferred: 1.9vw;
/* --body-font-floor: discovered by tests, then hardcoded */
}
Test side: The invariant thresholds must be parameters, not hardcoded assertions. The test runner should accept overrides:
bin/a-test --suite layout-invariants \
--min-body-words=8 \
--min-margin-words=5 \
--margin-ratio=0.8
This makes the overnight research repeatable: change a threshold, re-sweep, see where the layout breaks. Future aesthetic tuning (e.g. “try 9 words center, 75% ratio”) is just another run of the same suite.
Out of Scope
- Codex mode (>72rem) scaling — stays as freeze-and-center
- Pocket/swipe mode changes — the touch swipe columns work independently
- Wide-desktop margin font scaling (noted as opportunity in Feb critique, but not part of this project)
- Aesthetic/art-direction review of the scaled layouts (follow-up after research results are in)