--- name: viewer-ui-guidelines description: Design and accessibility rules for the open-doc viewer chrome — the browser shell, sidebars, thumbnail rail, outline, assets and design panels, inspector overlay, and menus. Use when building or reviewing UI under packages/core/src/app that surrounds a document. Does not apply to the printed page itself, which is governed by print-layout-review. --- # open-doc viewer UI The chrome is everything that is **not** the sheet: the shell, the rails, the panels, the menus. It has one job — keep the paper the loudest thing on screen and get out of the way. Judge it against that, not against how interesting it looks in a screenshot. ## Non-negotiables 1. **The page is the subject.** The sheet sits on `--canvas`; the chrome sits on `--background`. Chrome never competes with the document for contrast, saturation, or motion. A control that draws the eye away from the page during reading is a defect regardless of how well it's made. 2. **Tokens, not literals.** Colour comes from the theme tokens defined in `app/styles.css` — `--background`, `--foreground`, `--canvas`, `--muted`, `--muted-foreground`, `--accent`, `--accent-foreground`, `--primary`, `--primary-foreground`, `--border`. A raw hex, `rgb()`, or Tailwind palette colour (`bg-zinc-800`) in chrome code is a finding: it won't follow the dark theme. 3. **Both themes, always.** Dark mode is the `.dark` class variant wired through `next-themes`; every token has a dark value. Any new surface is checked in both. Never define a colour only inside one branch. 4. **Document colours are not chrome colours.** `--od-*` variables (`--od-bg`, `--od-text`, `--od-accent`, `--od-margin`, `--od-size-*`) belong to the document's design system and are scoped to the page. Chrome must never read them, and page content must never read chrome tokens — that leak is what makes a printed page follow the viewer's dark mode. 5. **Keyboard first.** Every action reachable by mouse is reachable by keyboard. Focus is visible (never `outline: none` without a replacement), focus order follows visual order, and focus is trapped and restored around any panel or menu that overlays content. New shortcuts are documented where the user can find them, and must not collide with browser or OS bindings. 6. **Real semantics.** Buttons are `