# Responsive Design — Loki Web App
**Created:** 2026-06-27
**Last modified:** 2026-08-26
**Last modified summary:** Public marketing surface rebuilt mobile-first — sticky 56px header, drawer owns theme + sign-in, viewport-relative display scale, `ui-public-section`/`ui-public-container` rhythm.
Loki is **mobile-first and dark-first**. Every authenticated route must be usable on a 320px-wide phone without horizontal page scroll, with primary actions reachable above the floating bottom nav.
## Breakpoints
Tailwind defaults (via `@theme inline` in `globals.css`):
| Token | Width | Shell behaviour |
| --- | --- | --- |
| (default) | `<640px` | Bottom nav pill, compact page headers, stacked layouts |
| `sm` | `≥640px` | Chip rows may wrap; some subtitles appear |
| `md` | `≥768px` | Sidebar visible; desktop top-bar search; duplicate page titles allowed |
| `lg` | `≥1024px` | Control workspace two-column rail + detail |
## Mobile chrome (Layer 1 tokens)
Defined in `src/app/globals.css` `:root`:
```
--mobile-nav-height Bottom tab bar height
--mobile-nav-offset Float gap above screen edge
--mobile-safe-bottom env(safe-area-inset-bottom)
--mobile-chrome-bottom Total bottom inset (nav + offset + safe area)
--app-topbar-height Sticky AppTopBar height
--app-viewport-height 100svh − top bar − mobile chrome (phones)
```
**Rule:** full-height surfaces (Loki, Terminal, workspace terminal) use `.app-viewport-pane`, not ad-hoc `100vh` / `100dvh` math.
## Shell layout
```
.app-shell-frame overflow-x-clip — no page-level horizontal bleed
.app-main padding-bottom: mobile chrome + 1rem
.app-page Standard page gutter (px-4 … md:px-8)
.app-page-compact Tighter vertical padding for chat/terminal pages
.app-viewport-pane Full remaining viewport height
```
Authenticated pages should still enter through `PageLayout` (see
`docs/branding-design.md` → App-shell layout SSOT). Mixing raw `app-page max-w-*`
with bespoke wrappers is the main source of inconsistent positioning across
routes.
Navigation:
- **Desktop (`md+`)**: `Sidebar` (Now / Fleet / Command + PIN-gated Private) + full `AppTopBar` search + `AccountMenu`
- **Mobile**: `AppTopBar` page label + icon search + `AccountMenu`; bottom bar is **Today · Control · Loki · Menu** — one entry point per loop section, plus Menu; the Menu sheet shows the same sections with their questions, and carries no footer
- **Account actions** (Settings, Download, appearance, lock private zone, sign out) live in `AccountMenu` only. They used to be duplicated in the sidebar footer and the Menu sheet footer — two account menus, neither called one, and none in the header where users look first.
## Component patterns
| Pattern | Class / component | Mobile note |
| --- | --- | --- |
| Page title | `PageTitle` | Hides when it duplicates `AppTopBar` label |
| Modals | `Modal` | Bottom-anchored on phones; `--mobile-chrome-bottom` inset |
| Drawers | `Drawer` + `ui-drawer-body` | Full width; safe-area padding on scroll body |
| The composer | `components/composer/Composer` (`ui-loki-composer`, `-compact`) | ONE component for Loki chat, the terminal's Ask/Inject rail, Prompt mode and Control's quick send; stacks textarea + toolbar row on `` — 36px glyph, one-line 18px wordmark, no kicker | Full stacked lockup |
| Nav | `PublicNavTrigger` → full-screen drawer | `PublicNav` mega-menu |
| Theme cycle | inside the drawer footer | in the header |
| Sign in | inside the drawer | in the header |
| Primary CTA | always visible, `whitespace-nowrap`, short label ("Open app") | full label |
`PublicHeaderActions` — not `PublicSurface` — mounts the drawer, because it is the only public header piece that can call `auth()`: `PublicSurface` is imported by `AuthShell`, which client pages import, so the shell itself is bundled for the browser.
**Type scale.** Display classes are viewport-relative with a phone-sized floor; the rem ceiling keeps desktop unchanged. Never raise a floor above what 320–390px can render.
| Class | Floor | Ceiling |
| --- | --- | --- |
| `ui-public-hero-title` | `2.5rem` | `5.75rem` |
| `ui-public-page-title` | `2.25rem` | `4.5rem` |
| `ui-public-display-lg` | `2rem` | `3.75rem` |
| `ui-public-display-md` | `1.75rem` | `3rem` |
| `--public-title-min` | `34px` | `108px` |
**Rhythm.** Use `ui-public-section` (`py-14 sm:py-20 lg:py-24`), `ui-public-section-gap`, and `ui-public-container{,-narrow,-mid,-wide}` (16px gutter on phones) rather than ad-hoc `py-24` + `max-w-* px-6`.
**Long pages.** `ui-public-jumpbar` (anchor chip row) on `/roadmap`; `DocContents` renders the whitepaper TOC as a collapsed `` below `sm` and an open `