.cs-hero {
  /* same top line as the homepage (.cp4-poster-inner): nav height + the
     homepage's clamp, so every page's first line starts at one height */
  padding-top: calc(clamp(1.5rem, 4vw, 3rem) + 70px);
  padding-bottom: 48px;
}

/* inner-page hero eyebrow + intro */
.hero-eyebrow {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 19px;
  color: var(--accent);
  margin-bottom: 20px;
  opacity: 0;
  animation: cs-rise 0.7s var(--ease) 0.1s forwards;
}

.hero-sub {
  margin-top: 28px;
  font-size: 18px;
  color: var(--ink-soft);
  max-width: 1080px; /* same measure as the body text */
  opacity: 0;
  animation: cs-rise 0.8s var(--ease) 0.4s forwards;
}

@keyframes cs-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-eyebrow, .hero-sub { animation: none; opacity: 1; }
}

.cs-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 400;
  letter-spacing: -0.01em;
  max-width: 40ch;
  margin: 16px 0 20px;
  text-wrap: balance;
}

.cs-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

@media (max-width: 760px) {
  .cs-meta { grid-template-columns: repeat(2, 1fr); }
}

.cs-meta > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14.5px;
}

.cs-meta-label {
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.cs-cover {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  /* derived from palette tokens so it auto-adapts in dark mode */
  background: linear-gradient(135deg, color-mix(in srgb, var(--ink) 8%, var(--surface)), color-mix(in srgb, var(--ink) 18%, var(--surface)));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 14px;
  margin: 32px auto 0;
}

.cs-cover-sm {
  margin-top: 28px;
  aspect-ratio: 16 / 7;
}

/* only top/bottom here — the side padding comes from .wrap, so the body
   text starts on the same edge as the nav logo. Line length is capped
   per block (.cs-block), not by narrowing the whole column. */
.cs-body {
  padding-top: 96px;
  padding-bottom: 40px;
}

/* Article: the gap above the photo matches the gap below it
   (72px on desktop, 2.5rem on phones, see .article-figure) */
.article-hero { padding-bottom: 0; }
.cs-hero h1.article-title { margin-bottom: 0; }
.cs-body-wide { padding-top: 72px; }
@media (max-width: 760px) { .cs-body-wide { padding-top: 2.5rem; } }

/* Article photo: under the title, above the essay, same width as the
   About photo, on the same left edge as the text */
.article-figure {
  width: min(576px, 100%);
  margin: 0 0 72px;
}

.article-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.article-figure figcaption {
  margin-top: 0.75rem;
  font-size: 14px;
  color: var(--ink-soft);
}

@media (max-width: 760px) {
  .article-figure { margin-bottom: 2.5rem; }
}

/* .cs-hero h1's max-width:40ch (element+class selector) outranks a
   plain .article-title class selector on specificity — qualify with the
   element+class chain so this override actually wins the cascade */
.cs-hero h1.article-title {
  max-width: none;
  text-wrap: initial;
}

.cs-block {
  margin-bottom: 72px;
  max-width: 1080px;
}

.cs-block h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.cs-block p {
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.65;
}

.cs-block p + p { margin-top: 1.3em; }

/* ---------------- ABOUT — split screen ---------------- */

/* the photo spans both rows, so its top edge lines up with the greeting */
.about-split {
  display: grid;
  grid-template-columns: 1fr auto;
  /* the greeting sits above the photo row, so the photo's top edge
     lines up with the title, not with the greeting */
  grid-template-areas:
    "greet ."
    "title photo"
    "text  photo";
  grid-template-rows: auto auto 1fr;
  align-content: start;
  column-gap: clamp(1.5rem, 5vw, 5rem);
  min-height: 100vh;
  min-height: 100svh;
  /* same edges as the nav (.wrap) */
  max-width: var(--max);
  margin: 0 auto;
  padding: calc(clamp(1.5rem, 4vw, 3rem) + 70px) clamp(1.25rem, 6vw, 100px) 3rem;
}

.about-split-text {
  grid-area: text;
  display: flex;
  flex-direction: column;
  gap: 1.6em;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--ink);
}

.about-split-text p { margin: 0; max-width: 62ch; }

/* same face and colour as the title, one step smaller */
.about-split-greeting {
  grid-area: greet;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.35rem, 2.2vw, 1.8rem);
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 0.35rem;
}

.about-split-title {
  grid-area: title;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 1.75rem;
}

.about-split-text a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.about-split-text a:hover { color: var(--accent); }

/* contact row: icon + label, no underline; same hover as the rest of the site */
.about-split-contact { display: flex; flex-direction: column; gap: 1rem; }
.about-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; }
.about-split-text .about-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  text-decoration: none;
  transition: color 0.2s var(--ease);
}
/* Phosphor Thin icons (one family, each in its full 256 box as designed);
   hairline strokes to match the site's 1px rules */
.about-links svg {
  width: 1.35em;
  height: 1.35em;
  flex: none;
  fill: currentColor;
}
.about-split-text .about-links a:hover,
.about-split-text .about-links a:focus-visible { color: var(--accent); }
/* small phones: one link per line instead of a 2 + 1 wrap */
@media (max-width: 480px) {
  .about-links { flex-direction: column; }
}

.about-split-photo {
  grid-area: photo;
  align-self: start;
}

/* photo keeps its natural proportions — no forced crop */
.about-split-photo img {
  display: block;
  width: 576px;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

@media (max-width: 760px) {
  .about-split {
    grid-template-columns: 1fr;
    grid-template-areas: "greet" "title" "text" "photo";
    grid-template-rows: auto;
    min-height: 0;
  }
  .about-split-photo { margin: 1.75rem 0 2rem; }
  .about-split-photo img { width: 100%; }
}

.cs-block ol {
  color: var(--ink-soft);
  font-size: 16.5px;
  line-height: 1.65;
  padding-left: 1.3em;
}

.cs-block ol li + li { margin-top: 1em; }

.cs-stats {
  display: flex;
  gap: 48px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.cs-stat-num {
  display: block;
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.cs-stat-label {
  display: block;
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--ink-soft);
}

/* .cs-cover now derives from color-mix() against palette tokens, so it
   auto-adapts in dark mode on its own — no separate override needed. */

/* case-study body: bullet lists, sub-headings and image placeholders */
.cs-block ul {
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.65;
  padding-left: 1.3em;
  margin: 1.3em 0;
}

.cs-block ul li + li { margin-top: 0.6em; }

.cs-block p + ul,
.cs-block ul + p { margin-top: 1.3em; }

.cs-block h3 {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 400;
  margin: 2.2em 0 12px;
}

.cs-block strong { color: var(--ink); font-weight: 600; }

.cs-figure { margin: 32px 0; }
.cs-figure .cs-cover { margin-top: 0; }
.cs-figure figcaption {
  margin-top: 1.25rem;
  font-size: 13px;
  color: var(--ink-soft);
}

.cs-block p.cs-stats-note {
  margin-top: 1.3em;
  font-size: 14px;
}

/* real app screens: a row of phone mockups */
.cs-screens {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.cs-screens img {
  display: block;
  width: 200px;
  max-width: calc(50% - 8px);
  height: auto;
}

/* cover: all six screens in a row, no panel behind them.
   Columns cap at the screens' natural width so they never upscale;
   space-between keeps the first and last screen on the text edges. */
.cs-screens-hero {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 254px));
  justify-content: space-between;
  gap: 16px;
  margin-top: 32px;
}

.cs-screens-hero img {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 760px) {
  .cs-screens-hero { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* screens open bigger on click (see the lightbox in main.js) */
.cs-zoom { display: block; cursor: zoom-in; }
.cs-screens .cs-zoom { width: 200px; max-width: calc(50% - 8px); }
.cs-screens .cs-zoom img { width: 100%; max-width: none; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  cursor: zoom-out;
}

/* width is set in main.js to twice the size the screen had on the page,
   capped so the whole screen always fits in the window */
.lightbox img {
  display: block;
  height: auto;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  border: 0;
  background: none;
  color: #fff;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
}

/* a video inside the same phone frame as the image mockups:
   the frame image sits on top, with a transparent screen */
.cs-phone {
  position: relative;
  width: 200px;
  max-width: calc(50% - 8px);
  aspect-ratio: 900 / 1859;
}
.cs-screens-hero .cs-phone { width: 100%; max-width: none; }
.cs-phone video {
  position: absolute;
  left: 4.2254%;
  top: 2.0455%;
  width: 91.549%;
  height: 95.909%;
  object-fit: cover;
  border-radius: 12.137% / 5.608%;
  background: #fff;
}
.cs-phone img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* small label above a row of screens, e.g. "First proposal" */
.cs-block p.cs-label {
  margin: 0 0 0.75rem;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* first proposal vs final, side by side */
.cs-compare { display: flex; gap: 48px; flex-wrap: wrap; }
.cs-compare .cs-screens .cs-zoom,
.cs-compare .cs-screens .cs-phone { max-width: none; }

.cs-block .cs-cover-sm { margin: 24px 0 32px; max-width: 640px; }
.cs-block p.cs-todo { color: var(--accent); }
.cs-screens-hero-4 { grid-template-columns: repeat(4, minmax(0, 300px)); }
@media (max-width: 760px) { .cs-screens-hero-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.lightbox-slot { display: flex; align-items: center; justify-content: center; max-height: 100%; }
.lightbox .cs-phone { cursor: zoom-out; }
.lightbox .cs-phone img { width: 100%; }

/* scenarios as three tidy columns: a thin rule, a small heading,
   then short lines without bullets */
.cs-scenarios {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px;
  margin: 32px 0;
}
.cs-block .cs-scenarios p.cs-label { margin: 0 0 12px; }
.cs-block .cs-scenarios ul {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
}
.cs-block .cs-scenarios li + li { margin-top: 10px; }
@media (max-width: 760px) { .cs-scenarios { grid-template-columns: 1fr; gap: 24px; } }

/* past work (initial designs and proposals): smaller than the final screens */
.cs-figure-muted .cs-screens .cs-zoom { width: 140px; }

/* a slightly smaller row for the final states */
.cs-figure-sm .cs-screens .cs-zoom { width: 170px; }

/* the one comparison a reader should remember: large and centred */
.cs-feature {
  margin: 0 0 96px;
  padding: 56px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.cs-feature .cs-compare { justify-content: center; gap: clamp(32px, 8vw, 120px); }
.cs-feature .cs-screens .cs-zoom { width: clamp(172px, 30vw, 391px); max-width: none; }
.cs-feature .cs-label { text-align: center; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 12px; }
.cs-pullquote {
  margin: 40px auto 0;
  max-width: 720px;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.3;
  color: var(--ink);
}

/* screen-row titles sit centred over the screens they name:
   the figure shrinks to the width of its row, the title centres in it */
.cs-figure:has(> .cs-label) { width: fit-content; max-width: 100%; }
.cs-block .cs-figure p.cs-label,
.cs-compare p.cs-label { text-align: center; }
@media (min-width: 761px) {
  .cs-figure:has(> .cs-label) .cs-screens .cs-zoom { max-width: none; }
}

/* screens under each scenario column, lined up along the bottom */
.cs-scenarios > div { display: flex; flex-direction: column; }
.cs-scenarios .cs-screens { margin-top: auto; padding-top: 24px; gap: 12px; flex-wrap: nowrap; }
.cs-block .cs-scenarios .cs-screens .cs-zoom { width: 140px; max-width: calc(50% - 6px); }
/* scenario columns: the text block (left-aligned, with bullets) and the
   screens are both centred in the column, so they share one centre line */
.cs-scenarios > div { align-items: center; }
.cs-scen-text { width: fit-content; max-width: 100%; text-align: left; }
.cs-block .cs-scenarios ul { list-style: disc; padding-left: 1.2em; }
.cs-scenarios .cs-screens { justify-content: center; width: 100%; }
/* scenario headings centred over their column, like the text block and screens */
.cs-block .cs-scenarios .cs-scen-text p.cs-label { text-align: center; }

/* scenarios: one size smaller, and the block may use the full page width
   (logo edge to menu edge) so each line fits on one row on a laptop.
   The rest of the section keeps the 1080px text width. */
.cs-block:has(.cs-scenarios) { max-width: none; }
.cs-block:has(.cs-scenarios) > :not(.cs-scenarios) { max-width: 1080px; }
.cs-block .cs-scenarios ul { font-size: 14px; }
/* columns sized to their content: Wishlist (longest lines, two screens)
   gets more room, Product detail page less; spare space goes between them */
@media (min-width: 761px) {
  .cs-scenarios { grid-template-columns: repeat(3, auto); justify-content: space-between; }
}
/* every scenario screen stays the same size, however narrow its column */
.cs-block .cs-scenarios .cs-screens .cs-zoom { width: 140px; max-width: none; flex: none; }
/* Shopping bag text may wrap, which frees room between the columns;
   a bit more air between each column's text and its screens */
.cs-scenarios > div:last-child .cs-scen-text { max-width: 330px; }
@media (min-width: 761px) { .cs-scenarios { column-gap: 64px; } }
.cs-scenarios .cs-screens { padding-top: 40px; }

/* the back-in-stock email: a long page, shown whole with a thin edge */
.cs-figure-email .cs-screens .cs-zoom { width: 240px; max-width: 100%; }
.cs-figure-email .cs-zoom img { border: 1px solid var(--line); }
/* long pages open at twice the width and scroll, instead of shrinking to fit */
.lightbox-scroll { align-items: flex-start; overflow-y: auto; }
.lightbox-scroll .lightbox-slot { max-height: none; }
.lightbox-scroll .lightbox-close { position: fixed; }

/* more room between a row's title and its screens */
.cs-block .cs-figure > p.cs-label { margin-bottom: 28px; }

/* the big comparison lines up with the text on the left, like the rest of the page */
.cs-feature .cs-compare { justify-content: flex-start; }
.cs-pullquote { margin: 40px 0 0; text-align: left; }

/* phones: keep the two comparison screens side by side so they still read as a comparison */
@media (max-width: 760px) {
  .cs-feature .cs-compare { flex-wrap: nowrap; gap: 16px; }
  .cs-feature .cs-compare > div { flex: 1 1 0; min-width: 0; }
  .cs-feature .cs-screens .cs-zoom { width: 100%; }
}

/* phones: tighter gaps between sections, and headings that wrap onto
   several lines keep their lines closer together */
@media (max-width: 760px) {
  .cs-block { margin-bottom: 40px; }
  .cs-block h2 { line-height: 1.25; }
}

/* more air between screens in a row (desktop; phones keep the tighter gap) */
@media (min-width: 761px) {
  .cs-screens { gap: 32px; }
}
.cs-block .cs-scenarios .cs-screens { gap: 24px; }

/* pause control for the case-study videos (added by main.js) */
.motion-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  padding: 6px 10px;
  border: 0;
  border-radius: 4px;
  background: var(--ink);
  color: var(--bg);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.motion-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
