/* Case study layout for davidbulldesign.com
   Brand from the CV and the PDF portfolio: white pages, a coral dot, a full colour
   title slide per project, screens on a light grey, Nunito Sans throughout.
   Type: one family, two weights (400, 700), five sizes. Nothing else.
   Each page sets its project colour with --project on <body>. */

@font-face { font-family: "Nunito Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url(fonts/nunito-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Nunito Sans"; font-weight: 400; font-style: italic; font-display: swap; src: url(fonts/nunito-sans-latin-400-italic.woff2) format("woff2"); }
@font-face { font-family: "Nunito Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url(fonts/nunito-sans-latin-700-normal.woff2) format("woff2"); }

:root {
  --paper: #ffffff;
  --ink: #1a1a1a;
  --muted: #555b60;
  --screen: #e7ebee;
  --dot: #f6776c;
  --coral-text: #b8483f;
  --project: #556c4e;
  --project-ink: #ffffff;
  --project-soft: rgba(255, 255, 255, 0.84);
  --green: #556c4e;
  --olive: #737148;
  --slate: #5f676d;

  --font: "Nunito Sans", system-ui, sans-serif;
  --regular: 400;
  --bold: 700;

  /* The type scale: six steps, calmer at the top */
  --small: 0.9375rem;                                  /* 15 */
  --body: 1.125rem;                                    /* 18 */
  --sub: 1.25rem;                                      /* 20 */
  --head: clamp(1.5rem, 1.25rem + 0.7vw, 1.75rem);     /* 24 to 28 */
  --title: clamp(1.875rem, 1.3rem + 1.5vw, 2.5rem);    /* 30 to 40 */
  --display: clamp(2.5rem, 1rem + 4vw, 4.5rem);        /* 40 to 72 */

  --pad: clamp(24px, 4vw, 64px);
  --gap: clamp(72px, 7vw, 112px);
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-move: cubic-bezier(0.77, 0, 0.175, 1);
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--paper); color: var(--ink); font-family: var(--font); font-size: var(--body); font-weight: var(--regular); line-height: 1.6; -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
b, strong, dt, th { font-weight: var(--bold); }
:focus-visible { outline: 3px solid var(--dot); outline-offset: 3px; }
::selection { background: var(--dot); color: #fff; }

h1, h2, h3 { font-weight: var(--bold); }
h1 { font-size: var(--display); line-height: 1.08; letter-spacing: -0.015em; }
h2 { font-size: var(--head); line-height: 1.2; letter-spacing: -0.01em; margin-bottom: 20px; }
h3 { font-size: var(--sub); line-height: 1.3; margin-bottom: 8px; }
p + p { margin-top: 0.9em; }
.lead { font-size: var(--sub); line-height: 1.45; }
.evidence { color: var(--coral-text); font-style: italic; }
p.evidence { font-size: var(--sub); line-height: 1.45; margin: 24px 0; }
figcaption, .small { font-size: var(--small); color: var(--muted); }
figcaption { margin-top: 10px; }

/* Header */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 72px; padding: 0 var(--pad); }
.wordmark { display: inline-flex; align-items: center; gap: 12px; font-weight: var(--bold); text-decoration: none; }
.wordmark::before { content: ""; width: 18px; height: 18px; border-radius: 50%; background: var(--dot); flex: none; }
.site-header nav { display: flex; align-items: center; gap: clamp(16px, 2.4vw, 32px); font-size: var(--small); font-weight: var(--bold); }
.site-header nav a { text-decoration: none; }
.site-header nav a:hover { text-decoration: underline; }

.button { display: inline-flex; align-items: center; min-height: 48px; padding: 0 22px; background: var(--ink); color: #fff; font-size: var(--small); font-weight: var(--bold); text-decoration: none; border: 0; border-radius: 999px; cursor: pointer; transition: transform 160ms var(--ease), background-color 160ms var(--ease), color 160ms var(--ease); }
.button:hover { background: var(--dot); color: var(--ink); }
.site-header .button { min-height: 40px; padding: 0 18px; }
.on-colour .button { background: #fff; color: var(--ink); }
.on-colour .button:hover { background: var(--dot); }

/* The split: text that scrolls, the screen that stays */
.split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
.read { background: var(--paper); padding: 0 var(--pad) var(--gap); min-width: 0; }
.read > section { max-width: 60ch; padding-top: var(--gap); }
.read > section.wide-read { max-width: 72ch; }
.stage { position: sticky; top: 0; height: 100svh; background: var(--screen); overflow: hidden; }
.stage-screen { position: absolute; inset: 0; display: grid; place-items: center; padding: 5vh 3vw; opacity: 0; transition: opacity 400ms ease; }
.stage-screen.is-on { opacity: 1; }
.stage-screen img { max-height: 86svh; width: auto; }
.inline-shot { display: none; }

/* Title slide */
.read > section.title { max-width: none; margin: 0 calc(-1 * var(--pad)); padding: 88px var(--pad) 64px; }
.title { background: var(--project); color: var(--project-ink); }
.title h1 { margin-bottom: 20px; }
.title .lead { color: var(--project-soft); max-width: 38ch; margin-bottom: 32px; }
.meta { display: grid; grid-template-columns: repeat(2, minmax(0, 15rem)); gap: 16px 32px; margin-bottom: 32px; font-size: var(--small); }
.meta dd { color: var(--project-soft); }

/* Figures: the number sits above its sentence, two per row, left aligned */
.figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 40px; margin-top: 4px; }
.figures b { display: block; font-size: var(--head); line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--project); margin-bottom: 6px; }

/* Label and text pairs: timeline, principles, measures. One pattern everywhere. */
.timeline, .principles, .terms { display: grid; gap: 14px; list-style: none; }
.timeline { margin-top: 28px; }
.timeline li, .principles div, .terms div { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 24px; align-items: start; }
p + .terms, p + .principles, p + .figures { margin-top: 28px; }
.timeline .when, .principles dt, .terms dt { font-weight: var(--bold); }

.decision + .decision { margin-top: 40px; }


/* Findings table */
.findings { width: 100%; border-collapse: collapse; font-size: var(--small); }
.findings th { text-align: left; padding: 0 16px 10px 0; border-bottom: 2px solid var(--ink); }
.findings td { vertical-align: top; padding: 14px 16px 14px 0; border-bottom: 1px solid #d5dade; }
.findings td:first-child { width: 52%; }

/* The live thing */
.ask { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
.ask-in { background: var(--project); color: var(--project-ink); padding: var(--gap) var(--pad); }
.ask-in h2 { color: var(--project-ink); }
.ask-in > p { color: var(--project-soft); max-width: 46ch; }
.ask-out { background: var(--screen); position: relative; display: grid; place-items: center; padding: 40px 3vw; min-height: 82svh; }
.prompts { display: grid; gap: 10px; margin-top: 28px; max-width: 46ch; }
.prompt { text-align: left; font: inherit; font-weight: var(--bold); line-height: 1.35; color: var(--project-ink); background: rgba(0, 0, 0, 0.2); border: 0; border-radius: 0; padding: 16px 20px; cursor: pointer; transition: background-color 160ms ease, transform 160ms var(--ease); }
.prompt:hover { background: rgba(0, 0, 0, 0.3); }
.prompt[aria-pressed="true"] { background: #fff; color: var(--ink); }
.prompt small { display: block; font-size: var(--small); font-weight: var(--regular); margin-top: 4px; }
.answer { display: grid; place-items: center; }
.js .answer { position: absolute; inset: 40px 3vw; opacity: 0; transition: opacity 220ms ease; pointer-events: none; }
.js .answer.is-on { opacity: 1; pointer-events: auto; }
.answer img { max-height: 70svh; width: auto; }
.answer p { font-size: var(--small); color: var(--muted); margin-top: 12px; text-align: center; max-width: 36ch; }
.no-js-answers .answer + .answer { margin-top: 40px; }

/* Full width panels */
.panel { background: var(--screen); padding: var(--gap) var(--pad); }
.panel-head { max-width: 60ch; margin-bottom: 40px; }
.boards, .flows { display: grid; gap: clamp(40px, 5vw, 72px); }
.boards img, .flows img, .wide img { width: 100%; background: #fff; }
.flow-head { max-width: 60ch; margin-bottom: 20px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.pair img { width: 100%; height: 280px; object-fit: cover; object-position: top left; background: #fff; }

/* Phones: device frame for raw screenshots, and a row of them */
.frame { display: inline-block; border: 10px solid #141414; border-radius: 40px; overflow: hidden; background: #141414; }
.frame img { border-radius: 30px; }
.stage-screen .frame img { max-height: 82svh; width: auto; }
.answer .frame img { max-height: 66svh; width: auto; }
.phones { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(16px, 3vw, 40px); align-items: start; }
.phones figure { min-width: 0; text-align: center; }
.phones .frame { border-width: 8px; border-radius: 32px; }
.phones .frame img { border-radius: 24px; width: 100%; }
.phones figcaption b { display: block; color: var(--ink); }

/* Active list */
.rows { list-style: none; }
.rows li { padding: 12px 0 12px 18px; border-left: 4px solid transparent; transition: border-color 200ms var(--ease); }
.row-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.row-name { font-weight: var(--bold); }
.row-state { font-size: var(--small); font-weight: var(--bold); color: var(--muted); }
.row-state.live { color: var(--project); }
.row-desc { margin-top: 2px; }
.rows li.is-on { border-left-color: var(--dot); }

/* What I learned */
.learned-band { padding: var(--gap) var(--pad); }
.learned { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px clamp(40px, 5vw, 80px); max-width: 1180px; }
.learned h3 { display: flex; gap: 14px; align-items: baseline; margin-bottom: 8px; }
.learned h3::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--dot); flex: none; transform: translateY(-2px); }
.learned p { padding-left: 26px; }

/* Next case study */
.next { background: var(--next, var(--slate)); color: #fff; padding: var(--gap) var(--pad); }
.next h2 { color: rgba(255, 255, 255, 0.84); font-size: var(--sub); margin-bottom: 8px; }
.next a.big { font-size: var(--display); font-weight: var(--bold); line-height: 1.05; letter-spacing: -0.02em; text-decoration: none; display: inline-block; transition: transform 220ms var(--ease); }
.next p { margin-top: 16px; max-width: 52ch; color: rgba(255, 255, 255, 0.86); }

.site-footer { display: grid; grid-template-columns: 1fr auto 1fr; gap: 24px; align-items: baseline; padding: 32px var(--pad); font-size: var(--small); color: var(--muted); }
.site-footer nav { display: flex; gap: 24px; }
.site-footer nav a { color: var(--ink); font-weight: var(--bold); }
.site-footer > :last-child { text-align: right; }

/* Entrances: content is never fully hidden */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal > * { opacity: 0.35; transform: translateY(12px); transition: opacity 500ms var(--ease), transform 500ms var(--ease); }
  .js .reveal.is-in > * { opacity: 1; transform: none; }
  .js .reveal.is-in > *:nth-child(2) { transition-delay: 50ms; }
  .js .reveal.is-in > *:nth-child(3) { transition-delay: 100ms; }
  .js .reveal.is-in > *:nth-child(n+4) { transition-delay: 150ms; }
}
@media (prefers-reduced-motion: reduce) {
  /* Reduced motion keeps gentle fades but drops all movement */
  *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; }
}

@media (max-width: 900px) {
  .split, .ask, .learned, .pair { grid-template-columns: 1fr; }
  .stage { display: none; }
  .read > section, .read > section.wide-read { max-width: none; }
  .read > section.title { padding: 56px var(--pad) 48px; }
  .inline-shot { display: block; margin: 32px calc(-1 * var(--pad)) 0; background: var(--screen); padding: 28px 0; }
  .inline-shot img { max-height: 68svh; width: auto; margin: 0 auto; }
  .inline-shot .frame { display: block; width: fit-content; margin: 0 auto; }
  .inline-shot .frame img { max-height: 62svh; }
  .title .inline-shot { margin-bottom: -48px; }
  .ask-out { min-height: 80svh; padding: 32px 20px; }
  .js .answer { inset: 32px 20px; }
  .answer img { max-height: 62svh; }
  .phones { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer { grid-template-columns: 1fr; gap: 8px; }
  .site-footer > :last-child { text-align: left; }
}
@media (max-width: 520px) {
  :root { --pad: 20px; --body: 1.0625rem; --sub: 1.25rem; }
  .site-header { height: 64px; }
  .site-header nav { gap: 14px; }
  .site-header nav a[href="about.html"] { display: none; }
  .timeline li, .principles div, .terms div { grid-template-columns: 1fr; gap: 0; }
  .figures { gap: 24px 20px; }
  .meta { grid-template-columns: 1fr 1fr; gap: 14px 20px; }
}

/* Images that open full size, a grid of research boards, tall flows */
figure > a { display: block; cursor: zoom-in; }
.board-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 24px; }
.board-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top left; background: #fff; }
.wide.tall img { max-width: 880px; }
.in-read { margin-top: 24px; }
@media (max-width: 900px) {
  .board-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 16px; }
}
@media (max-width: 520px) {
  .board-grid { grid-template-columns: 1fr; }
}
.terms + p, .principles + p, .figures + p, .timeline + p { margin-top: 24px; }

/* Boards shown whole, not cropped */
.board-grid.natural img, .pair.natural img { aspect-ratio: auto; height: auto; object-fit: contain; }
.board-grid.natural, .pair.natural { align-items: start; }
@media (max-width: 900px) { .pair.natural { grid-template-columns: 1fr; } }
p + .rows { margin-top: 24px; }

.phones.three { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 1100px; }
.phones figure img { margin: 0 auto 12px; }
@media (max-width: 520px) { .phones.three { grid-template-columns: 1fr; } .phones.three img { max-width: 300px; } }

/* Skip link: hidden until it gets keyboard focus */
.skip { position: absolute; left: 16px; top: -100px; z-index: 10; background: var(--ink); color: #fff; padding: 12px 18px; font-weight: var(--bold); text-decoration: none; }
.skip:focus { top: 12px; }

/* Back to top */
.to-top { position: fixed; right: 20px; bottom: 20px; z-index: 20; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px 0 14px; border: 2px solid #fff; border-radius: 999px; background: var(--ink); color: #fff; font: inherit; font-size: var(--small); font-weight: var(--bold); cursor: pointer; opacity: 0; visibility: hidden; transform: translateY(12px); transition: opacity 160ms ease, transform 160ms ease, visibility 0s linear 160ms, background-color 160ms ease, color 160ms ease; }
.to-top.is-on { opacity: 1; visibility: visible; transform: none; transition: opacity 240ms var(--ease), transform 240ms var(--ease), visibility 0s, background-color 160ms var(--ease), color 160ms var(--ease); }
.to-top:hover { background: var(--dot); color: var(--ink); }
.to-top svg { transition: transform 160ms var(--ease); }
h1[tabindex="-1"]:focus { outline: none; }
@media (max-width: 520px) { .to-top { right: 14px; bottom: 14px; padding: 0 14px; } .to-top span { display: none; } }

/* Motion, after Emil Kowalski's rules: press feedback everywhere, hover movement only
   for a real mouse, and nothing moves for people who ask for reduced motion. */
.button:active, .prompt:active, .to-top:active { transform: scale(0.97); }
.to-top { bottom: max(20px, env(safe-area-inset-bottom)); }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .button:hover { transform: translateY(-2px); }
  .button:active { transform: translateY(0) scale(0.97); }
  .prompt:hover { transform: translateX(4px); }
  .prompt:active { transform: translateX(4px) scale(0.98); }
  .next a.big:hover { transform: translateX(10px); }
  .to-top:hover svg { transform: translateY(-2px); }
  .stage-screen img { transform: scale(0.985); transition: transform 600ms var(--ease); }
  .stage-screen.is-on img { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .js .reveal > * { transform: none !important; }
  .button:active, .prompt:active, .to-top:active { transform: none; }
  .to-top { transform: none; }
}

/* Web interface guidelines: typography, anchors and touch */
h1, h2, h3 { text-wrap: balance; }
p, li, dd, figcaption { text-wrap: pretty; }
[id] { scroll-margin-top: 24px; }
a, button { touch-action: manipulation; -webkit-tap-highlight-color: rgba(246, 119, 108, 0.25); }
.project .stats b, .jobs .when, .timeline .when { font-variant-numeric: tabular-nums; }
figure > a img { transition: opacity 160ms ease; }
@media (hover: hover) and (pointer: fine) { figure > a:hover img { opacity: 0.9; } }

/* Arrow fill button (recreated in the spirit of Framer's Arrow Fill Button).
   A coral circle grows from behind the arrow with clip-path. Inside it sits a copy
   of the label in ink, so the text changes colour exactly where the fill passes.
   The arrow swaps, exit is quicker than entry, reduced motion gets a fade. */
.has-arrow { position: relative; isolation: isolate; overflow: hidden; gap: 14px; padding-right: 8px; }
.has-arrow > .btn-label { position: relative; }
.has-arrow .btn-fill { position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; gap: inherit; padding: inherit; border-radius: inherit; background: var(--dot); color: var(--ink); pointer-events: none;
  clip-path: circle(0 at calc(100% - 24px) 50%); transition: clip-path 260ms var(--ease); }
.has-arrow .btn-gap { width: 32px; flex: none; }
.has-arrow .btn-arrow { position: relative; z-index: 2; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; background: #fff; color: var(--ink); flex: none; transition: background-color 120ms ease, color 120ms ease; }
.has-arrow .btn-arrow > span { grid-area: 1 / 1; display: grid; place-items: center; transition: transform 260ms var(--ease); }
.has-arrow .a-in { transform: translateX(-150%); }
.on-colour .has-arrow .btn-arrow, .project .go.has-arrow .btn-arrow { background: var(--ink); color: #fff; }
.site-header .has-arrow { gap: 10px; padding-right: 5px; }
.site-header .has-arrow .btn-arrow { width: 28px; height: 28px; }
.site-header .has-arrow .btn-gap { width: 28px; }
.site-header .has-arrow .btn-fill { clip-path: circle(0 at calc(100% - 19px) 50%); }

/* Base colours never change; the fill does the work */
.button.has-arrow:hover { background: var(--ink); color: #fff; }
.on-colour .button.has-arrow:hover, .project .go.has-arrow, .project:hover .go.has-arrow, .project:focus-visible .go.has-arrow, article.project:hover .go.has-arrow, article.project .go.has-arrow:hover, article.project .go.has-arrow:focus-visible { background: #fff; color: var(--ink); }

/* Filled: hover for a mouse, press for touch, focus for keyboards */
.has-arrow:active .btn-fill, .has-arrow:focus-visible .btn-fill, .project:focus-visible .go.has-arrow .btn-fill { clip-path: circle(150% at calc(100% - 24px) 50%); transition-duration: 480ms; transition-timing-function: cubic-bezier(0.33, 1, 0.68, 1); }
.has-arrow:active .btn-arrow, .has-arrow:focus-visible .btn-arrow, .project:focus-visible .go.has-arrow .btn-arrow { background: var(--ink); color: #fff; }
.has-arrow:active .a-out, .has-arrow:focus-visible .a-out { transform: translateX(150%); }
.has-arrow:active .a-in, .has-arrow:focus-visible .a-in { transform: translateX(0); transition-delay: 60ms; }
@media (hover: hover) and (pointer: fine) {
  .has-arrow:hover .btn-fill, .project:hover .go.has-arrow .btn-fill { clip-path: circle(150% at calc(100% - 24px) 50%); transition-duration: 480ms; transition-timing-function: cubic-bezier(0.33, 1, 0.68, 1); }
  .site-header .has-arrow:hover .btn-fill { clip-path: circle(150% at calc(100% - 19px) 50%); }
  .has-arrow:hover .btn-arrow, .project:hover .go.has-arrow .btn-arrow { background: var(--ink); color: #fff; }
  .has-arrow:hover .a-out, .project:hover .go.has-arrow .a-out { transform: translateX(150%); }
  .has-arrow:hover .a-in, .project:hover .go.has-arrow .a-in { transform: translateX(0); transition-delay: 60ms; }
}
/* No lift or nudge on these buttons: the fill is the effect. Press still scales. */
.has-arrow:hover, .project:hover .go.has-arrow { transform: none !important; }
.has-arrow:active { transform: scale(0.97) !important; }
@media (prefers-reduced-motion: reduce) {
  .has-arrow .btn-fill { clip-path: none !important; opacity: 0; transition: opacity 160ms ease; }
  .has-arrow:hover .btn-fill, .has-arrow:active .btn-fill, .has-arrow:focus-visible .btn-fill, .project:hover .go.has-arrow .btn-fill { opacity: 1; }
  .has-arrow .btn-arrow > span { transition: none; }
  .has-arrow:active { transform: none !important; }
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Small phones: keep the header on one line */
.wordmark, .site-header nav a { white-space: nowrap; }
@media (max-width: 520px) {
  .site-header { gap: 12px; }
  .site-header nav { gap: 16px; }
  .site-header nav a[href="#about"], .site-header nav a[href="index.html#about"] { display: none; }
}
@media (max-width: 360px) {
  .site-header nav a[href="#work"], .site-header nav a[href="index.html#work"] { display: none; }
}

/* Sticky header: stays put, gains a hairline once you scroll */
:root { --header-h: 72px; }
html { scroll-padding-top: calc(var(--header-h) + 16px); }
.site-header { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, 0.94); -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px); box-shadow: 0 1px 0 transparent; transition: box-shadow 200ms ease; }
.site-header.is-stuck { box-shadow: 0 1px 0 rgba(26, 26, 26, 0.1); }
.stage { top: var(--header-h); height: calc(100svh - var(--header-h)); }
.stage-screen img { max-height: calc(86svh - var(--header-h)); }
[id] { scroll-margin-top: calc(var(--header-h) + 16px); }
@media (max-width: 520px) { :root { --header-h: 64px; } }

/* Cursor bubble */
.cursor-bubble { position: fixed; left: 0; top: 0; z-index: 40; pointer-events: none; padding: 9px 14px 10px; border-radius: 4px 16px 16px 16px; background: var(--ink); color: #fff; font-size: var(--small); font-weight: var(--bold); line-height: 1.2; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px;
  opacity: 0; scale: 0.9; transform-origin: 0 0; transition: opacity 160ms ease, scale 200ms cubic-bezier(0.23, 1, 0.32, 1); will-change: transform; }
.cursor-bubble::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dot); flex: none; }
.cursor-bubble.is-on { opacity: 1; scale: 1; }
@media print { .cursor-bubble { display: none; } }

/* Living galleries: JS owns the phone transforms, so switch off the CSS ones */
.is-live img { transition: none !important; will-change: transform; transform-style: preserve-3d; }
.project:hover .is-live img:first-child, .is-live img + img { transform: none; }
.phones.three.is-live img { display: block; }
.cursor-bubble.is-left { border-radius: 16px 4px 16px 16px; transform-origin: 100% 0; }

/* Type audit: one scale everywhere */
.next a.big { font-size: var(--title); line-height: 1.15; }
.lead { line-height: 1.5; }
@media (max-width: 520px) { :root { --sub: 1.1875rem; } }

/* Header: a faint line is always there, not just after scrolling */
.site-header { box-shadow: 0 1px 0 rgba(26, 26, 26, 0.08); }
.site-header.is-stuck { box-shadow: 0 1px 0 rgba(26, 26, 26, 0.12); }

/* Wider measures on case study title slides */
.title .lead { max-width: 52ch; }
.panel-head { max-width: 72ch; }

/* Signature moments */
@media (prefers-reduced-motion: no-preference) {
  .home-hero h1 .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; margin-bottom: -0.08em; }
  .home-hero h1 .w > span { display: inline-block; transform: translateY(105%); transition: transform 700ms cubic-bezier(0.23, 1, 0.32, 1); transition-delay: calc(var(--i) * 60ms + 80ms); }
  .home-hero h1.is-in .w > span { transform: none; }
  .project.will-open { clip-path: inset(6% 3% 0 3% round 24px); transition: clip-path 800ms cubic-bezier(0.23, 1, 0.32, 1); }
  .project.will-open.is-open { clip-path: inset(0 0 0 0 round 0); }
}

/* Footer: room for the Top button so nothing gets covered */
.site-footer { padding-bottom: 96px; }
@media (min-width: 901px) { .site-footer { padding-bottom: 84px; } }

/* Wider measures across case studies: less dead space beside subcopy */
.panel-head { max-width: 96ch; }
.panel-head p, .flow-head p { max-width: 90ch; }
.flow-head { max-width: 96ch; }
.learned { max-width: none; gap: 40px clamp(48px, 6vw, 120px); }
.learned p { max-width: 64ch; }
.read > section { max-width: 68ch; }
.read > section.wide-read { max-width: 80ch; }

/* Step by step phones: spread across the panel instead of bunched on the left */
.phones.three { max-width: 1320px; margin: 0 auto; gap: clamp(32px, 6vw, 120px); }
.phones.three figure img { max-width: 360px; width: 100%; }
.phones.three figcaption { max-width: 32ch; margin: 0 auto; }
.read > section { max-width: 76ch; }
.timeline li, .principles div, .terms div { grid-template-columns: 10rem minmax(0, 1fr); }

/* Try it yourself */
.try { background: var(--project); color: #fff; padding: clamp(56px, 6vw, 88px) var(--pad); }
.try h2 { color: #fff; }
.try p { color: rgba(255, 255, 255, 0.9); max-width: 60ch; }
.try .button { margin-top: 20px; background: #fff; color: var(--ink); }
.js .answer:not(.is-on) { visibility: hidden; transition: opacity 220ms ease, visibility 0s linear 220ms; }
.js .answer.is-on { visibility: visible; transition: opacity 220ms ease, visibility 0s; }

/* Use the width: fewer early wraps, less dead space. Caps only, so mobile is unaffected. */
.title .lead { max-width: 62ch; }
.meta { grid-template-columns: repeat(2, minmax(0, 20rem)); }
.ask-in > p, .prompts { max-width: 62ch; }
.answer p { max-width: 52ch; }
.panel-head, .flow-head { max-width: none; }
.panel-head p, .flow-head p { max-width: 110ch; }
.next p { max-width: 76ch; }
.learned p { max-width: none; }
.try p { max-width: 84ch; }
.phones.three figcaption { max-width: 40ch; }
p, li, dd, figcaption, .stats span, .metrics span, .figures span { text-wrap: pretty; }

/* Before and after tags on screens */
.shot-tag { position: absolute; top: max(5vh, 24px); left: 3vw; z-index: 2; padding: 6px 12px; border-radius: 999px; background: var(--ink); color: #fff; font-size: var(--small); font-weight: var(--bold); line-height: 1.2; }
.shot-tag.before { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.inline-shot { position: relative; }
@media (max-width: 900px) { .inline-shot .shot-tag { top: 12px; left: var(--pad); } }

/* Outcome line in each case study title */
.title .outcome { margin: 0 0 32px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, 0.32); max-width: 62ch; color: var(--project-ink); font-size: var(--sub); line-height: 1.45; }
.title .outcome b { display: block; font-size: var(--small); color: var(--project-soft); margin-bottom: 4px; }

/* Wide boards on phones: scroll sideways at a readable height */
.swipe { display: none; }
@media (max-width: 700px) {
  figure.scrollx > a { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad); scrollbar-width: thin; }
  figure.scrollx img { width: auto; max-width: none; height: min(52svh, 420px); aspect-ratio: auto; object-fit: unset; }
  figure.scrollx .swipe { display: inline; }
}
@media (max-width: 700px) {
  .flows, .flows > *, .board-grid, .board-grid > *, .pair, .pair > * { min-width: 0; }
  figure.scrollx { min-width: 0; max-width: 100%; }
}
