Back to blog
EngineeringDate unavailable· min read

When 18 Pixels Makes Your Hero Look Broken

A 356px stats row forced a 404px wrapper off-center in a 367px viewport. Plus: why viewport-height boxes waste 783 pixels on tall screens, and how CSS grid fixes headline height without guessing line counts.

The hero looked fine on desktop. On mobile it was 18 pixels to the right and the edge was clipped. The stats row — "4 Products, 97% Test Coverage, 12 Contributors" — was forcing the whole thing off-center.

The 356-Pixel Problem

The stats row had gap-10 (40px) between items and flex-nowrap. Its min-content width was 356 pixels. The content wrapper was a mx-auto flex item in a column flex section, so it sized itself to that 356px child — but with padding, it became 404px. The section was 367px wide with overflow-hidden. The whole hero sat ~18px right of center and the right edge clipped.

Three fixes:

Stats row: gap-4 below sm, gap-10 from sm up (16px instead of 40px on mobile).
Content wrapper: w-full so one wide child cannot widen it.
Headline wrapper: stack slogans in one CSS grid cell so height follows the tallest slogan at any width, instead of guessing min-height: 8rem (too short once the text wraps to 3 lines at 375px, 4 at 320px).

The Viewport-Height Tax

The hero was min-h-screen with justify-center. On a portrait tablet (1032×1376), the content was centered in a 1376px box with ~270px of empty space above it. The Story section had min-h-[80vh] and The Thesis had min-h-[70vh]. Short content centered inside viewport-height boxes left 250–300px of empty space above and below on tall screens.

Measured against production at 1032×1376: the content-to-content gaps around The Story and The Thesis dropped from 322/362/363px to 257/256/257px. The page was 783px shorter. Laptop and phone changed by less than 100px.

The hero got min-height: min(100dvh, 62rem). Viewports shorter than 992px (phones, laptops, most desktop windows) are unchanged. Tall screens no longer waste space.

The Spacing Tightening

Home sections used py-24 md:py-32 (96px / 128px vertical padding). Adjacent sections had 192px (phone) to 256px (desktop) between their content. Five home-only sections (Story, Products, Anti-Strug, Thesis, Stream) now use py-16 md:py-20 (64px / 80px), giving 128px / 160px spacing.

Measured at 700×1000 against production: gaps between sections went from 206/243/217/249/236/235px to 124/129/153/142/129/203px. The page is 540px shorter. ClosingCTASection is shared with /products/strug-works and is unchanged.

docs/design-system-reference.md now records py-16 md:py-20 as the SC 2.0 exemplar and marks py-24 md:py-32 as the legacy value for other pages to be migrated.

What's Next

The home page is the SC 2.0 design system exemplar. The product pages (/products/strug-works, /products/sabine, /products/anti-strug) still use the old spacing. They'll migrate to py-16 md:py-20 once we have visual regression tests to confirm nothing breaks. The headline grid stacking pattern will move to the other hero components if they have the same problem.