/* Case study template — shared by all case pages.
   Requires tokens.css and base.css (grid, dark header, dark footer).
   Layout: dark hero → cover image (columns 1–12) → sections with the label in
   columns 1–4 and content in columns 5–12 → next case → footer. */

/* ── Dark hero ─────────────────────────────────────── */
.case-hero {
  background: var(--dark-bg);
  color: var(--dark-text);
  padding: calc(var(--nav-h) + clamp(32px, 6vh, 72px)) 0 clamp(32px, 5vh, 56px);   /* header overlays the hero */
}
.case-hero__back { font-size: var(--fs-base); color: var(--dark-muted); }
.case-hero__back:hover { color: var(--dark-text); }
.case-hero__eyebrow {
  margin-top: clamp(40px, 8vh, 88px);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--dark-muted);
}
.case-hero h1 {
  margin-top: var(--space-3);
  font-weight: var(--fw-medium);
  font-size: clamp(40px, 6vw, 80px);
  line-height: .98;
  letter-spacing: -.04em;
}
.case-hero__summary {
  margin-top: var(--space-5);
  max-width: 52ch;
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.45;
  color: var(--dark-muted);
}

/* Facts row on the grid (4 × 3 columns; 3 × 4 with .case-facts--3) */
.case-facts {
  margin-top: clamp(48px, 9vh, 96px);
  padding-top: var(--space-5);
  border-top: 1px solid var(--dark-line);
  row-gap: var(--space-5);
}
.case-facts > div { grid-column: span 3; }
.case-facts--3 > div { grid-column: span 4; }
.case-facts dt { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--dark-muted); }
.case-facts dd { margin-top: 6px; font-size: var(--fs-base); line-height: 1.5; }
.case-facts__lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }

/* ── Cover image (columns 1–12) ────────────────────── */
.case-cover {
  margin: var(--space-10) 0 var(--section);
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--media-bg);
}
.case-cover img { width: 100%; height: 100%; object-fit: cover; object-position: var(--pos, center); }
/* Cover as a row of live CSS phones (bigger than the ones in the sections) */
.case-cover--phones { --phone-w: clamp(150px, 21vw, 280px); aspect-ratio: auto; padding: clamp(32px, 5vw, 64px) clamp(16px, 4vw, 56px); }
.case-cover--phones .phones { gap: clamp(16px, 3vw, 40px); }
/* Cover as a grid of separate screens (columns 1–12) */
.case-screens { margin: var(--space-10) 0 var(--section); }
.case-screens .screen-grid { gap: 16px; }

/* ── Sections on the grid ──────────────────────────── */
.case-sec {
  padding: 28px 0 var(--section);
  border-top: 1px solid var(--text);
  row-gap: var(--space-6);
}
.case-sec__label { font-size: 14px; font-weight: var(--fw-medium); line-height: 1.4; }
.case-sec__body > :first-child { margin-top: 0; }

.case-sec h3 { font-size: 18px; font-weight: var(--fw-semibold); line-height: 1.3; letter-spacing: -.01em; }
.case-block { margin-top: var(--space-11); }
.case-block > h3 + * { margin-top: var(--space-4); }

.prose { max-width: 70ch; font-size: 17px; line-height: 1.65; color: var(--muted); }
.prose > * + * { margin-top: var(--space-4); }
.lead { font-size: 22px; line-height: 1.55; color: var(--text); }
.lead:not(:first-child) { margin-top: var(--space-6); }

.bullets { max-width: 70ch; font-size: var(--fs-md); line-height: var(--lh-body); color: var(--muted); }
.bullets li { position: relative; padding-left: var(--space-5); }
.bullets li + li { margin-top: var(--space-3); }
.bullets li::before { content: ""; position: absolute; left: 2px; top: .7em; width: 5px; height: 5px; border-radius: 50%; background: var(--subtle); }
.bullets strong { color: var(--text); font-weight: var(--fw-medium); }

.stat-line { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-8); margin-top: var(--space-6); font-size: var(--fs-md); color: var(--muted); }
.stat-line b { margin-right: 6px; font-size: 28px; font-weight: var(--fw-medium); letter-spacing: -.02em; color: var(--text); }

.note { margin-top: var(--space-8); max-width: 70ch; font-size: 14px; line-height: var(--lh-body); color: var(--muted); }

/* Two columns inside 5–12 */
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-8) var(--col-gap); }

/* Minimal blocks (personas, specimens): thin rule, no box */
.card { padding-top: var(--space-5); border-top: 1px solid var(--border-strong); }
.persona__head { display: flex; align-items: center; gap: var(--space-4); }
.persona__photo { width: 56px; height: 56px; flex: none; border-radius: 50%; object-fit: cover; background: var(--media-bg); }
.persona__name { font-size: 17px; font-weight: var(--fw-semibold); line-height: 1.3; }
.persona__role { font-size: var(--fs-base); color: var(--muted); }
.persona dl { margin-top: var(--space-5); }
.persona dt, .decision dt { font-size: 12px; font-weight: var(--fw-medium); letter-spacing: .06em; text-transform: uppercase; color: var(--subtle); }
.persona dd { margin-top: var(--space-1); font-size: var(--fs-base); line-height: var(--lh-body); color: var(--muted); }
.persona dd + dt { margin-top: var(--space-4); }
.persona__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 16px; line-height: 1.5; }
.persona__list li { position: relative; padding-left: 14px; }
.persona__list li::before { content: ""; position: absolute; left: 0; top: .65em; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); }

/* Disclosure */
.disclosure { border-top: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong); }
.disclosure summary {
  display: flex; justify-content: space-between; align-items: center; gap: var(--space-4);
  padding: var(--space-4) 0; cursor: pointer; list-style: none; font-weight: var(--fw-medium);
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::after { content: "+"; font-size: 22px; line-height: 1; color: var(--muted); }
.disclosure[open] summary::after { content: "−"; }
.disclosure__body { padding-bottom: var(--space-5); }

/* ── Figures & galleries ───────────────────────────── */
.figure { margin: 0; }
.figure.case-block { margin-top: var(--space-11); }
.figure__frame { display: block; border-radius: var(--radius-sm); overflow: hidden; background: var(--media-bg); }
.figure__frame img { width: 100%; height: auto; transition: transform .3s ease; }
a.figure__frame { cursor: zoom-in; }
a.figure__frame:hover img { transform: scale(1.02); }
/* Artwork drawn on a dark canvas */
.figure--dark .figure__frame { background: var(--dark-bg); }

/* Diagram cropped to 16:9 from the top; a blurred copy on top
   takes over towards the bottom. No lightbox. */
.figure--arch .figure__frame { position: relative; aspect-ratio: 16 / 9; background: #171A1B; }
.figure--arch .figure__frame img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.figure--arch .figure--arch__blur {
  position: absolute; inset: 0;
  filter: blur(4px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, transparent 35%, #000 65%, #000 100%);
          mask-image: linear-gradient(to bottom, transparent 0%, transparent 35%, #000 65%, #000 100%);
}
/* Fit: fixed-ratio frame, whole image visible — equal heights in a row */
.figure--fit .figure__frame { aspect-ratio: var(--ratio, 16 / 10); padding: var(--fit-pad, var(--space-6)); }
.figure--fit .figure__frame img { width: 100%; height: 100%; object-fit: contain; object-position: var(--pos, center); }
/* Crop: fixed-ratio frame, image fills it from the top */
.figure--crop .figure__frame { aspect-ratio: var(--ratio, 4 / 3); }
.figure--crop .figure__frame img { height: 100%; object-fit: cover; object-position: var(--pos, top center); }
/* Mockup cut off at its right edge in the source image */
.figure--flush-right .figure__frame { padding-right: 0; }
.figure--flush-right .figure__frame img { object-position: right center; }
.figure figcaption { margin-top: var(--space-3); font-size: 14px; line-height: var(--lh-body); color: var(--muted); }
.figure figcaption b { font-weight: var(--fw-medium); color: var(--text); }

.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-10) var(--col-gap); align-items: start; }
.gallery--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }   /* narrow phone screens only */
.gallery .figure--wide { grid-column: 1 / -1; }

/* Grid of separate screens, each in its own equal 16:10 frame */
.screen-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--col-gap); }
.screen-grid .figure__frame { aspect-ratio: 16 / 10; }
.screen-grid .figure__frame img { height: 100%; object-fit: cover; object-position: top left; }
.screen-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.screen-grid--photos .figure__frame img { object-position: center; }
.screen-grid--mobile { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.screen-grid--mobile .figure__frame { aspect-ratio: 9 / 16; }
.screen-grid--mobile .figure__frame img { object-position: top center; }

/* Website screenshots in a "browser" frame, so light pages don't melt into the white page */
.figure--browser .figure__frame,
.landing__frame {
  padding: 0 24px 24px;
  background: #F3F4F6;
  border: 1px solid #E3E6EA;
  border-radius: var(--radius-sm);
}
.browser-bar { display: flex; align-items: center; gap: 6px; height: 28px; }
.browser-bar i { width: 8px; height: 8px; border-radius: 50%; background: #CDD1D7; }
.figure--browser .figure__frame img,
.landing__page { border-radius: 8px; box-shadow: 0 4px 16px rgba(15, 17, 21, .08); }

/* Full landing page: all sections stacked in one frame, capped until expanded */
.landing { margin-top: var(--space-2); }
.landing__frame { position: relative; overflow: hidden; }
.landing__page { overflow: hidden; }
.landing__page img { display: block; width: 100%; height: auto; }
.landing__frame.is-collapsed { max-height: 1600px; }
.landing__frame.is-collapsed::after { content: ""; position: absolute; inset: auto 0 0; height: 160px; background: linear-gradient(to bottom, rgba(243, 244, 246, 0), #F3F4F6); pointer-events: none; }
.landing__toggle {
  display: block; margin: var(--space-4) auto 0; padding: 10px 20px;
  border: 1px solid var(--text); border-radius: var(--radius-pill); background: var(--bg);
  font: inherit; font-size: var(--fs-base); font-weight: var(--fw-medium); color: var(--text); cursor: pointer;
}
.landing__toggle[hidden] { display: none; }
.landing__toggle:hover { background: var(--text); color: var(--bg); }
.landing figcaption { margin-top: var(--space-3); }

/* Numbered steps (a flow's order is content) */
.steps { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5) var(--col-gap); counter-reset: step; }
.steps li { counter-increment: step; padding-top: var(--space-3); border-top: 1px solid var(--border-strong); font-size: var(--fs-base); line-height: 1.45; }
.steps li::before { content: counter(step, decimal-leading-zero); display: block; margin-bottom: var(--space-1); font-size: var(--fs-sm); color: var(--subtle); }

/* Timeline */
.timeline { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-6) var(--col-gap); }
.timeline__phase { padding-top: var(--space-3); border-top: 1px solid var(--border-strong); }
.timeline__name { font-size: var(--fs-base); font-weight: var(--fw-semibold); line-height: 1.3; }
.timeline__num { display: block; margin-bottom: var(--space-1); font-size: 12px; font-weight: var(--fw-medium); letter-spacing: .06em; text-transform: uppercase; color: var(--subtle); }
.timeline__steps { margin-top: var(--space-3); display: grid; gap: 6px; }
.timeline__steps li { font-size: var(--fs-base); line-height: 1.4; color: var(--muted); }
.timeline + figcaption { margin-top: var(--space-6); }

/* ── Live CSS phones ───────────────────────────────── */
/* Every phone is the same size; screens are 786 × 1704. Long screens scroll
   by themselves (js/phones.js) and by wheel, touch and keyboard. */
:root { --phone-w: 176px; }
.phones-figure { margin: var(--space-6) 0 0; }
.phones-figure figcaption { margin-top: var(--space-3); font-size: 14px; line-height: var(--lh-body); color: var(--muted); }
.phones-figure figcaption b { font-weight: var(--fw-medium); color: var(--text); }
.phones { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 16px; }
.phone-item { flex: none; width: var(--phone-w); }
.phone-item__hint { margin-top: var(--space-2); font-size: 12px; text-align: center; color: var(--subtle); }
.phone {
  --bezel: calc(var(--phone-w) * .04);
  --screen-w: calc(var(--phone-w) - 2 * var(--bezel));
  padding: var(--bezel);
  border-radius: calc(var(--phone-w) * .17);
  background: #1A1A1C;
  box-shadow: 0 1px 2px rgba(15, 17, 21, .1), 0 12px 32px rgba(15, 17, 21, .16);
}
.phone__screen {
  position: relative;
  aspect-ratio: var(--screen-ratio, 786 / 1704);
  border-radius: calc(var(--phone-w) * .13);
  overflow: hidden;
  background: #1A1A1C;
  isolation: isolate;
}
.phone__screen img { display: block; width: 100%; height: auto; }
.phone__screen--scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.phone__screen--scroll::-webkit-scrollbar { display: none; }
.phone__screen--scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.phone__screen--scroll img { will-change: transform; }

/* Hint + pause/play button under an animated phone */
.phone-item__controls { display: flex; align-items: center; justify-content: center; gap: var(--space-2); margin-top: var(--space-2); min-height: 32px; }
.phone-item__controls .phone-item__hint { margin: 0; }
.anim-toggle {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 1px solid var(--border-strong); border-radius: 50%; background: var(--bg, #fff); color: var(--text); cursor: pointer;
}
.anim-toggle[hidden] { display: none; }
.anim-toggle:hover { border-color: var(--text); }
.anim-toggle svg { width: 14px; height: 14px; fill: currentColor; }
.anim-toggle .anim-toggle__play, .anim-toggle[aria-pressed="true"] .anim-toggle__pause { display: none; }
.anim-toggle[aria-pressed="true"] .anim-toggle__play { display: block; }

/* Onboarding: one phone, slides swipe in from the right */
.onboard { display: flex; flex-direction: column; align-items: center; }
.onboard .phone { width: var(--phone-w); }
.onboard__screen { overflow: hidden; }
.onboard__slide { position: absolute; inset: 0; width: 100%; height: 100%; transform: translateX(100%); }
.onboard__slide:first-child { transform: none; }
.onboard__slide.is-anim { transition: transform 600ms cubic-bezier(.22, .61, .36, 1); }
.onboard__labels { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-1) var(--space-4); }
.onboard__label { padding: 4px 0; border: 0; background: none; font: inherit; font-size: 14px; line-height: 1.4; color: var(--subtle); cursor: pointer; transition: color .3s ease; }
.onboard__label:hover { color: var(--muted); }
.onboard__label[aria-current="true"] { color: var(--text); }

/* ── Long-read essay (xPortal) ───────────────────────── */
.xp { --xp-green: #1F4D3A; --xp-yellow: #F4F1C9; --screen-ratio: 750 / 1334; --mono: 'IBM Plex Mono', ui-monospace, monospace; }
.essay .body-text { max-width: 66ch; }
.essay .body-text + .body-text, .essay .body-text + .essay-pull, .essay .essay-pull + .body-text { margin-top: var(--space-5); }
/* No cover image between the hero and the essay, so the intro gets the extra air itself */
.essay-intro { padding-top: calc(28px + var(--space-10) + var(--space-10)); }
.essay-intro .grid-content { grid-column: 5 / 13; }
.essay-kicker { font-size: clamp(64px, 9vw, 120px); font-weight: var(--fw-semibold); line-height: .95; letter-spacing: -.045em; margin-bottom: var(--space-8); }
.essay-part { font-family: var(--mono); font-size: 14px; font-weight: 500; color: var(--xp-green); }
.essay-title { font-size: clamp(28px, 3vw, 36px); font-weight: var(--fw-semibold); line-height: 1.15; letter-spacing: -.02em; margin-bottom: var(--space-6); }
.essay-sub { margin-top: var(--space-11); margin-bottom: var(--space-4); font-size: 20px; }
.essay-pull { max-width: 30ch; margin-block: var(--space-8); font-family: 'IBM Plex Sans', var(--font); font-size: clamp(22px, 2.4vw, 28px); font-weight: 500; line-height: 1.45; color: var(--text); }
.essay-pull mark { padding: .05em .3em; background: var(--xp-yellow); color: inherit; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.essay-figure { margin-top: var(--space-8); margin-bottom: var(--space-8); }

.essay-toc { margin-top: var(--space-10); border-top: 1px solid var(--border-strong); }
.essay-toc ol { list-style: none; margin: 0; padding: 0; }
.essay-toc li { border-bottom: 1px solid var(--border-strong); }
.essay-toc a { display: flex; align-items: baseline; gap: var(--space-4); padding: var(--space-3) 0; font-size: var(--fs-md); color: var(--text); text-decoration: none; }
.essay-toc__num { font-family: var(--mono); font-size: 13px; color: var(--xp-green); }
.essay-toc a:hover { color: var(--xp-green); text-decoration: underline; text-underline-offset: 4px; }

.essay-ia { list-style: none; margin: var(--space-5) 0; padding: 0; display: grid; gap: var(--space-4); max-width: 66ch; }
.essay-ia li { display: grid; grid-template-columns: 24px minmax(0, 1fr); font-size: var(--fs-md); line-height: var(--lh-body); }
.essay-ia__mark { font-family: var(--mono); font-weight: 500; color: var(--xp-green); }
.essay-ia strong { font-weight: var(--fw-medium); }

/* What's New: desktop browser frame (auto-scrolling) next to a phone */
.xp-pair { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-6); align-items: start; }
.xp-pair figcaption { grid-column: 1 / -1; }
.browser__screen { position: relative; height: 720px; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 16px rgba(15, 17, 21, .08); background: #fff; }
.browser__screen--scroll { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.browser__screen--scroll::-webkit-scrollbar { display: none; }
.browser__screen--scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.browser__screen img { display: block; width: 100%; height: auto; will-change: transform; }
.figure--browser .browser__screen img { border-radius: 0; box-shadow: none; }

/* Nevermind gallery: equal frames across the full grid */
.xp-gallery-figure { margin: var(--space-4) 0 var(--space-8); }
.xp-gallery { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.xp-gallery .figure__frame { aspect-ratio: 4 / 3; }
.xp-gallery .figure__frame img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.xp-gallery-figure figcaption { margin-top: var(--space-3); }

/* ── AI assistant concept (Compass): no images, all built in HTML/CSS ── */
/* First screenshot in the cover position, with a caption */
.case-lead { margin: var(--space-10) 0 var(--section); }
.cp .case-sec__body > * + * { margin-top: var(--space-6); }
.cp .case-sec__body > h3 { margin-top: var(--space-11); }
.cp .case-sec__body > h3 + * { margin-top: var(--space-4); }
.cp .lead strong { font-weight: var(--fw-medium); }
.cp .steps strong { font-weight: var(--fw-semibold); }
.cp-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6) var(--col-gap); }
.cp-card__title { font-size: var(--fs-md); font-weight: var(--fw-semibold); line-height: 1.3; }
.cp-card__text { margin-top: var(--space-2); font-size: var(--fs-base); line-height: var(--lh-body); color: var(--muted); }
.cp-text { max-width: 70ch; font-size: var(--fs-md); line-height: var(--lh-body); color: var(--muted); }
.cp .decision > * + * { margin-top: var(--space-6); }
.cp .decision > dl { margin-top: var(--space-5); }

/* Flow diagram: top-down tree; the three paths stack along a rail on phones */
.flow { --flow-line: var(--border-control); --flow-gap: 32px; margin: 0; display: flex; flex-direction: column; align-items: center; }
.flow__node {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 220px; padding: var(--space-3) var(--space-5);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--fs-md); font-weight: var(--fw-medium); line-height: 1.35; text-align: center;
}
.flow__node--key { background: var(--text); border-color: var(--text); color: var(--dark-text); }
.flow__title { font-weight: var(--fw-semibold); }
.flow__sub { font-size: var(--fs-base); font-weight: var(--fw-regular); color: var(--muted); }
.flow__node--key .flow__sub { color: var(--dark-muted); }
.flow__line { position: relative; width: 1px; height: var(--flow-gap); background: var(--flow-line); }
.flow__line::after {   /* arrowhead */
  content: ""; position: absolute; left: -4px; bottom: 0;
  border: 4.5px solid transparent; border-top: 6px solid var(--flow-line); border-bottom: 0;
}
.flow__paths {
  position: relative; align-self: stretch;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--col-gap);
  padding-top: var(--flow-gap);
}
/* Bar joining the three column centres */
.flow__paths::before {
  content: ""; position: absolute; top: 0; height: 1px; background: var(--flow-line);
  left: calc((100% - 2 * var(--col-gap)) / 6); right: calc((100% - 2 * var(--col-gap)) / 6);
}
.flow__path { position: relative; min-width: 0; justify-content: flex-start; }
.flow__path::before { content: ""; position: absolute; left: 50%; top: calc(-1 * var(--flow-gap)); width: 1px; height: var(--flow-gap); background: var(--flow-line); }

/* Tables (topic routes, toxic replies) */
.cp-table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); line-height: 1.5; }
.cp-table thead th {
  padding: 0 var(--space-5) var(--space-3) 0; border-bottom: 1px solid var(--text);
  font-size: 12px; font-weight: var(--fw-medium); letter-spacing: .06em; text-transform: uppercase; text-align: left; color: var(--subtle);
}
.cp-table tbody th, .cp-table td { padding: var(--space-3) var(--space-5) var(--space-3) 0; border-bottom: 1px solid var(--border-strong); text-align: left; vertical-align: top; }
.cp-table tbody th { width: 34%; font-weight: var(--fw-medium); color: var(--text); }
.cp-table td { color: var(--muted); }
.cp-table th:last-child, .cp-table td:last-child { padding-right: 0; }

/* JSON: scrolls inside its own block, never the page */
.cp-code { margin: 0; min-width: 0; }
.cp-code__label { margin-bottom: var(--space-2); font-size: 12px; font-weight: var(--fw-medium); letter-spacing: .06em; text-transform: uppercase; color: var(--subtle); }
.cp-code pre {
  max-width: 100%; overflow-x: auto; padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-sm); background: var(--media-bg);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 14px; line-height: 1.65; color: var(--text);
  tab-size: 2;
}
.cp-code .k { color: var(--accent-text); }
.cp-code .s { color: var(--ok-text); }
.cp-code .p { color: var(--muted); }

/* A Compass reply quoted in the text: same bubble as in the demo */
.cp-reply { max-width: 52ch; padding: var(--space-3) var(--space-5); border-radius: 18px 18px 18px 6px; background: var(--media-bg); font-size: var(--fs-md); line-height: 1.5; }

/* "Try it" demo: example buttons, then a chat log */
.demo { margin: 0; }
.demo__panel { border: 1px solid var(--border-strong); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg); }
.demo__picks { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-5); background: var(--surface); border-bottom: 1px solid var(--border-strong); }
.demo__picks-label { flex-basis: 100%; margin-bottom: var(--space-1); font-size: 12px; font-weight: var(--fw-medium); letter-spacing: .06em; text-transform: uppercase; color: var(--subtle); }
.demo__pick {
  min-height: 44px; padding: 8px 16px;
  border: 1px solid var(--border-control); border-radius: var(--radius-pill); background: var(--bg);
  font-size: var(--fs-base); line-height: 1.3; text-align: left; color: var(--text); cursor: pointer;
}
.demo__pick:hover { border-color: var(--text); }
.demo__pick[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.demo__bar { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4); padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--border); }
.demo__name { font-weight: var(--fw-semibold); }
.demo__mode { font-size: var(--fs-sm); color: var(--muted); }
.demo__log { display: flex; flex-direction: column; gap: var(--space-4); min-height: 440px; padding: var(--space-6) var(--space-5); }
.demo__empty { margin: auto; font-size: var(--fs-base); color: var(--muted); text-align: center; }
.demo figcaption { margin-top: var(--space-3); font-size: 14px; line-height: var(--lh-body); color: var(--muted); }
.demo .note { margin-top: var(--space-3); }

.msg { max-width: min(85%, 46ch); padding: 10px 16px; border-radius: 18px; font-size: var(--fs-md); line-height: 1.5; animation: msg-in .35s ease both; }
.msg--user { align-self: flex-end; border-bottom-right-radius: 6px; background: var(--text); color: var(--bg); }
.msg--bot { align-self: flex-start; border-bottom-left-radius: 6px; background: var(--media-bg); }
.msg__who { margin-bottom: 2px; font-size: 12px; font-weight: var(--fw-medium); color: var(--muted); }
.msg__redacted { display: grid; gap: 8px; width: 200px; max-width: 100%; padding: 6px 0; }
.msg__redacted i { display: block; height: 10px; border-radius: 5px; background: var(--dark-muted); filter: blur(3px); }
.msg__redacted i + i { width: 65%; }
.checks { align-self: stretch; padding: var(--space-4) var(--space-5); border: 1px dashed var(--border-control); border-radius: var(--radius-sm); font-size: var(--fs-base); line-height: 1.4; animation: msg-in .35s ease both; }
.checks__title { font-size: 12px; font-weight: var(--fw-medium); letter-spacing: .06em; text-transform: uppercase; color: var(--subtle); }
.checks dl { display: grid; gap: var(--space-2); margin-top: var(--space-3); }
.checks dl > div { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); }
.checks dt { flex: 1 1 auto; min-width: 0; color: var(--text); }
.checks dd { flex: none; }
.checks__format { color: var(--muted); }
.checks .tag.is-flag { background: var(--text); border-color: var(--text); color: var(--bg); }
.checks__path { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--border-strong); color: var(--muted); }
.checks__path-label { color: var(--muted); }
.checks__path b { font-weight: var(--fw-semibold); color: var(--text); }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }

@media (max-width: 600px) {
  .cp-trio { grid-template-columns: minmax(0, 1fr); }
  .cp-code pre { padding: var(--space-4); font-size: 13px; }
  .cp-table tbody th { width: 38%; }
  .demo__picks { padding: var(--space-4); }
  .demo__log { min-height: 400px; padding: var(--space-5) var(--space-4); }
  .msg { max-width: 92%; }
  /* Flow: left-aligned column, paths hang off a rail */
  .flow { --rail: 24px; align-items: stretch; }
  .flow__node { min-width: 0; text-align: left; }
  .flow__line { margin-left: var(--rail); }
  .flow__line::after { left: -4px; }
  .flow__paths { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); padding-top: 0; padding-left: calc(2 * var(--rail)); }
  .flow__paths::before { display: none; }
  .flow__path::before { left: calc(-1 * var(--rail)); top: 50%; width: var(--rail); height: 1px; }
  .flow__path::after { content: ""; position: absolute; left: calc(-1 * var(--rail)); top: calc(-1 * var(--space-3)); width: 1px; height: calc(50% + var(--space-3)); background: var(--flow-line); }
  .flow__path:first-child::after { top: 0; height: 50%; }
}

/* ── Key decisions: title, Problem / Solution, image below ── */
.decision + .decision { margin-top: var(--space-11); padding-top: var(--space-10); border-top: 1px solid var(--border); }
.decision h3 { font-size: 20px; }
.decision__title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.decision dl { margin-top: var(--space-5); max-width: 70ch; }
.decision dd { margin-top: var(--space-1); font-size: var(--fs-md); line-height: var(--lh-body); color: var(--muted); }
.decision dd + dt, .decision dl > div + div { margin-top: var(--space-5); }
.decision .figure, .decision__media { margin-top: var(--space-6); }
.decision__media { display: grid; gap: var(--space-8); }
.decision__media .figure { margin-top: 0; }
.decision__media--pair { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.decision--text .gallery { margin-top: var(--space-6); }
.decision__ref { margin-top: var(--space-4); font-size: var(--fs-base); }
.tag {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); line-height: 1.3; letter-spacing: 0;
  color: var(--text);
}

/* ── Design system specimens ───────────────────────── */
.specimen { display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-6); }
.specimen__aa { font-size: 80px; line-height: 1; letter-spacing: -.02em; }
.specimen__weights { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); font-size: 18px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--space-5) var(--space-4); }
.swatches--named { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.swatches--row { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-3); }

/* Tone of voice: original line, translation, short note */
.voice { list-style: none; margin: var(--space-8) 0 0; padding: 0; }
.voice__item { padding: var(--space-5) 0; border-top: 1px solid var(--border-strong); }
.voice__item:last-child { border-bottom: 1px solid var(--border-strong); }
.voice__uk { font-size: 20px; font-weight: var(--fw-medium); line-height: 1.35; letter-spacing: -.01em; }
.voice__en { margin-top: var(--space-1); font-size: var(--fs-md); line-height: var(--lh-body); color: var(--muted); }
.voice__note { margin-top: var(--space-3); font-size: var(--fs-base); line-height: var(--lh-body); color: var(--text); }
.swatch__chip { aspect-ratio: 3 / 2; border-radius: 8px; border: 1px solid rgba(15, 17, 21, .08); }
.swatch__hex { margin-top: var(--space-2); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.swatch__name { font-size: var(--fs-sm); line-height: 1.4; color: var(--muted); }

/* ── Next case (label 1–4, big link 5–12) ──────────── */
.next-case { padding: 28px 0 var(--section); border-top: 1px solid var(--text); row-gap: var(--space-6); }
.next-case__link {
  font-size: clamp(28px, 3.4vw, 44px);
  font-weight: var(--fw-medium);
  line-height: 1.15;
  letter-spacing: -.02em;
  text-underline-offset: 6px;
}

/* ── Lightbox (js/lightbox.js) ─────────────────────── */
.lightbox {
  width: 100vw; height: 100dvh;
  max-width: none; max-height: none;
  margin: 0; padding: var(--space-10) var(--gutter);
  border: 0;
  background: rgba(15, 17, 21, .92);
  color: var(--on-dark);
}
.lightbox[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-4); }
.lightbox::backdrop { background: transparent; }
.lightbox__img { max-width: 100%; max-height: calc(100dvh - 160px); width: auto; height: auto; object-fit: contain; border-radius: var(--radius-sm); }
.lightbox__caption { max-width: 72ch; text-align: center; font-size: var(--fs-base); color: #D5D8DE; }
.lightbox__close {
  position: absolute; top: var(--space-4); right: var(--space-4);
  min-width: 44px; min-height: 44px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--on-dark);
  cursor: pointer;
}
.lightbox__close:hover { border-color: var(--on-dark); }
.lightbox__close:focus-visible { outline-color: var(--on-dark); }


/* ── Responsive ────────────────────────────────────── */
@media (max-width: 960px) {
  .case-facts > div, .case-facts--3 > div { grid-column: span 6; }
  .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .screen-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .screen-grid--mobile { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .xp-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .essay-intro { padding-top: calc(28px + var(--space-6) + var(--space-6)); }
  .case-facts > div, .case-facts--3 > div { grid-column: 1 / -1; }
  .lead { font-size: 19px; }
  .prose { font-size: var(--fs-md); }
  .two-col, .gallery, .gallery--3, .steps, .timeline, .screen-grid, .decision__media--pair { grid-template-columns: minmax(0, 1fr); }
  .screen-grid--mobile { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .swatches--row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .xp-pair { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .xp-pair__desktop { width: 100%; }
  .browser__screen { height: 480px; }
  .xp-gallery { grid-template-columns: minmax(0, 1fr); }
  .landing__frame.is-collapsed { max-height: 900px; }
  .figure--browser .figure__frame, .landing__frame { padding: 0 16px 16px; }
  /* Phones: one horizontal swipe row, edge to edge */
  .phones {
    flex-wrap: nowrap; justify-content: flex-start;
    overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    margin-inline: calc(-1 * var(--gutter)); padding: 4px var(--gutter) var(--space-6);
    scroll-padding-inline: var(--gutter);
  }
  .phones::-webkit-scrollbar { display: none; }
  .phone-item { scroll-snap-align: start; }
  .case-cover--phones { --phone-w: 200px; padding-inline: 0; }
  .case-cover--phones .phones { margin-inline: 0; padding-inline: 24px; scroll-padding-inline: 24px; gap: 16px; }
  .case-screens .screen-grid > li:nth-child(n+3) { display: none; }
  .figure--fit .figure__frame { padding: var(--fit-pad, var(--space-4)); }
  .figure--flush-right .figure__frame { padding-right: 0; }
  .specimen__aa { font-size: 64px; }
  .lightbox { padding: var(--space-11) var(--space-4) var(--space-6); }
}
