/* ==========================================================================
   Case study page. Loads on top of styles.css and reuses its tokens, nav,
   buttons, sheet, contact panel, footer and keyframes.

   Two worlds, kept deliberately separate: the page itself speaks the
   portfolio's night-sky/slate language, while every Vida artifact sits on
   Vida's own warm cream (#FFFCFA + #E7E2DC hairlines) or its dark plum, so
   the reader always knows what is exhibit and what is frame.
   ========================================================================== */

:root {
  /* Vida's brand, used only inside artifacts and the live demo */
  --vida-red: #F52B28;
  --vida-purple: #A21CAF;
  --vida-grad: linear-gradient(135deg, #F52B28, #C81E7A);
  --vida-night: #140E14;
  --vida-cream: #FFFCFA;
  --vida-line: #E7E2DC;
  --vida-ink: #1C1917;
  --vida-body: #57534E;

  --ease-quart: cubic-bezier(0.165, 0.84, 0.44, 1);
  --dur-notify-enter: 130ms;
  --dur-notify-exit: 100ms;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ==========================================================================
   Case hero — the same pinned night sky as home, with Vida's warmth
   bleeding up from behind the cover shot.
   ========================================================================== */
.chero {
  position: sticky; top: 0;
  z-index: 1;
  overflow: clip;
  min-height: 100vh;
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 120px 32px 56px;
  background:
    radial-gradient(1100px 620px at 16% 22%, rgba(109,40,217,0.38), transparent 62%),
    radial-gradient(860px 540px at 82% 12%, rgba(14,165,233,0.12), transparent 60%),
    #0A0918;
}
/* the designed-on dot grid, one quiet layer */
.chero::before {
  content: '';
  position: absolute; inset: -40px;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(255,255,255,0.09) 1.1px, transparent 1.1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 88% 78% at 50% 40%, #000 55%, transparent 100%);
          mask-image: radial-gradient(ellipse 88% 78% at 50% 40%, #000 55%, transparent 100%);
  animation: gridIn 1100ms 350ms linear backwards;
}
/* Vida's gala light rising from behind the cover — their world entering his */
.chero__glow {
  position: absolute; left: 50%; bottom: -12%;
  width: min(1400px, 130vw); height: 60%;
  translate: -50% 0;
  pointer-events: none;
  background:
    radial-gradient(58% 68% at 50% 100%, rgba(245,43,40,0.20), transparent 68%),
    radial-gradient(42% 55% at 44% 100%, rgba(200,30,122,0.22), transparent 70%);
  filter: blur(6px);
  animation: gridIn 1400ms 500ms linear backwards;
}

.chero__inner {
  position: relative;
  width: 100%; max-width: 1120px;
  display: grid;
  grid-template-columns: minmax(0, 11fr) minmax(320px, 10fr);
  gap: clamp(36px, 5vw, 72px);
  align-items: center;
}
.chero__copy {
  display: flex; flex-direction: column; gap: 18px;
}
.chero__client { display: flex; align-items: center; gap: 11px; }
.chero__mark {
  width: 30px; height: 30px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.28), 0 2px 10px rgba(2,6,23,0.5);
}
.chero__copy > * { animation: heroIn 700ms var(--ease-out-quint) backwards; }
.chero__copy > *:nth-child(1) { animation-delay: 80ms; }
.chero__copy > *:nth-child(2) { animation-delay: 150ms; }
.chero__copy > *:nth-child(3) { animation-delay: 230ms; }
.chero__copy > *:nth-child(4) { animation-delay: 310ms; }

.chero__eyebrow { color: #A78BFA; }
.chero__title {
  margin: 0;
  font-size: clamp(42px, 5.4vw, 68px);
  line-height: 0.98;
  font-weight: 600;
  letter-spacing: -0.026em;
  background: linear-gradient(155deg, #FFFFFF 30%, #D6C7FF 78%, #F3B8D9 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.chero__lede {
  margin: 0;
  max-width: 620px;
  font-size: 18px; line-height: 29px;
  color: rgba(226,222,244,0.82);
}
.chero__facts {
  list-style: none;
  display: flex; flex-wrap: wrap; gap: 10px;
  margin: 6px 0 0; padding: 0;
}
.chero__facts li {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  font-size: 13.5px; font-weight: 500; letter-spacing: -0.1px;
  color: rgba(238,235,250,0.92);
  background: rgba(255,255,255,0.07);
  backdrop-filter: blur(10px) saturate(1.4);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.14);
}
.chero__facts li span {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(167,139,250,0.85);
}

/* the finished product, framed whole — never cropped */
.chero__cover {
  position: relative;
  margin: 0;
  border-radius: 18px;
  overflow: hidden;
  rotate: 1.4deg;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.14),
    0 22px 70px rgba(200,30,122,0.30),
    0 10px 44px rgba(2,6,23,0.55);
  transition: rotate 420ms var(--ease-out-quart), box-shadow 420ms var(--ease-out-quart);
  animation: artIn 900ms 420ms var(--ease-out-quint) backwards;
}
.chero__cover:hover {
  rotate: 0deg;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.2),
    0 26px 80px rgba(200,30,122,0.36),
    0 12px 48px rgba(2,6,23,0.6);
}
.chero__cover img {
  display: block; width: 100%; height: auto;
  view-transition-name: project-hero;
}

/* hero recedes into the sky as the sheet arrives — same physics as home */
@supports (animation-timeline: scroll()) {
  .chero__inner {
    animation: heroRecede linear;
    animation-timeline: scroll(root);
    animation-range: 2px 100svh;
  }
}

/* Arriving via the shared-element transition (vt-arrive set on pagereveal):
   the page already enters through the root cross-fade, and the cover IS the
   morph target — its artIn ran opacity-0 for its first 420ms, which blanked
   the flying image mid-transition. The copy stagger goes too; a double
   entrance reads as stutter. */
html.vt-arrive .chero__copy > *,
html.vt-arrive .chero__cover { animation: none; }

/* ==========================================================================
   Chapter rail — fixed left, appears once the sheet is up
   ========================================================================== */
/* Anchored to the CONTENT column, not the viewport edge: the column is
   centred, so a viewport-pinned rail slides under the text as the window
   narrows. This keeps a fixed gutter to the left of the column at every
   width, and the breakpoint below is the width where that gutter runs out. */
.rail {
  --rail-w: 128px;
  --rail-gap: 30px;
  position: fixed; top: 50%;
  left: calc(50% - (var(--max-w) / 2) - var(--rail-w) - var(--rail-gap));
  width: var(--rail-w);
  translate: 0 -50%;
  z-index: 90;
  display: flex; flex-direction: column; gap: 6px;
  opacity: 0; visibility: hidden;
  transition: opacity 300ms var(--ease-out-quart), visibility 0s linear 300ms;
}
.rail.is-on {
  opacity: 1; visibility: visible;
  transition: opacity 300ms var(--ease-out-quart);
}
.rail a {
  position: relative;
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 10px 6px 14px;
  border-radius: 10px;
  color: var(--slate-400);
  transition: color 180ms ease, background 180ms ease;
}
.rail a::before {
  content: '';
  position: absolute; left: 0; top: 50%;
  translate: 0 -50%;
  width: 3px; height: 16px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--p-a1), var(--p-a2));
  opacity: 0;
  scale: 1 0.4;
  transition: opacity 200ms ease, scale 260ms var(--ease-out-quart);
}
.rail__num {
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  color: inherit;
}
.rail__label {
  font-size: 13px; font-weight: 500; letter-spacing: -0.1px;
  white-space: nowrap;
}
.rail a:hover { color: var(--slate-700); background: rgba(2,6,23,0.045); }
.rail a.is-active { color: #6D28D9; }
.rail a.is-active::before { opacity: 1; scale: 1 1; }
/* 1040 column + 2 × (128 rail + 30 gutter + 16 breathing room) */
@media (max-width: 1388px) { .rail { display: none; } }

/* ==========================================================================
   Section scaffolding
   ========================================================================== */
.csec {
  position: relative; z-index: 1;
  padding: 104px 32px 24px;
  display: flex; flex-direction: column; align-items: center;
}
.csec:last-of-type { padding-bottom: 80px; }
.cwrap { width: 100%; max-width: var(--max-w); }
.cwrap + .cwrap { margin-top: 44px; }

.chap {
  display: inline-flex; align-items: baseline; gap: 10px;
  margin-bottom: 14px;
}
.chap__num {
  font-size: 13px; font-weight: 600; letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--p-a1), var(--p-a2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.chap__label {
  font-size: 13px; font-weight: 500; letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--slate-400);
}
.csec__h {
  margin: 0 0 16px;
  font-size: clamp(30px, 4vw, 42px); line-height: 1.12;
  font-weight: 600; letter-spacing: -0.024em;
  color: var(--slate-900);
  max-width: 760px;
}
.csec__lede {
  margin: 0;
  font-size: 19px; line-height: 30px;
  color: var(--slate-600);
  max-width: 660px;
}
.csec__body {
  margin: 18px 0 0;
  font-size: 16.5px; line-height: 27px;
  color: var(--slate-600);
  max-width: 660px;
}
.subh {
  margin: 0 0 16px;
  font-size: 14px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--slate-400);
}
* + .subh { margin-top: 48px; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(139,92,246,0.09);
  color: #6D28D9;
  white-space: nowrap;
}

/* ---------- Scroll reveals ----------
   `translate`, not `transform`: several revealed elements carry their own
   hover transforms, and a filled animation on `transform` would freeze them.
   The separate properties compose. */
.chap, .csec__h, .csec__lede, .csec__body:not(.dec .csec__body),
.docplate, .film, .handoff__notes, .ba, .ba__cap, .wireboard,
.dec, .finding, .stat, .phones .phone, .loose, .demo {
  animation: caseReveal linear both;
  animation-timeline: view();
  animation-range: entry 0% entry 38%;
}
@keyframes caseReveal {
  from { opacity: 0; translate: 0 24px; }
  to   { opacity: 1; translate: 0 0; }
}
.phones .phone:nth-child(2) { animation-range: entry 4% entry 42%; }
.phones .phone:nth-child(3) { animation-range: entry 8% entry 46%; }
.phones .phone:nth-child(4) { animation-range: entry 12% entry 50%; }
.statgrid .stat:nth-child(2), .findings .finding:nth-child(2) { animation-range: entry 4% entry 42%; }
@supports not (animation-timeline: view()) {
  .chap, .csec__h, .csec__lede, .csec__body,
  .docplate, .film, .handoff__notes, .ba, .ba__cap, .wireboard,
  .dec, .finding, .stat, .phones .phone, .loose, .demo {
    animation: none; opacity: 1; translate: none;
  }
}

/* ==========================================================================
   Document plate — real excerpts from the actual project docs
   ========================================================================== */
.docplate {
  margin: 28px 0 0;
  max-width: 660px;
  border-radius: 16px;
  overflow: hidden;
  background: #FFFFFF;
  border: 1px solid var(--slate-150);
  box-shadow: var(--shadow-card);
}
.docplate__bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; letter-spacing: 0;
  color: var(--slate-500);
  background: var(--slate-100);
  border-bottom: 1px solid var(--slate-150);
}
.docplate__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: linear-gradient(135deg, var(--p-a1), var(--p-a2));
  flex-shrink: 0;
}
.docplate__q { margin: 0; padding: 20px 24px; }
.docplate__q p {
  margin: 0;
  font-size: 16.5px; line-height: 27px;
  color: var(--slate-700);
}
.docplate__q p + p { margin-top: 10px; }
.docplate__q mark {
  background: linear-gradient(135deg, rgba(139,92,246,0.16), rgba(236,95,168,0.16));
  color: #6D28D9;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 5px;
}
.docplate--q { margin-top: 16px; }
.docplate--q .docplate__q p { font-size: 15.5px; line-height: 25px; }

/* ==========================================================================
   Filmstrip — tall page captures in a browser frame; hover pans, touch scrolls
   ========================================================================== */
.film {
  margin: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #FFFFFF;
  border: 1px solid var(--slate-150);
  box-shadow: 0px 2px 6px rgba(2,6,23,.04), 0px 18px 40px rgba(76,29,149,0.10);
}
.film__bar {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px;
  background: var(--slate-100);
  border-bottom: 1px solid var(--slate-150);
}
.film__dots { display: flex; gap: 5px; }
.film__dots i {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--slate-300);
}
.film__url {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--slate-500);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.film__hint { margin-left: auto; font-size: 12px; color: var(--slate-400); white-space: nowrap; }
@media (hover: hover) { .film__hint::after { content: 'hover to scan'; } }
@media (hover: none)  { .film__hint::after { content: 'scroll inside'; } }

.film__win {
  position: relative;
  height: var(--film-h, 520px);
  overflow: hidden;
}
.film__img {
  display: block; width: 100%; height: auto;
  transition: transform 1400ms var(--ease-out-quart);
}
@media (hover: hover) {
  .film__win:hover .film__img,
  .film:focus-within .film__img {
    transform: translateY(calc(-100% + var(--film-h, 520px)));
    transition: transform 9s cubic-bezier(0.3, 0, 0.7, 1);
  }
}
@media (hover: none) {
  .film__win { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .film__img { transition: none; }
}
.film__cap {
  padding: 12px 16px;
  font-size: 13.5px; line-height: 21px;
  color: var(--slate-500);
  border-top: 1px solid var(--slate-100);
}

/* ==========================================================================
   02 · handoff layout
   ========================================================================== */
.handoff {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(280px, 4fr);
  gap: 40px;
  align-items: start;
}
.handoff__notes { display: flex; flex-direction: column; }
.handoff__notes .subh { margin-bottom: 12px; }
.handoff__notes .subh + .notelist + .subh { margin-top: 32px; }
.notelist {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 9px;
}
.notelist li {
  position: relative;
  padding-left: 24px;
  font-size: 15.5px; line-height: 24px;
  color: var(--slate-600);
}
.notelist li::before {
  content: '';
  position: absolute; left: 2px; top: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
}
.notelist--in li::before {
  background: linear-gradient(135deg, var(--p-a1), var(--p-a2));
}
.notelist--bad li::before {
  background: transparent;
  border: 2px solid rgba(245,43,40,0.55);
  width: 6px; height: 6px;
  top: 7px; left: 1px;
}
.handoff__aside {
  margin: 28px 0 0;
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 15px; line-height: 24px;
  color: var(--slate-600);
  background: rgba(139,92,246,0.06);
  border: 1px solid rgba(139,92,246,0.14);
}

/* ==========================================================================
   02 · wireframe board — the structure pass, drawn on the working canvas
   ========================================================================== */
.wireboard {
  margin: 0 0 56px;
  padding: clamp(18px, 3vw, 34px);
  border-radius: 18px;
  background:
    radial-gradient(circle, rgba(100,116,139,0.16) 1px, transparent 1px) 0 0 / 22px 22px,
    #FBFCFE;
  border: 1px solid var(--slate-150);
  box-shadow: var(--shadow-card);
}
.wireboard svg {
  display: block; width: 100%; height: auto;
  font-family: var(--font-sans);
}
.wireboard figcaption {
  margin-top: 14px;
  font-size: 13.5px; line-height: 21px;
  color: var(--slate-500);
  max-width: 720px;
}

/* ==========================================================================
   03 · before/after slider — Sahil's cursor drags the seam
   ========================================================================== */
.ba {
  position: relative;
  width: 100%;
  aspect-ratio: 1400 / 772;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(2,6,23,.06), 0 24px 60px rgba(76,29,149,0.16);
  background: var(--vida-night);
  touch-action: pan-y;
}
.ba__img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.ba__top {
  position: absolute; inset: 0;
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}
.ba__seam {
  position: absolute; top: 0; bottom: 0;
  left: var(--pos);
  width: 2px;
  translate: -1px 0;
  background: rgba(255,255,255,0.92);
  box-shadow: 0 0 12px rgba(2,6,23,0.5);
  pointer-events: none;
}
.ba__handle {
  position: absolute; top: 50%;
  left: var(--pos);
  translate: -10px -4px;
  pointer-events: none;
  filter: drop-shadow(0 2px 6px rgba(2,6,23,0.45));
}
.ba__handle span {
  position: absolute; left: 15px; top: 17px;
  padding: 3px 9px 4px;
  border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 600; letter-spacing: 0;
  color: #FFFFFF;
  background: linear-gradient(135deg, var(--p-a1), var(--p-a2));
  white-space: nowrap;
}
.ba__tag {
  position: absolute; top: 14px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  color: #FFFFFF;
  background: rgba(10,9,24,0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
  pointer-events: none;
}
.ba__tag--l { left: 14px; }
.ba__tag--r { right: 14px; }
.ba__range {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  -webkit-appearance: none; appearance: none;
}
.ba__range:focus-visible ~ .ba__seam,
.ba:has(.ba__range:focus-visible) .ba__seam {
  background: #FFFFFF;
  box-shadow: 0 0 0 2px var(--p-a1), 0 0 12px rgba(2,6,23,0.5);
}
.ba__cap {
  margin: 16px auto 0;
  max-width: 720px;
  font-size: 14px; line-height: 23px;
  color: var(--slate-500);
  text-align: center;
}

/* ---------- 03 · phone lineup ---------- */
.phones {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  margin-top: 28px;
}
.phone {
  margin: 0;
  border-radius: 26px;
  padding: 7px;
  background: #100D1D;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.10),
    0 2px 6px rgba(2,6,23,0.10),
    0 16px 32px rgba(2,6,23,0.14);
  transition: transform 340ms var(--ease-out-quart), box-shadow 340ms var(--ease-out-quart);
}
.phone:hover {
  transform: translateY(-6px);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.10),
    0 4px 10px rgba(2,6,23,0.12),
    0 26px 48px rgba(76,29,149,0.22);
}
.phone img {
  display: block; width: 100%; height: auto;
  border-radius: 19px;
}

/* ==========================================================================
   04 · decisions
   ========================================================================== */
.dec {
  display: grid;
  grid-template-columns: minmax(280px, 5fr) minmax(0, 7fr);
  gap: 40px;
  align-items: start;
  padding-top: 56px;
}
.cwrap.dec { margin-top: 0; }
.dec--full { display: block; padding-top: 72px; }
.dec__text h3 {
  margin: 0 0 12px;
  font-size: 23px; line-height: 30px;
  font-weight: 600; letter-spacing: -0.02em;
  color: var(--slate-900);
}
.dec__text p {
  margin: 0;
  font-size: 16px; line-height: 26px;
  color: var(--slate-600);
  max-width: 640px;
}
.dec__text p + p { margin-top: 12px; }
.dec__art { min-width: 0; }
.dec__art--tickets { display: flex; flex-direction: column; gap: 18px; }

/* the section that got cut, stamped as evidence */
.cutshot {
  position: relative;
  margin: 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1.5px dashed rgba(245,43,40,0.55);
}
.cutshot img { display: block; width: 100%; height: auto; }
.cutshot::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,252,250,0.22);
  pointer-events: none;
}
.cutshot__tag {
  position: absolute; top: 12px; right: 12px;
  z-index: 1;
  padding: 5px 13px;
  border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #FFFFFF;
  background: var(--vida-grad);
  box-shadow: 0 4px 12px rgba(245,43,40,0.35);
  rotate: 2deg;
}

.iamap {
  margin: 0;
  padding: 20px 20px 14px;
  border-radius: 16px;
  background: #FFFFFF;
  border: 1px solid var(--slate-150);
  box-shadow: var(--shadow-card);
}
.iamap svg { display: block; width: 100%; height: auto; font-family: var(--font-sans); }
.iamap figcaption {
  margin-top: 10px;
  font-size: 13.5px; line-height: 21px;
  color: var(--slate-500);
}

/* ---------- Vida artifact plates ---------- */
.vplate {
  border-radius: 16px;
  padding: 22px;
  background: var(--vida-cream);
  border: 1px solid var(--vida-line);
  box-shadow: var(--shadow-card);
}
.vplate--dark {
  background:
    linear-gradient(180deg, rgba(20,14,20,0.92), rgba(20,14,20,0.86)),
    url("assets/vida-hero-plate.webp") center/cover no-repeat,
    var(--vida-night);
  border-color: rgba(255,255,255,0.08);
}
.vplate__tag {
  display: inline-block;
  margin-bottom: 14px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--slate-400);
}
.vplate--dark .vplate__tag { color: rgba(255,255,255,0.55); }

/* stats: 3 wraps, 2 fits */
.statdemo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
}
.statdemo__col {
  display: flex; flex-direction: column;
  max-width: 300px;
}
.statdemo__row {
  display: flex; flex-wrap: wrap; gap: 18px 28px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.22);
}
.vstat b {
  display: block;
  font-size: 25px; font-weight: 700; letter-spacing: -0.4px;
  color: #FFFFFF;
}
.vstat i {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-size: 11.5px;
  color: rgba(255,255,255,0.72);
  max-width: 120px;
}
.statdemo__verdict {
  margin-top: 16px;
  font-size: 12.5px; font-weight: 600;
  color: #6EE7B7;
}
.statdemo__verdict--bad { color: #FCA5A5; }

/* logo sizing */
.logodemo { display: flex; flex-direction: column; gap: 22px; }
.logodemo__strip {
  display: flex; align-items: center; gap: clamp(18px, 4vw, 40px);
  padding: 18px 20px;
  border-radius: 12px;
  background: #FFFFFF;
  border: 1px solid var(--vida-line);
  overflow: hidden;
}
/* the overflow is the point — the fade makes the clip read as deliberate */
.logodemo__strip--height {
  -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent 99%);
          mask-image: linear-gradient(90deg, #000 88%, transparent 99%);
}
.logodemo__strip--height img { height: 42px; width: auto; max-width: none; }
.logodemo__strip--cap img { max-width: 104px; max-height: 42px; width: auto; height: auto; }

/* demo intro note */
.demo__note {
  margin: 14px 0 0;
  font-size: 14px; line-height: 22px;
  color: var(--slate-500);
  max-width: 660px;
}

/* ==========================================================================
   05 · audit
   ========================================================================== */
.findings, .bugs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.finding {
  padding: 24px;
  border-radius: var(--radius-card);
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(233,238,244,0.9);
  box-shadow: var(--shadow-card);
}
.finding h4 {
  margin: 0 0 10px;
  font-size: 17px; line-height: 24px;
  font-weight: 600; letter-spacing: -0.01em;
  color: var(--slate-900);
}
.finding p {
  margin: 0;
  font-size: 14.5px; line-height: 23px;
  color: var(--slate-600);
}
.finding--swatch { grid-column: 1 / -1; }
.swatches { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.swatch { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.swatch__chip {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
}
.swatch__chip--credit-bad  { background: var(--vida-cream); color: #A8A29E; border: 1px solid var(--vida-line); }
.swatch__chip--credit-good { background: var(--vida-cream); color: #6E6961; border: 1px solid var(--vida-line); }
.swatch__chip--footer-bad  { background: var(--vida-ink); color: #78716C; }
.swatch__chip--footer-good { background: var(--vida-ink); color: #A8A29E; }
.swatch__ratio {
  font-size: 12.5px; font-weight: 600;
  color: var(--slate-500);
}
.swatch__ratio--bad { color: #DC2626; }
.swatch__arrow { color: var(--slate-300); }

.statgrid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.stat {
  display: flex; flex-direction: column; gap: 10px;
  padding: 24px;
  border-radius: var(--radius-card);
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(233,238,244,0.9);
  box-shadow: var(--shadow-card);
}
.stat__label {
  font-size: 13px; font-weight: 500; letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--slate-400);
}
.stat__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.stat__before {
  font-size: 28px; font-weight: 600; letter-spacing: -0.6px;
  color: var(--slate-400);
  text-decoration: line-through;
  text-decoration-color: var(--slate-300);
}
.stat__after {
  font-size: 28px; font-weight: 600; letter-spacing: -0.6px;
  background: linear-gradient(135deg, var(--p-a1), var(--p-a2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat p { margin: 0; font-size: 15px; line-height: 23px; color: var(--slate-600); }
.arrow { color: var(--slate-300); font-size: 20px; }

/* ==========================================================================
   06 · loose ends
   ========================================================================== */
.loose .csec__body { margin-top: 0; }
.loose .csec__body + .docplate--q { margin-top: 20px; }
.loose .docplate--q + .csec__body { margin-top: 24px; }

/* ==========================================================================
   Live demo — the Vida hero notify interaction, rebuilt rather than filmed
   ========================================================================== */
.demo {
  width: 100%; max-width: var(--max-w);
  margin-top: 26px;
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid rgba(233,238,244,0.9);
  box-shadow: 0px 2px 6px rgba(2,6,23,.04), 0px 20px 44px rgba(76,29,149,0.12);
  background: #FFFFFF;
}
.demo__bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--slate-100);
  background: rgba(255,255,255,0.9);
}
.demo__widths {
  display: flex; gap: 4px;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--slate-100);
}
.demo__wbtn {
  border: none;
  border-radius: var(--radius-pill);
  padding: 7px 16px;
  font-family: inherit;
  font-size: 13px; font-weight: 500; letter-spacing: -0.1px;
  color: var(--slate-500);
  background: transparent;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.demo__wbtn:hover { color: var(--slate-700); }
.demo__wbtn.is-active {
  color: var(--slate-900);
  background: #FFFFFF;
  box-shadow: 0px 1px 2px rgba(2,6,23,.06), 0px 2px 6px rgba(2,6,23,.06);
}
.demo__hint { font-size: 13px; color: var(--slate-400); }

.demo__stage {
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(139,92,246,0.05), rgba(236,95,168,0.05)),
    var(--slate-100);
  display: flex; justify-content: center;
}
.demo__frame {
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0px 8px 24px rgba(2,6,23,.14);
  transition: width 420ms var(--ease-in-out-quad);
}
#demo-stage.is-phone .demo__frame { width: 375px; }

.vh {
  position: relative;
  min-height: 280px;
  padding: 40px 28px;
  display: flex; flex-direction: column; justify-content: center; gap: 14px;
  background:
    linear-gradient(90deg, rgba(16,10,16,0.93) 0%, rgba(16,10,16,0.74) 55%, rgba(16,10,16,0.52) 100%),
    url("assets/vida-hero-plate.webp") center/cover no-repeat,
    var(--vida-night);
}
.vh__kicker {
  margin: 0;
  font-size: 13px; font-weight: 600; letter-spacing: -0.1px;
  color: rgba(255,255,255,0.85);
}
.vh__title {
  margin: 0;
  font-size: clamp(26px, 3.4vw, 38px); line-height: 1.14;
  font-weight: 600; letter-spacing: -0.8px;
  color: #FFFFFF;
  max-width: 460px;
}

.vh__actions { display: flex; align-items: center; gap: 12px; margin-top: 6px; }

.vh__donate {
  border: none;
  border-radius: var(--radius-pill);
  height: 50px;
  padding: 0 26px;
  font-family: inherit;
  font-size: 15px; font-weight: 500; letter-spacing: -0.2px;
  color: #FFFFFF;
  background: var(--vida-grad);
  box-shadow: 0px 4px 14px rgba(245,43,40,0.32);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: filter 200ms ease, transform var(--dur-notify-enter) var(--ease-quart);
}
.vh__donate:hover { filter: brightness(1.1); }
.vh__donate:active { transform: scale(0.97); }

/* display:contents keeps the three states in the same flex slot */
.vh__notify { display: contents; }

/* Setting display unconditionally would beat the `hidden` attribute's UA
   display:none — that exact conflict was a real bug on the Vida site. */
.vh__form[hidden], .vh__success[hidden] { display: none; }

.vh__glass, .vh__form, .vh__success { overflow: hidden; opacity: 1; }
.vh__glass { max-width: 220px; }

.vh__glass.is-out, .vh__form.is-out, .vh__success.is-out {
  transition: max-width var(--dur-notify-exit) var(--ease-quart),
              padding var(--dur-notify-exit) var(--ease-quart),
              opacity var(--dur-notify-exit) var(--ease-quart);
  max-width: 0; padding-left: 0; padding-right: 0; opacity: 0;
}
.vh__glass.is-in, .vh__form.is-in, .vh__success.is-in {
  max-width: 0; padding-left: 0; padding-right: 0; opacity: 0;
}
.vh__glass:not(.is-in):not(.is-out),
.vh__form:not(.is-in):not(.is-out),
.vh__success:not(.is-in):not(.is-out) {
  transition: max-width var(--dur-notify-enter) var(--ease-quart),
              padding var(--dur-notify-enter) var(--ease-quart),
              opacity var(--dur-notify-enter) var(--ease-quart);
}

.vh__glass {
  border: none;
  border-radius: var(--radius-pill);
  height: 50px;
  padding: 0 24px;
  font-family: inherit;
  font-size: 15px; font-weight: 500; letter-spacing: -0.2px;
  color: #FFFFFF;
  background: rgba(12,8,12,0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.32);
  cursor: pointer;
  white-space: nowrap;
}
.vh__glass:hover { background: rgba(12,8,12,0.62); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.45); }
.vh__glass:active { transform: scale(0.97); }

.vh__form {
  display: flex; align-items: center; gap: 8px;
  height: 50px;
  padding: 0 6px 0 20px;
  border-radius: var(--radius-pill);
  background: rgba(12,8,12,0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.32);
  max-width: 400px;
}
.vh__form:focus-within { box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.75); }

.vh__input {
  flex: 1; min-width: 120px;
  height: 100%;
  background: none; border: none; outline: none;
  color: #FFFFFF;
  font-family: inherit; font-size: 15px;
}
.vh__input::placeholder { color: rgba(255,255,255,0.78); }
.vh__input:focus-visible { outline: none; }

.vh__submit {
  border: none;
  border-radius: var(--radius-pill);
  height: 38px;
  padding: 0 18px;
  font-family: inherit; font-size: 14px; font-weight: 500;
  color: #FFFFFF;
  background: var(--vida-grad);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.vh__submit:active { transform: scale(0.97); }

.vh__close {
  width: 34px; height: 34px; flex-shrink: 0;
  border: none; background: none;
  color: rgba(255,255,255,0.7);
  font-size: 20px; line-height: 1;
  cursor: pointer;
  border-radius: var(--radius-pill);
  transition: background 200ms ease, color 200ms ease;
}
.vh__close:hover { background: rgba(255,255,255,0.14); color: #FFFFFF; }

.vh__success {
  margin: 0;
  display: flex; align-items: center;
  height: 50px;
  padding: 0 22px;
  max-width: 400px;
  border-radius: var(--radius-pill);
  background: rgba(12,8,12,0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.32);
  color: #FFFFFF;
  font-size: 14px; font-weight: 500;
  white-space: nowrap;
}

/* Not the input: its outline would be clipped into arcs by the form's
   overflow:hidden — the exact bug this case study calls out. The form's
   focus-within ring is the input's focus affordance. */
.vh :focus-visible:not(.vh__input) { outline: 2px solid rgba(255,255,255,0.9); outline-offset: 2px; }

#demo-stage.is-phone .vh { padding: 32px 20px; }
#demo-stage.is-phone .vh__actions { gap: 10px; }
#demo-stage.is-phone .vh__donate {
  max-width: 220px;
  overflow: hidden;
  transition: max-width var(--dur-notify-enter) var(--ease-quart),
              padding var(--dur-notify-enter) var(--ease-quart),
              opacity var(--dur-notify-enter) var(--ease-quart);
}
#demo-stage.is-phone .vh__actions.is-open .vh__donate {
  max-width: 0; padding-left: 0; padding-right: 0; opacity: 0;
  transition-duration: var(--dur-notify-exit);
}
#demo-stage.is-phone .vh__form { flex: 1; }
#demo-stage.is-phone .vh__input { min-width: 0; }
#demo-stage.is-phone .vh__success { white-space: normal; height: auto; padding: 12px 18px; line-height: 19px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1000px) {
  .chero__inner { grid-template-columns: 1fr; gap: 30px; }
  .chero__cover { rotate: 0.8deg; max-width: 640px; }
  .handoff { grid-template-columns: 1fr; }
  .handoff .film { order: 1; }
  .handoff__notes { order: 0; }
  .dec { grid-template-columns: 1fr; gap: 22px; }
  .phones { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .chero { padding: 104px 24px 44px; }
  .chero__lede { font-size: 16px; line-height: 26px; }
  .chero__facts li { padding: 8px 13px; font-size: 12.5px; }
  .chero__copy { gap: 14px; }

  .csec { padding: 76px 24px 20px; }
  .csec__lede { font-size: 17px; line-height: 28px; }

  .findings, .bugs, .statgrid { grid-template-columns: 1fr; }
  .statdemo { grid-template-columns: 1fr; }
  .film { --film-h: 420px; }

  .demo__stage { padding: 14px; }
  #demo-stage.is-phone .demo__frame { width: 100%; max-width: 375px; }
  .vh { min-height: 240px; }
}

@media (max-width: 560px) {
  .phones { grid-template-columns: repeat(2, 1fr); gap: 16px 12px; }
  .vh__donate, .vh__glass { padding: 0 18px; font-size: 14px; }
  .logodemo__strip { gap: 16px; padding: 14px; }
  .logodemo__strip--height img { height: 30px; }
  .logodemo__strip--cap img { max-width: 76px; max-height: 30px; }
  .ba__handle span { display: none; }
  .diffline { flex-direction: column; gap: 2px; }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .chero__copy > *, .chero__cover, .chero::before, .chero__glow {
    animation: none;
  }
  .chap, .csec__h, .csec__lede, .csec__body,
  .docplate, .film, .handoff__notes, .ba, .ba__cap, .wireboard,
  .dec, .finding, .stat, .phones .phone, .loose, .demo {
    animation: none; opacity: 1; translate: none;
  }
  .film__img { transition: none !important; transform: none !important; }
  .film__win { overflow-y: auto; }
  .phone, .phone:hover { transform: none; transition: none; }
  .chero__cover, .chero__cover:hover { rotate: 0deg; transition: none; }
  .demo__frame,
  .vh__glass, .vh__form, .vh__success, .vh__donate { transition: none !important; }
  @supports (animation-timeline: scroll()) {
    .chero__inner { animation: none; }
  }
}
