/* Case study layout — shared by /work/<slug>/ pages. Loaded after landing.css
   and effects.css. Each page sets --case-accent on <body> as a decorative
   brand cue (markers, rules, stat glyphs); text never relies on it. */

.case { --case-accent: var(--accent); }

/* ---------- Hero ---------- */
.case-hero { position: relative; isolation: isolate; padding: var(--space-hero-bottom) 0 0; }
.case-hero::before { content: ""; position: absolute; inset: 0 0 30% 0; z-index: -1; background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px), radial-gradient(var(--grid-dot) 1px, transparent 1.4px); background-size: 72px 72px, 72px 72px, 18px 18px; mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, #000 25%, transparent 75%); }
.case-crumb { display: flex; align-items: center; gap: 12px; }
.case-crumb a { color: var(--muted); transition: color var(--duration-quick); }
.case-crumb a:hover { color: var(--text); }
.case-crumb .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--case-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--case-accent) 22%, transparent); }
.case-hero h1 { margin-top: 20px; max-width: 20ch; font-size: var(--text-hero); font-weight: 600; letter-spacing: -0.04em; }
.case-dek { margin-top: 20px; max-width: 40rem; font-size: var(--text-lead); color: var(--muted); }
.case-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.case-meta { display: grid; grid-template-columns: repeat(4, 1fr); margin: var(--space-block) 0 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.case-meta > div { padding: 20px; border-left: 1px solid var(--line); }
.case-meta > div:first-child { border-left: 0; padding-left: 0; }
.case-meta dt { margin-bottom: 8px; }
.case-meta dd { margin: 0; font-size: var(--fs-16); line-height: 1.5; }
.case-meta a { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; transition: text-decoration-color var(--duration-quick); }
.case-meta a:hover { text-decoration-color: currentColor; }

/* ---------- Screenshots ---------- */
.shot { margin: 0; padding: 8px; border-radius: var(--radius-l); background: var(--card-bg); border: 1px solid var(--card-border); box-shadow: var(--shadow-2), var(--highlight); }
.shot a { display: block; border-radius: 13px; overflow: hidden; background: var(--stage-bg); box-shadow: var(--stage-inset); }
.shot img { display: block; width: 100%; height: auto; transition: transform var(--duration-slow) var(--ease-smooth-out); }
.shot a:hover img { transform: scale(1.012); }
.shot figcaption { padding: 12px 8px 4px; font-size: var(--fs-12); color: var(--muted); }
.shot--hero { margin-top: var(--space-block); box-shadow: var(--shadow-3), var(--highlight); }
.shot--narrow { max-width: 420px; }

.shot-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.shot-pair .label { display: block; padding: 12px 8px 4px; }
/* Paired shots share one ratio so the two cards line up */
.shot-pair img { aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; }

/* ---------- Body: sticky TOC + article ---------- */
.case-body { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--space-split); padding-top: var(--space-section); }
/* No "On this page" menu: the article takes the full row, at reading width */
.case-body--solo { grid-template-columns: minmax(0, 1fr); }
.case-body--solo article { max-width: 46rem; }
.case-toc { position: sticky; top: 92px; align-self: start; }
.case-toc ol { margin-top: 16px; border-left: 1px solid var(--line); }
.case-toc a { display: block; position: relative; padding: 8px 0 8px 16px; margin-left: -1px; border-left: 1px solid transparent; font-size: var(--fs-12); color: var(--muted); transition: color var(--duration-quick), border-color var(--duration-quick); }
.case-toc a:hover { color: var(--text); }
.case-toc a[aria-current="true"] { color: var(--text); border-left-color: var(--case-accent); }

.chapter { scroll-margin-top: 84px; }
.chapter + .chapter { margin-top: var(--space-chapter); }
.chapter-head { display: flex; align-items: center; gap: 12px; }
.chapter-head::before { content: ""; width: 20px; height: 2px; border-radius: 2px; background: var(--case-accent); }
.chapter h2 { margin-top: 12px; max-width: 24ch; font-size: var(--text-h2); font-weight: 600; }
.prose { max-width: 40rem; margin-top: 20px; }
.prose p + p { margin-top: 16px; }
.prose p { font-size: var(--fs-16); line-height: 1.7; }
.prose strong { font-weight: 600; }
.prose code { font-family: var(--font-mono); font-size: 0.75em; padding: 0 8px; border-radius: 5px; background: var(--chip-bg); }
.chapter .shot, .chapter .shot-pair, .chapter .split,
article > .shot, article > .shot-pair, article > .split { margin-top: 32px; }

.roles { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

/* Pull quote — the one line a skimmer should leave with */
.pull { margin: 32px 0 0; padding: 4px 0 4px 24px; max-width: 34rem; border-left: 2px solid var(--case-accent); font-size: var(--fs-24); font-weight: 500; line-height: 1.35; letter-spacing: -0.02em; }

/* Problem list — numbered grid of frictions */
.frictions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; /* hairline dividers, not spacing */ margin-top: 32px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.frictions li { padding: 20px 24px 24px; background: var(--card-bg); }
.frictions h3 { font-size: var(--fs-16); font-weight: 600; letter-spacing: -0.01em; }
.frictions p { margin-top: 8px; font-size: var(--fs-16); color: var(--muted); }
.frictions .label { display: block; margin-bottom: 12px; color: var(--case-accent); }

/* Text beside a tall screenshot */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr); gap: 32px; align-items: start; }
.split .prose { margin-top: 0; }

/* Facts list — terse spec-sheet rows */
.facts { margin-top: 28px; max-width: 40rem; border-top: 1px solid var(--line); }
.facts li { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-16); }
.facts li > span:last-child { color: var(--muted); }

/* ---------- Outcome band ---------- */
.case-stats { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 32px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.case-stats > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; padding: 28px 20px 24px; border-left: 1px solid var(--line); }
.case-stats > div:first-child { border-left: 0; padding-left: 0; }
.case-stats dt { margin-top: 12px; }
.case-stats dd { margin: 0; font-size: var(--text-h2); font-weight: 600; letter-spacing: -0.045em; line-height: 1; }
.case-stats dd span { color: var(--case-accent); }

/* ---------- Next case ---------- */
.case-next { display: block; margin-top: var(--space-section); }
.case-next .card-stage { min-height: 0; padding: var(--space-card); place-items: stretch; }
.case-next-inner { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.case-next h2 { margin-top: 12px; font-size: var(--text-h2); font-weight: 600; }
.case-next p { margin-top: 8px; color: var(--muted); max-width: 32rem; }
.case-next .arrow { font-size: var(--fs-28); color: var(--muted); transition: transform var(--duration-fast) var(--ease-smooth-out), color var(--duration-fast); }
.case-next:hover .arrow { transform: translateX(6px); color: var(--text); }

/* Code-mock stand-in where no screenshot exists */
.case-mock { display: grid; place-items: center; padding: var(--space-panel) 16px; }
.case-mock .mock-ide { width: min(520px, 100%); font-size: var(--fs-12); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .case-body { grid-template-columns: 1fr; }
  .case-toc { display: none; }
  .case-meta, .case-stats { grid-template-columns: 1fr 1fr; }
  .case-meta > div:nth-child(3), .case-stats > div:nth-child(3) { border-left: 0; padding-left: 0; }
  .case-meta > div:nth-child(n+3), .case-stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .shot-pair, .frictions { grid-template-columns: 1fr; }
  .facts li { grid-template-columns: 1fr; gap: 4px; }
  .case-meta > div, .case-stats > div { padding-left: 0; padding-right: 12px; }
  .case-next .arrow { display: none; }
}
