Spacings
Every spacing value is a multiple of 4px — the base unit. This creates a consistent spatial rhythm across all components, layouts, and platforms. The scale maps 1:1 to iOS HIG points and Android dp units at standard density.
All web layouts use a 12-column grid at tablet and above, collapsing to 4 columns on mobile. The container is capped at 1240px and centered horizontally.
Native mobile layouts follow platform-specific grid guidelines. Both iOS HIG and Android Material Design 3 use a 4-column baseline at phone sizes with 16pt/dp margins and gutters. The 4px spacing base maps 1:1 to iOS points and Android dp at standard display density.
4 col · 16pt
4 col · 16pt
4 col · 20pt
6+ col · 20pt
16dp margin
16dp margin
24dp margin
/* ── SPACING SCALE — 4px base unit ─────────────────────── */
:root {
--sp-0: 0px; /* 0px — None */
--sp-1: 4px; /* 4px — Icon nudge, tight gap */
--sp-2: 8px; /* 8px — Inline gap, tag margin */
--sp-3: 12px; /* 12px — Compact list gap */
--sp-4: 16px; /* 16px — Base ★ · mobile margin */
--sp-5: 20px; /* 20px — Card padding (mobile) */
--sp-6: 24px; /* 24px — Desktop gutter */
--sp-8: 32px; /* 32px — Card padding (desktop) */
--sp-10: 40px; /* 40px — Feature block gap */
--sp-12: 48px; /* 48px — Section padding (mob) */
--sp-16: 64px; /* 64px — Hero padding */
--sp-20: 80px; /* 80px — Desktop outer margin */
--sp-24: 96px; /* 96px — Page section padding */
--sp-32: 128px; /* 128px — Landing hero divider */
/* ── LAYOUT GRID — WEB ─────────────────────────────── */
--container-max: 1240px;
--container-prose: 720px;
--container-card: 480px;
--gutter-desktop: 24px;
--gutter-tablet: 16px;
--gutter-mobile: 16px;
--margin-2xl: 80px;
--margin-xl: 48px;
--margin-lg: 32px;
--margin-md: 24px;
--margin-sm: 16px;
--margin-xs: 12px;
/* ── BREAKPOINTS ──────────────────────────────────── */
--bp-xs: 320px;
--bp-sm: 375px;
--bp-md: 768px;
--bp-lg: 1024px;
--bp-xl: 1280px;
--bp-2xl: 1440px;
}
Every spacing value must be a multiple of 4px. Never use arbitrary values like 7px, 13px, or 19px. The 4px grid maps directly to iOS points and Android dp at 1× density, keeping web and native layouts numerically consistent.
--sp-4 (16px) is the spatial base — the minimum comfortable touch padding, the default mobile margin, and the baseline gutter on small screens. Everything scales from here: --sp-2 for tight UI, --sp-8 for comfortable cards, --sp-24 for page sections.
Always apply horizontal margins. Content must never touch viewport edges. On mobile, 16px minimum each side. On desktop use the .container utility — it applies the correct margin per breakpoint automatically up to the 1240px max-width cap.
Desktop 12-col: full-width = 12, body prose = 8, sidebar = 4. Tablet 8-col: main = 6, aside = 4. Mobile 4-col: most content = 4, simple grids stack to 2. Minimum meaningful span is 2 columns at any breakpoint.
Design and code from the smallest breakpoint upward using min-width media queries exclusively. Default styles target 320px. Overrides layer on at 375 → 768 → 1024 → 1280 → 1440px. Never use max-width queries — they conflict with progressive enhancement.
Interactive elements on mobile must meet 44×44pt (iOS HIG) or 48×48dp (Android MD3) minimum tap target — that's --sp-12 (48px). Use padding to expand small visual elements. Apply --sp-2 (8px) minimum padding to all tappable text links.