/* ==========================================================================
   CASE STUDIES
   One stylesheet for every case study page in case-studies/. These pages are
   a neutral "shared interior": they use tokens.css and base.css (so the nav,
   footer, quote player and results numbers match the home page) but never a
   look's look.css, so they read the same whichever look you came from.

   The house style: Cal Sans titles, Manrope text, a narrow reading column for
   the words and big images that run wider than it.

   Each study sets its own colour on <body>, e.g. style="--study: var(--color-pink)",
   matching its colour in the home page's deep dives list.
   ========================================================================== */
.case-page {
  --study: var(--color-pink);
  --reading: 680px;                         /* the text column */
  --wide: 1248px;                           /* images: the full page column */
  --well: #f3f3f5;                          /* the grey behind images */
  --line: rgba(0, 0, 0, 0.1);
  --gap-section: clamp(88px, 11vw, 168px);  /* between the story's sections */
  --gap-block: clamp(40px, 5vw, 72px);      /* between pieces inside a section */
}

/* The story: text sits in a centred reading column; anything marked .wide spans the page */
.case { padding-bottom: var(--gap-section); }
.case-section { padding-top: var(--gap-section); scroll-margin-top: var(--nav-height); }
.case-section > *, .case-hero > * { max-width: var(--reading); margin-inline: auto; }
.case-section > .wide, .case-hero > .wide { max-width: var(--wide); }
.case-section > * + * { margin-top: var(--space-xl); }
.case-section > .wide, .case-section > * + .wide, .case-section > .wide + * { margin-top: var(--gap-block); }

/* Reading text */
.case p, .case li { text-wrap: pretty; }
.prose { font-size: var(--text-body); font-weight: 400; line-height: 1.6; }
.prose > * + * { margin-top: 1.1em; }
.prose strong { font-weight: 700; }
.prose ul { list-style: none; }
.prose li { position: relative; padding-left: 1.4em; }
.prose li + li { margin-top: 0.6em; }
.prose li::before { content: ""; position: absolute; left: 0.2em; top: 0.68em; width: 0.42em; height: 0.42em; border-radius: 50%; background: var(--study); }
.case a.link { color: var(--color-link); text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }

/* Small coloured label above each section title, e.g. "01 · Context" */
.eyebrow {
  display: flex;
  gap: 0.6em;
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--study);
}
.eyebrow + * { margin-top: var(--space-md) !important; }
.case-section h2 { font-size: var(--text-xxl); line-height: 1; text-wrap: balance; }
.case-section h3 { font-size: var(--text-lg); line-height: var(--leading-snug); text-wrap: balance; }

/* A short, big statement: the problem in one line, the lesson in one line */
.statement { font-family: var(--font-display); font-size: var(--text-xl); line-height: var(--leading-snug); text-wrap: balance; }

/* ---------- Hero ---------- */
.case-hero { padding-top: clamp(32px, 5vw, 72px); }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--color-link);
}
.back-link img { width: 16px; height: auto; transition: translate 0.2s; }
.back-link:hover img { translate: -3px 0; }
.case-hero .back { margin-bottom: clamp(40px, 6vw, 88px); }
.case-hero h1 { font-size: var(--text-display); line-height: var(--leading-tight); }
.case-subtitle { margin-top: var(--space-md); font-family: var(--font-display); font-size: var(--text-lg); line-height: var(--leading-snug); color: var(--study); }
.case-summary { margin-top: var(--space-xl); font-size: var(--text-md); font-weight: 400; line-height: 1.45; text-wrap: pretty; }

/* Facts under the summary: company, role, timeline, team */
.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-lg) var(--space-xl);
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--line);
}
.facts dt { font-size: var(--text-fine); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.55; }
.facts dd { margin: 6px 0 0; font-size: 16px; line-height: 1.4; }
.case-hero > .shot { margin-top: clamp(48px, 6vw, 88px); }

/* ---------- Images ---------- */
/* Every screen sits on a soft grey well with plenty of room around it */
.shot { display: block; }
.shot-well {
  display: grid;
  place-items: center;
  padding: clamp(10px, 2.5vw, 40px);
  border-radius: clamp(16px, 2vw, 28px);
  background: var(--well);
  overflow: hidden;
}
.shot-well img { display: block; width: 100%; height: auto; }
/* A silent screen recording that plays while it's on screen (js/case-study.js).
   The play button shows only while it's paused; clicking the video pauses it. */
.shot-well--video { position: relative; }
.shot-well video { display: block; width: 100%; height: auto; cursor: pointer; }
.video-toggle { position: absolute; top: 50%; left: 50%; translate: -50% -50%; transition: opacity 0.2s; }
.shot-well--video.is-playing .video-toggle { opacity: 0; pointer-events: none; }
.shot-well--photo { padding: 0; }
/* A single phone screen, shown at phone size and centred in its well */
.shot-well--phone img { max-width: 390px; border-radius: 16px; box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 12px 32px rgb(0 0 0 / 0.08); }
.shot-well--photo img { height: 100%; object-fit: cover; }
.shot figcaption { margin-top: var(--space-md); font-size: var(--text-caption); line-height: 1.5; opacity: 0.7; }
.shot figcaption strong { opacity: 1; }

/* Side by side images. Each row of a .gallery shares its height. */
.gallery { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: var(--space-lg); align-items: stretch; }
.gallery .shot { display: flex; flex-direction: column; }
.gallery .shot-well { flex: 1; }
.gallery--2 { --cols: 2; }
.gallery--4 { --cols: 4; }

/* One screen at several sizes, each column as wide as its screen so they share a scale */
.gallery--sizes { grid-template-columns: 1920fr 992fr 575fr; align-items: start; }
.gallery--sizes figcaption { text-align: center; }

/* One tall screen on the left, two stacked on the right */
/* Phone, desktop and dialog screens in one row, each column as wide as its screen's shape so they share a height */
.gallery--snapshot { grid-template-columns: 484fr 1443fr 603fr; }
/* A desktop screen and its phone version in one well, side by side at exactly the same height.
   Each screen's flex-grow is its width ÷ height, so both come out equally tall. */
.shot-well--devices { display: flex; align-items: flex-start; gap: clamp(10px, 2.5vw, 40px); }
.shot-well--devices img { flex: var(--ratio) 1 0; min-width: 0; }
.gallery--feature { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.gallery--feature > :first-child { grid-row: span 2; }

/* Big screens in a row you can swipe or scroll sideways. Only the row scrolls, never the page. */
.strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(78%, 940px);
  gap: var(--space-lg);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding-bottom: var(--space-md);
  scrollbar-width: thin;
}
.strip .shot { display: flex; flex-direction: column; scroll-snap-align: start; }
.strip .shot-well { flex: 1; }
.caption { font-size: var(--text-caption); line-height: 1.5; opacity: 0.7; }
.case-section > .wide + .caption { margin-top: var(--space-md); }

/* Grey stand-in until Jared supplies the real image. Says what's needed. */
.placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: var(--ratio, 16 / 10);
  padding: var(--space-xl);
  border-radius: clamp(16px, 2vw, 28px);
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, rgba(0, 0, 0, 0.025) 14px 28px),
    #e6e6ea;
  color: rgba(0, 0, 0, 0.5);
  font-size: var(--text-caption);
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}
.gallery .placeholder { flex: 1; aspect-ratio: auto; min-height: 240px; }

/* Missing facts in the text: [square brackets] in a soft highlight, so they're easy to spot */
.todo {
  padding: 0.05em 0.35em;
  border-radius: 6px;
  background: #fff3b0;
  color: #6b5500;
  font-weight: 600;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* Copy Claude drafted from the slides, for Jared to rewrite or approve.
   It looks like everything else, unless the address ends in ?review. */
html.review .draft { background: #e8f1ff; box-shadow: 0 0 0 6px #e8f1ff; border-radius: 4px; }
html.review .draft::before { content: "Draft"; display: block; width: fit-content; margin-bottom: 4px; padding: 1px 6px; border-radius: 4px; background: #004fc6; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }

/* ---------- Strategy: who's in the market ---------- */
.parties { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-lg); }
.party { padding: var(--space-xl); border-radius: 20px; background: var(--party); }
.party:nth-child(1) { --party: #f2ddff; }
.party:nth-child(2) { --party: #dff4fb; }
.party:nth-child(3) { --party: #fbf6c9; }
.party h3 { font-size: var(--text-md) !important; }
.party p { margin-top: var(--space-xs); font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.55; }
.party ul { margin-top: var(--space-md); padding-left: 1.1em; font-size: 16px; font-weight: 400; line-height: 1.5; }
.party li + li { margin-top: 6px; }

/* Wide images stacked with a small gap, such as a wall of research screenshots */
.stack { display: grid; gap: var(--space-sm); padding: clamp(10px, 2.5vw, 40px); border-radius: clamp(16px, 2vw, 28px); background: var(--well); }
.stack img { display: block; width: 100%; height: auto; }
.chapter > .wide + .caption { margin-top: var(--space-md); }

/* Before and after, in two labelled columns */
.ba-label { font-size: var(--text-caption); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.55; }
.ba-label + .ba-label { color: var(--study); opacity: 1; }

/* The closing line of a reflection, e.g. "Build with, not for." */
.kicker { padding-left: 20px; border-left: 3px solid var(--study); font-family: var(--font-display); font-size: var(--text-lg); line-height: var(--leading-snug); color: var(--study); }

/* A list of named tools or modules, as cards. Each can have an icon (an <img> first) and shows a chevron,
   like the tool menu in the product (Velvet's suite, from Figma) */
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: var(--space-md); list-style: none; }
.modules li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04), 5px 10px 22px -8px rgba(0, 0, 0, 0.28);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.3;
}
.modules li img { flex: none; width: 26px; height: 26px; }
.modules li::after { content: ""; flex: none; width: 18px; height: 18px; margin-left: auto; background: url("../case-studies/velvet/icons/chevron.svg") center / contain no-repeat; }

/* ---------- The work: one block per chapter ---------- */
.case-section > .chapter { max-width: none; }
.chapter + .chapter { margin-top: clamp(72px, 9vw, 128px) !important; }
.chapter > * { max-width: var(--reading); margin-inline: auto; }
.chapter > .wide { max-width: var(--wide); }
.chapter > * + * { margin-top: var(--space-lg); }
.chapter > * + .wide, .chapter > .wide + * { margin-top: var(--gap-block); }

/* The leadership move behind each piece of work */
.move {
  padding: var(--space-lg) var(--space-xl);
  border-left: 3px solid var(--study);
  background: linear-gradient(90deg, color-mix(in srgb, var(--study) 7%, transparent), transparent);
  border-radius: 0 14px 14px 0;
  font-size: 17px;
  line-height: 1.5;
}
.move b { display: block; margin-bottom: 4px; font-size: var(--text-fine); letter-spacing: 0.06em; text-transform: uppercase; color: var(--study); }

/* ---------- Results ---------- */
/* Reuses the home page's .results-list and coloured .result-number, set wider here */
.case .results-list { grid-template-columns: repeat(var(--results, 4), minmax(0, 1fr)); gap: var(--space-2xl) var(--space-xl); }
.case .result-label { font-size: 17px; font-weight: 600; line-height: 1.4; }

/* ---------- Quote ---------- */
.case-quote { display: flex; flex-direction: column; gap: var(--space-xl); }
.case-quote blockquote { font-family: var(--font-display); font-size: var(--text-md); line-height: 1.35; }
.case-quote blockquote p + p { margin-top: 0.8em; }
.case-quote blockquote p:first-child::before { content: "\201C"; margin-left: -0.45em; }
.case-quote blockquote p:last-child::after { content: "\201D"; }
.case-quote figcaption { font-size: 16px; line-height: 1.5; white-space: pre-wrap; }
.case-quote .listen-icon { background: var(--well); }
.case-quote-small { margin-top: var(--space-md); padding: var(--space-lg) var(--space-xl); border-radius: 16px; background: color-mix(in srgb, var(--study) 9%, #fff); }
.case-quote-small blockquote { font-family: var(--font-display); font-size: var(--text-md); line-height: 1.3; }
.case-quote-small figcaption { margin-top: var(--space-sm); font-size: var(--text-caption); font-weight: 600; }

/* ---------- Up next ---------- */
.case-next {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-xl);
  padding-top: var(--space-2xl);
  border-top: 1px solid var(--line);
}
.next-label { font-size: var(--text-caption); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.55; }
.case-next .next-title { display: block; width: fit-content; margin-top: var(--space-xs); font-family: var(--font-display); font-size: var(--text-xl); line-height: 1; color: var(--next, var(--color-violet)); }
a.next-title:hover { text-decoration: none; }
a.next-title .dive-arrow { display: inline-flex; margin-left: 14px; vertical-align: middle; }
a.next-title:hover .dive-arrow { opacity: 1; translate: 4px 0; }
.case-next .next-title small { display: block; margin-top: 8px; line-height: 1.3; font-family: var(--font-body); font-size: var(--text-body); font-weight: 500; color: var(--color-text); opacity: 0.6; }
.home-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-radius: 999px;
  background: var(--color-text);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}
.home-button:hover { text-decoration: none; background: #33333a; }
.home-button img { width: 16px; filter: invert(1); }

/* The section you're in, underlined in the nav like the current look */
.nav-link[aria-current="page"]::after { scale: 1 1; }

/* ---------- Smaller screens ---------- */
@media (max-width: 1040px) {
  .gallery--4 { --cols: 2; }
  .case .results-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .gallery:not(.gallery--4, .gallery--sizes), .parties { grid-template-columns: minmax(0, 1fr); }
  .gallery--feature > :first-child { grid-row: auto; }
  .before-after { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: var(--space-sm); }
  .strip { grid-auto-columns: 88%; gap: var(--space-md); }
  .modules { gap: 10px; }
  .modules li { padding: 12px 16px; border-radius: 14px; font-size: 16px; }
  .gallery .placeholder { min-height: 200px; }
  .case .results-list { grid-template-columns: minmax(0, 1fr); }
  .move { padding: var(--space-md) var(--space-lg); }
}
@media (max-width: 480px) {
  .facts { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .back-link img { transition: none; }
}
