[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M757SZN5FTGFTEXNN81CYS6Z":3,"skill-same:01M757SZN5FTGFTEXNN81CYS6Z":53},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":29,"commitSha":30,"skillDirectory":31,"forksCount":32,"repositoryHtmlUrl":33,"repositoryHomepageUrl":34,"ownerHtmlUrl":35,"ownerBlogUrl":36,"ownerDescription":37,"updatedAt":38,"install":39,"resources":52},"01M757SZN5FTGFTEXNN81CYS6Z","responsive-and-multi-device",null,"Reference-grade playbook for responsive and adaptive design across every screen class — phone, tablet, laptop, desktop, TV, watch, foldable — using mobile-first breakpoints, fluid clamp() type, container queries, logical properties, and dvh\u002Fsafe-area viewport handling.","jpoindexter\u002FVanta","jpoindexter","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F2729617?v=4","01M72VRRYY1CP7RPF3B7GHH0CR","01M757GWDBT6RD147ZZ79N4MEX",4,"MIT","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fdesign-system-skills\u002Fresponsive-and-multi-device\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: responsive-and-multi-device\ndescription: Reference-grade playbook for responsive and adaptive design across every screen class — phone, tablet, laptop, desktop, TV, watch, foldable — using mobile-first breakpoints, fluid clamp() type, container queries, logical properties, and dvh\u002Fsafe-area viewport handling.\ntags: [design-systems, responsive, mobile-first, multi-device, breakpoints]\n---\n# Responsive & Multi-Device Design\n\nOne layout, every screen. The goal is not \"make it shrink\" — it's to serve the right *information density, interaction model, and ergonomics* for each device class. A phone is held one-handed with a thumb; a TV is driven by a D-pad from 10 feet; a watch is glanceable in 2 seconds. Same content, different affordances.\n\n## Philosophy\n\n- **Mobile-first** = author the small layout as the baseline, then *add* with `min-width` media\u002Fcontainer queries. Progressive enhancement: the base CSS is the floor everyone gets; larger screens layer on. Smaller cascade, fewer overrides, better perf on weak devices.\n- **Desktop-first** (`max-width`, graceful degradation) is legacy. Avoid for new work — you end up un-styling for mobile, which is more code and more bugs.\n- **Content-first, not device-first.** Design the content, let it dictate where it breaks. Devices are a moving target; content is yours.\n- **Responsive vs adaptive vs fluid:** *Fluid* = continuous scaling (`%`, `vw`, `clamp()`), no jumps. *Responsive* = fluid + breakpoint reflows. *Adaptive* = discrete fixed layouts swapped at thresholds (server-detected or JS), no in-between. Modern default: **fluid + a few responsive breakpoints**. Reserve adaptive for genuinely different device *classes* (e.g. a real TV\u002Fwatch app, not a width).\n- **Intrinsic web design** (Jen Simmons): let the content's natural size drive layout via `minmax()`, `auto-fit`, `clamp()`, `fit-content` — fewer hard breakpoints, no cliffs.\n\n## Breakpoints\n\nPrefer **content-driven** breakpoints: resize the browser, add one where the layout *breaks* (line length >~75ch, cramped columns, awkward gaps). Don't target specific devices — they change yearly.\n\n| Class | Reference width | Common use |\n|---|---|---|\n| Small phone | 320–360px | absolute floor; must work at 320 |\n| Phone | 390–430px | iPhone 14\u002F15, modern Android |\n| Tablet (portrait) | 768px | iPad mini\u002FAir portrait |\n| Tablet (landscape) \u002F small laptop | 1024px | iPad landscape, 11\" laptop |\n| Desktop | 1280–1440px | mainstream laptop\u002Fmonitor |\n| Large desktop | 1920px+ | external monitors, cap content width |\n\n- **Major** breakpoints reflow structure (1→2 columns); **minor** ones tweak spacing\u002Ftype. Most design systems need **3–5 majors total**, not a dozen.\n- **Use `em` for breakpoints**, not `px`: `@media (min-width: 48em)` respects the user's root font size \u002F browser zoom. (`48em` = 768px at default 16px.)\n- **Orientation:** `@media (orientation: landscape)`. Useful for tablet master-detail and short-viewport keyboard handling, not as a primary axis.\n- Cap content with `max-width` + `margin-inline: auto` (e.g. text `max-width: 65ch`, shells `max-width: 1280px`) so 4K monitors don't stretch lines to 200ch.\n\n```css\n\u002F* mobile-first, em breakpoints, content-capped *\u002F\n.container { width: 100%; padding-inline: clamp(1rem, 5vw, 2rem); }\n@media (min-width: 48em)  { .grid { grid-template-columns: 1fr 1fr; } }   \u002F* 768 *\u002F\n@media (min-width: 64em)  { .grid { grid-template-columns: 1fr 2fr 1fr; } } \u002F* 1024 *\u002F\n@media (min-width: 90em)  { .container { max-width: 1280px; margin-inline: auto; } } \u002F* 1440 *\u002F\n```\n\n## Units & density\n\n| Unit | Use it for | Avoid for |\n|---|---|---|\n| `rem` | type, spacing, radii — scales with user root | nothing; default choice |\n| `em` | spacing relative to *local* font size, media queries | global spacing |\n| `%` | fluid container widths | type sizes |\n| `ch` | text measure \u002F line length (`max-width: 65ch`) | non-text |\n| `vw\u002Fvh` | hero sizing, but pair with `clamp()` | locking font size alone |\n| `dvh\u002Fsvh\u002Flvh` | full-height mobile layouts (below) | — |\n| `fr` | grid track distribution | fixed gutters |\n| `px` | borders, 1px hairlines, fine detail | type, layout spacing |\n\n- **`dvh` \u002F `svh` \u002F `lvh` solve the mobile URL-bar problem.** On mobile, `100vh` = the *largest* viewport (URL bar hidden), so a `height:100vh` element overflows when the bar is showing and content gets cut off. `svh` = small (bar shown), `lvh` = large (bar hidden), `dvh` = **dynamic** (resizes live as the bar shows\u002Fhides). Use `min-height: 100dvh` for app shells \u002F full-screen heroes. Keep a `vh` fallback for old browsers: `min-height: 100vh; min-height: 100dvh;`.\n- **Device pixel ratio (DPR):** CSS px ≠ device px. `@1x` (DPR 1) → 1 CSS px = 1 hardware px; `@2x` (Retina, most phones) = 2×2; `@3x` (iPhone Pro) = 3×3. Ship `srcset` with `1x\u002F2x\u002F3x` so a 2× screen gets a sharp image without a 3× screen over-downloading.\n- **Cross-platform unit map:** iOS uses **pt** (1pt = 1px @1x = 2px @2x). Android uses **dp** (density-independent px, baseline 160dpi) for layout and **sp** (scalable px, respects user font-size) for text. The web's `rem` is the closest analog to `sp` — it scales with user preference. Reference math: iPhone 15 = 393pt wide × DPR 3 = 1179 physical px; design at 393 CSS px, export assets at 3×.\n\n## Fluid technique — kill the breakpoint cliffs\n\n`clamp(MIN, PREFERRED, MAX)` scales smoothly between two anchors so you don't need a media query for every size jump.\n\n```css\n:root {\n  \u002F* fluid type: 16px floor → 20px ceiling, scaling with viewport *\u002F\n  --step-0: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);\n  --step-1: clamp(1.25rem, 1rem + 1.2vw, 2rem);    \u002F* h3 *\u002F\n  --step-2: clamp(1.6rem, 1.2rem + 2vw, 3rem);     \u002F* h2 *\u002F\n  \u002F* fluid space scale *\u002F\n  --space-s: clamp(0.75rem, 0.6rem + 0.7vw, 1.25rem);\n  --space-l: clamp(2rem, 1.5rem + 2.5vw, 4rem);\n}\nh2 { font-size: var(--step-2); }\n.stack > * + * { margin-block-start: var(--space-l); }\n\n\u002F* fluid grid: as many ~16rem cards as fit, no media queries *\u002F\n.cards { display: grid; gap: var(--space-s);\n  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)); }\n```\n\n- `min(16rem, 100%)` inside `minmax` prevents overflow on tiny screens (the column never exceeds the container).\n- `auto-fit` collapses empty tracks (cards stretch); `auto-fill` keeps empty tracks (cards stay fixed-width). Pick `auto-fit` for \"fill the row,\" `auto-fill` for \"consistent card size.\"\n- Use a tool like Utopia to generate the `clamp()` anchors from a min\u002Fmax viewport + scale ratio. Don't hand-tune every value.\n\n## Container queries — the design-system unlock\n\nMedia queries respond to the **viewport**; container queries (`@container`) respond to the **element's own container**. For reusable components this is decisive: the *same* card behaves correctly in a wide main column and a narrow sidebar without knowing the page layout.\n\n```css\n.card-wrap { container-type: inline-size; container-name: card; }\n\n.card { display: grid; gap: 1rem; }\n@container card (min-width: 30rem) {\n  .card { grid-template-columns: 8rem 1fr; }  \u002F* image beside text when wide *\u002F\n}\n```\n\n- **Container query units:** `cqw`\u002F`cqh` (1% of container width\u002Fheight), `cqi`\u002F`cqb` (inline\u002Fblock — prefer these, they respect writing direction), `cqmin`\u002F`cqmax`. Example: `font-size: clamp(1rem, 4cqi, 1.5rem)` scales type to the *container*, not the page.\n- Rule of thumb: **container queries for components, media queries for page shell** (global nav, page columns, print).\n- Baseline since 2023 across all evergreen browsers. Safe to use; provide a sensible no-query base layout for ancient browsers.\n\n## Logical properties — write once, work in every direction\n\nUse logical (flow-relative) properties instead of physical ones so RTL, vertical writing, and i18n work for free.\n\n| Physical | Logical |\n|---|---|\n| `margin-left\u002Fright` | `margin-inline-start\u002Fend`, `margin-inline` |\n| `margin-top\u002Fbottom` | `margin-block-start\u002Fend`, `margin-block` |\n| `padding-left` | `padding-inline-start` |\n| `width \u002F height` | `inline-size \u002F block-size` |\n| `text-align: left` | `text-align: start` |\n| `left \u002F right` (inset) | `inset-inline-start\u002Fend` |\n\n`padding-inline: 1rem` = left+right in LTR, automatically right+left in RTL. No mirrored stylesheet needed.\n\n## Touch vs pointer — design for the input, not the width\n\nA 1024px screen could be a touch tablet or a mouse laptop. **Width tells you nothing about input.** Query the input:\n\n```css\n@media (hover: hover) and (pointer: fine)  { .menu:hover .submenu { display:block; } } \u002F* mouse *\u002F\n@media (hover: none)  and (pointer: coarse) { .btn { min-height: 44px; } }            \u002F* touch *\u002F\n```\n\n- **Touch target minimums:** Apple HIG **44×44pt**, Material\u002FAndroid **48×48dp**, WCAG 2.2 (2.5.8) **24×24 CSS px** absolute floor. Design to **44–48px**. Space targets ≥8px apart.\n- **Never gate critical UI behind `:hover`.** Touch has no hover — tooltips, hover menus, and reveal-on-hover content must have a tap\u002Ffocus equivalent. `@media (hover: hover)` to *enhance*, never to *require*.\n- **Thumb zones \u002F reachability:** one-handed phone use puts the easy zone at the **bottom and center**. Put primary actions and nav in the bottom third; top corners are the hardest reach. This is why mobile apps use **bottom tab bars** and **bottom sheets**, not top nav.\n- `pointer: coarse` (finger\u002Fstylus, imprecise) vs `pointer: fine` (mouse\u002Ftrackpad). Use it to size hit areas, not to assume device class.\n\n## Viewport & browser chrome\n\n```html\n\u003Cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\">\n```\n\n- `width=device-width, initial-scale=1` is mandatory — without it mobile browsers render at 980px and shrink. **Never** set `maximum-scale=1` \u002F `user-scalable=no`: it blocks pinch-zoom and fails WCAG.\n- `viewport-fit=cover` lets content extend under the notch\u002Frounded corners — required for `env()` safe areas to do anything.\n- **Safe-area insets** (notch, Dynamic Island, home indicator, foldable hinge): pad with `env(safe-area-inset-*)`. Combine with your own padding via `max()`:\n\n```css\n.app-bar  { padding-top:    max(1rem, env(safe-area-inset-top)); }\n.bottom-nav { padding-bottom: max(0.5rem, env(safe-area-inset-bottom)); } \u002F* clears home indicator *\u002F\n.screen   { padding-inline: max(1rem, env(safe-area-inset-left), env(safe-area-inset-right)); }\n```\n\n- **On-screen keyboard:** it resizes the visual viewport, not the layout viewport. `100dvh` + the `VirtualKeyboard` API (`navigator.virtualKeyboard.overlaysContent = true`) and the `env(keyboard-inset-*)` values let you keep the input visible. At minimum, `scrollIntoView()` the focused field and avoid pinning critical controls to the bottom when an input is focused.\n- **Address-bar resize:** handled by `dvh` (above). Don't lock heights with `100vh`.\n\n## Per-device-class patterns\n\n| Class | Layout | Navigation | Notes |\n|---|---|---|---|\n| **Phone** | single column, stacked | bottom tab bar, hamburger, **sheets\u002Fmodals** | thumb-reachable actions, 44px targets, full-width CTAs |\n| **Tablet** | **master-detail \u002F split view**, 2 columns | sidebar or tab bar | support iPad Slide Over\u002FSplit View → treat as a *narrower* viewport, don't assume full width; portrait vs landscape differs a lot |\n| **Desktop** | multi-pane, dense, sidebars | persistent top + side nav | hover affordances, keyboard shortcuts, right-click menus, denser tables, cursor precision allows small targets (but keep ≥24px) |\n| **TV (10-foot UI)** | large, few items per screen, generous spacing | **D-pad focus traversal**, no cursor | huge type (min ~24–32px body, scale up), strong visible **focus state** (the focus ring *is* the cursor), respect **overscan** (5% safe margin), high contrast, no hover, no tiny text |\n| **Watch** | one thing per screen, glanceable | crown\u002Fswipe, minimal taps | 2-second readability, largest type, single primary action, no dense data, complications-style summaries |\n| **Foldable** | adapt to **posture** (folded\u002Funfolded\u002Fhalf-open \"tabletop\"); avoid content under the **hinge** | reflows phone→tablet on unfold | use `env(fold-*)` \u002F Viewport Segments API to detect the seam; **continuity** — preserve state across fold; book vs tabletop posture changes layout |\n\n- TV focus: every interactive element needs an unmistakable focus style (`:focus-visible` with a thick ring\u002Fscale), and a logical spatial traversal order — D-pad moves between *visible neighbors*, so layout = navigation graph.\n- Foldables: don't span a single text column across the hinge gap; split into two logical panes or shift content to one side.\n\n## Responsive media\n\n- **Images — resolution switching** (same image, different sizes): `srcset` + `sizes` lets the browser pick.\n  ```html\n  \u003Cimg src=\"hero-800.jpg\"\n       srcset=\"hero-400.jpg 400w, hero-800.jpg 800w, hero-1600.jpg 1600w\"\n       sizes=\"(min-width: 64em) 50vw, 100vw\"\n       alt=\"…\" width=\"1600\" height=\"900\" loading=\"lazy\" decoding=\"async\">\n  ```\n  Always set `width`\u002F`height` (or `aspect-ratio`) to reserve space and prevent CLS.\n- **Art direction** (different *crop* per screen — wide banner on desktop, square on phone): `\u003Cpicture>` with `\u003Csource media=\"...\">`.\n  ```html\n  \u003Cpicture>\n    \u003Csource media=\"(min-width: 64em)\" srcset=\"banner-wide.jpg\">\n    \u003Cimg src=\"banner-square.jpg\" alt=\"…\">\n  \u003C\u002Fpicture>\n  ```\n- Modern formats: offer AVIF\u002FWebP via `\u003Cpicture>\u003Csource type=\"image\u002Favif\">` with a JPEG fallback.\n- `aspect-ratio: 16 \u002F 9` on the container keeps media boxes stable while fluid; `object-fit: cover` for crop-to-fill.\n- **Responsive tables:** wrap in `overflow-x: auto` for horizontal scroll as the floor; for true mobile reflow, switch to a **stacked card layout** (`display: block` rows with `data-label` pseudo-content) below a breakpoint. Never let a wide table cause the whole page to scroll horizontally.\n- **Responsive type ramp:** define a modular scale once with `clamp()` (see Fluid section); don't redefine font sizes inside every breakpoint.\n\n## Testing across devices\n\n- **Reflow at 320px wide** with no horizontal scroll, and at **400% zoom** (WCAG 1.4.10 reflow) — both must keep all content\u002Ffunctions usable.\n- DevTools device toolbar + responsive mode for fast iteration; throttle to mid-tier mobile + slow network.\n- **Test on real devices** for the things emulators lie about: touch ergonomics, safe areas, dynamic viewport (URL bar), keyboard behavior, scroll momentum, real DPR rendering. At least one low-end Android and one iPhone.\n- Use a device lab \u002F cloud (BrowserStack, real hardware) for TV, watch, foldable — emulators don't capture D-pad focus or hinge posture.\n- Check both orientations, light\u002Fdark, and `prefers-reduced-motion`.\n\n## Common mistakes\n\n| Don't | Do |\n|---|---|\n| Design only at 1440px (or only at 390px) | Design at the extremes + one mid; test 320 → 1920+ |\n| `height: 100vh` for full-screen mobile | `min-height: 100dvh` (with `100vh` fallback) |\n| Hover-only menus\u002Ftooltips | Tap\u002Ffocus equivalent; `@media (hover:hover)` to enhance only |\n| 12 breakpoints chasing devices | 3–5 content-driven, em-based breakpoints + `clamp()` fluid |\n| Ignore notch\u002Fhome indicator | `viewport-fit=cover` + `env(safe-area-inset-*)` |\n| 30px touch targets, packed together | 44–48px targets, ≥8px apart |\n| `user-scalable=no` | Allow pinch-zoom (accessibility) |\n| Fixed `px` everywhere | `rem`\u002F`clamp()` for type & space, `%`\u002F`fr` for layout |\n| Wide table breaks page (horizontal page scroll) | Scroll-container or stacked-card reflow |\n| Physical `margin-left`\u002F`text-align:left` | Logical `margin-inline-start`\u002F`text-align:start` |\n| Component queries the viewport | Component uses `@container`; only the shell uses media queries |\n| Images with no `width`\u002F`height` | Always set dimensions or `aspect-ratio` (no CLS) |\n\n**Bottom line:** Build mobile-first with logical properties, let `clamp()` and `auto-fit` grids handle the in-between so you need only 3–5 real breakpoints, scope component responsiveness to `@container`, fix heights with `dvh` and edges with `env()` safe areas, size for the *input* (touch vs pointer) not the width, and treat TV\u002Fwatch\u002Ffoldable as distinct ergonomic classes — then verify on real hardware at 320px and 400% zoom.\n","# Responsive & Multi-Device Design\n\nOne layout, every screen. The goal is not \"make it shrink\" — it's to serve the right *information density, interaction model, and ergonomics* for each device class. A phone is held one-handed with a thumb; a TV is driven by a D-pad from 10 feet; a watch is glanceable in 2 seconds. Same content, different affordances.\n\n## Philosophy\n\n- **Mobile-first** = author the small layout as the baseline, then *add* with `min-width` media\u002Fcontainer queries. Progressive enhancement: the base CSS is the floor everyone gets; larger screens layer on. Smaller cascade, fewer overrides, better perf on weak devices.\n- **Desktop-first** (`max-width`, graceful degradation) is legacy. Avoid for new work — you end up un-styling for mobile, which is more code and more bugs.\n- **Content-first, not device-first.** Design the content, let it dictate where it breaks. Devices are a moving target; content is yours.\n- **Responsive vs adaptive vs fluid:** *Fluid* = continuous scaling (`%`, `vw`, `clamp()`), no jumps. *Responsive* = fluid + breakpoint reflows. *Adaptive* = discrete fixed layouts swapped at thresholds (server-detected or JS), no in-between. Modern default: **fluid + a few responsive breakpoints**. Reserve adaptive for genuinely different device *classes* (e.g. a real TV\u002Fwatch app, not a width).\n- **Intrinsic web design** (Jen Simmons): let the content's natural size drive layout via `minmax()`, `auto-fit`, `clamp()`, `fit-content` — fewer hard breakpoints, no cliffs.\n\n## Breakpoints\n\nPrefer **content-driven** breakpoints: resize the browser, add one where the layout *breaks* (line length >~75ch, cramped columns, awkward gaps). Don't target specific devices — they change yearly.\n\n| Class | Reference width | Common use |\n|---|---|---|\n| Small phone | 320–360px | absolute floor; must work at 320 |\n| Phone | 390–430px | iPhone 14\u002F15, modern Android |\n| Tablet (portrait) | 768px | iPad mini\u002FAir portrait |\n| Tablet (landscape) \u002F small laptop | 1024px | iPad landscape, 11\" laptop |\n| Desktop | 1280–1440px | mainstream laptop\u002Fmonitor |\n| Large desktop | 1920px+ | external monitors, cap content width |\n\n- **Major** breakpoints reflow structure (1→2 columns); **minor** ones tweak spacing\u002Ftype. Most design systems need **3–5 majors total**, not a dozen.\n- **Use `em` for breakpoints**, not `px`: `@media (min-width: 48em)` respects the user's root font size \u002F browser zoom. (`48em` = 768px at default 16px.)\n- **Orientation:** `@media (orientation: landscape)`. Useful for tablet master-detail and short-viewport keyboard handling, not as a primary axis.\n- Cap content with `max-width` + `margin-inline: auto` (e.g. text `max-width: 65ch`, shells `max-width: 1280px`) so 4K monitors don't stretch lines to 200ch.\n\n```css\n\u002F* mobile-first, em breakpoints, content-capped *\u002F\n.container { width: 100%; padding-inline: clamp(1rem, 5vw, 2rem); }\n@media (min-width: 48em)  { .grid { grid-template-columns: 1fr 1fr; } }   \u002F* 768 *\u002F\n@media (min-width: 64em)  { .grid { grid-template-columns: 1fr 2fr 1fr; } } \u002F* 1024 *\u002F\n@media (min-width: 90em)  { .container { max-width: 1280px; margin-inline: auto; } } \u002F* 1440 *\u002F\n```\n\n## Units & density\n\n| Unit | Use it for | Avoid for |\n|---|---|---|\n| `rem` | type, spacing, radii — scales with user root | nothing; default choice |\n| `em` | spacing relative to *local* font size, media queries | global spacing |\n| `%` | fluid container widths | type sizes |\n| `ch` | text measure \u002F line length (`max-width: 65ch`) | non-text |\n| `vw\u002Fvh` | hero sizing, but pair with `clamp()` | locking font size alone |\n| `dvh\u002Fsvh\u002Flvh` | full-height mobile layouts (below) | — |\n| `fr` | grid track distribution | fixed gutters |\n| `px` | borders, 1px hairlines, fine detail | type, layout spacing |\n\n- **`dvh` \u002F `svh` \u002F `lvh` solve the mobile URL-bar problem.** On mobile, `100vh` = the *largest* viewport (URL bar hidden), so a `height:100vh` element overflows when the bar is showing and content gets cut off. `svh` = small (bar shown), `lvh` = large (bar hidden), `dvh` = **dynamic** (resizes live as the bar shows\u002Fhides). Use `min-height: 100dvh` for app shells \u002F full-screen heroes. Keep a `vh` fallback for old browsers: `min-height: 100vh; min-height: 100dvh;`.\n- **Device pixel ratio (DPR):** CSS px ≠ device px. `@1x` (DPR 1) → 1 CSS px = 1 hardware px; `@2x` (Retina, most phones) = 2×2; `@3x` (iPhone Pro) = 3×3. Ship `srcset` with `1x\u002F2x\u002F3x` so a 2× screen gets a sharp image without a 3× screen over-downloading.\n- **Cross-platform unit map:** iOS uses **pt** (1pt = 1px @1x = 2px @2x). Android uses **dp** (density-independent px, baseline 160dpi) for layout and **sp** (scalable px, respects user font-size) for text. The web's `rem` is the closest analog to `sp` — it scales with user preference. Reference math: iPhone 15 = 393pt wide × DPR 3 = 1179 physical px; design at 393 CSS px, export assets at 3×.\n\n## Fluid technique — kill the breakpoint cliffs\n\n`clamp(MIN, PREFERRED, MAX)` scales smoothly between two anchors so you don't need a media query for every size jump.\n\n```css\n:root {\n  \u002F* fluid type: 16px floor → 20px ceiling, scaling with viewport *\u002F\n  --step-0: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);\n  --step-1: clamp(1.25rem, 1rem + 1.2vw, 2rem);    \u002F* h3 *\u002F\n  --step-2: clamp(1.6rem, 1.2rem + 2vw, 3rem);     \u002F* h2 *\u002F\n  \u002F* fluid space scale *\u002F\n  --space-s: clamp(0.75rem, 0.6rem + 0.7vw, 1.25rem);\n  --space-l: clamp(2rem, 1.5rem + 2.5vw, 4rem);\n}\nh2 { font-size: var(--step-2); }\n.stack > * + * { margin-block-start: var(--space-l); }\n\n\u002F* fluid grid: as many ~16rem cards as fit, no media queries *\u002F\n.cards { display: grid; gap: var(--space-s);\n  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)); }\n```\n\n- `min(16rem, 100%)` inside `minmax` prevents overflow on tiny screens (the column never exceeds the container).\n- `auto-fit` collapses empty tracks (cards stretch); `auto-fill` keeps empty tracks (cards stay fixed-width). Pick `auto-fit` for \"fill the row,\" `auto-fill` for \"consistent card size.\"\n- Use a tool like Utopia to generate the `clamp()` anchors from a min\u002Fmax viewport + scale ratio. Don't hand-tune every value.\n\n## Container queries — the design-system unlock\n\nMedia queries respond to the **viewport**; container queries (`@container`) respond to the **element's own container**. For reusable components this is decisive: the *same* card behaves correctly in a wide main column and a narrow sidebar without knowing the page layout.\n\n```css\n.card-wrap { container-type: inline-size; container-name: card; }\n\n.card { display: grid; gap: 1rem; }\n@container card (min-width: 30rem) {\n  .card { grid-template-columns: 8rem 1fr; }  \u002F* image beside text when wide *\u002F\n}\n```\n\n- **Container query units:** `cqw`\u002F`cqh` (1% of container width\u002Fheight), `cqi`\u002F`cqb` (inline\u002Fblock — prefer these, they respect writing direction), `cqmin`\u002F`cqmax`. Example: `font-size: clamp(1rem, 4cqi, 1.5rem)` scales type to the *container*, not the page.\n- Rule of thumb: **container queries for components, media queries for page shell** (global nav, page columns, print).\n- Baseline since 2023 across all evergreen browsers. Safe to use; provide a sensible no-query base layout for ancient browsers.\n\n## Logical properties — write once, work in every direction\n\nUse logical (flow-relative) properties instead of physical ones so RTL, vertical writing, and i18n work for free.\n\n| Physical | Logical |\n|---|---|\n| `margin-left\u002Fright` | `margin-inline-start\u002Fend`, `margin-inline` |\n| `margin-top\u002Fbottom` | `margin-block-start\u002Fend`, `margin-block` |\n| `padding-left` | `padding-inline-start` |\n| `width \u002F height` | `inline-size \u002F block-size` |\n| `text-align: left` | `text-align: start` |\n| `left \u002F right` (inset) | `inset-inline-start\u002Fend` |\n\n`padding-inline: 1rem` = left+right in LTR, automatically right+left in RTL. No mirrored stylesheet needed.\n\n## Touch vs pointer — design for the input, not the width\n\nA 1024px screen could be a touch tablet or a mouse laptop. **Width tells you nothing about input.** Query the input:\n\n```css\n@media (hover: hover) and (pointer: fine)  { .menu:hover .submenu { display:block; } } \u002F* mouse *\u002F\n@media (hover: none)  and (pointer: coarse) { .btn { min-height: 44px; } }            \u002F* touch *\u002F\n```\n\n- **Touch target minimums:** Apple HIG **44×44pt**, Material\u002FAndroid **48×48dp**, WCAG 2.2 (2.5.8) **24×24 CSS px** absolute floor. Design to **44–48px**. Space targets ≥8px apart.\n- **Never gate critical UI behind `:hover`.** Touch has no hover — tooltips, hover menus, and reveal-on-hover content must have a tap\u002Ffocus equivalent. `@media (hover: hover)` to *enhance*, never to *require*.\n- **Thumb zones \u002F reachability:** one-handed phone use puts the easy zone at the **bottom and center**. Put primary actions and nav in the bottom third; top corners are the hardest reach. This is why mobile apps use **bottom tab bars** and **bottom sheets**, not top nav.\n- `pointer: coarse` (finger\u002Fstylus, imprecise) vs `pointer: fine` (mouse\u002Ftrackpad). Use it to size hit areas, not to assume device class.\n\n## Viewport & browser chrome\n\n```html\n\u003Cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\">\n```\n\n- `width=device-width, initial-scale=1` is mandatory — without it mobile browsers render at 980px and shrink. **Never** set `maximum-scale=1` \u002F `user-scalable=no`: it blocks pinch-zoom and fails WCAG.\n- `viewport-fit=cover` lets content extend under the notch\u002Frounded corners — required for `env()` safe areas to do anything.\n- **Safe-area insets** (notch, Dynamic Island, home indicator, foldable hinge): pad with `env(safe-area-inset-*)`. Combine with your own padding via `max()`:\n\n```css\n.app-bar  { padding-top:    max(1rem, env(safe-area-inset-top)); }\n.bottom-nav { padding-bottom: max(0.5rem, env(safe-area-inset-bottom)); } \u002F* clears home indicator *\u002F\n.screen   { padding-inline: max(1rem, env(safe-area-inset-left), env(safe-area-inset-right)); }\n```\n\n- **On-screen keyboard:** it resizes the visual viewport, not the layout viewport. `100dvh` + the `VirtualKeyboard` API (`navigator.virtualKeyboard.overlaysContent = true`) and the `env(keyboard-inset-*)` values let you keep the input visible. At minimum, `scrollIntoView()` the focused field and avoid pinning critical controls to the bottom when an input is focused.\n- **Address-bar resize:** handled by `dvh` (above). Don't lock heights with `100vh`.\n\n## Per-device-class patterns\n\n| Class | Layout | Navigation | Notes |\n|---|---|---|---|\n| **Phone** | single column, stacked | bottom tab bar, hamburger, **sheets\u002Fmodals** | thumb-reachable actions, 44px targets, full-width CTAs |\n| **Tablet** | **master-detail \u002F split view**, 2 columns | sidebar or tab bar | support iPad Slide Over\u002FSplit View → treat as a *narrower* viewport, don't assume full width; portrait vs landscape differs a lot |\n| **Desktop** | multi-pane, dense, sidebars | persistent top + side nav | hover affordances, keyboard shortcuts, right-click menus, denser tables, cursor precision allows small targets (but keep ≥24px) |\n| **TV (10-foot UI)** | large, few items per screen, generous spacing | **D-pad focus traversal**, no cursor | huge type (min ~24–32px body, scale up), strong visible **focus state** (the focus ring *is* the cursor), respect **overscan** (5% safe margin), high contrast, no hover, no tiny text |\n| **Watch** | one thing per screen, glanceable | crown\u002Fswipe, minimal taps | 2-second readability, largest type, single primary action, no dense data, complications-style summaries |\n| **Foldable** | adapt to **posture** (folded\u002Funfolded\u002Fhalf-open \"tabletop\"); avoid content under the **hinge** | reflows phone→tablet on unfold | use `env(fold-*)` \u002F Viewport Segments API to detect the seam; **continuity** — preserve state across fold; book vs tabletop posture changes layout |\n\n- TV focus: every interactive element needs an unmistakable focus style (`:focus-visible` with a thick ring\u002Fscale), and a logical spatial traversal order — D-pad moves between *visible neighbors*, so layout = navigation graph.\n- Foldables: don't span a single text column across the hinge gap; split into two logical panes or shift content to one side.\n\n## Responsive media\n\n- **Images — resolution switching** (same image, different sizes): `srcset` + `sizes` lets the browser pick.\n  ```html\n  \u003Cimg src=\"hero-800.jpg\"\n       srcset=\"hero-400.jpg 400w, hero-800.jpg 800w, hero-1600.jpg 1600w\"\n       sizes=\"(min-width: 64em) 50vw, 100vw\"\n       alt=\"…\" width=\"1600\" height=\"900\" loading=\"lazy\" decoding=\"async\">\n  ```\n  Always set `width`\u002F`height` (or `aspect-ratio`) to reserve space and prevent CLS.\n- **Art direction** (different *crop* per screen — wide banner on desktop, square on phone): `\u003Cpicture>` with `\u003Csource media=\"...\">`.\n  ```html\n  \u003Cpicture>\n    \u003Csource media=\"(min-width: 64em)\" srcset=\"banner-wide.jpg\">\n    \u003Cimg src=\"banner-square.jpg\" alt=\"…\">\n  \u003C\u002Fpicture>\n  ```\n- Modern formats: offer AVIF\u002FWebP via `\u003Cpicture>\u003Csource type=\"image\u002Favif\">` with a JPEG fallback.\n- `aspect-ratio: 16 \u002F 9` on the container keeps media boxes stable while fluid; `object-fit: cover` for crop-to-fill.\n- **Responsive tables:** wrap in `overflow-x: auto` for horizontal scroll as the floor; for true mobile reflow, switch to a **stacked card layout** (`display: block` rows with `data-label` pseudo-content) below a breakpoint. Never let a wide table cause the whole page to scroll horizontally.\n- **Responsive type ramp:** define a modular scale once with `clamp()` (see Fluid section); don't redefine font sizes inside every breakpoint.\n\n## Testing across devices\n\n- **Reflow at 320px wide** with no horizontal scroll, and at **400% zoom** (WCAG 1.4.10 reflow) — both must keep all content\u002Ffunctions usable.\n- DevTools device toolbar + responsive mode for fast iteration; throttle to mid-tier mobile + slow network.\n- **Test on real devices** for the things emulators lie about: touch ergonomics, safe areas, dynamic viewport (URL bar), keyboard behavior, scroll momentum, real DPR rendering. At least one low-end Android and one iPhone.\n- Use a device lab \u002F cloud (BrowserStack, real hardware) for TV, watch, foldable — emulators don't capture D-pad focus or hinge posture.\n- Check both orientations, light\u002Fdark, and `prefers-reduced-motion`.\n\n## Common mistakes\n\n| Don't | Do |\n|---|---|\n| Design only at 1440px (or only at 390px) | Design at the extremes + one mid; test 320 → 1920+ |\n| `height: 100vh` for full-screen mobile | `min-height: 100dvh` (with `100vh` fallback) |\n| Hover-only menus\u002Ftooltips | Tap\u002Ffocus equivalent; `@media (hover:hover)` to enhance only |\n| 12 breakpoints chasing devices | 3–5 content-driven, em-based breakpoints + `clamp()` fluid |\n| Ignore notch\u002Fhome indicator | `viewport-fit=cover` + `env(safe-area-inset-*)` |\n| 30px touch targets, packed together | 44–48px targets, ≥8px apart |\n| `user-scalable=no` | Allow pinch-zoom (accessibility) |\n| Fixed `px` everywhere | `rem`\u002F`clamp()` for type & space, `%`\u002F`fr` for layout |\n| Wide table breaks page (horizontal page scroll) | Scroll-container or stacked-card reflow |\n| Physical `margin-left`\u002F`text-align:left` | Logical `margin-inline-start`\u002F`text-align:start` |\n| Component queries the viewport | Component uses `@container`; only the shell uses media queries |\n| Images with no `width`\u002F`height` | Always set dimensions or `aspect-ratio` (no CLS) |\n\n**Bottom line:** Build mobile-first with logical properties, let `clamp()` and `auto-fit` grids handle the in-between so you need only 3–5 real breakpoints, scope component responsiveness to `@container`, fix heights with `dvh` and edges with `env()` safe areas, size for the *input* (touch vs pointer) not the width, and treat TV\u002Fwatch\u002Ffoldable as distinct ergonomic classes — then verify on real hardware at 320px and 400% zoom.\n",{"name":5,"tags":23,"description":7},[24,25,26,27,28],"design-systems","responsive","mobile-first","multi-device","breakpoints","main","4911ae44bbb35beef4511ba298475ba5a82b7e1c","design-system-skills\u002Fresponsive-and-multi-device",0,"https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta","https:\u002F\u002Fdocs.vanta.theft.studio","https:\u002F\u002Fgithub.com\u002Fjpoindexter","jason.theft.studio","Just some guy trying to build stuff","2026-11-12 17:11:35",{"source":8,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add jpoindexter\u002FVanta --skill responsive-and-multi-device",{"tool":45,"command":46},"bunx","bunx skills add jpoindexter\u002FVanta --skill responsive-and-multi-device",{"tool":48,"command":49},"pnpm","pnpm dlx skills add jpoindexter\u002FVanta --skill responsive-and-multi-device","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fdesign-system-skills\u002Fresponsive-and-multi-device\u002FSKILL.md",true,[],[54,61,68,75,82,88],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":18},"01M7582PEM7XM8B98VFRDV0C0J","write-changelog","Turn a range of commits into a user-facing changelog","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fvanta-ts\u002Fsrc\u002Fmigrate\u002F__fixtures__\u002Fopenclaw\u002Fskills\u002Fwrite-changelog\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":18},"01M7582KTQJMP5Y7GS83MS1C7Z","debug-flaky-test","Reproduce and isolate a flaky test before fixing it","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fvanta-ts\u002Fsrc\u002Fmigrate\u002F__fixtures__\u002Fopenclaw\u002Fskills\u002Fdebug-flaky-test\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":18},"01M7582HG7XFM4Z5NGG1YFECT8","triage-incident","First 10 minutes of an incident — stabilize, then diagnose","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fvanta-ts\u002Fsrc\u002Fmigrate\u002F__fixtures__\u002Fhermes\u002Fskills\u002Ftriage-incident\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":18},"01M7582DQABK7A96XHMB770KQZ","writing-plans","Write implementation plans: bite-sized tasks, paths, code.","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fvanta-ts\u002Fskills-library\u002Fwriting-plans\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":18},"01M7582BBK8H0HGSXKK08FCXJ1","vanta-port-adapter","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fvanta-ts\u002Fskills-library\u002Fvanta-port-adapter\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":18},"01M75828P8PX5XSBMJ2BVVDA9Y","test-driven-development","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fvanta-ts\u002Fskills-library\u002Ftest-driven-development\u002FSKILL.md",[],[]]