/* Stitch2 Article System — Technical Editorial / Monolith Archive */
:root {
  color-scheme: dark;
  --surface: #0e0e0e;
  --surface-lowest: #000000;
  --surface-low: #131313;
  --surface-container: #191a1a;
  --surface-high: #1f2020;
  --surface-highest: #252626;
  --text: #e7e5e4;
  --text-dim: #acabaa;
  --text-soft: #9f9d9d;
  --primary: #adc6ff;
  --primary-ink: #003d88;
  --tertiary: #ffa85d;
  --outline: #484848;
  --outline-soft: rgba(118,117,117,.22);
  --font-headline: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
}

* { box-sizing: border-box; border-radius: 0 !important; box-shadow: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.78;
  letter-spacing: .01em;
}
img { max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--text); }
::selection { background: var(--primary); color: var(--primary-ink); }

.site-shell {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  background: rgba(14,14,14,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--outline-soft);
}
.topbar-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-family: var(--font-headline);
  font-size: 13px;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.brand-mark {
  width: 14px;
  height: 14px;
  background: var(--primary);
}
.global-nav {
  display: flex;
  gap: 22px;
  align-items: center;
  flex-wrap: wrap;
}
.global-nav a {
  color: var(--text-soft);
  font-family: var(--font-headline);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .16em;
}
.global-nav a[aria-current="page"] { color: var(--text); }

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 48px;
  padding: 40px 0 80px;
}
.article-main {
  min-width: 0;
}
.article-rail {
  min-width: 0;
}
.rail-sticky {
  position: sticky;
  top: 96px;
}

.kicker {
  margin: 0 0 14px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .22em;
  color: var(--text-soft);
}
.hero {
  padding: 16px 0 28px;
  border-bottom: 1px solid var(--outline-soft);
  margin-bottom: 28px;
}
.hero h1 {
  margin: 0 0 16px;
  font-family: var(--font-headline);
  font-size: clamp(40px, 6vw, 76px);
  line-height: .96;
  letter-spacing: -.045em;
  max-width: 11ch;
}
.hero-lede {
  max-width: 72ch;
  color: var(--text-dim);
  font-size: 18px;
}
.hero-meta {
  margin-top: 24px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 12px;
}

.answer-box,
.note-box,
.cta-box,
.rail-card,
.surface-card {
  background: var(--surface-low);
  padding: 24px;
}
.answer-box {
  margin: 0 0 28px;
}
.answer-box strong { color: var(--text); }
.answer-box p { margin: 0 0 12px; }
.answer-box p:last-child { margin-bottom: 0; }
.button-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .18em;
  font-family: var(--font-headline);
}
.btn-primary {
  background: var(--primary);
  color: var(--primary-ink);
}
.btn-secondary {
  background: var(--surface-high);
  color: var(--text);
}

.article-body {
  max-width: 76ch;
}
.article-body h2 {
  margin: 42px 0 14px;
  font-family: var(--font-headline);
  font-size: 31px;
  line-height: 1.04;
  letter-spacing: -.03em;
}
.article-body h3 {
  margin: 26px 0 10px;
  font-family: var(--font-headline);
  font-size: 20px;
  line-height: 1.14;
}
.article-body p,
.article-body li {
  color: var(--text-dim);
  font-size: 16px;
}
.article-body ul,
.article-body ol {
  padding-left: 18px;
  margin: 0 0 18px;
}
.article-body li + li { margin-top: 8px; }
.article-body code {
  font-family: var(--font-mono);
  background: var(--surface-lowest);
  color: var(--text);
  padding: 2px 6px;
}
.article-body pre {
  margin: 18px 0 22px;
  padding: 18px 20px;
  background: var(--surface-lowest);
  overflow: auto;
}
.article-body pre code {
  padding: 0;
  background: transparent;
}
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0 22px;
}
.article-body th,
.article-body td {
  padding: 10px 0;
  text-align: left;
  border-bottom: 1px solid var(--outline-soft);
}
.article-body th { color: var(--text); }
.article-body td { color: var(--text-dim); }

.note-box {
  margin: 26px 0;
  background: var(--surface-container);
}
.note-label {
  margin: 0 0 10px;
  color: var(--tertiary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .22em;
  font-family: var(--font-headline);
}

.rail-card + .rail-card { margin-top: 18px; }
.rail-title {
  margin: 0 0 14px;
  font-family: var(--font-headline);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--text-soft);
}
.toc,
.rail-list { list-style: none; padding: 0; margin: 0; }
.toc li + li,
.rail-list li + li { margin-top: 10px; }
.toc a,
.rail-list a { color: var(--text-dim); }
.toc a:hover,
.rail-list a:hover { color: var(--text); }

.cta-box {
  margin-top: 36px;
  background: var(--surface-high);
}
.cta-box h2 { margin-top: 0; }

.site-footer {
  border-top: 1px solid var(--outline-soft);
  padding: 28px 0 48px;
  color: var(--text-soft);
  font-size: 13px;
}
.site-footer a { color: var(--text-dim); }

@media (max-width: 1040px) {
  .article-layout { grid-template-columns: 1fr; gap: 28px; }
  .rail-sticky { position: static; }
}
@media (max-width: 720px) {
  .site-shell { width: min(100% - 28px, 1440px); }
  .topbar-inner { align-items: flex-start; padding: 12px 0; }
  .global-nav { gap: 12px 16px; }
  .hero h1 { max-width: none; }
  .answer-box,.note-box,.cta-box,.rail-card,.surface-card { padding: 18px; }
  .button-row a { width: 100%; }
}
