/* ============================================================
   CASE STUDY TEMPLATE — case-study-template.css
   Requires tokens.css and global.css, in that order. The reset,
   the body defaults and the .btn family used to live at the top
   of this file; they're shared with the homepage now, so they
   moved to global.css.

   This is the layout agreed in the Paper file, on the
   "Original Version Case Study" artboard — the global template
   for case studies going forward.

   Structure:
     .cs-wordmark      animated brand mark, top of page
     .cs-hero          centred eyebrow / h1 / lead
     .cs-hero-media    full-bleed image
     .cs-summary       Role title, headline stats + bullets, in a surface panel
     .chapters > .ch   text column at 60%, then media rows
     .cs-cta           closing call to action (.cs-foot is in global.css)

   Fluid values use clamp(); the Paper artboard is the 1440px
   resolution of each one.
   ============================================================ */

/* The base layer lives in global.css and the wordmark in brand.css,
   both shared with the homepage. Load them before this file. */

/* ═══════════════════════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════════════════════ */
.cs-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--head-top) var(--pad) clamp(2.5rem, 4.5vw, 4rem);
  gap: 20px;
}

.cs-eyebrow {
  font-size: var(--text-eyebrow);
  line-height: var(--leading-eyebrow);
  letter-spacing: var(--tracking-eyebrow);
  font-weight: var(--font-weight-eyebrow);
  color: var(--gold);
}

/* Type comes from the shared page-title role in global.css. */
.cs-hero h1 {
  align-self: stretch;
  text-align: center;
}

.cs-lead {
  width: 70%;
  text-align: center;
  font-size: var(--text-lead);
  line-height: var(--leading-lead);
  font-weight: var(--font-weight-lead);
  color: var(--cream-dim);
  text-wrap: pretty;
}

.cs-hero-media {
  width: 100%;
  aspect-ratio: 12 / 5;
  overflow: hidden;
}
.cs-hero-media img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; }

/* ═══════════════════════════════════════════════════════════
   SUMMARY PANEL
   ═══════════════════════════════════════════════════════════ */
/* Role title and bullets, then the stats in a surface band. Only the
   stats carry the surface — it acts as a light divider between the hero
   and the chapters rather than a card holding the whole summary. No
   inline padding here: the section has to be the full page width so the
   text column's 60% resolves the same as a chapter's. */
.cs-summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(2rem, 3.9vw, 3.5rem);
  padding: clamp(2.5rem, 5.5vw, 5.5rem) 0 0;
}

/* Same measure as .ch-text, so the summary lines up with the chapters. */
.cs-summary-text {
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 2.5vw, 2rem);
  width: min(60%, 864px);
}

.cs-panel-title {
  font-size: var(--text-stat);
  line-height: var(--leading-stat);
  letter-spacing: var(--tracking-stat);
  font-weight: var(--font-weight-stat);
  color: var(--gold);
}

/* Centres itself rather than leaning on section padding, which would
   otherwise narrow the text column above. */
.cs-stats-panel {
  width: calc(100% - 2 * var(--pad));
  /* Paper's panel is 1260 wide: a --max content column plus its
     own 40px padding either side. Capping at --max instead would
     squeeze the content to 1100. */
  max-width: calc(var(--max) + 5rem);
  padding: clamp(1.5rem, 2.8vw, 2.5rem);
  background: var(--surface);
  border-radius: 20px;
}

.cs-headline-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px;
}

.cs-headline b {
  display: block;
  font-size: var(--text-stat);
  line-height: var(--leading-stat);
  letter-spacing: var(--tracking-stat);
  font-weight: var(--font-weight-stat);
  color: var(--cream);
  margin-bottom: 10px;
}
.cs-headline span { display: block; color: var(--cream-dim); }

/* Gold-dot list, shared by the summary panel and chapter lists. */
.cs-list { display: flex; flex-direction: column; gap: 16px; list-style: none; }
.cs-list li { display: flex; gap: 14px; color: var(--cream-dim); }
.cs-list li::before {
  content: '';
  flex-shrink: 0;
  align-self: center;
  width: 6px; height: 6px;
  border-radius: var(--radius-pill);
  background: var(--gold);
}

/* ═══════════════════════════════════════════════════════════
   CHAPTERS
   ═══════════════════════════════════════════════════════════ */
.chapters {
  display: flex;
  flex-direction: column;
  padding: clamp(3rem, 7vw, 7rem) 0;
  gap: clamp(3rem, 5vw, 5rem);
}

.ch { display: flex; flex-direction: column; align-items: center; gap: clamp(2rem, 3vw, 3rem); }

/* 60% measure, centred — the template's defining move. */
.ch-text {
  display: flex;
  flex-direction: column;
  width: min(60%, 864px);
  gap: 20px;
}

.ch-label {
  font-size: var(--text-label);
  line-height: var(--leading-label);
  letter-spacing: var(--tracking-label);
  font-weight: var(--font-weight-label);
  color: var(--gold);
}
.ch-title {
  font-family: var(--font-display);
  font-size: var(--text-ch-title);
  line-height: var(--leading-ch-title);
  letter-spacing: var(--tracking-ch-title);
  font-weight: var(--font-weight-ch-title);
  color: var(--cream);
  text-wrap: pretty;
}
.ch-dek { color: var(--cream-dim); text-wrap: pretty; }

/* Media rows: 1–3 shots, equal width, 90% of the page. */
.ch-media { display: flex; flex-direction: column; align-items: center; width: 100%; gap: 20px; }
.ch-media-row {
  display: flex;
  align-items: stretch;
  gap: 20px;
  width: 90%;
  padding: 20px;
}
/* The slot is a wrapper with no surface of its own: the plate below,
   then the caption beneath it on the page ground. */
.ch-shot {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* The plate — everything the slot used to be. Shared with video, so
   a still and a clip sit in identical frames. flex: 1 keeps the
   plates in a row level with each other when their captions run to
   different lengths. */
.ch-shot-frame {
  flex: 1;
  min-height: 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--rule-soft);
  overflow: hidden;
  background: var(--plum-soft);
}
.ch-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Video ────────────────────────────────────────────────
   The video's plate is the same object, black and fixed at 16:9 so
   the controls have somewhere predictable to sit. They're positioned
   against the plate, not the figure, which is what keeps them off
   the caption below it. */
.ch-shot--video .ch-shot-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}
.ch-shot-frame video {
  display: block;
  width: 100%;
  height: 100%;
  /* contain, not cover: cropping a photograph is a composition
     choice, cropping a video someone edited is not. */
  object-fit: contain;
  background: #000;
}
.is-enhanced .ch-shot-frame video { cursor: pointer; }

.ch-shot-fallback { padding: 1.5rem; color: var(--cream-dim); text-align: center; }
.ch-shot-fallback a { color: var(--gold); }

/* The control bar. Hidden until player.js has replaced the native
   set, so the two are never both on screen. */
.ch-player {
  position: absolute;
  inset: auto 0 0 0;
  display: none;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  /* Legible over both a bright frame and a dark one. */
  background: linear-gradient(to top, rgba(9, 5, 3, .88), rgba(9, 5, 3, 0));
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.is-enhanced .ch-player { display: flex; }

/* Visible while paused, on hover, and whenever anything inside has
   keyboard focus — otherwise tabbing to the seek bar would move
   focus somewhere invisible. */
.ch-shot--video:hover .ch-player,
.ch-shot--video:not(.is-playing) .ch-player,
.ch-player:focus-within { opacity: 1; }

.ch-player-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: var(--radius-pill);
  background: none;
  color: var(--cream);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease);
}
.ch-player-btn:hover { color: var(--gold); }
.ch-player-btn svg { width: 24px; height: 24px; fill: currentColor; }

.ch-player-time {
  flex-shrink: 0;
  font-size: var(--text-caption);
  font-variant-numeric: tabular-nums;
  color: var(--cream-dim);
}

/* A real <input type=range>, restyled. --played is set by player.js
   so the filled portion tracks playback in both track halves. */
.ch-player-seek {
  flex: 1;
  min-width: 0;
  height: 20px;
  margin: 0;
  padding: 0;
  background: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  --played: 0%;
}
.ch-player-seek::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: var(--radius-pill);
  background: linear-gradient(to right,
    var(--gold) 0 var(--played), rgba(244, 238, 230, .25) var(--played) 100%);
}
.ch-player-seek::-moz-range-track {
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(244, 238, 230, .25);
}
.ch-player-seek::-moz-range-progress {
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--gold);
}
.ch-player-seek::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--cream);
}
.ch-player-seek::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--cream);
}
.ch-player-seek:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }

/* The centred play button over the poster: the target before anyone
   has thought about a control bar. Goes once playback starts. */
.ch-player-poke {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--cream);
  cursor: pointer;
}
.is-enhanced .ch-player-poke { display: flex; }
.is-enhanced.is-playing .ch-player-poke { display: none; }
.ch-player-poke svg {
  width: 76px;
  height: 76px;
  padding: 18px;
  border-radius: var(--radius-pill);
  background: rgba(9, 5, 3, .55);
  fill: currentColor;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.ch-player-poke:hover svg { background: var(--gold); transform: scale(1.06); }

@media (prefers-reduced-motion: reduce) {
  .ch-player, .ch-player-poke svg { transition: none; }
}

/* ── Empty slots ──────────────────────────────────────────
   A frame with no <img> draws itself as a designed plate. Drop
   an <img> in as the first child and :has() swaps everything
   over — no markup or class changes needed. A video counts as
   filled: its poster is an attribute rather than an element, so
   without naming it here a video slot would draw the plate
   behind itself. */
.ch-shot-frame:not(:has(img, video)) {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--plum-soft);
  background-image:
    radial-gradient(ellipse 70% 90% at 50% 50%, rgba(232,64,16,.09), transparent 64%),
    repeating-linear-gradient(115deg, rgba(244,238,230,.022) 0 1px, transparent 1px 10px),
    linear-gradient(152deg, #1a0b07 0%, #0E0907 70%);
  background-size: 170% 170%, auto, auto;
  background-position: 50% 50%, 0 0, 0 0;
  background-repeat: no-repeat, repeat, no-repeat;
  animation: shot-drift 34s ease-in-out infinite;
}

/* Inset hairline — makes a reserved space read as deliberate
   rather than as a broken image. */
.ch-shot-frame:not(:has(img, video))::before {
  content: '';
  position: absolute;
  inset: clamp(.75rem, 2%, 1.5rem);
  border: 1px dashed rgba(244, 238, 230, .10);
  border-radius: calc(var(--radius-lg) - 8px);
  pointer-events: none;
}

.ch-shot-frame figcaption {
  position: relative;
  padding: 1.5rem;
  text-align: center;
  font-size: var(--text-caption);
  line-height: var(--leading-caption);
  letter-spacing: var(--tracking-caption);
  font-weight: var(--font-weight-caption);
  text-transform: uppercase;
  color: rgba(244, 238, 230, .24);
}

/* A real caption: outside the plate, on the page ground below it, in
   italic. As an overlay it sat on whatever the bottom of the picture
   happened to be — barely readable on a light or busy frame, and on a
   video it landed on the controls. */
.ch-shot > figcaption {
  padding: .85rem .25rem 0;
  text-align: left;
  text-transform: none;
  letter-spacing: -.01em;
  font-size: var(--text-footer);
  font-style: italic;
  font-weight: var(--font-weight-footer);
  color: var(--cream-dim);
  background: none;
}

@keyframes shot-drift {
  0%, 100% { background-position: 24% 20%, 0 0, 0 0; }
  50%      { background-position: 76% 74%, 0 0, 0 0; }
}
/* ── The three row layouts ─────────────────────────────────
   Taken from the "Media" group on the Paper artboard, which sets
   a fixed shot height at 1440 and lets flex divide the width:

     one    1256 × 645   full width of the row
     two     618 × 379   (1256 − 20 gap) / 2
     three   405 × 379   (1256 − 40 gaps) / 3

   Expressed as ratios rather than heights so they hold at any
   width — a fixed 379px would grow proportionally wrong as the
   row narrows. The numbers are the Paper pixels unreduced, so
   they can be traced straight back to the artboard. */
.ch-media-row--one   .ch-shot { aspect-ratio: 1256 / 645; }
.ch-media-row--two   .ch-shot { aspect-ratio: 618 / 379; }
.ch-media-row--three .ch-shot { aspect-ratio: 405 / 379; }

/* ═══════════════════════════════════════════════════════════
   WHERE NEXT
   Sits between the last chapter and the contact ask: keep reading
   on the right, back to the index on the left.
   ═══════════════════════════════════════════════════════════ */
.cs-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(2.5rem, 4vw, 4rem) var(--pad);
  border-top: 1px solid var(--rule-soft);
}

.cs-next-all {
  color: var(--cream);
  font-size: var(--text-svc-title);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.cs-next-all:hover { color: var(--gold); border-bottom-color: var(--gold); }

.cs-next-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: inherit;
  text-decoration: none;
}
.cs-next-title {
  font-size: var(--text-svc-title);
  font-weight: var(--font-weight-semibold);
  color: var(--cream);
  transition: color var(--dur-fast) var(--ease);
}
.cs-next-link:hover .cs-next-title { color: var(--gold); }

/* The homepage carousel's nav button, reused: 40px, 8px corners, a
   gold hairline and a gold chevron. */
.cs-next-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--gold);
  color: var(--gold);
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.cs-next-link:hover .cs-next-btn { background: var(--gold); color: var(--plum); }

/* Stacked and ranged left once there isn't room for two ends. */
@media (max-width: 620px) {
  .cs-next { flex-direction: column; align-items: flex-start; gap: 1.75rem; }
  .cs-next-link { align-self: stretch; justify-content: space-between; }
}

/* ═══════════════════════════════════════════════════════════
   CTA + FOOTER
   ═══════════════════════════════════════════════════════════ */
.cs-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(2.5rem, 4vw, 4rem) var(--pad) clamp(3.5rem, 5.5vw, 5.5rem);
  border-top: 1px solid var(--rule-soft);
}
/* Centred, unlike the chapter columns — matches the artboard. */
.cs-cta-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(60%, 864px);
  gap: 16px;
  text-align: center;
}
.cs-cta h2 {
  align-self: stretch;
  font-family: var(--font-display);
  font-size: var(--text-ch-title);
  line-height: var(--leading-ch-title);
  letter-spacing: var(--tracking-ch-title);
  font-weight: var(--font-weight-ch-title);
  color: var(--cream);
  text-wrap: balance;
}
.cs-cta p { align-self: stretch; color: var(--cream-dim); text-wrap: pretty; }

/* .btn itself is in global.css. The gap below it is this layout's,
   not the button's — the homepage sets its own with flex. */
.cs-cta .btn { margin-top: 20px; }

/* .cs-foot and .cs-foot-social moved to global.css — the homepage
   shares the footer now and doesn't load this sheet. */

/* ═══════════════════════════════════════════════════════════
   MOBILE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .cs-headline-row { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 720px) {
  /* No .cs-hero padding-top here: --head-top already scales with the
     viewport, and an override put this page 6px below the others. */
  .cs-lead { width: 100%; }
  .cs-hero-media { aspect-ratio: 4 / 3; }
  /* The 60% measure is a desktop device; on a phone it just
     means a needlessly narrow column. */
  .ch-text,
  .cs-summary-text { width: 100%; padding-inline: var(--pad); }
  .cs-cta-inner { width: 100%; }
  /* Stack the media rows rather than shrink three shots to
     ~100px each. */
  .ch-media-row { flex-direction: column; width: 100%; padding: 0 var(--pad); }
  .ch-media-row .ch-shot { aspect-ratio: 4 / 3 !important; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ch-shot { animation: none; }
}
