*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-base: #FAFAFA;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F4F4F5;
  --bg-muted: #E4E4E7;
  --text-primary: #18181B;
  --text-secondary: #52525B;
  --text-muted: #A1A1AA;
  --accent: #6366F1;
  --accent-soft: #EEF2FF;
  --accent-hover: #4F46E5;
  --border: #E4E4E7;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.07);
  --diagram-limit: var(--accent);
  --diagram-limit-soft: var(--accent-soft);
  --diagram-share: #16A34A;
  --diagram-share-soft: #F0FDF4;
  --diagram-warn: #F59E0B;
  --diagram-warn-soft: #FFFBEB;
  --diagram-danger: #DC2626;
  --diagram-danger-soft: #FEF2F2;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Geist', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

/* NAV */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(250,250,250,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-weight: 700;
  font-size: 17px;
  font-family: 'Geist Mono', monospace;
  letter-spacing: -0.02em;
  color: var(--text-muted);
  text-decoration: none;
}
.nav-logo span { color: var(--accent); }
.back-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.back-link:hover { color: var(--text-primary); background: var(--bg-subtle); }

/* LAYOUT */
.container { max-width: 760px; margin: 0 auto; padding: 0 32px; }

/* HEADER */
.article-header { padding: 152px 0 48px; animation: fadeUp 0.6s ease both; }
.article-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'Geist Mono', monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(99,102,241,0.2);
  padding: 5px 12px;
  border-radius: 100px;
  margin-bottom: 24px;
}
.article-title {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 16px;
}
.article-dek {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 620px;
}
.article-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 24px;
  font-size: 12px;
  font-family: 'Geist Mono', monospace;
  color: var(--text-muted);
}
.article-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-muted); }

/* PROSE */
article { padding-bottom: 96px; }
.prose { display: flex; flex-direction: column; gap: 20px; }
.prose h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-top: 40px;
}
.prose h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-top: 8px;
}
.prose p { font-size: 15.5px; color: var(--text-secondary); line-height: 1.8; }
.prose ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.prose ul li {
  font-size: 15px;
  color: var(--text-secondary);
  padding-left: 18px;
  position: relative;
  line-height: 1.7;
}
.prose ul li::before {
  content: '';
  position: absolute;
  left: 0; top: 9px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
}
.prose code {
  font-family: 'Geist Mono', monospace;
  font-size: 0.88em;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-primary);
}
.prose pre {
  font-family: 'Geist Mono', monospace;
  font-size: 12.5px;
  line-height: 1.7;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  overflow-x: auto;
  color: var(--text-primary);
}
.pull-question {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-surface);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
}

/* DIAGRAM CARD SHELL */
.diagram-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
  margin: 8px 0;
}
.diagram-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 18px;
}
.diagram-caption {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

/* GENERIC TWO-PANEL LAYOUT */
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 640px) {
  .panel-grid { grid-template-columns: 1fr; }
}

/* GENERIC BAR ROWS (usage meters, before/after comparisons) */
.bar-row { display: flex; align-items: center; gap: 8px; }
.bar-label { width: 78px; font-size: 11px; font-weight: 600; color: var(--text-secondary); flex-shrink: 0; }
.bar-track { flex: 1; height: 14px; background: var(--bg-subtle); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; }
.bar-status { width: 64px; font-size: 10px; font-weight: 700; text-align: right; flex-shrink: 0; }
.bar-fill.good, .bar-fill.fair { background: var(--diagram-share); }
.bar-fill.bad, .bar-fill.busy { background: var(--diagram-warn); }
.bar-fill.danger { background: var(--diagram-danger); }
.bar-fill.idle, .bar-fill.neutral { background: var(--bg-muted); }
.bar-fill.capped { background: var(--diagram-limit); }
.bar-status.good, .bar-status.fair { color: var(--diagram-share); }
.bar-status.bad, .bar-status.busy { color: var(--diagram-warn); }
.bar-status.danger { color: var(--diagram-danger); }
.bar-status.idle, .bar-status.neutral { color: var(--text-muted); }
.bar-status.capped { color: var(--diagram-limit); }

/* GENERIC ARCHITECTURE / PIPELINE FLOW */
.arch-flow { display: flex; align-items: stretch; gap: 8px; }
.arch-stage {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  border-radius: 10px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}
.arch-stage .arch-icon { font-size: 20px; }
.arch-stage .arch-name { font-size: 12px; font-weight: 700; color: var(--text-primary); }
.arch-stage .arch-desc { font-size: 10.5px; color: var(--text-muted); line-height: 1.5; }
.arch-arrow { display: flex; align-items: center; color: var(--text-muted); flex-shrink: 0; }
@media (max-width: 640px) {
  .arch-flow { flex-direction: column; }
  .arch-arrow { transform: rotate(90deg); align-self: center; }
}

/* GENERIC BADGES */
.badge-fail, .badge-pass {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
  white-space: nowrap;
}
.badge-fail { background: var(--diagram-danger-soft); color: var(--diagram-danger); }
.badge-pass { background: var(--diagram-share-soft); color: var(--diagram-share); }

/* GENERIC CHECKLIST (outcomes) */
.check-list { display: flex; flex-direction: column; gap: 8px; }
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.check-item svg { flex-shrink: 0; margin-top: 2px; color: var(--diagram-share); }

/* GENERIC CALLOUT */
.callout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--diagram-warn-soft);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 10px;
  padding: 16px 18px;
}
.callout svg { flex-shrink: 0; margin-top: 2px; color: var(--diagram-warn); }
.callout p { font-size: 14px; color: var(--text-secondary); line-height: 1.7; margin: 0; }
.callout strong { color: var(--text-primary); }

/* GENERIC 2-COLUMN COMPARE TABLE */
.compare-table { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.compare-row { display: grid; grid-template-columns: 1fr 1fr; }
.compare-row + .compare-row { border-top: 1px solid var(--border); }
.compare-cell {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.compare-cell:first-child { border-right: 1px solid var(--border); }
.compare-head { font-weight: 700; font-size: 13px; }
.compare-head.before { background: var(--diagram-danger-soft); color: var(--diagram-danger); }
.compare-head.after { background: var(--diagram-share-soft); color: var(--diagram-share); }
.compare-cell svg { flex-shrink: 0; }

/* GENERIC BEFORE/AFTER STATE PANEL */
.state-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.state-panel-head { display: flex; align-items: center; justify-content: space-between; }
.state-panel-name { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.state-panel.before .state-panel-name { color: var(--diagram-danger); }
.state-panel.after .state-panel-name { color: var(--diagram-share); }
.state-flag {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}
.state-panel.before .state-flag { color: var(--diagram-danger); background: var(--diagram-danger-soft); border: 1px solid rgba(220,38,38,0.2); }
.state-panel.after .state-flag { color: var(--diagram-share); background: var(--diagram-share-soft); border: 1px solid rgba(22,163,74,0.2); }
.state-outcome { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.event-strip { display: flex; flex-wrap: wrap; gap: 4px; }
.event-tick {
  font-family: 'Geist Mono', monospace;
  font-size: 9.5px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
}
.event-tick.danger { background: var(--diagram-danger-soft); color: var(--diagram-danger); }
.event-tick.good { background: var(--diagram-share-soft); color: var(--diagram-share); }
.event-tick.neutral { background: var(--bg-subtle); color: var(--text-muted); }

/* GENERIC Q&A / KEY-VALUE TABLE */
.qa-table { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.qa-row { display: grid; grid-template-columns: 1.3fr 1fr; }
.qa-row + .qa-row { border-top: 1px solid var(--border); }
.qa-cell { padding: 12px 16px; font-size: 13.5px; }
.qa-cell:first-child { border-right: 1px solid var(--border); color: var(--text-secondary); }
.qa-cell:last-child { font-weight: 600; color: var(--text-primary); font-family: 'Geist Mono', monospace; font-size: 12px; }
.qa-row.head .qa-cell { background: var(--bg-subtle); font-weight: 700; color: var(--text-primary); font-family: 'Geist'; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }

/* TAKEAWAYS */
.takeaway-list { display: flex; flex-direction: column; gap: 10px; }
.takeaway-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  color: var(--text-secondary);
}
.takeaway-item strong { color: var(--text-primary); }
.takeaway-icon { color: var(--accent); flex-shrink: 0; margin-top: 1px; }

/* CTA / FOOTER */
.article-cta {
  margin-top: 56px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.article-cta p { font-size: 14px; color: var(--text-secondary); margin-bottom: 18px; }
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(99,102,241,0.25);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(99,102,241,0.35); }

footer { border-top: 1px solid var(--border); padding: 24px 0; text-align: center; }
footer p { font-size: 12px; font-family: 'Geist Mono', monospace; color: var(--text-muted); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  .container { padding: 0 20px; }
  .nav-inner { padding: 0 20px; }
  .compare-row, .qa-row { grid-template-columns: 1fr; }
  .compare-cell:first-child, .qa-cell:first-child { border-right: none; border-bottom: 1px solid var(--border); }
}
