/* Case-study detail pages — complements ../styles.css (tokens, fonts, nav, foot, well).
   Monochrome reading layout. */

.case-top {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding-bottom: 0.9rem; margin-bottom: clamp(1.5rem, 4vw, 2.75rem);
  border-bottom: 1px solid var(--line);
  font-family: "JetBrains Mono", monospace; font-size: 0.74rem; letter-spacing: 0.06em;
}
.case-top a { color: var(--muted); transition: color 0.2s; }
.case-top a:hover { color: var(--ink); }
.case-top .src { color: var(--faint); }

/* hero */
.case-eyebrow { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.2rem; }
.case-eyebrow .pill { font-family: "JetBrains Mono", monospace; font-size: 0.66rem; letter-spacing: 0.14em; color: var(--muted); border: 1px solid var(--line); padding: 4px 9px; }
.case-eyebrow .pill.solid { background: var(--ink); color: var(--well); border-color: var(--ink); font-weight: 700; }

.case-title {
  font-family: "Archivo", sans-serif; font-weight: 900; text-transform: uppercase;
  font-size: clamp(2rem, 6vw, 4.6rem); line-height: 0.95; letter-spacing: -0.025em;
  margin: 0 0 1rem; max-width: 18ch;
}
.case-dek { font-size: clamp(1.02rem, 1.8vw, 1.3rem); line-height: 1.55; color: var(--ink-2); max-width: 60ch; margin: 0 0 clamp(1.5rem, 3vw, 2.25rem); }

.case-meta { display: grid; grid-template-columns: repeat(4, auto); gap: 0; border: 1px solid var(--line); width: fit-content; max-width: 100%; margin-bottom: clamp(1.5rem, 4vw, 2.5rem); }
.case-meta > div { padding: 0.65rem 1rem; border-right: 1px solid var(--line-2); }
.case-meta > div:last-child { border-right: none; }
.case-meta dt { font-family: "JetBrains Mono", monospace; font-size: 0.6rem; letter-spacing: 0.16em; color: var(--faint); margin: 0; }
.case-meta dd { margin: 3px 0 0; font-size: 0.85rem; font-weight: 700; letter-spacing: 0.01em; }
@media (max-width: 720px) { .case-meta { grid-template-columns: 1fr 1fr; } .case-meta > div:nth-child(2) { border-right: none; } }

/* big metric strip — reuses .metrics/.metric/.big/.cap from styles.css; extra modifier for >4 */
.metrics.metrics-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 900px) { .metrics.metrics-5 { grid-template-columns: 1fr 1fr; } }

/* prose reading column — text stays at a readable measure, figures span full width */
.prose { max-width: 100%; margin: clamp(1.5rem, 4vw, 2.75rem) 0 0; }
.prose > section > p, .prose > section > ul, .prose > section > h2,
.prose > section > h3, .prose > section > h4, .prose > section > blockquote { max-width: 72ch; }
.prose > section { padding: clamp(1.4rem, 3.5vw, 2.4rem) 0; border-top: 1px solid var(--line); }
.prose > section:first-child { border-top: none; padding-top: 0; }
.prose h2 {
  font-family: "Archivo", sans-serif; font-weight: 800; text-transform: uppercase;
  font-size: clamp(1.3rem, 3vw, 2rem); letter-spacing: -0.01em; line-height: 1.05;
  margin: 0 0 1rem; position: relative; padding-left: 1.6rem;
}
.prose h2::before { content: "§"; position: absolute; left: 0; top: 0.05em; color: var(--faint); font-family: "JetBrains Mono", monospace; font-size: 0.8em; }
.prose h3 { font-family: "Archivo", sans-serif; font-weight: 700; font-size: clamp(1.05rem, 2.2vw, 1.35rem); letter-spacing: -0.005em; margin: 1.6rem 0 0.6rem; }
.prose h4 { font-family: "JetBrains Mono", monospace; font-weight: 700; font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); margin: 1.4rem 0 0.5rem; }
.prose p { font-size: 0.98rem; line-height: 1.72; color: var(--ink-2); margin: 0 0 1rem; }
.prose ul { list-style: none; padding: 0; margin: 0 0 1.1rem; }
.prose li { position: relative; padding-left: 1.5rem; margin-bottom: 0.6rem; font-size: 0.95rem; line-height: 1.65; color: var(--ink-2); }
.prose li::before { content: "—"; position: absolute; left: 0; color: var(--faint); }
.prose li b, .prose li strong, .prose p strong { color: var(--ink); }
.prose blockquote {
  margin: 1.4rem 0; padding: 0.4rem 0 0.4rem 1.3rem; border-left: 3px solid var(--ink);
  font-family: "Archivo", sans-serif; font-weight: 600; font-style: normal;
  font-size: clamp(1.1rem, 2.4vw, 1.55rem); line-height: 1.3; letter-spacing: -0.01em; color: var(--ink);
}
.prose blockquote cite { display: block; margin-top: 0.6rem; font-family: "JetBrains Mono", monospace; font-size: 0.72rem; font-style: normal; color: var(--faint); letter-spacing: 0.04em; }

/* placeholder for original visuals */
.fig-note {
  display: flex; align-items: center; gap: 0.6rem; margin: 0.4rem 0 1.3rem;
  border: 1px dashed var(--line); background: var(--canvas);
  padding: 0.7rem 0.9rem; font-family: "JetBrains Mono", monospace; font-size: 0.68rem;
  letter-spacing: 0.08em; color: var(--faint);
}
.fig-note::before { content: "▦"; color: var(--faint); }

/* ---------- FIGURES (full-color visuals in a monochrome frame) ---------- */
.fig { margin: 1.7rem 0; }
.fig-frame {
  position: relative; border: 1px solid var(--line); background: var(--canvas);
  overflow: hidden; cursor: zoom-in; line-height: 0;
}
.fig-frame img { display: block; width: 100%; height: auto; }
.fig-tag {
  position: absolute; top: 0; left: 0; z-index: 2; line-height: 1;
  font-family: "JetBrains Mono", monospace; font-size: 0.6rem; letter-spacing: 0.12em;
  background: var(--ink); color: var(--well); padding: 3px 8px;
}
.fig-enlarge {
  position: absolute; top: 0; right: 0; z-index: 2; line-height: 1;
  font-family: "JetBrains Mono", monospace; font-size: 0.6rem; letter-spacing: 0.1em;
  background: var(--well); color: var(--ink);
  border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 3px 8px; opacity: 0; transform: translateY(-3px); transition: opacity .2s, transform .2s;
}
.fig-frame:hover .fig-enlarge, .fig-frame:focus-visible .fig-enlarge { opacity: 1; transform: none; }
.fig figcaption {
  margin-top: 0.55rem; font-family: "JetBrains Mono", monospace; font-size: 0.7rem;
  line-height: 1.5; letter-spacing: 0.02em; color: var(--muted);
}
.fig figcaption b { color: var(--ink); font-weight: 700; }
.fig figcaption .fc-n { color: var(--faint); }

/* portrait / mobile-screen figures: don't let tall shots dominate */
.fig.portrait { max-width: 360px; }
.fig-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.7rem; align-items: start; margin: 1.7rem 0; }
.fig-row .fig.portrait { max-width: none; }
.fig-row .fig { margin: 0; }

/* animated prototype: poster + play-on-click <video> (fast, reduced-motion friendly) */
.fig-anim .fig-frame { cursor: pointer; }
.fig-anim video { display: block; width: 100%; height: auto; }
.fig-play {
  position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--ink) 26%, transparent); transition: opacity .2s; line-height: 1;
}
.fig-play span {
  font-family: "JetBrains Mono", monospace; font-weight: 700; font-size: 0.74rem; letter-spacing: 0.1em;
  background: var(--well); color: var(--ink); border: 1px solid var(--ink); padding: 8px 15px;
}
.fig-anim.playing .fig-play { opacity: 0; pointer-events: none; }

/* ---------- GALLERY (compact grid → lightbox) ---------- */
.gallery-wrap { margin: 1.8rem 0; }
.gallery-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  font-family: "JetBrains Mono", monospace; font-size: 0.7rem; letter-spacing: 0.08em;
  color: var(--faint); margin-bottom: 0.6rem; padding-bottom: 0.45rem; border-bottom: 1px solid var(--line-2);
}
.gallery-head b { color: var(--ink-2); font-weight: 700; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.gallery button { all: unset; cursor: zoom-in; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--canvas); position: relative; }
.gallery button:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .2s, transform .3s; }
.gallery button:hover img { opacity: 0.82; transform: scale(1.04); }
.gallery .g-n { position: absolute; top: 0; left: 0; z-index: 2; font-family: "JetBrains Mono", monospace; font-size: 0.55rem; letter-spacing: 0.06em; background: var(--ink); color: var(--well); padding: 2px 5px; }

/* ---------- LIGHTBOX (injected once by script.js) ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; background: color-mix(in srgb, #000 86%, transparent); padding: clamp(1rem, 4vw, 3rem); }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 84vh; object-fit: contain; border: 1px solid var(--ink-2); background: var(--well); }
.lb-cap { position: absolute; left: 0; right: 0; bottom: 1rem; text-align: center; padding: 0 1rem; font-family: "JetBrains Mono", monospace; font-size: 0.72rem; letter-spacing: 0.04em; color: #e7e7e7; }
.lb-btn { position: absolute; font-family: "JetBrains Mono", monospace; background: var(--well); color: var(--ink); border: 1px solid var(--ink); cursor: pointer; }
.lb-close { top: 1rem; right: 1rem; padding: 6px 12px; font-size: 0.78rem; letter-spacing: 0.06em; }
.lb-nav { top: 50%; transform: translateY(-50%); width: 44px; height: 44px; font-size: 1.1rem; }
.lb-prev { left: 1rem; } .lb-next { right: 1rem; }
.lb-btn:hover { background: var(--ink); color: var(--well); }
@media (max-width: 600px) { .lb-nav { width: 38px; height: 38px; } }

@media (prefers-reduced-motion: reduce) {
  .gallery img, .fig-enlarge { transition: none; }
}

/* footer next/all nav */
.case-next { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-top: clamp(2rem, 5vw, 3.5rem); padding-top: 1.2rem; border-top: 2px solid var(--ink); }
.case-next a { display: inline-flex; flex-direction: column; gap: 2px; text-decoration: none; }
.case-next .nm { font-size: 0.66rem; }
.case-next .nx-t { font-family: "Archivo", sans-serif; font-weight: 800; font-size: 1.05rem; color: var(--ink); }
.case-next a:hover .nx-t { text-decoration: underline; text-underline-offset: 3px; }
