/* Riverforge v4, version B: case study pages.
   Loaded after ../../styles.css (tokens, header, buttons, contact) and ../../services/services.css (related links).
   Like the work scenes on the homepage, a case study takes on the client's colours: B3 Designers' linen, sand, plum and orange.
   Base styles show every scene finished, stacked; html.fx (set by ../../script.js) turns on the scroll-locked versions. */

.cs {
  --plum: #1f1a21;
  --plum-text: #f3eee8;
  --plum-muted: #b9adb3;
  --linen: #e9e4dd;
  --sand: #e5d3c1;
  --warm-paper: #f4f0ea;
  --cs-ink: #2a232c;
  --cs-muted: #655a60;
  --b3: #ea5532;          /* B3 orange, on plum */
  --b3-mark: #d94a25;     /* the same orange, one step darker for marks on linen and sand */
  --before: #8b807b;      /* 2025 bars: the quiet half of the chart */
  --line-w: rgba(42, 35, 44, .14);
  --line-d: rgba(243, 238, 232, .14);
  color: var(--cs-ink);
}

/* Header tones for the client's palette */
.site-header[data-tone="plum"] { --hdr-bg: rgba(31, 26, 33, .86); --hdr-fg: #f3eee8; --hdr-solid: #1f1a21; }
.site-header[data-tone="linen"] { --hdr-bg: rgba(233, 228, 221, .88); --hdr-fg: #2a232c; --hdr-solid: #ffffff; }
.site-header[data-tone="sand"] { --hdr-bg: rgba(229, 211, 193, .88); --hdr-fg: #2a232c; --hdr-solid: #ffffff; }
.site-header[data-tone="paper"] { --hdr-bg: rgba(244, 240, 234, .88); --hdr-fg: #2a232c; --hdr-solid: #ffffff; }
.nav a[aria-current="true"] { opacity: 1; }

.cs-small { margin-top: 14px; font-size: 14px; color: var(--cs-muted); }

/* Hero */
.cs-hero { padding: calc(var(--header) + 9vh) 0 7vh; background: var(--plum); color: var(--plum-text); }
.cs-hero-copy { padding: 0 var(--gutter); }
.cs-hero h1 { font-size: clamp(38px, 6vw, 112px); max-width: 12.5em; }
.cs-lede { max-width: 33em; margin-top: 26px; font-size: clamp(17px, 1.4vw, 22px); color: var(--plum-muted); }
.cs-hero-photo { height: clamp(240px, 38vw, 74vh); margin: 7vh 0 0; overflow: hidden; }
.cs-hero-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; transform: scale(calc(1.1 - var(--hp, 1) * .1)); will-change: transform; }
.cs-hero-stats { display: grid; gap: 26px; padding: 6vh var(--gutter) 0; }
.cs-hero-stats p { padding-top: 16px; border-top: 1px solid var(--line-d); }
.cs-hero-stats strong { display: block; font-stretch: 125%; font-weight: 740; font-size: clamp(52px, 6vw, 108px); line-height: .9; letter-spacing: -.04em; }
.cs-hero-stats span { display: block; margin-top: 12px; font-size: clamp(16px, 1.25vw, 19px); color: var(--plum-muted); }
.cs-hero-note { padding: 3vh var(--gutter) 0; font-size: 14px; color: var(--plum-muted); }

/* The account we took over */
.cs-brief { display: grid; gap: 52px; padding: 16vh var(--gutter); background: var(--linen); }
.cs-brief h2 { font-size: clamp(32px, 4.2vw, 72px); max-width: 10em; }
.cs-brief-copy p { max-width: 31em; margin-top: 20px; font-size: clamp(17px, 1.3vw, 20px); color: var(--cs-muted); }
.cs-brief-copy p:first-of-type { color: var(--cs-ink); }
.cs-brief-photos { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; align-items: start; }
.cs-brief-photos figure { margin: 0; }
.cs-brief-photos figure:last-child { margin-top: 18%; }
.cs-brief-photos img { width: 100%; border-radius: 10px; box-shadow: 0 40px 70px -40px rgba(31, 26, 33, .55); }

/* Scroll-locked scenes: stacked by default */
.cs-stage { display: grid; gap: 40px; padding: 14vh var(--gutter); }
.cs-copy h2 { font-size: clamp(30px, 3.5vw, 62px); max-width: 11em; }
.cs-copy p { max-width: 30em; margin-top: 20px; font-size: clamp(16px, 1.25vw, 20px); color: var(--cs-muted); }
.cs-after-step { font-weight: 620; transition: opacity .5s, transform .6s cubic-bezier(.2, .8, .2, 1); }

/* Searches */
.cs-searches { background: var(--plum); color: var(--plum-text); }
.cs-searches .cs-copy p, .cs-searches .cs-small { color: var(--plum-muted); }
.cs-searches .cs-copy .cs-after-step { color: var(--plum-text); }
.cs-terms { border-top: 1px solid var(--line-d); }
.term { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; padding: 11px 0; border-bottom: 1px solid var(--line-d); font-size: clamp(16px, 1.3vw, 20px); line-height: 1.3; }
.term s { color: rgba(243, 238, 232, .42); text-decoration: line-through; text-decoration-color: var(--b3); text-decoration-thickness: 2px; transition: color .4s, text-decoration-color .4s; }
.term b { font-weight: 620; color: #fff; transition: font-weight .4s, color .4s; }
.term span { flex: none; font-size: 14px; color: var(--plum-muted); transition: opacity .4s, transform .5s cubic-bezier(.2, .8, .2, 1); }
.term.is-kept span { display: inline-flex; align-items: center; gap: 8px; color: var(--plum-text); font-weight: 600; }
.term.is-kept span::before { content: ""; width: 10px; height: 2px; background: var(--b3); }

/* Schedule */
.cs-schedule { background: var(--sand); }
.cs-steps p { color: var(--cs-muted); }
.cs-steps p[data-step="2"] { color: var(--cs-ink); }
.cs-days strong { display: block; font-stretch: 125%; font-weight: 740; font-size: clamp(56px, 6vw, 112px); line-height: .9; letter-spacing: -.04em; }
.cs-days span { display: block; margin-top: 12px; font-size: 18px; font-weight: 600; }
.cs-week { display: grid; gap: 5px; margin-top: 30px; }
.cs-day { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 10px; align-items: center; }
.cs-day > span { font-size: 14px; font-weight: 650; transition: opacity .4s; }
.cs-hours { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 3px; }
.cs-hours i { aspect-ratio: 1; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(42, 35, 44, .18); transition: background-color .45s, box-shadow .45s; }
.cs-week[data-phase="0"] .cs-hours i,
.cs-week[data-phase="1"] .cs-day:not(.is-cut) .cs-hours i,
.cs-week[data-phase="2"] .cs-day:not(.is-cut) .cs-hours i.is-office { background: var(--b3-mark); box-shadow: none; }
.cs-week[data-phase="1"] .cs-day.is-cut > span, .cs-week[data-phase="2"] .cs-day.is-cut > span { opacity: .4; }
.cs-hour-axis .cs-hours { display: block; position: relative; height: 18px; }
.cs-hour-axis em { position: absolute; top: 0; left: calc(var(--h) / 24 * 100%); transform: translateX(-50%); font-style: normal; font-size: 12px; color: var(--cs-muted); white-space: nowrap; }
.cs-hour-axis em:first-child { transform: none; }
.cs-hour-axis em:last-child { transform: translateX(-100%); }
.cs-week-key { display: flex; align-items: center; flex-wrap: wrap; }
.cs-week-key i { width: 12px; height: 12px; margin-right: 8px; border-radius: 3px; background: var(--b3-mark); }
.cs-week-key i.is-off { margin-left: 22px; background: none; box-shadow: inset 0 0 0 1px rgba(42, 35, 44, .3); }

/* Results */
.cs-results { background: var(--linen); }
.cs-results-head h2 { font-size: clamp(34px, 4.4vw, 78px); }
.cs-results-head p { max-width: 28em; margin-top: 14px; color: var(--cs-muted); }
.cs-chart { --plot-h: 280px; }
.cs-legend { display: flex; flex-wrap: wrap; gap: 6px 24px; font-size: 14px; color: var(--cs-muted); }
.cs-legend span { display: inline-flex; align-items: center; }
.cs-legend i { width: 12px; height: 12px; margin-right: 8px; border-radius: 3px; }
.cs-legend i.is-before { background: var(--before); }
.cs-legend i.is-after { background: var(--b3-mark); }
.cs-plot { position: relative; margin-top: 18px; }
.cs-bars { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); align-items: end; height: var(--plot-h); border-bottom: 1px solid rgba(42, 35, 44, .3); }
.cs-bar { display: flex; align-items: flex-end; justify-content: center; height: 100%; }
.cs-bar b { width: min(24px, 64%); height: calc(var(--v) * 100%); border-radius: 4px 4px 0 0; background: var(--before); transform-origin: bottom; transition: transform .7s cubic-bezier(.2, .8, .2, 1); }
.cs-bar.is-after b { background: var(--b3-mark); }
.cs-bar.is-zero b { height: 2px; border-radius: 0; opacity: .7; }
.cs-takeover { position: absolute; top: 0; bottom: 0; left: calc(var(--at) / var(--n) * 100%); border-left: 2px solid var(--cs-ink); transition: opacity .5s; }
.cs-takeover span { position: absolute; top: 0; right: 10px; font-size: 14px; font-weight: 650; white-space: nowrap; }
.cs-note { margin-top: 10px; font-size: 14px; font-weight: 600; line-height: 1.3; transition: opacity .5s, transform .6s cubic-bezier(.2, .8, .2, 1); }
.cs-note::before { content: ""; display: inline-block; width: 10px; height: 1.5px; margin: 0 8px 4px 0; background: var(--cs-ink); }
.cs-axis { position: relative; height: 20px; margin-top: 8px; font-size: 13px; color: var(--cs-muted); }
.cs-axis span { position: absolute; top: 0; left: calc(var(--i) / var(--n) * 100%); white-space: nowrap; }
.cs-results-stats { display: grid; gap: 22px; margin-top: 36px; transition: opacity .6s, transform .7s cubic-bezier(.2, .8, .2, 1); }
.cs-results-stats p:not(.cs-results-spend) { padding-top: 14px; border-top: 1px solid var(--line-w); }
.cs-results-stats strong { display: block; font-stretch: 125%; font-weight: 740; font-size: clamp(40px, 4.2vw, 76px); line-height: .9; letter-spacing: -.04em; }
.cs-results-stats span { display: block; margin-top: 10px; font-size: 16px; color: var(--cs-muted); }
.cs-results-spend { align-self: end; font-stretch: 112%; font-weight: 660; font-size: clamp(19px, 1.6vw, 24px); letter-spacing: -.015em; }

/* When it got harder */
.cs-harder { display: grid; gap: 40px; padding: 16vh var(--gutter); background: var(--warm-paper); }
.cs-harder h2 { font-size: clamp(32px, 4vw, 68px); max-width: 10em; }
.cs-harder-copy p { max-width: 31em; margin-top: 20px; font-size: clamp(17px, 1.3vw, 20px); color: var(--cs-muted); }
.cs-factors { border-bottom: 1px solid var(--line-w); }
.cs-factors li { padding: 13px 0; border-top: 1px solid var(--line-w); font-stretch: 112%; font-weight: 620; font-size: clamp(19px, 1.7vw, 27px); letter-spacing: -.02em; line-height: 1.2; }
.cs-harder-honest { font-size: clamp(17px, 1.3vw, 20px); color: var(--cs-muted); }
.cs-harder-big { padding-top: 5vh; border-top: 2px solid var(--b3-mark); font-stretch: 125%; font-weight: 720; font-size: clamp(28px, 3.4vw, 58px); line-height: 1.02; letter-spacing: -.03em; max-width: 17em; }

/* AI Max test */
.cs-aimax { background: var(--plum); color: var(--plum-text); }
.cs-aimax .cs-copy p { color: var(--plum-muted); }
.cs-aimax .cs-copy .cs-after-step { color: var(--plum-text); }
.cs-vs { --unit: 9%; --g: 1; }
.cs-vs-head { font-size: 15px; color: var(--plum-muted); }
.cs-vs-rows { --label: 112px; position: relative; padding-bottom: 30px; }
.cs-vs-row { display: grid; grid-template-columns: var(--label) minmax(0, 1fr); align-items: end; gap: 0 16px; margin-top: 22px; }
.cs-vs-row > b { padding-bottom: 1px; font-weight: 650; font-size: 16px; line-height: 22px; }
.cs-vs-bar span { display: block; text-align: right; font-stretch: 112%; font-weight: 700; font-size: clamp(22px, 2.2vw, 36px); letter-spacing: -.02em; line-height: 1.1; }
.cs-vs-track { position: relative; height: 22px; margin-top: 10px; }
.cs-vs-track i { position: absolute; inset: 0 auto 0 0; width: min(calc(var(--x) * var(--unit)), 100%); border-radius: 0 4px 4px 0; background: var(--b3); transform-origin: left; transform: scaleX(var(--g)); }
.cs-vs-row.is-huge .cs-vs-track i { border-radius: 0; -webkit-mask-image: linear-gradient(90deg, #000 80%, transparent); mask-image: linear-gradient(90deg, #000 80%, transparent); }
/* 1× marker: the start of the track plus one unit */
.cs-vs-one { position: absolute; top: 20px; bottom: 26px; left: calc(var(--label) + 16px + (100% - var(--label) - 16px) * .09); border-left: 1px dotted rgba(243, 238, 232, .55); }
.cs-vs-one span { position: absolute; top: 100%; left: 0; margin-top: 8px; transform: translateX(-50%); font-size: 13px; color: var(--plum-muted); white-space: nowrap; }

/* What it shows */
.cs-shows { padding: 16vh var(--gutter); background: var(--linen); }
.cs-shows h2 { font-size: clamp(32px, 4vw, 68px); max-width: 12em; }
.cs-shows-rows { display: grid; gap: 0 40px; margin-top: 48px; }
.cs-shows-rows > div { padding: 24px 0; border-top: 1px solid var(--line-w); }
.cs-shows-rows h3 { font-stretch: 125%; font-weight: 720; font-size: clamp(22px, 2.1vw, 34px); letter-spacing: -.025em; }
.cs-shows-rows p { max-width: 26em; margin-top: 10px; color: var(--cs-muted); }

/* Quote */
.cs-quote { display: grid; gap: 48px; padding: 16vh var(--gutter); background: var(--plum); color: var(--plum-text); }
.cs-quote blockquote p { font-size: clamp(22px, 2.4vw, 40px); font-weight: 450; line-height: 1.25; letter-spacing: -.015em; }
.cs-quote figcaption { display: flex; flex-direction: column; gap: 2px; margin-top: 28px; padding-left: 14px; border-left: 2px solid var(--b3); font-size: 16px; }
.cs-quote figcaption span { color: var(--plum-muted); }
.cs-quote-photo img { width: 100%; border-radius: 10px; }

/* Screenshots from the account */
.cs-receipts { padding: 16vh var(--gutter); background: var(--white); }
.cs-receipts h2 { font-size: clamp(32px, 4vw, 68px); }
.cs-receipts .section-lede { color: var(--cs-muted); }
.cs-shot { max-width: 1100px; margin: 52px 0 0; }
.cs-shot-frame { padding: clamp(10px, 2vw, 28px); border-radius: 12px; background: var(--white); box-shadow: 0 40px 80px -48px rgba(31, 26, 33, .45), 0 0 0 1px var(--line); }
.cs-shot-frame img { width: 100%; }
.cs-shot figcaption { max-width: 44em; margin-top: 14px; font-size: 15px; color: var(--cs-muted); }
.cs-method { max-width: 46em; margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--line); }
.cs-method h3 { font-size: 18px; }
.cs-method p { margin-top: 8px; font-size: 15px; color: var(--cs-muted); }

@media (min-width: 700px) {
  .cs-hero-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
  .cs-results-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
  .cs-results-spend { grid-column: 1 / -1; }
  .cs-chart { --plot-h: 340px; }
  .cs-shows-rows { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1000px) {
  .cs-brief { grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 6vw; align-items: center; }
  .cs-stage { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 5vw; align-items: center; }
  .cs-results { grid-template-columns: 1fr; }
  .cs-results-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; }
  .cs-results-head p { margin: 0; text-align: right; }
  .cs-results-stats { grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, .9fr); }
  .cs-results-spend { grid-column: auto; padding-bottom: 4px; }
  .cs-harder { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px 6vw; align-items: start; }
  .cs-harder-honest { grid-column: 2; }
  .cs-harder-big { grid-column: 1 / -1; margin-top: 4vh; }
  .cs-quote { grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: 6vw; align-items: center; }
}

/* Chart annotations ride the bars on wider screens; on phones they sit in a list under the chart. */
@media (min-width: 700px) {
  .cs-note { position: absolute; margin: 0; bottom: calc(var(--y) * var(--plot-h) + 6px); }
  .cs-note.is-start { left: calc(var(--from) / var(--n) * 100% + 10px); max-width: 21em; }
  .cs-note.is-centre { left: calc(var(--from) / var(--n) * 100%); width: calc((var(--to) - var(--from)) / var(--n) * 100%); min-width: 12em; text-align: center; }
  .cs-note.is-centre::before { display: none; }
  .cs-note.is-centre::after { content: ""; display: block; height: 6px; margin-top: 6px; border: 1px solid var(--cs-ink); border-bottom: 0; }
  .cs-note.is-end { right: calc((var(--n) - var(--to)) / var(--n) * 100%); text-align: right; white-space: nowrap; }
}
@media (max-width: 699px) {
  /* Notes drop below the month labels */
  .cs-chart { display: flex; flex-direction: column; }
  .cs-plot { display: contents; }
  .cs-bars { order: 1; margin-top: 18px; }
  .cs-axis { order: 2; }
  .cs-note { order: 3; }
  .cs-axis span:not(:nth-child(4n + 1)) { display: none; }
  .cs-takeover span { font-size: 13px; }
}

/* ---------- Scroll-locked desktop scenes (html.fx) ---------- */
.fx .cs-lock { height: var(--lock, 240svh); }
.fx .cs-stage { position: sticky; top: 0; height: 100svh; overflow: hidden; padding: calc(var(--header) + 5vh) var(--gutter) 5vh; }
.fx .cs-stage:not(.is-done) .cs-after-step { opacity: 0; transform: translateY(10px); }

/* Searches: wrong-intent terms are struck out one by one */
.fx .term[data-cut]:not(.is-cut) s { color: var(--plum-text); text-decoration-color: transparent; }
.fx .term[data-cut]:not(.is-cut) span, .fx .cs-searches:not(.is-done) .term.is-kept span { opacity: 0; transform: translateX(10px); }
.fx .cs-searches:not(.is-done) .term.is-kept b { font-weight: 400; color: var(--plum-text); }

/* Schedule: only one step of copy at a time */
.fx .cs-steps { display: grid; }
.fx .cs-steps p { grid-area: 1 / 1; opacity: 0; transform: translateY(8px); transition: opacity .45s, transform .55s cubic-bezier(.2, .8, .2, 1); }
.fx .cs-steps p.is-active { opacity: 1; transform: none; }
.fx .cs-week { max-width: 760px; }

/* Results: the chart draws month by month, then the totals land */
.fx .cs-results { grid-template-rows: auto minmax(0, 1fr) auto; gap: 3vh; align-items: stretch; }
.fx .cs-chart { display: flex; flex-direction: column; min-height: 0; }
.fx .cs-plot { flex: 1; min-height: 0; }
.fx .cs-bars { height: 100%; }
.fx .cs-note { bottom: calc(var(--y) * 100% + 6px); }
.fx .cs-results-stats { margin: 0; }
.fx .cs-bar:not(.is-on) b { transform: scaleY(0); }
.fx .cs-takeover:not(.is-on), .fx .cs-note:not(.is-on) { opacity: 0; }
.fx .cs-note:not(.is-on) { transform: translateY(8px); }
.fx .cs-results:not(.is-done) .cs-results-stats { opacity: 0; transform: translateY(16px); }

/* AI Max: the bars grow, and impressions run off the edge of the screen */
.fx .cs-vs-row.is-huge .cs-vs-track { margin-right: calc(-1 * var(--gutter)); }

@media (max-height: 820px) {
  .fx .cs-stage { padding-top: calc(var(--header) + 3vh); padding-bottom: 3vh; }
  .fx .term { padding: 8px 0; font-size: 16px; }
  .fx .cs-copy h2 { font-size: clamp(28px, 3vw, 50px); }
  .fx .cs-results-head h2 { font-size: clamp(30px, 3.6vw, 60px); }
  .fx .cs-results-stats strong { font-size: clamp(34px, 3.4vw, 60px); }
}
