logo hsb.horse

Architecture Decision Record

Screen-size layout policy (mobile-first)

Adopt a two-tier breakpoint mobile-first design as the standard.

Accepted #design #ux #responsive #tailwind

Screen-size layout policy (mobile-first)

Decision

  • Mobile-first is the default approach. Base styles target mobile; enhancements are added at md: and above.
  • Use Tailwind CSS v4 default breakpoints, operating with two tiers as a rule.
TierWidthTailwind prefixPurpose
Mobile< 768px(none = base)Single-column, stacked layout
Desktop>= 768pxmd:Side-by-side, expanded layout
  • sm: / lg: / xl: / 2xl: should be used only as exceptions. Add a comment explaining the reason when used.
  • Maximum content width is max-w-4xl (896px), applied consistently across all pages.
  • Horizontal padding uses px-6 (24px) as the baseline.
TierBehavior
MobileHamburger toggle to show/hide navigation
DesktopPersistent horizontal navigation bar

Typography scale

Headings use mobile sizes as the base and scale up by one step at md:.

ElementMobile (base)Desktop (md:)
Page title (h1)text-3xlmd:text-4xl
Section heading (h2)text-2xlmd:text-3xl
Sub-heading (h3)text-xlmd:text-2xl
List headingtext-lgmd:text-xl
Body texttext-baseNo change

Layout patterns

PatternMobileDesktop
Card listSingle-column stackSingle-column stack (sufficient within max-w-4xl)
Filter barStacked flex-colHorizontal md:flex-row
FooterStacked, centeredHorizontal md:flex-row md:justify-between
HeaderTwo rows + hamburgerTwo rows + horizontal nav

Context

This site is a content-focused personal site (blog, tool catalog, ADR, About) where layouts rarely need to be complex. The existing implementation already uses only md:, effectively operating with two tiers. This implicit convention needed to be documented to maintain consistency in future development.

Rationale

  • Keep it simple: Two tiers are sufficient for a content-centric site. More breakpoints increase maintenance cost.
  • Consistency with existing code: The entire codebase already uses only md:, so no migration work is required.
  • Follow Tailwind defaults: Avoiding custom breakpoint definitions prevents drift from official documentation.
  • Mobile-first makes sense: Aligns with Google’s mobile-first indexing and prioritizes the mobile browsing experience.

Consequences

  • When building new components, complete the mobile layout first, then enhance with md:.
  • Using sm: / lg: etc. requires an explicit justification in the PR.
  • If content width beyond max-w-4xl is needed, a separate ADR should be created.
  • Typography scale changes should also be managed through ADRs.