/* Case study template: three switchable looks on ONE set of markup.
   Built 29 Sep 2026 by chat TEMPLATE. Every value is a token from tokens.css
   (origin/main d14b722b) or a documented mock-ok step between two tokens.

   HOW THE SWITCH WORKS
   <html> carries data-intro, data-numbers and data-close, each one of
   plates, exhibit or ledger. Every part of the page says which of the three
   it belongs to with data-part. A look's rules sit inside ONE :is() block
   that matches the parts set to that look, so the same page can run one
   look throughout or mix them per part. A case study picks its look the
   same way: three attributes, no markup change.

   Base rules below the looks are deliberately weak (one class); every look
   rule outranks them through the :is() wrapper. */

.cs { --gutter: clamp(var(--space-400), 4vw, var(--space-800)); }
.cs-wrap { max-width: var(--container-wide); margin-inline: auto; padding-inline: var(--gutter); }
/* Phones and tablets (25 Oct 2026, chat VA MOBILE PASS): the 92% container and the gutter stacked, so text sat
   31px in at 375 against the site's 16. Below the site's 1024 tier the wrappers run full width on the site's own
   gutter, as main > section.container-wide does in sections.css; bleed rows that negate --gutter still reach the edge. */
@media (max-width: 1023.98px) {
  .cs { --gutter: var(--gutter-centered); }
  .cs :is(.cs-wrap, .vj-in, .vf-in, .vs-in), .cs #launch .vj9r { max-width: none; }
  .cs #launch { overflow-x: clip; }   /* the BNE MEL SYD flight path draws past the wider row at 768 */
}
.cs-eyebrow { font: var(--weight-semibold) var(--text-label)/1.4 var(--font-mono); letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; color: var(--color-text-tertiary); }
.cs-title { font-family: var(--font-display); font-weight: var(--weight-regular); letter-spacing: var(--display-tight); line-height: var(--line-display); overflow-wrap: break-word; }
.cs-title::after { content: "" / ""; display: inline-block; width: 0.14em; height: 0.14em; margin-left: 0.06em; border-radius: var(--dot-radius); background: var(--brand-primary); }
.cs-cover > :is(img, .cs-stage) { width: 100%; object-fit: cover; object-position: 50% 45%; background: var(--color-surface-sunken); }
.cs-facts dt { font: var(--weight-semibold) var(--text-label)/1.4 var(--font-mono); letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; }
.cs-live-link { display: inline-flex; align-items: center; gap: var(--space-200); min-height: var(--touch-target-min); font-weight: var(--weight-semibold); }
.cs-stats { list-style: none; padding: 0; }
.cs-stat:nth-child(2) { --i: 1; } .cs-stat:nth-child(3) { --i: 2; }
.cs-next-link { display: grid; text-decoration: none; color: inherit; }
.cs-next-text, .cs-next-name, .cs-next-title { display: block; }
.cs-next-cta { display: inline-flex; align-items: center; gap: var(--space-200); font-weight: var(--weight-semibold); }
.cs-next-cta svg { width: 20px; height: 20px; }
.cs-next-img { display: block; overflow: hidden; }
.cs-next-img img { width: 100%; object-fit: cover; }
.cs-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-400); font-size: var(--text-nav); }
.cs-foot a { display: inline-flex; align-items: center; min-height: var(--touch-target-min); }
.cs-ask a { font-weight: var(--weight-semibold); }

/* Only the Ledger look shows these. */
.cs-live-label, .cs-cover figcaption, .cs-ledger-head, .cs-change, .cs-legend, .cs-rest { display: none; }

/* Outside the Ledger, the three events read as one paragraph. */
.cs-events li { display: inline; }
.cs-events li + li::before { content: " "; }

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .cs-next-img img { transition: transform var(--duration-slow) var(--ease-emphasized); }
  .cs-next-link:hover .cs-next-img img { transform: scale(1.03); }
  .cs-next-cta svg { transition: transform var(--duration-base) var(--ease-emphasized); }
  .cs-next-link:hover .cs-next-cta svg { transform: translateX(var(--space-100)); }
}

/* ===========================================================================
   A. PLATES
   Full-bleed plates, each owning its ground: the brand gradient for the
   numbers, grey for What changed, ink for the Next footer (--brand-ink,
   fixed identity, dark in both themes). The hero follows the reader's theme
   like B and C (13 Oct, his call, chat FRAME LOCK): light by default, dark
   with the header's theme switch or a device in dark mode.
   =========================================================================== */
:is(:root[data-numbers="plates"] [data-part="numbers"],
    [data-part="next"]) {

  /* The Next footer is this look's in every look (13 Oct, his notes: the
     ending splits in two, Next on ink like the header); What changed sits
     on a dark neutral grey above it, so the two read as separate parts. */
  &.cs-next { background: var(--brand-ink); color: var(--color-on-ink-primary); padding-block: var(--space-800) var(--space-700); border-top: 1px solid var(--color-on-ink-border); }
  .cs-eyebrow { color: var(--color-on-ink-secondary); }

  &.cs-intro .cs-intro-grid {
    display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    grid-template-areas: "eb eb" "title title" "result facts" "result live";
    column-gap: var(--space-800);
    padding-block: var(--space-900) var(--space-800);
  }
  .cs-intro-eb { grid-area: eb; margin-bottom: var(--space-500); }
  .cs-title {
    grid-area: title; max-width: 14ch; text-transform: uppercase; line-height: 0.92;
    font-size: clamp(3rem, 11.2vw, 10.5rem); /* mock-ok: poster scale above --display-hero, the one oversize move in this look */
    color: var(--color-text-primary);
  }
  .cs-result { grid-area: result; margin-top: var(--space-800); font-size: clamp(1.25rem, 2.2vw, 1.75rem); line-height: var(--line-snug); color: var(--color-text-primary); max-width: 30ch; } /* mock-ok: between --display-intro and --size-2xl */
  .cs-facts { grid-area: facts; margin-top: var(--space-800); display: flex; flex-wrap: wrap; gap: var(--space-200); align-content: start; }
  .cs-facts div { padding: var(--space-200) var(--space-300); border: 1px solid var(--color-border-strong); border-radius: var(--chip-radius); }
  .cs-facts div:first-child { border-color: var(--brand-primary); }
  .cs-facts dt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .cs-facts dd { font: var(--weight-medium) var(--text-caption)/1 var(--font-mono); color: var(--color-text-primary); }
  .cs-live { grid-area: live; margin-top: var(--space-500); }
  .cs-live-link { padding: var(--space-300) var(--space-500); border-radius: var(--btn-radius); background: var(--btn-primary-bg); color: var(--btn-primary-fg); text-decoration: none; }
  .cs-live-link:hover { background: var(--btn-primary-bg-hover); color: var(--btn-primary-fg-hover); }
  .cs-cover > :is(img, .cs-stage) { height: min(70svh, 56vw); }

  &.cs-numbers { --cs-num-bg: var(--brand-gradient); --cs-num-fg: var(--brand-ink); background: var(--cs-num-bg); color: var(--cs-num-fg); padding-block: var(--space-900); --cs-before-ink: var(--cs-num-fg); }
  &.cs-numbers .cs-eyebrow { color: var(--cs-num-fg); margin-bottom: var(--space-500); }
  .cs-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-600); }
  .cs-stat { padding-top: var(--space-400); border-top: 2px solid var(--cs-num-fg, var(--brand-ink)); gap: var(--space-200); }
  .cs-stat-num { font-family: var(--font-display); font-weight: var(--weight-regular); letter-spacing: var(--tracking-normal); font-size: clamp(3rem, 7.4vw, 7rem); } /* mock-ok: display numerals, one step above --display-stat-num */
  .cs-before, .cs-arrow { font-size: 0.42em; }
  .cs-stat-label { font-size: var(--size-lg); font-weight: var(--weight-medium); }
  .cs-stat:nth-child(2) { --i: 4; } .cs-stat:nth-child(3) { --i: 8; }

  &.cs-story { background: var(--color-bg); color: var(--color-text-primary); padding-block: var(--space-900); }
  &.cs-story .cs-eyebrow { color: var(--color-text-tertiary); margin-bottom: var(--space-300); }
  .cs-story-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-600) var(--space-800); }
  .cs-story-grid p { font-size: var(--size-lg); max-width: 52ch; }
  .cs-story-grid .review-note { grid-column: 1 / -1; font-size: var(--text-meta); max-width: none; }

  &.cs-close { padding-block: var(--space-900) var(--space-800); }
  .cs-close-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--space-700) var(--space-800); align-items: start; }
  .cs-changed .cs-eyebrow, .cs-lookback .cs-eyebrow { margin-bottom: var(--space-400); }
  .cs-events { font-size: clamp(1.25rem, 2vw, 1.625rem); line-height: var(--line-snug); color: var(--color-on-ink-strong); } /* mock-ok: same tier as the result line */
  .cs-lookback { padding-left: var(--space-500); border-left: 3px solid var(--brand-primary); }
  .cs-lookback p { font-size: var(--size-lg); }
  .cs-credits { grid-column: 1 / -1; font-size: var(--text-meta); color: var(--color-on-ink-secondary); }
  .cs-quote { border-top-color: var(--color-on-ink-border); }
  .cs-quote blockquote p { color: var(--color-on-ink-emphasis); }
  .cs-quote figcaption { color: var(--color-on-ink-secondary); }

  .cs-next-link { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); grid-template-areas: "text img"; gap: var(--space-600) var(--space-800); align-items: end; margin-top: var(--space-300); }
  .cs-next-text { grid-area: text; }
  .cs-next-img { grid-area: img; border-radius: var(--radius-lg); }
  .cs-next-img img { aspect-ratio: 16 / 9; }
  .cs-next-name { font-family: var(--font-display); font-size: clamp(2.5rem, 7vw, 6.5rem); line-height: 0.95; text-transform: uppercase; color: var(--color-on-ink-emphasis); } /* mock-ok: second poster moment, smaller than the title */
  .cs-next-link:hover .cs-next-name { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 0.12em; }
  .cs-next-title { margin-top: var(--space-300); font-size: var(--size-lg); }
  .cs-next-cta { margin-top: var(--space-500); color: var(--brand-primary); }
  .cs-foot { margin-top: var(--space-800); padding-top: var(--space-500); border-top: 1px solid var(--color-on-ink-border); color: var(--color-on-ink-secondary); }
  .cs-foot a { color: var(--color-on-ink-emphasis); }

  @media (max-width: 767.98px) {
    &.cs-intro .cs-intro-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "eb" "title" "result" "facts" "live"; padding-block: var(--space-700); }
    .cs-result { margin-top: var(--space-600); }
    .cs-facts { margin-top: var(--space-500); }
    .cs-cover > :is(img, .cs-stage) { height: auto; aspect-ratio: 4 / 5; }
    &.cs-numbers, &.cs-story, &.cs-close { padding-block: var(--space-800); }
    .cs-stats, .cs-story-grid, .cs-close-grid { grid-template-columns: minmax(0, 1fr); }
    .cs-next-link { grid-template-columns: minmax(0, 1fr); grid-template-areas: "img" "text"; }
  }
}

/* B. EXHIBIT and C. LEDGER were removed 13 Oct 2026 (his notes, chat HERO
   MIX, applied by chat FRAME COLOUR): the hero is Today (A), Mix or Big
   (hero-mix.css), the numbers are locked to A, and What changed's B and C
   left the same day. The old rules are in _before-hero-mix/assets/looks.css. */

/* ---------------------------------------------------------------------------
   Gaps, drafts and wires: what the story chats still have to fill. They sit
   outside the three looks on purpose, so a gap reads the same in any look.
   --------------------------------------------------------------------------- */
.cs-gap-box { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-200); max-width: 62ch; padding: var(--space-200) var(--space-300); border: 1px dashed currentColor; border-radius: var(--radius-sm); font: var(--weight-regular) var(--text-meta)/1.5 var(--font-mono); letter-spacing: var(--tracking-normal); text-transform: none; text-align: left; }
.cs-gap-box b { font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: var(--tracking-label); }
.cs-title.is-gap::after { content: none; }
.cs-confirm-chip { display: inline-block; margin-left: var(--space-200); padding: var(--space-50) var(--space-200); border: 1px dashed currentColor; border-radius: var(--chip-radius); font: var(--weight-semibold) var(--text-label)/1.4 var(--font-mono); letter-spacing: var(--tracking-label); text-transform: uppercase; vertical-align: middle; white-space: nowrap; }
.cs-stat-note { font: var(--weight-regular) var(--text-caption)/1.4 var(--font-mono); }
.cs-numbers-gap { margin-top: var(--space-300); }
.cs-live .cs-stat-note { display: block; margin-top: var(--space-100); max-width: 48ch; }
.cs-cover { position: relative; }
.cs-standin { position: absolute; top: var(--space-400); right: var(--space-400); padding: var(--space-100) var(--space-300); border-radius: var(--chip-radius); background: var(--color-surface-inverse); color: var(--color-on-ink-emphasis); font: var(--weight-semibold) var(--text-label)/1.6 var(--font-mono); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.cs-loading { padding-block: var(--space-900); color: var(--color-text-secondary); }
.cs-preset { padding-block: var(--space-400); }
.cs-quote { grid-column: 1 / -1; margin: 0; padding-top: var(--space-500); border-top: var(--border-hairline); }
.cs-quote blockquote { margin: 0; }
.cs-quote blockquote p { font-family: var(--font-display); font-size: var(--text-h2); line-height: var(--line-heading); letter-spacing: var(--display-tight); max-width: 34ch; }
.cs-quote figcaption { margin-top: var(--space-300); font-size: var(--text-meta); }
.cs-story-grid .cs-wire { grid-column: 1 / -1; }

.cs-wires { padding-block: var(--space-800); border-top: 1px dashed var(--color-border-strong); background: var(--color-bg); color: var(--color-text-primary); }
.cs-wires .review-note { margin-bottom: var(--space-600); }
.cs-wires .cs-eyebrow { margin-bottom: var(--space-300); }
.cs-wires-sub { margin-top: var(--space-600); }
.cs-wire-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-600) var(--space-800); align-items: start; padding-block: var(--space-600); border-top: var(--border-hairline); }
.cs-wire-grid h3 { font-family: var(--font-display); font-weight: var(--weight-regular); font-size: var(--text-h2); line-height: var(--line-heading); letter-spacing: var(--display-tight); margin-bottom: var(--space-300); }
.cs-wire-grid p { max-width: 56ch; }
.cs-wire-grid p + p { margin-top: var(--space-200); }
.cs-wire { display: grid; place-content: center; gap: var(--space-100); width: 100%; aspect-ratio: 16 / 9; padding: var(--space-400); border: 2px dashed var(--color-text-tertiary); border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-text-secondary); text-align: center; font: var(--weight-medium) var(--text-caption)/1.5 var(--font-mono); }
.cs-wire b { color: var(--color-text-primary); font-weight: var(--weight-semibold); }
.cs-wire--45 { aspect-ratio: 4 / 5; max-width: 340px; justify-self: end; }
.cs-wire-grid--proof { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: end; }
@media (max-width: 767.98px) {
  .cs-wire-grid, .cs-wire-grid--proof { grid-template-columns: minmax(0, 1fr); }
  .cs-wire--45 { justify-self: start; max-width: 260px; }
}

/* ===========================================================================
   THE FRAME AROUND A STUDY'S OWN MIDDLE (12 Oct 2026, chat VIRGIN BUILD,
   his picks): the hero picture switch, the number's unit and source, the
   chapter rail and the review bar's new toggles. Tokens only.
   =========================================================================== */

/* The hero picture: a stage the same size as the photo in each layout
   (the size rules above take img and .cs-stage together). The study's own
   accent, when it sets one, glows faintly behind the work. */
.cs-stage {
  position: relative; display: grid; place-items: center; overflow: hidden;
  container-type: size;
  background:
    radial-gradient(60% 70% at 50% 60%, color-mix(in oklab, var(--client-primary, transparent) 14%, transparent), transparent 70%),
    var(--color-surface-sunken);
  color: var(--color-text-primary);
}
.cs-stage .cs-wire { width: min(520px, 84%); aspect-ratio: auto; min-height: 50%; }
.cs-devices { display: flex; align-items: center; justify-content: center; gap: var(--space-700); width: 100%; height: 100%; }
.cs-devices .vj-phone { margin: 0; }
.cs-devices .vj-phone.side { opacity: 0.9; translate: 0 var(--space-500); }
.cs-video { display: block; height: 88cqh; width: auto; max-width: 90%; border-radius: var(--radius-xl); box-shadow: 0 20px 50px var(--color-overlay-soft); background: var(--color-surface); }
.cs-screens { display: flex; align-items: center; justify-content: center; gap: var(--space-500); height: 84cqh; }
.cs-screen { flex: none; height: 100%; width: auto; aspect-ratio: 375 / 812; border-radius: var(--radius-xl); overflow: hidden; box-shadow: 0 20px 50px var(--color-overlay-soft); background: var(--color-surface); }
img.cs-screen { object-fit: cover; }
.cs-screen .vj-phone.flat { margin: 0; }
.cs-screen .vj-phone.flat .frame { display: none; }
@media (max-width: 767.98px) {
  .cs-devices .vj-phone.side { display: none; }
  .cs-screens { gap: var(--space-300); height: min(84cqh, 88cqw); }
  .cs-screens > :nth-child(1), .cs-screens > :nth-child(4) { display: none; }
}

/* The number's unit and where it comes from. */
.cs-unit { display: inline-block; margin-left: 0.15em; font-size: 0.42em; letter-spacing: var(--tracking-normal); }
.cs-stat-src { font: var(--weight-regular) var(--text-caption)/1.4 var(--font-mono); color: var(--color-text-tertiary); }
:root[data-numbers="plates"] .cs-numbers .cs-stat-src { color: var(--cs-num-fg, var(--brand-ink)); opacity: 0.72; }

/* A coded middle sits on the page ground in every look. */
.cs-middle { background: var(--color-bg); color: var(--color-text-primary); }

/* ---------------------------------------------------------------------------
   Screen height is locked Natural for every study (13 Oct 2026, his call,
   chat FRAME LOCK; the switch it replaces was added the same day by chat
   CASE STUDY FRAME). No page switch: data-fill on <html> is always
   "natural", so --cs-fill is 0 and every frame part keeps its own height.
   --cs-top is the site header's height (frame.js), for sections that use it.
   The old 80% and Full screen rules are in _before-lock/assets/looks.css.
   --------------------------------------------------------------------------- */
:root { --cs-fill: 0; --cs-top: 0px; }

/* ---------------------------------------------------------------------------
   The site header (13 Oct 2026, his ask: "the proper header" with his
   wordmark and mark, not a stand-in). Its look is the live site's, lifted
   into site-header.css by _tools/lift-site-header.py; only what the review
   page needs differently is here. The live header is fixed to the top; here
   it sticks to the top of the window, and --cs-top is its height (frame.js).
   --------------------------------------------------------------------------- */
.cs .site-header-frosted { position: sticky; top: 0; }
/* The site's own base drops link underlines; the template's base keeps them. */
:is(#site-header, #mobile-nav-drawer) a { text-decoration: none; }
/* With no theme picked the page follows the device. The live site always
   names one, so its moon and sun swap has no rule for that case. */
:root:not([data-theme]) .theme-toggle-icon[data-theme-icon="dark"] { opacity: 0; transform: rotate(-90deg) scale(.4); filter: blur(2px); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle-icon[data-theme-icon="dark"] { opacity: 1; transform: none; filter: none; }
  :root:not([data-theme]) .theme-toggle-icon[data-theme-icon="light"] { opacity: 0; transform: rotate(-90deg) scale(.4); filter: blur(2px); }
}
