/*
 * Case-study pages. Builds on insight / service / home / devices.
 * Page accent: --cs-tint (set per page by the builder).
 *
 * BODY components:
 *   <section class="h-sec [alt]"><div class="svc-wrap"> … </div></section>
 *   .cs-chap          chapter header: <span class="n">01</span><span class="k">Kicker</span><h2>… <em>word</em></h2><p>one line</p>
 *   .cs-split(.rev)   text + stage, 2 columns        .cs-split__t / .cs-split__stage
 *   .cs-wide          full-width stage (min-height 520, centred)
 *   .browser          macOS window frame (devices.css) > .bar + .bscr
 *   .cs-video         rounded video; use <video data-lazy muted loop playsinline preload="none" poster=…> (case-kit plays on view)
 *   .cs-gallery       horizontal row of phones / screens (scrolls on mobile)
 *   .cs-steps         numbered process, line draws in: > .cs-step > b + p
 *   .cs-bento         2–3 column grid of tiles: > .cs-tile(.span2) > .k + h3 + p + visual
 *   .cs-quote         pull quote: <blockquote> + <cite>
 *   .cs-chips         tech-stack chips: > span
 *   .cs-rise          anything that should fade up on scroll
 */
.cs main { overflow-x: clip; }

/* ---------- hero ---------- */
.cs-hero { position: relative; padding: 140px 0 40px; overflow: hidden; }
.cs-hero::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(50% 45% at 70% 55%, color-mix(in srgb, var(--cs-tint) 26%, transparent), transparent 70%),
              radial-gradient(40% 40% at 10% 5%, rgba(59,130,246,.16), transparent 70%); }
.cs-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .45;
  background-image: linear-gradient(var(--in-line) 1px, transparent 1px), linear-gradient(90deg, var(--in-line) 1px, transparent 1px); background-size: 46px 46px;
  mask-image: radial-gradient(70% 60% at 50% 60%, #000, transparent 75%); -webkit-mask-image: radial-gradient(70% 60% at 50% 60%, #000, transparent 75%); }
.cs-hero > * { position: relative; z-index: 1; }
.cs-back { display: inline-block; font-size: 14px; color: var(--in-muted); text-decoration: none; margin-bottom: 22px; }
.cs-back:hover { color: var(--in-ink); }
.cs-back + .h-kicker { display: flex; width: fit-content; }
.cs-hero h1 { font-size: clamp(42px, 6.4vw, 88px); line-height: 1.08; letter-spacing: -.05em; font-weight: 700; margin: 22px 0 18px; max-width: 16ch; text-wrap: balance; }
.cs-hero h1 em { font-family: var(--in-serif); font-style: italic; font-weight: 400; letter-spacing: -.01em; }
.cs-hero h1 .sr-w { padding-bottom: .22em; margin-bottom: -.22em; }
.cs-hero h1 em .sr-w > span { background: linear-gradient(90deg, var(--cs-tint), color-mix(in srgb, var(--cs-tint) 40%, #fff)); -webkit-background-clip: text; background-clip: text; color: transparent; padding-right: .06em; }
.cs-dek { font-size: clamp(17px, 2vw, 21px); line-height: 1.5; color: var(--in-ink-2); max-width: 46ch; margin: 0 0 30px; }
.cs-facts { display: flex; flex-wrap: wrap; gap: 10px 34px; padding-top: 22px; border-top: 1px solid var(--in-line); }
.cs-fact span { display: block; font-family: var(--in-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--in-muted); }
.cs-fact b { display: block; font-size: 15px; color: var(--in-ink); font-weight: 600; margin-top: 5px; }
.cs-stage { position: relative; margin: 56px auto 0; width: min(1280px, calc(100% - 32px)); min-height: 560px; display: grid; place-items: center; }
.cs-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 56px; border-top: 1px solid var(--in-line); border-bottom: 1px solid var(--in-line); }
.cs-stat { padding: 26px 22px; }
.cs-stat + .cs-stat { border-left: 1px solid var(--in-line); }
.cs-stat b { display: block; font-size: clamp(32px, 4vw, 52px); font-weight: 700; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap;
  background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--cs-tint) 65%, #fff)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cs-stat span { display: block; margin-top: 10px; font-size: 14px; color: var(--in-muted); line-height: 1.4; max-width: 26ch; }
.cs-stats:has(.cs-stat:nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 820px) {
  .cs-hero { padding-top: 118px; }
  .cs-stage { min-height: 0; margin-top: 40px; }
  .cs-stats, .cs-stats:has(.cs-stat:nth-child(3):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs-stat:nth-child(3) { border-left: 0; } .cs-stat:nth-child(n+3) { border-top: 1px solid var(--in-line); }
}

/* ---------- chapters ---------- */
.cs-chap { max-width: 760px; margin: 0 0 44px; }
.cs-chap.c { margin-left: auto; margin-right: auto; text-align: center; }
.cs-chap .n { font-family: var(--in-mono); font-size: 12px; color: var(--cs-tint); margin-right: 10px; }
.cs-chap .k { font-family: var(--in-mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--in-muted); }
.cs-chap h2 { font-size: clamp(32px, 4.6vw, 58px); line-height: 1.1; letter-spacing: -.04em; font-weight: 700; margin: 14px 0 14px; color: var(--in-ink); text-wrap: balance; }
.cs-chap h2 em { font-family: var(--in-serif); font-style: italic; font-weight: 400; color: var(--cs-tint); }
.cs-chap h2 .sr-w { padding-bottom: .2em; margin-bottom: -.2em; }
.cs-chap p { font-size: 18px; line-height: 1.55; color: var(--in-ink-2); margin: 0; max-width: 52ch; }
.cs-chap.c p { margin: 0 auto; }

/* ---------- layouts ---------- */
.cs-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 60px; align-items: center; }
.cs-split.rev { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.cs-split.rev > :first-child { order: 2; }
.cs-split__stage, .cs-wide { position: relative; display: grid; place-items: center; min-height: 480px; }
.cs-split .cs-chap { margin-bottom: 22px; }
@media (max-width: 900px) { .cs-split, .cs-split.rev { grid-template-columns: minmax(0, 1fr); gap: 34px; } .cs-split.rev > :first-child { order: 0; } .cs-split__stage, .cs-wide { min-height: 0; } }

/* ---------- media ---------- */
.cs-video { display: block; width: 100%; height: auto; border-radius: 18px; background: #0b0c10; }
.browser .cs-video { border-radius: 0 0 14px 14px; }
.cs-shot { display: block; width: 100%; height: auto; border-radius: 18px; }
.cs-gallery { display: flex; gap: 22px; justify-content: center; align-items: flex-end; }
.cs-gallery .phone { width: 250px; flex: none; }
@media (max-width: 900px) {
  .cs-gallery { justify-content: flex-start; overflow-x: auto; padding: 10px 16px 24px; margin: 0 -20px; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .cs-gallery::-webkit-scrollbar { display: none; }
  .cs-gallery > * { scroll-snap-align: center; }
  .cs-gallery .phone { width: 230px; }
}

/* ---------- process steps ---------- */
.cs-steps { position: relative; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; }
.cs-steps::before { content: ""; position: absolute; left: 22px; right: 22px; top: 22px; height: 2px; background: linear-gradient(90deg, var(--cs-tint), transparent); transform-origin: left; transform: scaleX(var(--cs-line, 1)); opacity: .5; }
.cs-step { position: relative; }
.cs-step > i { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 700; font-size: 15px; color: #0a0a0a; background: var(--cs-tint); box-shadow: 0 0 0 6px color-mix(in srgb, var(--cs-tint) 18%, transparent); margin-bottom: 16px; position: relative; }
.cs-step b { display: block; font-size: 17px; color: var(--in-ink); margin-bottom: 6px; }
.cs-step p { font-size: 14.5px; color: var(--in-muted); margin: 0; line-height: 1.5; }
@media (max-width: 700px) { .cs-steps { grid-template-columns: minmax(0, 1fr); } .cs-steps::before { left: 22px; right: auto; top: 22px; bottom: 22px; width: 2px; height: auto; background: linear-gradient(180deg, var(--cs-tint), transparent); transform-origin: top; transform: scaleY(var(--cs-line, 1)); }
  .cs-step { padding-left: 66px; } .cs-step > i { position: absolute; left: 0; top: 0; } }

/* ---------- bento ---------- */
.cs-bento { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.cs-tile { position: relative; border: 1px solid var(--in-line); border-radius: 26px; padding: 26px; background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.012)); overflow: hidden; min-height: 260px; display: flex; flex-direction: column; }
.cs-tile.span2 { grid-column: span 2; }
.cs-tile .k { font-family: var(--in-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--cs-tint); }
.cs-tile h3 { font-size: 22px; letter-spacing: -.02em; color: var(--in-ink); margin: 10px 0 6px; line-height: 1.15; }
.cs-tile p { font-size: 15px; color: var(--in-muted); margin: 0; line-height: 1.5; max-width: 40ch; }
.cs-tile .vis { margin-top: auto; padding-top: 22px; }
@media (max-width: 900px) { .cs-bento { grid-template-columns: minmax(0, 1fr); } .cs-tile.span2 { grid-column: auto; } }

/* ---------- quote, chips ---------- */
.cs-quote { max-width: 860px; margin: 0 auto; text-align: center; }
.cs-quote blockquote { font-family: var(--in-serif); font-size: clamp(28px, 3.6vw, 44px); line-height: 1.2; color: var(--in-ink); margin: 0 0 18px; letter-spacing: -.01em; }
.cs-quote cite { font-style: normal; font-size: 14px; color: var(--in-muted); }
.cs-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cs-chips span { font-family: var(--in-mono); font-size: 12px; padding: 7px 12px; border-radius: 99px; border: 1px solid var(--in-line-2); color: var(--in-ink-2); background: rgba(255,255,255,.03); white-space: nowrap; }

/* ---------- next ---------- */
.cs-next { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); border: 1px solid var(--in-line-2); border-radius: 28px; overflow: hidden; text-decoration: none; background: var(--in-bg-2); transition: border-color .3s, transform .3s; }
.cs-next:hover { border-color: color-mix(in srgb, var(--cs-tint) 60%, transparent); transform: translateY(-3px); }
.cs-next__img { min-height: 240px; background: #111; overflow: hidden; } .cs-next__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cs-next__t { padding: 34px 30px; display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.cs-next__t .k { font-family: var(--in-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--cs-tint); }
.cs-next__t b { font-size: clamp(24px, 3vw, 34px); color: var(--in-ink); letter-spacing: -.03em; line-height: 1.1; }
.cs-next:not(:has(.cs-next__img)) { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 760px) { .cs-next { grid-template-columns: minmax(0, 1fr); } .cs-next__img { min-height: 190px; } }

/* page accent on shared section headings */
.cs .svc-h .k { color: var(--cs-tint); }
.cs .svc-h h2 em { color: var(--cs-tint); }

/* buttons never wrap */
.cs .svc-btn, .cs .in-cta a, .cs .lg-pill { white-space: nowrap; }

/* stage children never force the page wider; fitted UIs scale inside them */
.cs-stage > *, .cs-split__stage > *, .cs-wide > * { min-width: 0; max-width: 100%; }
.browser .bscr[data-fit] { max-width: none; }
.cs-stage > .in-replay, .cs-split__stage > .in-replay, .cs-wide > .in-replay { top: auto; bottom: -40px; right: 0; }
@media (max-width: 820px) {
  .cs-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
  .cs-fact b { font-size: 14px; }
}
