/* ============================================================
   article.css — case-study / long-read pages. Layered on top of
   style.css + enhance.css. Theme-aware via the shared variables.
   ============================================================ */

.article-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(96px, 12vh, 140px) var(--gutter) clamp(60px, 8vh, 100px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}
@media (max-width: 900px) {
  .article-shell { grid-template-columns: 1fr; }
  .article-toc { display: none; }
}

/* ---- breadcrumb ---- */
.breadcrumb {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--mist-400);
  margin-bottom: 22px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--teal-300); }
.breadcrumb a:hover { text-decoration: underline; }

/* ---- writing index ---- */
.section.writing { padding-top: clamp(120px, 14vh, 170px); }
.section.writing .breadcrumb { margin-bottom: 28px; }
.rss-link { color: var(--teal-300); text-decoration: underline; text-underline-offset: 2px; }

/* ---- header ---- */
.article-head { margin-bottom: 40px; }
.article-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal-300);
  margin-bottom: 16px;
}
.article-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--mist-100);
  margin-bottom: 18px;
  max-width: 18ch;
}
.article-dek {
  font-size: clamp(17px, 2.2vw, 21px);
  line-height: 1.5;
  color: var(--mist-200);
  max-width: 60ch;
  margin-bottom: 22px;
}
.article-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--mist-400);
}
.article-meta .dot { color: var(--mist-500); }

/* ---- prose ---- */
.prose { max-width: 68ch; }
.prose > * + * { margin-top: 1.2em; }
.prose h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: -0.01em;
  color: var(--mist-100);
  margin-top: 2em;
  scroll-margin-top: 90px;
}
.prose h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  color: var(--mist-100);
  margin-top: 1.6em;
}
.prose p, .prose li { color: var(--mist-200); font-size: 16.5px; line-height: 1.7; }
.prose ul, .prose ol { padding-left: 1.2em; display: grid; gap: 8px; }
.prose ul li { list-style: none; position: relative; padding-left: 18px; }
.prose ul li::before { content: "→"; position: absolute; left: 0; color: var(--teal-400); font-family: var(--font-mono); }
.prose ol { list-style: decimal; }
.prose a { color: var(--teal-300); text-decoration: underline; text-underline-offset: 2px; }
.prose strong { color: var(--mist-100); font-weight: 600; }
.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: rgba(var(--ink-800-rgb), 0.7);
  border: 1px solid rgba(var(--mist-400-rgb), 0.18);
  border-radius: 5px;
  padding: 1px 6px;
}
.prose blockquote {
  border-left: 2px solid var(--teal-400);
  padding: 4px 0 4px 18px;
  color: var(--mist-200);
  font-style: italic;
}
.prose pre {
  background: rgba(var(--ink-900-rgb), 0.8);
  border: 1px solid rgba(var(--mist-400-rgb), 0.16);
  border-radius: 12px;
  padding: 18px 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
}
.prose pre code { background: none; border: 0; padding: 0; }

/* a callout for the [FILL] author markers — visible but tasteful */
.fill {
  display: inline-block;
  background: rgba(var(--mist-400-rgb), 0.12);
  border: 1px dashed rgba(var(--teal-400-rgb, 93,214,229), 0.5);
  border-radius: 6px;
  padding: 0 6px;
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--teal-300);
}

/* key-metric strip */
.metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: rgba(var(--mist-400-rgb), 0.14);
  border: 1px solid rgba(var(--mist-400-rgb), 0.14);
  border-radius: 14px;
  overflow: hidden;
  margin: 1.6em 0;
}
.metric-row .metric { background: rgba(var(--ink-900-rgb), 0.6); padding: 18px 20px; }
.metric-row .metric .n { font-family: var(--font-display); font-weight: 700; font-size: 26px; color: var(--teal-300); }
.metric-row .metric .l { font-size: 12.5px; color: var(--mist-300); margin-top: 4px; line-height: 1.4; }

/* ---- TOC (sticky) ---- */
.article-toc { position: sticky; top: 90px; }
.article-toc .toc-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mist-400);
  margin-bottom: 12px;
}
.article-toc ul { display: grid; gap: 2px; }
.article-toc a {
  display: block;
  padding: 6px 12px;
  border-left: 2px solid transparent;
  color: var(--mist-400);
  font-size: 13.5px;
  line-height: 1.4;
  transition: color .18s, border-color .18s;
}
.article-toc a:hover { color: var(--mist-100); }
.article-toc a.active { color: var(--teal-300); border-left-color: var(--teal-400); }

/* ---- prev / next ---- */
.article-nav {
  max-width: 68ch;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid rgba(var(--mist-400-rgb), 0.16);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.article-nav a {
  display: block;
  padding: 18px 20px;
  border: 1px solid rgba(var(--mist-400-rgb), 0.16);
  border-radius: 12px;
  transition: border-color .2s, transform .2s, background .2s;
}
.article-nav a:hover { border-color: rgba(var(--teal-400-rgb, 93,214,229), 0.4); transform: translateY(-2px); background: rgba(var(--ink-800-rgb), 0.4); }
.article-nav .dir { font-family: var(--font-mono); font-size: 12px; color: var(--mist-400); margin-bottom: 6px; }
.article-nav .t { color: var(--mist-100); font-size: 14.5px; font-weight: 500; line-height: 1.35; }
.article-nav .next { text-align: right; }
.article-nav .next:only-child { grid-column: 2; }
@media (max-width: 560px) { .article-nav { grid-template-columns: 1fr; } .article-nav .next { text-align: left; } }

@media (prefers-reduced-motion: reduce) {
  .article-nav a { transition: none; }
  .article-nav a:hover { transform: none; }
}

/* ---- architecture figure (diagram embedded in a case study) ---- */
.article-figure {
  margin: 1.8em 0;
  max-width: none;          /* let the diagram use the full prose width */
}
.article-figure .diagram-wrap { margin: 0; }
.article-figure figcaption {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--mist-400);
  text-align: center;
}
/* the prose column is ~68ch; allow the figure to breathe a little wider on desktop */
@media (min-width: 900px) {
  .article-figure { width: min(100%, 760px); }
}
