Goal
Prefer rem (and clamp() in rem) for typography and layout spacing in the React app so the UI tracks root font size and user zoom / accessibility settings. Keep px where appropriate (hairline borders, some shadows, media-query breakpoints unless we adopt em breakpoints).
Why
frontend/src/styles/theme.css and many page-level inline styles still use raw px. A rem-based scale aligns with responsive and accessibility habits without changing design intent at default zoom.
Agent / implementation checklist
Run these steps when picking up this issue (Cursor, Claude Code, etc.):
-
Baseline
- Confirm root font size (
html / :root, typically 100% → 16px). If anything non-default exists, document it next to shared CSS variables.
-
Tokens first (frontend/src/styles/theme.css)
- Convert
--nb-page-edge, --nb-copy-pad-x, and other spacing tokens to rem (e.g. translate current px intent: 1rem equals 16px at default browser settings).
- Prefer
rem for padding, margin, gap, and font sizes; keep px for border widths and very small UI chrome unless we define a project-wide rule.
-
Pages
- Reduce
px in frontend/src/pages/*.jsx inline styles: either switch numeric spacing to rem or move rules into theme.css classes that use rem.
-
Avoid
- Mechanical replace-all of every
px (breakpoints, borders, box-shadow offsets often stay px).
- Unintentional visual drift: after conversion, compare dashboard, posts list, post detail, login at ~375px and ~1280px width.
-
Verify
cd frontend && npm run lint && npm test -- --run
- Optional:
uv run pytest if any shared contracts touched (unlikely).
Commands (copy-paste)
cd frontend && npm run lint && npm test -- --run
Tracking
Goal
Prefer
rem(andclamp()inrem) for typography and layout spacing in the React app so the UI tracks root font size and user zoom / accessibility settings. Keeppxwhere appropriate (hairline borders, some shadows, media-query breakpoints unless we adoptembreakpoints).Why
frontend/src/styles/theme.cssand many page-level inline styles still use rawpx. A rem-based scale aligns with responsive and accessibility habits without changing design intent at default zoom.Agent / implementation checklist
Run these steps when picking up this issue (Cursor, Claude Code, etc.):
Baseline
html/:root, typically100%→ 16px). If anything non-default exists, document it next to shared CSS variables.Tokens first (
frontend/src/styles/theme.css)--nb-page-edge,--nb-copy-pad-x, and other spacing tokens torem(e.g. translate current px intent:1remequals 16px at default browser settings).remfor padding, margin, gap, and font sizes; keeppxfor border widths and very small UI chrome unless we define a project-wide rule.Pages
pxinfrontend/src/pages/*.jsxinline styles: either switch numeric spacing toremor move rules intotheme.cssclasses that use rem.Avoid
px(breakpoints, borders, box-shadow offsets often staypx).Verify
cd frontend && npm run lint && npm test -- --runuv run pytestif any shared contracts touched (unlikely).Commands (copy-paste)
Tracking