/* ============================================================
   Launch Lex — Case Studies
   Shared design system for the overview page and detail pages.
   ============================================================ */

/* --- Reset ----------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body.cs-body {
  background: var(--cs-bg);
  color: var(--cs-primary);
  /* IBM Plex Sans Variable matches the homepage body. The fallback
     stack mirrors what the global Webflow CSS uses. */
  font-family: var(--ll-font-body);
  font-size: 17px;
  line-height: 1.75;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg,
picture {
  max-width: 100%;
  display: block;
}

button {
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

/* --- Design tokens ---------------------------------------
   The case studies pages were originally built with a brutalist
   pure-black palette. They've been flipped to align with the
   homepage's warm-paper system (see /css/site-overrides.css for
   the canonical --ll-* token layer). Each --cs-* token below now
   re-exposes a homepage-derived value so every existing selector
   automatically gets the new look.

   Where the old name implied "dark surface" (e.g. --cs-card-bg
   was a near-black), we now point it at the matching warm-light
   surface (e.g. bg-lift = #efede7). Device chrome remains dark
   intentionally — screens look like screens on any background.
   ---------------------------------------------------------- */
:root {
  /* Surfaces */
  --cs-bg:                var(--ll-bg-base);     /* paper white */
  --cs-surface:           var(--ll-bg-lift);     /* warm beige */
  --cs-card-bg:           var(--ll-bg-lift);
  --cs-card-border:       var(--ll-border-subtle);
  --cs-card-border-hover: var(--ll-border-medium);
  --cs-divider:           var(--ll-border-subtle);

  /* Text */
  --cs-primary:    var(--ll-text-strong);   /* headings + body strong */
  --cs-secondary:  var(--ll-text-medium);   /* subdued body */
  --cs-tertiary:   var(--ll-text-subtle);   /* metadata */
  --cs-accent:     var(--ll-text-strong);   /* "white" became dark on light */

  /* Tag pills — match homepage .label-master spec */
  --cs-tag-bg:     var(--ll-bg-lift);
  --cs-tag-text:   var(--ll-text-body);
  --cs-tag-border: var(--ll-border-subtle);

  /* Stats */
  --cs-metric-value: var(--ll-text-strong);
  --cs-metric-label: var(--ll-text-subtle);

  /* Device chrome stays dark (intentional — screens look like
     screens, not embedded ghost frames) */
  --cs-device-chrome: #111111;
  --cs-device-border: #2a2a2a;

  /* Browser window dot colors (macOS-style) — unchanged */
  --cs-dot-red:    #ff5f57;
  --cs-dot-yellow: #febc2e;
  --cs-dot-green:  #28c840;

  /* Architecture diagrams (used on detail pages) */
  --cs-diagram-bg:          var(--ll-bg-lift);
  --cs-diagram-border:      var(--ll-border-subtle);
  --cs-diagram-border-hero: var(--ll-border-strong);
  --cs-diagram-line:        var(--ll-border-medium);
  --cs-diagram-label:       var(--ll-text-body);
  --cs-diagram-label-hero:  var(--ll-text-strong);

  /* Scroll/anchor offset — matches global Webflow navbar height */
  --cs-nav-h: 96px;
}

/* --- Layout ---------------------------------------------- */
.cs-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
  width: 100%;
}

.cs-divider {
  width: 100%;
  height: 1px;
  background: var(--cs-divider);
  border: 0;
  margin: 0;
}

/* --- Typography helpers ---------------------------------- */
.cs-label {
  font-family: var(--ll-font-display);
  font-style: italic;
  font-style: italic;
  font-weight: 400;
  font-size: 16px;
  color: var(--cs-secondary);
  letter-spacing: 0;
}

.cs-eyebrow {
  font-family: var(--ll-font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cs-metric-label);
}

.cs-mono {
  font-family: var(--ll-font-mono);
  font-feature-settings: 'tnum' 1, 'cv11' 1;
}

/* --- Scroll reveal --------------------------------------- */
.cs-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.cs-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.cs-reveal-stagger > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.cs-reveal-stagger.is-visible > * {
  opacity: 1;
  transform: translateY(0);
}

.cs-reveal-stagger.is-visible > *:nth-child(1) { transition-delay: 0ms; }
.cs-reveal-stagger.is-visible > *:nth-child(2) { transition-delay: 100ms; }
.cs-reveal-stagger.is-visible > *:nth-child(3) { transition-delay: 200ms; }
.cs-reveal-stagger.is-visible > *:nth-child(4) { transition-delay: 300ms; }
.cs-reveal-stagger.is-visible > *:nth-child(5) { transition-delay: 400ms; }
.cs-reveal-stagger.is-visible > *:nth-child(6) { transition-delay: 500ms; }
.cs-reveal-stagger.is-visible > *:nth-child(7) { transition-delay: 600ms; }
.cs-reveal-stagger.is-visible > *:nth-child(8) { transition-delay: 700ms; }

@media (prefers-reduced-motion: reduce) {
  .cs-reveal,
  .cs-reveal-stagger > * {
    opacity: 1;
    transform: none;
    transition: none;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ============================================================
   GLOBAL CHROME ON CASE STUDIES PAGES
   ------------------------------------------------------------
   Now that the case studies pages share the homepage's warm
   palette, the global Webflow header/footer should render with
   their default homepage styling (light navbar, blue logo, white
   sticky bar). No chrome overrides needed here — the case
   studies HTML uses `data-variant="dark"` (which keeps Webflow's
   default light-bg / blue-logo navbar) instead of the previous
   `data-variant="light"` (which forced dark-bg / white-logo).
   The global footer also takes its homepage default treatment.

   Removed in the rebrand:
     - body bg !important to #000000      (now var(--cs-bg) = paper)
     - navbar bg !important to #000000    (now Webflow default)
     - nav-link color !important to white (now Webflow default)
     - CTA pill inverted to white-on-black (now blue gradient default)
     - mobile menu black-out               (now Webflow default)
   ============================================================ */

/* ============================================================
   PAGE WRAPPER + BACK LINK
   ------------------------------------------------------------
   Top padding clears the global navbar. The Webflow nav is
   ~92px tall on desktop (52px logo + ~20px padding each side)
   and ~70px on mobile. We use the larger value desktop-side
   and override down on mobile.
   ============================================================ */
.cs-page {
  padding-top: 96px;
}

@media (max-width: 768px) {
  .cs-page {
    padding-top: 72px;
  }
}

/* Anchor targets get scroll-margin so smooth-scroll lands below
   the sticky nav rather than under it. Matches the previous
   --cs-nav-h offset behavior. */
.cs-page [id] {
  scroll-margin-top: 96px;
}
@media (max-width: 768px) {
  .cs-page [id] {
    scroll-margin-top: 72px;
  }
}

.cs-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ll-font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--cs-secondary);
  letter-spacing: -0.005em;
  padding: 40px 0 0;
  transition: color 0.2s ease;
}

.cs-back-link:hover {
  color: var(--cs-accent);
}

/* ============================================================
   OVERVIEW HERO
   ------------------------------------------------------------
   The hero is the editorial moment of the page. It runs five
   sequenced animation systems on load:

     A) Kinetic text reveal — label + 3 headline lines clip up,
        subheadline fades up.
     B3) Scanlines — static horizontal field via ::before, opacity
         capped at 0.018 so it stays subliminal.
     B5) Circuit traces — SVG layer with traveling dash-offset
         animation. See .cs-hero-traces below.
     B7) Cursor blink — span at end of last headline line,
         appears after reveal and blinks 3x then fades.
     C)  Glow rules — radial-gradient horizontal rules above and
         below the stat bar, scale in from center.
     E)  Marquee strip — full-width scrolling brand strip below
         the chapter index.
     F)  Timeline connector — vertical line + dot DOM placed
         AFTER this section, draws when hero scrolls out.

   Initial states for animated elements are set here so the JS
   sequence in initHero() can simply add `is-revealed` /
   `is-visible` classes on the spec timeline. If JS fails to run
   the hero is hidden — acceptable trade-off for this page.
   ============================================================ */
.cs-overview-hero {
  position: relative;
  padding: 52px 0 96px;
  overflow: hidden;
  text-align: center;
  isolation: isolate;
}

/* B3 — Scanlines. Inverted to dark-on-paper for the warm bg.
   Same opacity as the original white-on-black version (0.025
   reads at the same subliminal level on warm paper as 0.018
   reads on pure black). */
.cs-overview-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 87px,
    rgba(25, 24, 24, 0.025) 87px,
    rgba(25, 24, 24, 0.025) 88px
  );
  pointer-events: none;
  z-index: 0;
}

/* Centered content wrapper sits above scanlines + traces. */
.cs-hero-content {
  position: relative;
  z-index: 2;
}

/* Section label pill — mirrors the about-page hero (label-master +
   label-small Webflow tag) so the two editorial pages share an
   immediately recognizable opener. The Webflow base styles already
   give .label-master its pill shape and .label-small its uppercase
   small-cap look — we just animate it in via .cs-hero-label-pill. */
.cs-hero-label-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 0;
}
.cs-hero-label-pill {
  opacity: 0;
  transform: translateY(8px);
  animation: cs-hero-label-fade-in 600ms cubic-bezier(0.16, 1, 0.3, 1) 100ms forwards;
}
@keyframes cs-hero-label-fade-in {
  to { opacity: 1; transform: translateY(0); }
}

/* Thin blue accent bar between the label and the headline — mirrors
   .about-hero-accent (52px × 3px, --ll-accent-solid, 28px vertical
   margin). Animates as a scaleX grow from center on load so it ties
   into the kinetic-headline reveal sequence. */
.cs-hero-accent {
  width: 52px;
  height: 3px;
  background: var(--ll-accent-solid);
  border-radius: 2px;
  margin: 28px auto;
  opacity: 0;
  transform: scaleX(0);
  transform-origin: center center;
  animation: cs-hero-accent-grow 600ms cubic-bezier(0.16, 1, 0.3, 1) 250ms forwards;
}
@keyframes cs-hero-accent-grow {
  to { opacity: 1; transform: scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
  .cs-hero-label-pill,
  .cs-hero-accent {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
}

/* Headline — IBM Plex Serif at the homepage's h1 scale (64px /
   72px / -2.5px). On case studies we cap larger via clamp because
   the editorial moment can take more space than the homepage. */
.cs-hero-headline {
  font-family: var(--ll-font-heading);
  font-weight: var(--ll-weight-regular);
  font-size: clamp(44px, 7.5vw, 80px);
  line-height: 1.05;
  letter-spacing: -2.5px;
  color: var(--cs-primary);
  margin-bottom: 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.cs-hero-sub {
  max-width: 560px;
  margin: 28px auto 0;
  font-family: var(--ll-font-body);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.75;
  letter-spacing: 0;
  color: var(--cs-secondary);
  /* Initial state for fade-up at t=2200ms. */
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.cs-hero-sub.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stat bar — centered cells with vertical dividers between.
   Top/bottom borders removed (the glow rules sit there now). */
.cs-stat-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 48px 0;
  margin-top: 0;
}

.cs-stat {
  padding: 0 24px;
  border-right: 1px solid var(--cs-divider);
  text-align: center;
  /* Initial state for the staggered fade-in at t=2900ms. */
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 500ms ease-out, transform 500ms ease-out;
}

.cs-stat.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

.cs-stat:last-child {
  border-right: 0;
}

.cs-stat-value {
  font-family: var(--ll-font-mono);
  font-size: 48px;
  font-weight: var(--ll-weight-medium);
  color: var(--cs-metric-value);
  line-height: 1.1;
  letter-spacing: -0.03em;
  /* Increased gap so the value reads as dominant and the label
     clearly subordinate (Part 2 case-studies fix #2). */
  margin-bottom: 16px;
}

.cs-stat-label {
  font-family: var(--ll-font-mono);
  font-size: 11px;
  font-weight: var(--ll-weight-regular);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cs-metric-label);
}

@media (max-width: 900px) {
  .cs-stat-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 28px 0;
    padding: 32px 0;
  }
  .cs-stat {
    padding: 0 20px;
  }
  .cs-stat:nth-child(odd) {
    border-right: 1px solid var(--cs-divider);
    border-bottom: 0;
  }
  .cs-stat:nth-child(even) {
    border-right: 0;
  }
  .cs-stat:nth-child(1),
  .cs-stat:nth-child(2) {
    padding-bottom: 28px;
    border-bottom: 1px solid var(--cs-divider);
  }
  .cs-stat:nth-child(3),
  .cs-stat:nth-child(4) {
    padding-top: 28px;
  }
  .cs-stat-value {
    font-size: 36px;
  }
}

/* Chapter index (TOC) — centered horizontal row of 3 anchor links.
   Acts as a mini table-of-contents below the stat bar. Each item
   fades up on the load sequence with a 120ms stagger. */
.cs-chapter-index {
  margin-top: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  /* 48px gives each item clear breathing room without crowding */
  gap: 48px;
  border: 0;
}

.cs-chapter-index-item {
  display: inline-flex;
  align-items: center;
  padding: 0;
  font-family: var(--ll-font-body);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #555555;
  border: 0;
  transition: color 200ms ease, opacity 500ms ease-out, transform 500ms ease-out;
  /* Initial state for staggered fade-up at t=3600ms. */
  opacity: 0;
  transform: translateY(8px);
}

.cs-chapter-index-item.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

.cs-chapter-index-item .arrow {
  margin-left: 12px;
  transition: transform 0.2s ease;
}

.cs-chapter-index-item:hover {
  color: var(--cs-primary);
}

.cs-chapter-index-item:hover .arrow {
  transform: translateX(4px);
}

@media (max-width: 768px) {
  .cs-chapter-index {
    flex-direction: column;
    gap: 20px;
  }
}

/* ============================================================
   HERO ANIMATION SYSTEMS
   ------------------------------------------------------------
   Pure presentation; orchestration lives in initHero() in
   js/case-studies.js. Initial states here = hidden / pre-roll.
   The JS adds is-revealed / is-visible / cursor-fade per the
   spec timeline.
   ============================================================ */

/* A — Kinetic text reveal -------------------------------------
   Each headline/label line is wrapped in a clip box; its inner
   span slides up from below (translateY 105% -> 0) with opacity
   fade. Spec easing: cubic-bezier(0.16, 1, 0.3, 1). */
.cs-hero-line-clip {
  display: block;
  overflow: hidden;
  /* Tight line-box so the clip hugs glyphs without extra space
     descending letters from leaking out. The headline still
     uses 1.05 line-height, so we add a touch of bottom padding
     on the clip to prevent descender clipping. */
  padding-bottom: 0.05em;
}

.cs-hero-line-inner {
  display: block;
  transform: translateY(105%);
  opacity: 0;
  transition:
    transform 500ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 500ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}

.cs-hero-line-inner.is-revealed {
  transform: translateY(0);
  opacity: 1;
}

/* Label uses a slightly faster reveal per spec (400ms). */
.cs-hero-label .cs-hero-line-inner {
  transition:
    transform 400ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* B7 — Cursor at end of last headline line ---------------------
   Hidden by default; JS sets opacity:1 + animation at t=1050ms.
   Blinks 3x via step-end keyframes, then JS adds .cursor-fade
   for the 400ms exit. aria-hidden in HTML keeps it out of AT.
   Color follows the headline (dark on paper). */
.cs-hero-cursor {
  display: inline-block;
  margin-left: 6px;
  font-family: var(--ll-font-heading);
  font-weight: 300;
  color: var(--cs-primary);
  opacity: 0;
  vertical-align: baseline;
}

.cs-hero-cursor.cursor-fade {
  opacity: 0 !important;
  animation: none !important;
  transition: opacity 400ms ease;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* B5 — Circuit / data flow traces -----------------------------
   SVG layer behind the centered text. Inverted to dark-on-paper
   for the warm bg. Opacity stays subliminal — 0.05 on dark text
   reads at the same level as 0.06 white-on-black did. JS sets
   per-path --path-len after measuring length so the
   stroke-dashoffset keyframes can interpolate. */
.cs-hero-traces {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.cs-hero-traces path {
  fill: none;
  stroke: rgba(25, 24, 24, 0.05);
  stroke-width: 1;
  stroke-linecap: square;
  /* Dasharray + offset are set inline by JS once the path length
     is measured; the keyframes consume the --path-len custom
     property for the to-state. */
}

.cs-hero-traces circle {
  /* Junction dots — inverted to dark-on-paper, capped at 0.08 per spec. */
  fill: rgba(25, 24, 24, 0.08);
}

@keyframes traceDash {
  from { stroke-dashoffset: var(--path-len, 1000); }
  to   { stroke-dashoffset: 0; }
}

.cs-hero-traces .cs-trace-1 {
  animation: traceDash 4s linear 0s infinite;
}
.cs-hero-traces .cs-trace-2 {
  animation: traceDash 4.5s linear 1.3s infinite;
}
.cs-hero-traces .cs-trace-3 {
  animation: traceDash 3.5s linear 2.1s infinite;
}
.cs-hero-traces .cs-trace-4 {
  animation: traceDash 3s linear 0.7s infinite;
}

@media (max-width: 767px) {
  .cs-hero-traces {
    display: none;
  }
}

/* C — Weighted divider rules flanking the stat bar ------------
   1px tall full-width band rendered as a radial gradient. On
   the original brutalist black, this read as "light leaking
   through a seam". On the warm-paper rebrand we invert: a dark
   accent rule that gets denser at the horizontal center and
   fades to transparent at the edges — reads as a deliberate,
   weighted divider rather than ambient light. Same scaleX-in
   reveal mechanic. */
.cs-glow-rule {
  height: 1px;
  width: 100%;
  background: radial-gradient(
    ellipse 70% 100% at 50% 50%,
    rgba(25, 24, 24, 0.55) 0%,
    rgba(25, 24, 24, 0.15) 35%,
    transparent 100%
  );
  transform: scaleX(0);
  transform-origin: center center;
  transition: transform 800ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
  margin: 0;
  border: 0;
}

.cs-glow-rule.is-visible {
  transform: scaleX(1);
}

/* E — Marquee strip -------------------------------------------
   Full-width DARK contrast strip below the chapter index. This
   is the page's dark moment — kept as the warm-dark anchor color
   even after the rest of the page flipped to paper white, so it
   reads as a deliberate punctuation between the editorial hero
   and the chapters. Pauses on hover so a curious visitor can
   read items. */
.cs-marquee-strip {
  background: var(--ll-bg-dark-base);
  border-top: 1px solid var(--ll-border-dark-subtle);
  border-bottom: 1px solid var(--ll-border-dark-subtle);
  overflow: hidden;
  padding: 13px 0;
  margin-top: 48px;
  opacity: 0;
  transition: opacity 400ms ease;
  /* Promote so transform on the track is GPU-only. */
  contain: layout paint;
}

.cs-marquee-strip.is-visible {
  opacity: 1;
}

.cs-marquee-track {
  display: flex;
  width: max-content;
  animation: marqueeScroll 38s linear infinite;
  will-change: transform;
}

.cs-marquee-strip:hover .cs-marquee-track {
  animation-play-state: paused;
}

.cs-marquee-content {
  /* Mono on the dark strip — labels read as terminal output. */
  font-family: var(--ll-font-mono);
  font-size: 11px;
  font-weight: var(--ll-weight-regular);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ll-text-on-dark-medium);
  white-space: nowrap;
  padding-right: 0;
}

@keyframes marqueeScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* E — Capability tag row (replaces the dark marquee strip) */
.cs-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 40px;
  padding: 0 16px;
}

.cs-tag {
  font-family: var(--ll-font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cs-secondary);
  background: transparent;
  border: 1px solid var(--ll-border-medium);
  border-radius: 999px;
  padding: 5px 14px;
  white-space: nowrap;
  transition: border-color 200ms ease, color 200ms ease;
}

.cs-tag:hover {
  border-color: var(--ll-accent-solid);
  color: var(--ll-accent-solid);
}

@media (max-width: 600px) {
  .cs-marquee-content {
    font-size: 10px;
  }
}

/* F — Timeline connector --------------------------------------
   Sits between the hero section and chapter 01 in DOM order.
   Vertical 1px line scales from top down, then a small dot
   fades in at the bottom. JS adds .is-visible based on an
   IntersectionObserver on the hero. */
.cs-timeline-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 88px;
  padding: 0;
  margin: 0 auto;
}

.cs-timeline-line {
  width: 1px;
  flex: 1;
  background: linear-gradient(
    to bottom,
    var(--ll-border-medium) 0%,
    var(--ll-border-subtle) 100%
  );
  transform: scaleY(0);
  transform-origin: top center;
  transition: transform 1000ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.cs-timeline-line.is-visible {
  transform: scaleY(1);
}

.cs-timeline-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cs-bg);
  border: 1px solid var(--ll-border-strong);
  margin-top: 4px;
  opacity: 0;
  transition: opacity 300ms ease;
}

.cs-timeline-dot.is-visible {
  opacity: 1;
}

@media (max-width: 767px) {
  .cs-timeline-connector {
    display: none;
  }
}

/* Reduced motion shortcut for the hero animation block.
   Belt-and-braces with the JS reduced-motion path: if JS still
   runs the timed sequence, the visual transitions complete in
   ~1 frame. CSS-only animations (cursor blink, marquee, traces)
   are also collapsed. */
@media (prefers-reduced-motion: reduce) {
  .cs-overview-hero,
  .cs-overview-hero *,
  .cs-overview-hero *::before,
  .cs-overview-hero *::after,
  .cs-marquee-strip,
  .cs-marquee-strip *,
  .cs-timeline-connector,
  .cs-timeline-connector * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* B3 — Detail-page-wide scanlines -----------------------------
   Inverted to dark-on-paper for the warm bg. The texture runs
   through the entire reading experience on detail pages so the
   editorial feel is consistent from hero to outcome. */
body.cs-page-scanlines {
  position: relative;
}

body.cs-page-scanlines::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 87px,
    rgba(25, 24, 24, 0.025) 87px,
    rgba(25, 24, 24, 0.025) 88px
  );
  pointer-events: none;
  z-index: 0;
}

@media (max-width: 767px) {
  body.cs-page-scanlines::before {
    background-image: repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 63px,
      rgba(25, 24, 24, 0.025) 63px,
      rgba(25, 24, 24, 0.025) 64px
    );
  }
}

/* ============================================================
   FEATURED CHAPTER (OVERVIEW PAGE)
   ============================================================ */
.cs-chapter {
  position: relative;
  padding: 140px 0;
  overflow: hidden;
}

.cs-chapter-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
  position: relative;
  z-index: 2;
}

.cs-chapter[data-image-position="left"] .cs-chapter-content  { order: 2; }
.cs-chapter[data-image-position="left"] .cs-chapter-device   { order: 1; }

/* Chapter number watermark — pushed to the far edge per Part 2
   fix #7 (right edge for odd chapters, left edge for even).
   Color is `--ll-bg-depth` (slightly darker than the page bg) so
   it reads as a textural beige shadow against the paper white,
   never legible enough to compete with body text or headlines.
   z-index: 0 keeps it absolutely behind .cs-chapter-inner. */
.cs-chapter-watermark {
  position: absolute;
  top: 80px;
  right: -16px;
  font-family: var(--ll-font-mono);
  font-size: 280px;
  font-weight: 500;
  line-height: 1;
  color: var(--ll-bg-depth);
  letter-spacing: -0.05em;
  z-index: 0;
  pointer-events: none;
  user-select: none;
}

.cs-chapter[data-image-position="left"] .cs-chapter-watermark {
  right: auto;
  left: -16px;
}

.cs-chapter-number {
  display: inline-block;
  font-family: var(--ll-font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--cs-metric-label);
  letter-spacing: 0.08em;
  margin-bottom: 20px;
}

.cs-chapter-client {
  font-family: var(--ll-font-display);
  font-style: italic;
  font-style: italic;
  font-size: 16px;
  color: var(--cs-secondary);
  margin-bottom: 20px;
}

.cs-chapter-title {
  font-family: var(--ll-font-body);
  font-weight: 800;
  font-size: clamp(28px, 4.5vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: var(--cs-accent);
  margin-bottom: 28px;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.cs-chapter-industry {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  margin-bottom: 28px;
  font-family: var(--ll-font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--cs-tag-text);
  background: var(--cs-tag-bg);
  border: 1px solid var(--cs-tag-border);
  border-radius: 4px;
}

.cs-chapter-hook {
  font-family: var(--ll-font-body);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.75;
  color: var(--cs-primary);
  margin-bottom: 32px;
}

.cs-chapter-body {
  font-family: var(--ll-font-body);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.75;
  color: var(--cs-secondary);
  margin-bottom: 20px;
}

.cs-chapter-body-label {
  font-family: var(--ll-font-body);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cs-metric-label);
  margin-bottom: 12px;
  display: block;
}

.cs-chapter-body + .cs-chapter-body-label {
  margin-top: 28px;
}

/* Chapter metrics */
.cs-chapter-metrics {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 48px;
  margin: 40px 0;
  padding: 28px 0;
  border-top: 1px solid var(--cs-card-border);
  border-bottom: 1px solid var(--cs-card-border);
  justify-content: flex-start;
}

.cs-chapter-metric .cs-chapter-metric-value {
  font-family: var(--ll-font-mono);
  font-size: 32px;
  font-weight: 500;
  color: var(--cs-metric-value);
  line-height: 1.1;
  letter-spacing: -0.02em;
  /* 12px > label font-size (11px) — value reads clearly dominant,
     label sits comfortably below. Applied identically to all three
     chapter metric rows. */
  margin-bottom: 12px;
}

.cs-chapter-metric .cs-chapter-metric-label {
  font-family: var(--ll-font-body);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cs-metric-label);
}

/* Stack preview pills */
.cs-stack-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 40px;
}

.cs-stack-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  font-family: var(--ll-font-mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--cs-tag-text);
  background: var(--cs-tag-bg);
  border: 1px solid var(--cs-tag-border);
  border-radius: 4px;
}

/* Chapter CTA link — primary conversion link per chapter.
   Base state is intentionally prominent: 600 weight, underline visible
   at rest so it scans immediately as a link without hovering. */
.cs-chapter-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ll-font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--cs-accent);
  /* Underline at rest — text-decoration-color at ~30% opacity of the link
     color (--cs-accent = #191818) makes it immediately scannable without
     dominating the surrounding content. */
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(25, 24, 24, 0.30);
  /* Legacy bottom-border kept for hover state animation — it will be
     overridden at hover with border-color: var(--cs-accent). */
  border-bottom: 0;
  padding-bottom: 0;
  /* 40px clear visual separation from the content above */
  margin-top: 40px;
  transition: text-decoration-color 0.2s ease, gap 0.2s ease;
}

.cs-chapter-cta:hover {
  text-decoration-color: rgba(25, 24, 24, 0.80);
  gap: 12px;
}

.cs-chapter-cta .arrow {
  transition: transform 0.2s ease;
}

.cs-chapter-cta:hover .arrow {
  transform: translateX(3px);
}

@media (max-width: 900px) {
  .cs-chapter {
    padding: 72px 0;
  }
  .cs-chapter-inner {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  /* Content first, device after — better reading flow on mobile */
  .cs-chapter[data-image-position="left"] .cs-chapter-content,
  .cs-chapter[data-image-position="right"] .cs-chapter-content {
    order: 1;
  }
  .cs-chapter[data-image-position="left"] .cs-chapter-device,
  .cs-chapter[data-image-position="right"] .cs-chapter-device {
    order: 2;
  }
  .cs-chapter-watermark {
    font-size: 120px;
    top: 24px;
    right: -8px;
    opacity: 0.6;
  }
  .cs-chapter-metrics {
    gap: 20px;
    margin: 32px 0;
    padding: 20px 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-content: space-between;
  }
  .cs-chapter-metric .cs-chapter-metric-value {
    font-size: 22px;
  }
}

/* ============================================================
   DEVICE MOCKUPS
   ============================================================ */

/* Shared device wrap */
.cs-device {
  position: relative;
  width: 100%;
}

/* Flat marketing image variant — no browser chrome, no padding-top trick.
   Used for the Windscreen Compare chapter where the marketing multi-screen
   image speaks for itself. scale() enlarges the image visually without
   affecting layout — safe inside the overflow:hidden chapter wrapper. */
.cs-device--flat {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

/* Default: scale up for dramatic presentation on the index chapter card
   (the cs-chapter wrapper has overflow:hidden which clips the bleed safely) */
.cs-marketing-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0;
  transform: scale(1.45);
  transform-origin: center center;
}

@media (max-width: 900px) {
  .cs-marketing-image { transform: scale(1.2); }
}
@media (max-width: 600px) {
  .cs-marketing-image { transform: scale(1); }
}

/* Inside a figure on the detail page: no scale, just a clean full-width image */
.cs-figure .cs-marketing-image {
  transform: none;
  border-radius: 6px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.10);
}

/* Stacked overview — hook text centred above a full-width hero image */
.cs-detail-overview--stacked {
  padding: 56px 0 72px;
}

.cs-detail-overview--stacked .cs-detail-overview-hook {
  max-width: 760px;
  margin: 0 auto 56px;
  text-align: center;
}

.cs-overview-hero {
  max-width: 960px;
  margin: 0 auto;
}

.cs-overview-hero-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}

.cs-device-label {
  text-align: center;
  margin-top: 16px;
  font-family: var(--ll-font-body);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cs-tertiary);
}

/* Browser frame */
.cs-browser {
  position: relative;
  width: 100%;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 8px;
  overflow: hidden;
  background: #f5f5f5;
}

/* Chrome bar — glassmorphism via a blurred copy of the screenshot.
   ::before renders the same image blurred behind the bar.
   ::after is a very light frosted overlay — kept minimal so dark
   screenshots (e.g. Courtside Cuts dark hero) still read as dark glass. */
.cs-browser-chrome {
  position: relative;
  height: 36px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 0;
  z-index: 2;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  isolation: isolate;
}

/* Blurred screenshot — the glass colour source */
.cs-browser-chrome::before {
  content: '';
  position: absolute;
  inset: -4px;
  z-index: -2;
  background-image: var(--chrome-img, none);
  background-color: #e8e8e6;
  background-size: 100% auto;
  background-position: top center;
  background-repeat: no-repeat;
  filter: blur(22px) saturate(2.2);
}

/* Thin translucent overlay — lightens slightly without killing the tint */
.cs-browser-chrome::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(255, 255, 255, 0.22);
}

.cs-browser-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cs-browser-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: block;
}

.cs-browser-dot.is-red    { background: var(--cs-dot-red); }
.cs-browser-dot.is-yellow { background: var(--cs-dot-yellow); }
.cs-browser-dot.is-green  { background: var(--cs-dot-green); }

.cs-browser-url {
  flex: 1;
  margin: 0 12px;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.40);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  font-family: var(--ll-font-body);
  font-size: 12px;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.60);
  letter-spacing: -0.005em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs-browser-screen {
  overflow: hidden;
  background: #f5f5f5;
}

.cs-browser-screen img {
  width: 100%;
  height: auto;
  display: block;
}

/* Live-site iframe — needs an explicit height so the scaled iframe
   has a container to fill. Taller = more of the site visible. */
.cs-browser-screen:has(iframe.cs-live-frame) {
  position: relative;
  height: 680px;
}

/* In the chapter (portfolio index) morph device the browser is inside a
   narrower column, so a shorter height avoids it being too tall there. */
.cs-morph .cs-browser-screen:has(iframe.cs-live-frame) {
  height: 380px;
}

.cs-browser-screen iframe.cs-live-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 1280px;
  height: 800px;
  border: 0;
  transform-origin: top left;
  pointer-events: none;
  background: var(--cs-surface);
  z-index: 1;
  transform: scale(0.46875);
}

/* When a live iframe is present, hide the static image beneath it by
   default — JS will un-hide it if the iframe fails to load. */
.cs-browser-screen:has(iframe.cs-live-frame) > img,
.cs-browser-screen:has(iframe.cs-live-frame) > .cs-img-placeholder {
  visibility: hidden;
}

.cs-img-placeholder {
  width: 100%;
  min-height: 280px;
  /* display: flex so the centered text alignment rules below
     actually take effect. Without it the element renders as a
     block with align-items / justify-content doing nothing. */
  display: flex;
  align-items: center;
  justify-content: center;
  /* --cs-device-chrome = #111111 — kept intentionally dark so the frame
     interior reads as a screen, not the page background. */
  background: var(--cs-device-chrome);
  font-family: var(--ll-font-mono);
  font-size: 12px;
  /* rgba(247,247,242,0.48) — on-dark-subtle from the design system.
     Replaces the previous --cs-tertiary (dark-on-dark, invisible). */
  color: rgba(247, 247, 242, 0.48);
  letter-spacing: 0.02em;
  text-align: center;
  padding: 0 12px;
}

/* ── Phone mockup ──────────────────────────────────────────────────────────
   Outer shell: the dark body that forms the bezel around the screen.
   padding-top: 211% sets the 9:19 aspect ratio via the % = width rule.
   The screen sits inset from every edge so the bezel is always visible.
   3-D depth comes from layered box-shadows + a side-lighting gradient.
   ───────────────────────────────────────────────────────────────────────── */
.cs-phone {
  position: relative;
  width: 100%;
  padding-top: 211%;
  /* Slightly warm dark body — feels like anodised aluminium */
  background:
    /* Side-lighting gradient: bright left edge, darker right = 3-D */
    linear-gradient(
      105deg,
      #2e2e2e 0%,
      #1c1c1e 30%,
      #111113 65%,
      #0d0d0f 100%
    );
  border-radius: 28px;
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    /* Chamfer highlight — thin bright strip on the top-left edge */
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    inset 1px 1px 0 rgba(255, 255, 255, 0.08),
    /* Outer drop shadows: tight contact + diffuse lift */
    0 2px 4px rgba(0, 0, 0, 0.45),
    0 8px 24px rgba(0, 0, 0, 0.35),
    0 24px 56px rgba(0, 0, 0, 0.2);
}

/* Sheen overlay — simulates the curved-glass reflection on the face */
.cs-phone::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.06) 0%,
    rgba(255, 255, 255, 0.01) 40%,
    transparent 60%
  );
}

/* Status bar — floats inside the bezel above the screen */
.cs-phone-chrome {
  position: absolute;
  top: 5%;
  left: 4%;
  right: 4%;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  background: transparent;
  z-index: 3;
  pointer-events: none;
  /* Hide time, signal, battery text — keep the chrome bar in place
     so spacing inside the bezel is preserved */
  color: transparent;
  font-size: 0;
}

.cs-phone-status-right {
  display: none;
}

.cs-phone-status-right svg {
  display: none;
}

/* Home indicator — inside the chin bezel below the screen */
.cs-phone-home {
  position: absolute;
  bottom: 1.5%;
  left: 50%;
  transform: translateX(-50%);
  width: 28%;
  max-width: 90px;
  height: 3px;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  z-index: 3;
}

/* Screen — inset from the body edges so the dark bezel is visible all round */
.cs-phone-screen {
  position: absolute;
  top: 4.5%;
  left: 4%;
  right: 4%;
  bottom: 4.5%;
  overflow: hidden;
  background: transparent;
  border-radius: 16px;
}

.cs-phone-screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

/* Live-site iframe embedded in a phone frame. Renders at a mobile
   viewport width and scales to fit. pointer-events disabled. */
.cs-phone-screen iframe.cs-live-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 390px;
  height: 844px;
  border: 0;
  transform-origin: top left;
  pointer-events: none;
  background: var(--cs-surface);
  z-index: 1;
  /* transform is applied via JS to fit the parent exactly */
}

.cs-phone-screen:has(iframe.cs-live-frame) > img,
.cs-phone-screen:has(iframe.cs-live-frame) > .cs-img-placeholder {
  visibility: hidden;
}

/* ============================================================
   MORPH DEVICE (OVERVIEW PAGE ONLY)
   ------------------------------------------------------------
   The overview reuses the same dual-device layout as the detail
   pages (desktop browser + phone overlap, bottom-right). The phone
   "pops in" as you scroll the chapter into view: starts hidden +
   shrunk + offset, animates to its resting position.

   Performance: animation only touches `transform` and `opacity` on
   the phone layer. The desktop browser is static and never re-laid
   out during scroll.

   The .cs-morph wrapper exists only to scope the pop-in animation
   to the overview chapters. The visual structure is shared with
   .cs-dual-device on the detail pages.
   ============================================================ */
.cs-morph {
  --morph: 0;
  position: relative;
  width: 100%;
}

/* The phone inside an overview .cs-morph block is the only thing
   that animates. We layer transform + opacity driven by --morph.
     --morph = 0  → phone is shrunk to ~0.4, offset down/right, hidden
     --morph = 1  → phone sits at its natural detail-page position
*/
.cs-morph .cs-phone {
  /* Pivot off the bottom-right so the pop-in feels anchored in
     the corner (rather than swelling from the centre and clipping). */
  transform-origin: 100% 100%;
  transform:
    translate(
      calc((1 - var(--morph)) * 24px),
      calc((1 - var(--morph)) * 28px)
    )
    scale(calc(0.4 + 0.6 * var(--morph)));
  opacity: var(--morph);
  will-change: transform, opacity;
  /* Promote the phone to its own compositor layer so transform
     changes are GPU-only — no repaint of the desktop browser. */
  backface-visibility: hidden;
}

/* Mobile fallback (below 900px the dual-device CSS already stacks
   the phone underneath the browser; just make sure it's fully
   visible regardless of --morph and never animates). */
@media (max-width: 900px) {
  .cs-morph {
    --morph: 1;
  }
  .cs-morph .cs-phone {
    transform: none;
    opacity: 1;
    will-change: auto;
  }
}

/* ============================================================
   DETAIL PAGE — HERO
   ============================================================ */
.cs-detail-hero {
  padding: 60px 0 64px;
}

/* ── Case overview strip — sits directly below the hero image,
   before the first divider. One paragraph of context. ───────── */
.cs-case-overview {
  padding: 0 0 64px;
}

.cs-case-overview-inner {
  max-width: 780px;
  margin: 0 auto;
  padding-top: 48px;
  border-top: 1px solid var(--cs-card-border);
}

.cs-case-overview-text {
  font-family: var(--ll-font-body);
  font-size: 19px;
  font-weight: 400;
  font-style: italic;
  line-height: 1.7;
  letter-spacing: -0.01em;
  color: var(--cs-secondary);
}

@media (max-width: 900px) {
  .cs-case-overview {
    padding-bottom: 48px;
  }
  .cs-case-overview-inner {
    padding-top: 36px;
  }
  .cs-case-overview-text {
    font-size: 17px;
  }
}

/* Device mockup anchored to the bottom of the hero — sits below the metric
   row and inherits the hero's bottom padding as breathing room. */
.cs-hero-device {
  margin-top: 64px;
}

/* ============================================================
   PROJECT OVERVIEW — reusable component, placed directly below
   the hero image on every case study detail page.
   ============================================================ */
.cs-project-overview {
  padding: 72px 0 80px;
  border-top: 1px solid var(--cs-divider);
}

.cs-project-overview-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px 80px;
  align-items: start;
}

/* Left column — the big pull-quote */
.cs-project-overview-quote {
  font-family: var(--ll-font-serif, 'IBM Plex Serif', serif);
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 400;
  font-style: italic;
  line-height: 1.55;
  letter-spacing: -0.015em;
  color: var(--cs-primary);
  margin: 0;
}

/* Right column — structured summary */
.cs-project-overview-details {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.cs-project-overview-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cs-project-overview-item-label {
  font-family: var(--ll-font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cs-tertiary);
}

.cs-project-overview-item-value {
  font-family: var(--ll-font-body);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--cs-secondary);
}

@media (max-width: 900px) {
  .cs-project-overview {
    padding: 52px 0 60px;
  }

  .cs-project-overview-inner {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .cs-project-overview-quote {
    font-size: 20px;
  }
}

.cs-breadcrumb {
  font-family: var(--ll-font-body);
  font-size: 13px;
  font-weight: 400;
  color: #555555;
  letter-spacing: -0.005em;
  margin-bottom: 40px;
}

.cs-breadcrumb a {
  color: #555555;
  transition: color 0.2s ease;
}

.cs-breadcrumb a:hover {
  color: var(--cs-accent);
}

.cs-breadcrumb .sep {
  margin: 0 8px;
  color: #333333;
}

.cs-detail-hero-label {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  font-family: var(--ll-font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--cs-tag-text);
  background: var(--cs-tag-bg);
  border: 1px solid var(--cs-tag-border);
  border-radius: 4px;
  margin-bottom: 32px;
}

.cs-detail-hero-headline {
  font-family: var(--ll-font-body);
  font-weight: 900;
  font-size: clamp(32px, 6.5vw, 72px);
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: var(--cs-accent);
  margin-bottom: 32px;
  max-width: 20ch;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.cs-detail-hero-sub {
  max-width: 640px;
  font-family: var(--ll-font-body);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.75;
  letter-spacing: -0.01em;
  color: var(--cs-secondary);
  margin-bottom: 64px;
}

.cs-metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--cs-card-border);
  border-bottom: 1px solid var(--cs-card-border);
  padding: 32px 0;
}

.cs-metric-row.is-four {
  grid-template-columns: repeat(4, 1fr);
}

.cs-metric-row-item {
  padding: 0 24px;
  border-right: 1px solid var(--cs-card-border);
}

.cs-metric-row-item:first-child { padding-left: 0; }
.cs-metric-row-item:last-child  { border-right: 0; }

.cs-metric-row-value {
  font-family: var(--ll-font-mono);
  font-size: 40px;
  font-weight: 500;
  color: var(--cs-metric-value);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.cs-metric-row-label {
  font-family: var(--ll-font-body);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cs-metric-label);
}

@media (max-width: 900px) {
  .cs-metric-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .cs-metric-row.is-four {
    grid-template-columns: repeat(2, 1fr);
    gap: 28px 0;
  }
  .cs-metric-row.is-four .cs-metric-row-item {
    border-right: 0;
  }
  .cs-metric-row.is-four .cs-metric-row-item:nth-child(odd) {
    border-right: 1px solid var(--cs-card-border);
  }
  .cs-metric-row-item {
    padding: 0 16px;
  }
  .cs-metric-row-item:first-child {
    padding-left: 0;
  }
  .cs-metric-row-value {
    font-size: 28px;
  }
}

/* ============================================================
   DETAIL PAGE — OVERVIEW (hook + static mockup)
   ============================================================ */
.cs-detail-overview {
  padding: 64px 0;
}

.cs-detail-overview-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
}

.cs-detail-overview-hook {
  font-family: var(--ll-font-body);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: -0.01em;
  color: var(--cs-primary);
}

/* ============================================================
   DETAIL PAGE — FEATURE BLOCKS (image + text, alternating)
   ============================================================ */
/* ============================================================
   FEATURE BLOCKS — image + text, alternating
   ============================================================ */
.cs-feature-block {
  padding: 64px 0;
  border-top: 1px solid var(--cs-card-border);
}

.cs-feature-block:last-of-type {
  padding-bottom: 64px;
}

/* ── Layout grid ──────────────────────────────────────────────── */
.cs-feature-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
}

/* Reverse: text left, image right */
.cs-feature-inner--reverse {
  direction: rtl;
}
.cs-feature-inner--reverse > * {
  direction: ltr;
}

/* ── Image column ─────────────────────────────────────────────── */
.cs-feature-image {
  position: relative;
}

/* Feature block browsers — glass border and shadow */
.cs-feature-image .cs-browser {
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.55);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.4) inset,
    0 2px 4px rgba(0,0,0,0.04),
    0 8px 24px rgba(0,0,0,0.08),
    0 24px 48px rgba(0,0,0,0.06);
}

/* Feature block browsers inherit the global glass chrome — no overrides needed */

/* Dual-device wrapper inside feature column */
.cs-feature-image .cs-dual-device {
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.10)) drop-shadow(0 24px 48px rgba(0,0,0,0.07));
}

/* ── Plain image variant ──────────────────────────────────────── */
.cs-feature-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--cs-card-border);
  box-shadow: 0 4px 24px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04);
}

/* ── Text column ──────────────────────────────────────────────── */
.cs-feature-tag {
  font-family: var(--ll-font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cs-accent);
  margin-bottom: 16px;
}

.cs-feature-heading {
  font-family: var(--ll-font-body);
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--cs-primary);
  margin-bottom: 20px;
}

.cs-feature-body {
  font-family: var(--ll-font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.75;
  color: var(--cs-secondary);
  margin-bottom: 14px;
}

.cs-feature-body:last-child {
  margin-bottom: 0;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 900px) {
  .cs-feature-block {
    padding: 60px 0;
  }
  .cs-feature-inner,
  .cs-feature-inner--reverse {
    grid-template-columns: 1fr;
    gap: 36px;
    direction: ltr;
  }
  .cs-feature-inner--reverse .cs-feature-image {
    order: -1;
  }
  .cs-feature-heading {
    font-size: 22px;
  }
  .cs-feature-body {
    font-size: 15px;
  }
}

@media (max-width: 900px) {
  .cs-detail-overview {
    padding: 60px 0;
  }
  .cs-detail-overview-inner {
    grid-template-columns: 1fr;
    gap: 48px;
  }
  .cs-detail-overview-hook { font-size: 18px; }
}

/* ── Dual-device layout (browser left, phone overlapping bottom-right) ──────
   The phone is position:absolute so it lifts out of flow and overlaps the
   browser corner. To stop it being clipped we:
     1. Keep overflow:visible on the wrapper
     2. Add padding-bottom on the wrapper equal to the phone's bottom overhang
        so the document flow reserves the space below the browser frame.
   ─────────────────────────────────────────────────────────────────────────── */
.cs-dual-device {
  position: relative;
  /* Reserve room for the phone that hangs below the browser */
  padding-bottom: 6%;
  /* Must NOT clip — phone overflows the browser rect */
  overflow: visible;
}

.cs-dual-device .cs-browser {
  width: 100%;
}

.cs-dual-device .cs-phone {
  position: absolute;
  right: -2%;
  bottom: 0;
  width: 26%;
  min-width: 120px;
  max-width: 180px;
  padding-top: 0;
  aspect-ratio: 9 / 19;
  z-index: 2;
  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,0.08),
    0 8px 24px -4px rgba(0, 0, 0, 0.35),
    0 24px 48px -8px rgba(0, 0, 0, 0.2);
}

/* Scale down the chrome for the small overlaid phone — text already hidden globally */
.cs-dual-device .cs-phone .cs-phone-chrome {
  height: 18px;
  font-size: 0;
  padding: 0 8px;
}
.cs-dual-device .cs-phone .cs-phone-home {
  width: 28%;
  height: 2.5px;
}

/* ── Mobile (≤900px) — portfolio index: phone only ─────────────────────────
   Default: hide the browser, show the phone full-width centred.
   ─────────────────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .cs-dual-device {
    padding-bottom: 0;
  }
  .cs-dual-device .cs-browser {
    display: none;
  }
  .cs-dual-device .cs-phone {
    position: relative;
    width: 55%;
    min-width: 0;
    max-width: 260px;
    /* Keep padding-top: 211% — the screen's absolute % offsets depend on it */
    margin: 0 auto;
    box-shadow:
      inset 0 0 0 2px rgba(255,255,255,0.08),
      0 8px 24px -4px rgba(0, 0, 0, 0.3),
      0 24px 48px -8px rgba(0, 0, 0, 0.15);
  }
  .cs-dual-device .cs-phone .cs-phone-chrome {
    height: 22px;
    padding: 0 10px;
    font-size: 10px;
  }
  .cs-dual-device .cs-phone .cs-phone-home {
    width: 28%;
    max-width: 90px;
    height: 3px;
  }

  /* ── Detail page override: browser only, phone hidden ───────────────────
     On the detail page overview the browser is already loaded at a desktop
     virtual viewport — show it full-width so the site renders clearly.
     The phone overlay is redundant at this size so we hide it.
     ─────────────────────────────────────────────────────────────────────── */
  .cs-dual-device[data-context="detail"] .cs-browser {
    display: flex;
  }
  .cs-dual-device[data-context="detail"] .cs-phone {
    display: none;
  }
  /* Tighten the iframe height for narrow screens */
  .cs-dual-device[data-context="detail"] .cs-browser-screen:has(iframe.cs-live-frame) {
    height: 480px;
  }
}

/* ── Mobile view toggle — phone ↔ desktop ───────────────────────────────── */
.cs-view-toggle {
  display: none;
}

/* Wrapper that holds whichever view is active — fades between them */
.cs-view-stage {
  position: relative;
}

.cs-view-stage .cs-browser,
.cs-view-stage .cs-phone {
  transition: opacity 0.28s ease, transform 0.28s ease;
}

/* Outgoing view */
.cs-view-stage.is-switching .cs-browser,
.cs-view-stage.is-switching .cs-phone {
  opacity: 0;
  transform: scale(0.97) translateY(6px);
}

/* Browser shown on mobile via toggle */
.cs-view-stage .cs-browser.cs-mobile-shown {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
}

.cs-view-stage .cs-browser.cs-mobile-shown .cs-browser-screen {
  height: 420px;
}

@media (max-width: 600px) {
  .cs-view-stage .cs-browser.cs-mobile-shown .cs-browser-screen {
    height: 340px;
  }
}

@media (max-width: 900px) {
  .cs-view-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
  }

  .cs-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: 999px;
    border: 1px solid var(--cs-card-border);
    background: #ffffff;
    color: var(--cs-secondary);
    font-family: var(--ll-font-body);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s;
    -webkit-tap-highlight-color: transparent;
  }

  .cs-view-btn svg {
    flex-shrink: 0;
  }

  .cs-view-btn.is-active {
    background: var(--cs-primary);
    color: #ffffff;
    border-color: var(--cs-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  }

  .cs-view-btn:not(.is-active):active {
    background: var(--cs-surface);
  }
}

@media (max-width: 600px) {
  /* Portfolio index phone */
  .cs-dual-device:not([data-context="detail"]) .cs-phone {
    width: 65%;
    max-width: 240px;
  }
  /* Detail browser gets full container width */
  .cs-dual-device[data-context="detail"] .cs-browser-screen:has(iframe.cs-live-frame) {
    height: 420px;
  }
}

@media (max-width: 480px) {
  .cs-dual-device:not([data-context="detail"]) .cs-phone {
    width: 75%;
    max-width: 220px;
  }
  .cs-dual-device[data-context="detail"] .cs-browser-screen:has(iframe.cs-live-frame) {
    height: 360px;
  }
}

/* ============================================================
   DETAIL PAGE — PROBLEM / SOLUTION / OUTCOME
   ============================================================ */
.cs-narrative {
  padding: 72px 0;
}

.cs-narrative-inner {
  max-width: 780px;
  margin: 0 auto;
}

.cs-narrative-label {
  font-family: var(--ll-font-display);
  font-style: italic;
  font-style: italic;
  font-size: 16px;
  color: var(--cs-metric-label);
  margin-bottom: 32px;
}

.cs-narrative-body {
  font-family: var(--ll-font-body);
  font-size: 19px;
  font-weight: 400;
  line-height: 1.75;
  letter-spacing: -0.01em;
  color: var(--cs-primary);
}

.cs-narrative-body p + p {
  margin-top: 24px;
}

/* ── In-narrative product figures ──────────────────────────────────────────
   Clean editorial screenshots — no heavy browser chrome, just a rounded card
   with a subtle border and shadow that sits proportionately within the text. */
.cs-narrative-inner .cs-figure {
  margin: 48px 0;
}

.cs-narrative-inner .cs-figure + .cs-narrative-body {
  margin-top: 0;
}

/* Single screenshot — full width of the narrative column, max constrained */
.cs-screenshot {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--cs-card-border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.07), 0 8px 28px rgba(0,0,0,0.05);
}

/* Split layout: CRM desktop + mobile phone side by side */
.cs-figure--split {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
}

.cs-figure--split figcaption {
  grid-column: 1 / -1;
}

/* The mobile screenshot in the split — constrained to a phone-like width */
.cs-screenshot--mobile {
  width: 140px;
  flex-shrink: 0;
  border-radius: 12px;
}

.cs-figure-caption {
  margin-top: 14px;
  padding: 0;
  font-family: var(--ll-font-body);
  font-size: 13px;
  line-height: 1.5;
  color: var(--cs-tertiary);
  text-align: left;
  font-style: italic;
}

@media (max-width: 900px) {
  .cs-narrative {
    padding: 80px 0;
  }
  .cs-narrative-body {
    font-size: 17px;
  }
  .cs-narrative-inner .cs-figure {
    margin: 36px 0;
  }
  .cs-screenshot--mobile {
    width: 110px;
  }
}

@media (max-width: 600px) {
  .cs-figure--split {
    grid-template-columns: 1fr;
  }
  .cs-screenshot--mobile {
    display: none;
  }
}

/* ============================================================
   DETAIL PAGE — ARCHITECTURE DIAGRAM
   ============================================================ */
.cs-arch {
  padding: 80px 0;
  border-top: 1px solid var(--cs-divider);
  border-bottom: 1px solid var(--cs-divider);
}

.cs-arch-header {
  text-align: center;
  margin-bottom: 72px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.cs-arch-label {
  font-family: var(--ll-font-display);
  font-style: italic;
  font-style: italic;
  font-size: 16px;
  color: var(--cs-metric-label);
  margin-bottom: 24px;
}

.cs-arch-headline {
  font-family: var(--ll-font-body);
  font-weight: 800;
  font-size: clamp(24px, 3.5vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.04em;
  color: var(--cs-accent);
  margin-bottom: 20px;
}

.cs-arch-desc {
  font-family: var(--ll-font-body);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.75;
  color: var(--cs-secondary);
}

.cs-arch-image {
  max-width: 900px;
  margin: 0 auto;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--cs-card-border);
  background: var(--cs-surface);
}

.cs-arch-image img {
  width: 100%;
  display: block;
}

.cs-arch-svg {
  width: 100%;
  max-width: 980px;
  height: auto;
  margin: 0 auto;
  display: block;
  background: #fafaf8;
  border: 1px solid var(--cs-card-border);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

/* ── Zone backgrounds (group regions) ──────────────────────────── */
.cs-arch-svg rect.zone {
  fill: rgba(0,0,0,0.025);
  stroke: rgba(0,0,0,0.06);
  stroke-width: 1;
  rx: 10;
}

/* ── Nodes ──────────────────────────────────────────────────────── */
.cs-arch-svg rect.node {
  fill: #ffffff;
  stroke: rgba(0,0,0,0.12);
  stroke-width: 1;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.06));
}
.cs-arch-svg rect.node.is-hero {
  fill: #1a1a1a;
  stroke: #1a1a1a;
  stroke-width: 0;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.18));
}
.cs-arch-svg rect.node.is-external {
  fill: #f5f5f2;
  stroke: rgba(0,0,0,0.10);
  stroke-dasharray: 5 3;
  stroke-width: 1;
}

/* ── Node text ──────────────────────────────────────────────────── */
.cs-arch-svg .node-label {
  font-family: var(--ll-font-body);
  font-size: 12px;
  font-weight: 600;
  fill: #1a1a1a;
  letter-spacing: -0.01em;
}
.cs-arch-svg .node-label.is-hero {
  fill: #ffffff;
}
.cs-arch-svg .node-sublabel {
  font-family: var(--ll-font-body);
  font-size: 10px;
  font-weight: 400;
  fill: #888880;
  letter-spacing: 0;
}
.cs-arch-svg .node-sublabel.is-hero {
  fill: rgba(255,255,255,0.6);
}
.cs-arch-svg .zone-label {
  font-family: var(--ll-font-body);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  fill: #aaa89a;
}

/* ── Connections (paths, not lines) ────────────────────────────── */
.cs-arch-svg path.link {
  fill: none;
  stroke: rgba(0,0,0,0.15);
  stroke-width: 1.5;
}
.cs-arch-svg path.link.is-dashed {
  stroke-dasharray: 5 4;
  stroke: rgba(0,0,0,0.10);
}

/* ── Edge labels ────────────────────────────────────────────────── */
.cs-arch-svg .link-label {
  font-family: var(--ll-font-body);
  font-size: 9.5px;
  font-weight: 400;
  fill: #999990;
  letter-spacing: 0;
}

@media (max-width: 900px) {
  .cs-arch {
    padding: 80px 0;
  }
  .cs-arch-svg {
    overflow-x: auto;
    display: block;
  }
  .cs-arch-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }
  .cs-arch-scroll .cs-arch-svg {
    min-width: 760px;
  }
}

/* ============================================================
   DETAIL PAGE — TECH STACK (LAYERED TABLE)
   ============================================================ */
.cs-stack {
  padding: 80px 0;
}

.cs-stack-header {
  margin-bottom: 72px;
  max-width: 720px;
}

.cs-stack-label {
  font-family: var(--ll-font-display);
  font-style: italic;
  font-style: italic;
  font-size: 16px;
  color: var(--cs-metric-label);
  margin-bottom: 24px;
}

.cs-stack-headline {
  font-family: var(--ll-font-body);
  font-weight: 800;
  font-size: clamp(24px, 3.5vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.04em;
  color: var(--cs-accent);
  margin-bottom: 20px;
}

.cs-stack-desc {
  font-family: var(--ll-font-body);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.75;
  color: var(--cs-secondary);
}

.cs-stack-layer {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 48px;
  padding: 32px 0;
  border-top: 1px solid var(--cs-divider);
  align-items: start;
}

.cs-stack-layer:last-child {
  border-bottom: 1px solid var(--cs-divider);
}

.cs-stack-layer-label {
  font-family: var(--ll-font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--cs-primary);
  letter-spacing: -0.01em;
  padding-top: 8px;
}

.cs-stack-layer-items {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 32px;
}

.cs-stack-tech {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cs-stack-tech-name {
  font-family: var(--ll-font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--cs-primary);
  letter-spacing: -0.005em;
}

.cs-stack-tech-role {
  font-family: var(--ll-font-body);
  font-size: 13px;
  font-weight: 400;
  color: var(--cs-secondary);
  line-height: 1.5;
}

@media (max-width: 900px) {
  .cs-stack {
    padding: 80px 0;
  }
  .cs-stack-layer {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .cs-stack-layer-items {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* ============================================================
   DETAIL PAGE — NEXT PROJECT CARD
   ============================================================ */
.cs-next {
  padding: 120px 0;
  border-top: 1px solid var(--cs-divider);
}

.cs-next-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
  padding: 48px;
  background: var(--cs-card-bg);
  border: 1px solid var(--cs-card-border);
  border-radius: 4px;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.cs-next-card:hover {
  border-color: var(--cs-card-border-hover);
  transform: translateY(-2px);
}

.cs-next-card .cs-next-label {
  font-family: var(--ll-font-display);
  font-style: italic;
  font-style: italic;
  font-size: 14px;
  color: var(--cs-metric-label);
  margin-bottom: 12px;
}

.cs-next-card .cs-next-client {
  font-family: var(--ll-font-body);
  font-weight: 800;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--cs-accent);
  margin-bottom: 12px;
}

.cs-next-card .cs-next-teaser {
  font-family: var(--ll-font-body);
  font-size: 16px;
  color: var(--cs-secondary);
}

.cs-next-arrow {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--cs-card-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.25s ease, background 0.25s ease, color 0.25s ease;
  color: var(--cs-primary);
}

.cs-next-card:hover .cs-next-arrow {
  border-color: var(--cs-accent);
  background: var(--cs-accent);
  color: var(--cs-bg);
}

@media (max-width: 768px) {
  .cs-next {
    padding: 80px 0;
  }
  .cs-next-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 32px;
    gap: 24px;
  }
}

/* ============================================================
   MORE WORK RAIL (OVERVIEW PAGE)
   ============================================================ */
.cs-more {
  padding: 140px 0;
  border-top: 1px solid var(--cs-divider);
}

.cs-more-header {
  margin-bottom: 64px;
  max-width: 720px;
}

.cs-more-label {
  font-family: var(--ll-font-display);
  font-style: italic;
  font-style: italic;
  font-size: 16px;
  color: var(--cs-metric-label);
  margin-bottom: 20px;
}

.cs-more-headline {
  font-family: var(--ll-font-body);
  font-weight: 800;
  font-size: clamp(24px, 3.5vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.04em;
  color: var(--cs-accent);
}

.cs-more-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.cs-more-card {
  background: var(--cs-card-bg);
  border: 1px solid var(--cs-card-border);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.25s ease, transform 0.25s ease;
  display: flex;
  flex-direction: column;
}

.cs-more-card:hover {
  border-color: var(--cs-card-border-hover);
  transform: translateY(-2px);
}

.cs-more-thumb {
  position: relative;
  width: 100%;
  /* 16:9 aspect-ratio applied consistently across all four cards */
  padding-top: 56.25%;
  background: var(--cs-surface);
  overflow: hidden;
}

/* Gradient overlay — identical on all four thumbnail cards.
   Creates visual consistency regardless of image content type
   (UI screenshot vs editorial photography). Dark at ~18% opacity
   at the bottom edge, transparent at the top. */
.cs-more-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 50%,
    rgba(25, 24, 24, 0.18) 100%
  );
  pointer-events: none;
  z-index: 1;
}

.cs-more-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.cs-more-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.cs-more-client {
  font-family: var(--ll-font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cs-metric-label);
}

.cs-more-project {
  font-family: var(--ll-font-body);
  font-size: 16px;
  font-weight: 600;
  color: var(--cs-accent);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.cs-more-one-liner {
  font-family: var(--ll-font-body);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--cs-secondary);
  margin-top: 4px;
  flex: 1;
}

.cs-more-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-family: var(--ll-font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--cs-primary);
  transition: gap 0.2s ease;
}

.cs-more-card:hover .cs-more-arrow {
  gap: 10px;
}

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

@media (max-width: 600px) {
  .cs-more {
    padding: 80px 0;
  }
  .cs-more-grid {
    grid-template-columns: 1fr;
  }
}

/* CTA section — relocated to /css/site-overrides.css so the same
   shared CTA component can render on any page (including /process.html
   without case-studies.css loaded). Selectors stay .cs-* / .cs-btn so
   case-studies.html keeps zero visual regression. */

/* Footer — global Webflow footer is mounted at #site-footer and
   styled by halden-miller.webflow.css. Its dark theme already
   matches our black canvas. No overrides needed beyond ensuring
   the body bg stays #000 (above). */

/* ============================================================
   MOBILE REFINEMENTS
   Custom-built mobile layout — tight spacing, clear hierarchy,
   nothing decorative that doesn't earn its place on a small screen.
   ============================================================ */

/* --- Tablet (<= 900px) ---------------------------------- */
@media (max-width: 900px) {
  .cs-container {
    padding: 0 24px;
  }

  /* Detail hero */
  .cs-detail-hero {
    padding: 32px 0 72px;
  }
  .cs-detail-hero-sub {
    margin-bottom: 48px;
  }

  /* Tech stack layer spacing */
  .cs-stack-layer {
    padding: 24px 0;
  }
  .cs-stack-layer-label {
    font-size: 12px;
    padding-top: 0;
  }

  /* More Work header margin */
  .cs-more-header {
    margin-bottom: 48px;
  }
}

/* --- Main mobile (<= 768px) ----------------------------- */
@media (max-width: 768px) {
  .cs-container {
    padding: 0 20px;
  }

  .cs-overview-hero {
    padding: 16px 0 72px;
  }
  .cs-overview-hero::before {
    background-image: repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 63px,
      rgba(25, 24, 24, 0.025) 63px,
      rgba(25, 24, 24, 0.025) 64px
    );
  }
  /* Tighter accent + label spacing on mobile to keep the hero
     vertical rhythm balanced at smaller viewport heights. */
  .cs-hero-accent {
    margin: 20px auto;
  }
  .cs-hero-headline {
    font-size: clamp(40px, 9vw, 56px);
    letter-spacing: -0.04em;
  }
  .cs-hero-sub {
    font-size: 16px;
    line-height: 1.65;
    margin-top: 24px;
  }

  /* Stat bar — tighter 2x2 on mobile */
  .cs-stat-bar {
    padding: 24px 0;
    gap: 20px 0;
  }
  .cs-stat {
    padding: 0 16px;
  }
  .cs-stat:nth-child(1),
  .cs-stat:nth-child(2) {
    padding-bottom: 20px;
  }
  .cs-stat:nth-child(3),
  .cs-stat:nth-child(4) {
    padding-top: 20px;
  }
  .cs-stat-value {
    font-size: 30px;
    margin-bottom: 6px;
  }
  .cs-stat-label {
    font-size: 10px;
    letter-spacing: 0.06em;
  }

  /* Chapter index — vertical column on mobile (set in base rule) */
  .cs-chapter-index {
    margin-top: 28px;
  }
  .cs-chapter-index-item {
    font-size: 12px;
    /* Touch target: 44px min — vertical padding hits this with line-height */
    padding: 12px 0;
  }

  /* Chapters */
  .cs-chapter {
    padding: 56px 0;
  }
  .cs-chapter-inner {
    gap: 32px;
  }
  .cs-chapter-number {
    margin-bottom: 16px;
  }
  .cs-chapter-client {
    margin-bottom: 16px;
  }
  .cs-chapter-title {
    margin-bottom: 20px;
  }
  .cs-chapter-industry {
    margin-bottom: 20px;
  }
  .cs-chapter-hook {
    font-size: 17px;
    margin-bottom: 24px;
  }
  .cs-chapter-body {
    font-size: 16px;
    line-height: 1.7;
  }
  .cs-chapter-body-label {
    margin-bottom: 8px;
  }
  .cs-chapter-body + .cs-chapter-body-label {
    margin-top: 20px;
  }

  /* Chapter watermark — hidden on mobile to reduce visual clutter */
  .cs-chapter-watermark {
    display: none;
  }

  /* Chapter metrics — still 3 columns but breathe more */
  .cs-chapter-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 28px 0;
    padding: 18px 0;
  }
  .cs-chapter-metric .cs-chapter-metric-value {
    font-size: 20px;
    /* 10px = label font-size at this breakpoint — keep gap ≥ label size */
    margin-bottom: 10px;
  }
  .cs-chapter-metric .cs-chapter-metric-label {
    font-size: 10px;
    letter-spacing: 0.06em;
  }

  /* Stack preview pills — smaller, tighter */
  .cs-stack-preview {
    gap: 6px;
    margin-bottom: 32px;
  }
  .cs-stack-pill {
    padding: 5px 10px;
    font-size: 10px;
  }

  /* Chapter CTA — bigger touch target on mobile */
  .cs-chapter-cta {
    font-size: 15px;
    padding: 12px 0;
    min-height: 44px;
    align-items: center;
  }

  /* Detail hero */
  .cs-detail-hero {
    padding: 24px 0 56px;
  }
  .cs-breadcrumb {
    margin-bottom: 32px;
    font-size: 12px;
  }
  .cs-detail-hero-label {
    margin-bottom: 24px;
  }
  .cs-detail-hero-headline {
    margin-bottom: 24px;
    letter-spacing: -0.035em;
  }
  .cs-detail-hero-sub {
    font-size: 17px;
    line-height: 1.7;
    margin-bottom: 40px;
  }

  /* Detail metric row — 3 items stay in a tight row, 4 items go 2x2 */
  .cs-metric-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    padding: 20px 0;
  }
  .cs-metric-row-item {
    padding: 0 12px;
  }
  .cs-metric-row.is-four {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 0;
    padding: 20px 0;
  }
  .cs-metric-row.is-four .cs-metric-row-item {
    padding: 0 16px;
    border-right: 1px solid var(--cs-card-border);
  }
  .cs-metric-row.is-four .cs-metric-row-item:nth-child(2n + 1) {
    padding-left: 0;
  }
  .cs-metric-row.is-four .cs-metric-row-item:nth-child(2n) {
    border-right: 0;
    padding-right: 0;
  }
  .cs-metric-row.is-four .cs-metric-row-item:nth-child(1),
  .cs-metric-row.is-four .cs-metric-row-item:nth-child(2) {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--cs-card-border);
  }
  .cs-metric-row.is-four .cs-metric-row-item:nth-child(3),
  .cs-metric-row.is-four .cs-metric-row-item:nth-child(4) {
    padding-top: 18px;
  }
  .cs-metric-row-value {
    font-size: 24px;
    margin-bottom: 6px;
  }
  .cs-metric-row-label {
    font-size: 10px;
    letter-spacing: 0.06em;
    line-height: 1.4;
  }

  /* Detail overview */
  .cs-detail-overview {
    padding: 48px 0;
  }
  .cs-detail-overview-inner {
    gap: 32px;
  }
  .cs-detail-overview-hook {
    font-size: 17px;
    line-height: 1.7;
  }

  /* Narrative */
  .cs-narrative {
    padding: 56px 0;
  }
  .cs-narrative-label {
    margin-bottom: 20px;
    font-size: 14px;
  }
  .cs-narrative-body {
    font-size: 16px;
    line-height: 1.7;
  }
  .cs-narrative-body p + p {
    margin-top: 18px;
  }

  /* Architecture section */
  .cs-arch {
    padding: 64px 0;
  }
  .cs-arch-header {
    margin-bottom: 40px;
  }
  .cs-arch-label {
    margin-bottom: 16px;
    font-size: 14px;
  }
  .cs-arch-desc {
    font-size: 15px;
    line-height: 1.65;
  }

  /* SVG diagram scroll container — give it visual affordance */
  .cs-arch-scroll {
    position: relative;
    margin: 0 -20px;
    padding: 0 20px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--cs-card-border-hover) transparent;
  }
  .cs-arch-scroll::-webkit-scrollbar {
    height: 4px;
  }
  .cs-arch-scroll::-webkit-scrollbar-track {
    background: transparent;
  }
  .cs-arch-scroll::-webkit-scrollbar-thumb {
    background: var(--cs-card-border-hover);
    border-radius: 2px;
  }
  .cs-arch-image,
  .cs-arch-svg {
    min-width: 640px;
  }

  /* Stack section */
  .cs-stack {
    padding: 56px 0;
  }
  .cs-stack-header {
    margin-bottom: 40px;
  }
  .cs-stack-label {
    margin-bottom: 16px;
    font-size: 14px;
  }
  .cs-stack-desc {
    font-size: 15px;
    line-height: 1.65;
  }
  .cs-stack-layer {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 20px 0;
  }
  .cs-stack-layer-items {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .cs-stack-tech-name {
    font-size: 13px;
  }
  .cs-stack-tech-role {
    font-size: 12px;
  }

  /* Next project card */
  .cs-next {
    padding: 56px 0;
  }
  .cs-next-card {
    padding: 28px;
    gap: 20px;
  }
  .cs-next-card .cs-next-client {
    font-size: 22px;
  }
  .cs-next-card .cs-next-teaser {
    font-size: 15px;
  }
  .cs-next-arrow {
    width: 44px;
    height: 44px;
  }

  /* CTA section responsive — relocated to site-overrides.css */

  /* More Work */
  .cs-more {
    padding: 64px 0;
  }
  .cs-more-header {
    margin-bottom: 32px;
  }
  .cs-more-label {
    margin-bottom: 16px;
    font-size: 14px;
  }
  .cs-more-body {
    padding: 16px;
  }
  .cs-more-project {
    font-size: 15px;
  }
  .cs-more-one-liner {
    font-size: 12px;
  }

}

/* --- Small mobile (<= 480px) ---------------------------- */
@media (max-width: 480px) {
  .cs-container {
    padding: 0 18px;
  }

  .cs-overview-hero {
    padding: 4px 0 56px;
  }
  .cs-hero-headline {
    font-size: 36px;
    line-height: 1.08;
  }
  .cs-hero-sub {
    font-size: 15px;
    margin-top: 20px;
  }

  .cs-stat-value {
    font-size: 26px;
  }

  .cs-chapter {
    padding: 48px 0;
  }
  .cs-chapter-title {
    font-size: 26px;
  }

  /* Watermark — gone at this width, it's just noise */
  .cs-chapter-watermark {
    display: none;
  }

  /* Chapter metrics — stay as a tight 3-col row (always 3 items) */
  .cs-chapter-metrics {
    gap: 12px;
    padding: 16px 0;
  }
  .cs-chapter-metric .cs-chapter-metric-value {
    font-size: 18px;
  }
  .cs-chapter-metric .cs-chapter-metric-label {
    font-size: 9px;
    letter-spacing: 0.04em;
  }

  .cs-detail-hero {
    padding: 20px 0 48px;
  }
  .cs-detail-hero-headline {
    font-size: 30px;
  }
  .cs-detail-hero-sub {
    font-size: 15px;
  }

  .cs-metric-row-value {
    font-size: 22px;
  }

  .cs-arch-image,
  .cs-arch-svg {
    min-width: 560px;
  }

  .cs-next-card {
    padding: 24px;
  }
  .cs-next-card .cs-next-client {
    font-size: 20px;
  }
}

/* --- Very small (<= 360px) ------------------------------ */
@media (max-width: 360px) {
  .cs-hero-headline {
    font-size: 28px;
  }
  .cs-detail-hero-headline {
    font-size: 26px;
  }
  .cs-chapter-title {
    font-size: 24px;
  }
  .cs-stat-value {
    font-size: 24px;
  }
  .cs-metric-row-value {
    font-size: 20px;
  }
  .cs-chapter-metric .cs-chapter-metric-value {
    font-size: 18px;
  }
}
