/* =========================================================
   Well Crafted AI — design system
   Adapted from the Jay Bellew portfolio styles. Same posture:
   semantic HTML, CSS custom properties, system font stack,
   no build pipeline. Dark by default, light by toggle.
   ========================================================= */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, "Cascadia Mono", monospace;

  /* Spacing scale (4px base) */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --space-12: 48px; --space-16: 64px; --space-20: 80px; --space-24: 96px;

  /* Type scale */
  --text-xs: 12px;  --text-sm: 13px; --text-base: 15px; --text-md: 16px;
  --text-lg: 18px; --text-xl: 22px; --text-2xl: 28px; --text-3xl: 36px;
  --text-4xl: 48px; --text-5xl: 64px;

  /* Radius */
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 14px; --radius-pill: 999px;

  /* Status colors — same hue family across both themes */
  --green: #10b981; --green-bg: rgba(16,185,129,.12);
  --amber: #eab308; --amber-bg: rgba(234,179,8,.12);
  --rose: #f43f5e;  --rose-bg:  rgba(244,63,94,.12);

  /* Transitions */
  --tx-fast: 120ms ease;
  --tx-base: 200ms cubic-bezier(.2,.8,.2,1);
}

/* Dark theme (default) */
[data-theme="dark"] {
  --bg-base:      #0e0e10;
  --bg-surface:   #16161a;
  --bg-elevated:  #1d1d22;
  --bg-hover:     #25252c;
  --border:       #2a2a31;
  --border-strong:#3a3a42;
  --text-primary: #e8e8ea;
  --text-secondary:#a0a0a8;
  --text-muted:   #6a6a72;
  --accent:       #3b82f6;
  --accent-hover: #60a5fa;
  --accent-soft:  rgba(59,130,246,.14);
  --shadow:       0 1px 0 rgba(255,255,255,.04) inset, 0 8px 24px rgba(0,0,0,.4);
}

/* Light theme */
[data-theme="light"] {
  --bg-base:      #fafaf9;
  --bg-surface:   #ffffff;
  --bg-elevated:  #ffffff;
  --bg-hover:     #f4f4f2;
  --border:       #e7e7e4;
  --border-strong:#d4d4d1;
  --text-primary: #18181b;
  --text-secondary:#52525b;
  --text-muted:   #71717a;
  --accent:       #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft:  rgba(37,99,235,.10);
  --shadow:       0 1px 2px rgba(24,24,27,.04), 0 8px 24px rgba(24,24,27,.06);
}

/* =========================================================
   Reset + base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--bg-base);
  transition: background var(--tx-base), color var(--tx-base);
}
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
button { font-family: inherit; cursor: pointer; }

/* =========================================================
   Top bar
   ========================================================= */
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg-base) 80%, transparent);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: var(--space-4) var(--space-6);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
}
.brand {
  display: inline-flex; align-items: center;
  font-weight: 600; font-size: var(--text-md);
  color: var(--text-primary);
}
/* Real wordmark logo. Two variants ship: a white-on-transparent
   PNG for dark mode, a black-on-transparent PNG for light mode.
   We render both <img> tags and let the theme switch which is
   visible — keeps the markup semantic and avoids a flash on toggle. */
.brand-logo {
  height: 22px; width: auto; display: block;
}
.brand-logo--light { display: none; }
[data-theme="light"] .brand-logo--dark  { display: none; }
[data-theme="light"] .brand-logo--light { display: block; }
.brand-wordmark--sr { /* visually hidden, kept for screen readers */
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.nav { display: flex; align-items: center; gap: var(--space-2); }
.nav a {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  transition: color var(--tx-fast), background var(--tx-fast);
}
.nav a:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav a[aria-current="page"] { color: var(--text-primary); }
.nav-divider { width: 1px; height: 18px; background: var(--border); margin: 0 var(--space-2); }
.icon-btn {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid var(--border);
  color: var(--text-secondary);
  display: grid; place-items: center;
  transition: background var(--tx-fast), color var(--tx-fast), border-color var(--tx-fast);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-strong); }

/* =========================================================
   Layout
   ========================================================= */
.page { max-width: 1080px; margin: 0 auto; padding: 0 var(--space-6); }
section { padding: var(--space-20) 0; border-bottom: 1px solid var(--border); }
section:last-of-type { border-bottom: none; }

/* Section eyebrow */
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}
.eyebrow::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}

/* =========================================================
   Hero (publication / home)
   ========================================================= */
.hero { padding: var(--space-20) 0 var(--space-16); border-bottom: 1px solid var(--border); }
.hero h1 {
  font-size: clamp(36px, 5.2vw, var(--text-5xl));
  line-height: 1.04; letter-spacing: -.02em; font-weight: 600;
  margin: 0 0 var(--space-5);
  max-width: 18ch;
}
.hero h1 .accent { color: var(--accent); }
.hero-lede {
  font-size: var(--text-lg); line-height: 1.55; color: var(--text-secondary);
  margin: 0 0 var(--space-8); max-width: 60ch;
}
.hero-meta {
  display: flex; flex-wrap: wrap; gap: var(--space-3);
  font-family: var(--font-mono); font-size: var(--text-xs);
  letter-spacing: .08em; color: var(--text-muted); text-transform: uppercase;
  margin: 0;
}
.hero-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; align-self: center; }

/* Hero author byline */
.hero-author {
  display: flex; align-items: center; gap: var(--space-3);
  margin: 0 0 var(--space-6);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  max-width: 60ch;
}
.hero-author-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover; flex-shrink: 0;
  background: var(--surface);
}
.hero-author-text { display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.hero-author-name { font-weight: 600; color: var(--text-primary); font-size: var(--text-sm); }
.hero-author-role { font-size: var(--text-xs); color: var(--text-secondary); }
.hero-author-link {
  margin-left: auto;
  font-family: var(--font-mono); font-size: var(--text-xs);
  letter-spacing: .04em; color: var(--text-muted);
  text-decoration: none; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 4px;
  transition: color var(--tx-fast);
}
.hero-author-link:hover { color: var(--accent); }
@media (max-width: 520px) {
  .hero-author-link { display: none; }
}

/* Hero CTA row */
.cta-row { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-8); }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 500;
  transition: background var(--tx-fast), transform var(--tx-fast), border-color var(--tx-fast);
}
.btn-primary {
  background: var(--accent); color: white; border: 1px solid var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: var(--bg-surface); color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn .icon { width: 16px; height: 16px; }

/* =========================================================
   Section heading row
   ========================================================= */
.section-head {
  display: flex; align-items: end; justify-content: space-between;
  gap: var(--space-6); margin-bottom: var(--space-10);
}
.section-head h2 {
  font-size: var(--text-3xl); line-height: 1.1; letter-spacing: -.02em;
  font-weight: 600; margin: 0;
}
.section-head p {
  color: var(--text-secondary); font-size: var(--text-md); max-width: 50ch;
  margin: var(--space-3) 0 0;
}
.section-link {
  color: var(--text-secondary); font-size: var(--text-sm);
  display: inline-flex; align-items: center; gap: var(--space-2);
  transition: color var(--tx-fast); white-space: nowrap;
}
.section-link:hover { color: var(--text-primary); }
.section-link .icon { width: 16px; height: 16px; transition: transform var(--tx-fast); }
.section-link:hover .icon { transform: translateX(2px); }

/* =========================================================
   Featured article card — hero of the archive
   ========================================================= */
.article-featured {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: var(--space-10);
  padding: var(--space-8); align-items: center;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--tx-fast), background var(--tx-fast);
}
.article-featured:hover {
  border-color: var(--border-strong); background: var(--bg-elevated);
}
@media (max-width: 860px) {
  .article-featured { grid-template-columns: 1fr; padding: var(--space-5); gap: var(--space-6); }
}
.article-featured-fig {
  width: 100%; height: auto;
  display: block; border-radius: var(--radius-md);
  background: var(--bg-base);
  border: 1px solid var(--border);
  padding: var(--space-4);
}
.article-featured-fig svg { width: 100%; height: auto; display: block; }
.article-featured-meta {
  display: flex; align-items: center; gap: var(--space-3);
  font-family: var(--font-mono); font-size: var(--text-xs);
  letter-spacing: .08em; color: var(--text-muted); text-transform: uppercase;
  margin-bottom: var(--space-3);
}
.article-featured-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }
.article-featured h3 {
  font-size: clamp(24px, 3.2vw, 32px);
  font-weight: 600; letter-spacing: -.01em;
  line-height: 1.18; margin: 0 0 var(--space-3); color: var(--text-primary);
}
.article-featured p {
  font-size: var(--text-md); color: var(--text-secondary);
  margin: 0 0 var(--space-5); line-height: 1.6;
  max-width: 52ch;
}
.article-featured-cta {
  display: inline-flex; align-items: center; gap: var(--space-2);
  color: var(--accent); font-size: var(--text-sm); font-weight: 500;
}
.article-featured-cta .icon { transition: transform var(--tx-fast); }
.article-featured:hover .article-featured-cta .icon { transform: translate(2px, -2px); }

/* =========================================================
   Archive grid — article cards
   ========================================================= */
.article-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5);
}
@media (max-width: 860px) { .article-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .article-grid { grid-template-columns: 1fr; } }

.article-card {
  display: flex; flex-direction: column;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: border-color var(--tx-base), transform var(--tx-base), background var(--tx-base);
}
.article-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
  transform: translateY(-2px);
}
.article-card[aria-disabled="true"] {
  opacity: .7;
}
.article-card[aria-disabled="true"]:hover {
  transform: none; cursor: default;
}
.article-card-thumb {
  width: 100%; aspect-ratio: 16/9;
  border-bottom: 1px solid var(--border);
  background: var(--bg-base);
  padding: var(--space-4);
  display: flex; align-items: center; justify-content: center;
}
.article-card-thumb svg { width: 100%; height: 100%; display: block; }
.article-card-body {
  padding: var(--space-5);
  display: flex; flex-direction: column; gap: var(--space-3);
  flex: 1;
}
.article-card-meta {
  display: flex; align-items: center; gap: var(--space-3);
  font-family: var(--font-mono); font-size: var(--text-xs);
  letter-spacing: .08em; color: var(--text-muted); text-transform: uppercase;
}
.article-card-meta .pill {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 2px 6px; border-radius: var(--radius-sm); letter-spacing: .04em;
}
.article-card h4 {
  font-size: var(--text-lg); font-weight: 600; letter-spacing: -.01em;
  line-height: 1.25; margin: 0; color: var(--text-primary);
}
.article-card p {
  font-size: var(--text-sm); color: var(--text-secondary);
  line-height: 1.55; margin: 0;
}

/* Make anchor-wrapped article cards behave correctly */
a.article-card {
  text-decoration: none; color: inherit;
}

/* Real-image card thumbnail (used by published archive cards) */
.article-card-img {
  width: 100%; aspect-ratio: 16/9; object-fit: cover;
  display: block; border-bottom: 1px solid var(--border);
  background: var(--bg-base);
}

/* Real-image featured fig (used by the Currently Writing slot) */
.article-featured-img {
  width: 100%; aspect-ratio: 16/9; object-fit: cover;
  display: block; border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-base);
}

/* External-link badge: shows in the card meta row when the card links out */
.article-medium-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-muted);
}
.article-medium-tag::before {
  content: ""; width: 4px; height: 4px; border-radius: 50%;
  background: var(--text-muted);
}

/* "Read on Medium" CTA that sits at the bottom of an outbound card */
.article-card-cta {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--text-sm); font-weight: 500;
  color: var(--accent);
  margin-top: auto;
}
.article-card-cta::after { content: "→"; transition: transform var(--tx-fast); }
a.article-card:hover .article-card-cta::after { transform: translateX(3px); }

/* In-progress status pill — louder than the muted Medium tag */
.article-status-progress {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}
.article-status-progress::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-soft);
  animation: wcai-status-pulse 1.8s ease-out infinite;
}
@keyframes wcai-status-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  70%  { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .article-status-progress::before { animation: none; }
}

/* =========================================================
   About strip — quiet two-column block
   ========================================================= */
.about {
  display: grid; grid-template-columns: 1fr 1.4fr; gap: var(--space-12);
  align-items: start;
}
@media (max-width: 860px) { .about { grid-template-columns: 1fr; gap: var(--space-6); } }
.about h2 {
  font-size: var(--text-3xl); line-height: 1.1; letter-spacing: -.02em;
  font-weight: 600; margin: 0 0 var(--space-4);
}
.about p {
  font-size: var(--text-md); line-height: 1.7; color: var(--text-secondary);
  margin: 0 0 var(--space-4); max-width: 64ch;
}
.about p strong { color: var(--text-primary); font-weight: 500; }
.about-link {
  display: inline-flex; align-items: center; gap: var(--space-2);
  color: var(--accent); font-size: var(--text-sm); font-weight: 500;
  margin-top: var(--space-2);
}
.about-link .icon { width: 14px; height: 14px; transition: transform var(--tx-fast); }
.about-link:hover .icon { transform: translate(2px, -2px); }

/* =========================================================
   Subscribe block
   ========================================================= */
.subscribe-card {
  padding: var(--space-12) var(--space-10);
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-10);
  align-items: center;
}
@media (max-width: 860px) {
  .subscribe-card { grid-template-columns: 1fr; padding: var(--space-8); gap: var(--space-6); }
}
.subscribe-card h2 {
  font-size: var(--text-2xl); font-weight: 600; letter-spacing: -.01em;
  margin: 0 0 var(--space-3); line-height: 1.2;
}
.subscribe-card p {
  font-size: var(--text-md); color: var(--text-secondary);
  margin: 0; line-height: 1.6; max-width: 44ch;
}
.subscribe-form {
  display: flex; flex-direction: column; gap: var(--space-3);
}
.subscribe-form-row {
  display: flex; gap: var(--space-2);
}
.subscribe-form input[type="email"] {
  flex: 1; padding: var(--space-3) var(--space-4);
  background: var(--bg-base); border: 1px solid var(--border);
  border-radius: var(--radius-md); color: var(--text-primary);
  font-family: inherit; font-size: var(--text-sm);
  transition: border-color var(--tx-fast), background var(--tx-fast);
}
.subscribe-form input[type="email"]:focus {
  outline: none; border-color: var(--accent);
  background: var(--bg-surface);
}
.subscribe-form button {
  padding: var(--space-3) var(--space-5);
  background: var(--accent); color: white; border: 1px solid var(--accent);
  border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: 500;
  white-space: nowrap;
  transition: background var(--tx-fast);
}
.subscribe-form button:hover { background: var(--accent-hover); }
.subscribe-fine {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-muted); letter-spacing: .04em;
  margin: 0;
}

/* =========================================================
   Footer
   ========================================================= */
footer {
  padding: var(--space-16) 0 var(--space-12);
  border-top: 1px solid var(--border);
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-10); margin-bottom: var(--space-10);
}
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--space-8); } }
.footer-col h5 {
  font-family: var(--font-mono); font-size: var(--text-xs);
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-muted); margin: 0 0 var(--space-4);
}
.footer-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.footer-col a { color: var(--text-secondary); font-size: var(--text-sm); transition: color var(--tx-fast); }
.footer-col a:hover { color: var(--text-primary); }
.footer-col p { font-size: var(--text-sm); color: var(--text-secondary); max-width: 38ch; margin: 0; line-height: 1.6; }
.footer-bottom {
  padding-top: var(--space-6); border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--text-sm); color: var(--text-muted);
  flex-wrap: wrap; gap: var(--space-3);
}
.footer-bottom-mono { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: .04em; }

/* =========================================================
   Article page — hero + body
   ========================================================= */
.cs-hero { padding: var(--space-12) 0 var(--space-10); border-bottom: 1px solid var(--border); }
.cs-hero h1 {
  font-size: clamp(32px, 4.5vw, 52px); line-height: 1.1;
  letter-spacing: -.02em; font-weight: 600; margin: 0 0 var(--space-5);
  max-width: 18ch;
}
.cs-hero h1 .accent { color: var(--accent); }
.cs-hero-lede {
  font-size: var(--text-lg); color: var(--text-secondary);
  max-width: 60ch; margin: 0 0 var(--space-6); line-height: 1.55;
}

/* Article meta + byline */
.article-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3);
  font-family: var(--font-mono); font-size: var(--text-xs);
  letter-spacing: .08em; color: var(--text-muted);
  margin: 0 0 var(--space-6);
}
.article-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }
.article-byline {
  font-size: var(--text-sm); color: var(--text-secondary);
  margin: 0 0 var(--space-2);
}
.article-byline strong { color: var(--text-primary); font-weight: 500; }

/* Article body — wide editorial container */
.cs-body {
  max-width: 1080px; margin: 0 auto;
  padding-top: var(--space-16); padding-bottom: var(--space-16);
}
.cs-body > p,
.cs-body > ul,
.cs-body > ol,
.cs-body > blockquote {
  max-width: 70ch;
}
.cs-body p, .cs-body ul, .cs-body ol {
  font-size: var(--text-md); line-height: 1.7; color: var(--text-secondary);
  margin: 0 0 var(--space-5);
}
.cs-body p strong, .cs-body li strong { color: var(--text-primary); font-weight: 500; }
.cs-body h2 {
  font-size: var(--text-2xl); font-weight: 600; letter-spacing: -.01em;
  color: var(--text-primary); margin: var(--space-12) 0 var(--space-4);
  max-width: 22ch;
}
.cs-body h2:first-child { margin-top: 0; }
.cs-body h3 {
  font-size: var(--text-lg); font-weight: 600;
  color: var(--text-primary); margin: var(--space-8) 0 var(--space-3);
}
.cs-body code {
  font-family: var(--font-mono); font-size: 0.92em;
  background: var(--bg-surface); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 4px; color: var(--text-primary);
}
.cs-body blockquote {
  margin: var(--space-8) 0; padding: var(--space-5) var(--space-6);
  border-left: 3px solid var(--accent); background: var(--bg-surface);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: var(--text-lg); color: var(--text-primary); line-height: 1.6;
}
.cs-body blockquote.pullquote {
  font-size: var(--text-xl);
  line-height: 1.45;
  letter-spacing: -.01em;
  font-weight: 500;
}
.cs-body hr {
  border: 0; border-top: 1px dashed var(--border);
  margin: var(--space-12) 0;
}

/* Inline figure */
.cs-figure {
  margin: var(--space-10) 0; padding: var(--space-8);
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); position: relative;
}
.cs-figure-label {
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--text-muted); letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: var(--space-5);
}
.cs-figure svg { width: 100%; height: auto; display: block; }
.cs-figure-caption {
  font-size: var(--text-sm); color: var(--text-muted);
  text-align: center; margin-top: var(--space-4); font-style: italic;
}

/* Themed figure styling — drives SVGs from CSS variables */
.fig svg:not(.icon) { width: 100%; height: auto; display: block; }
.fig text { font-family: var(--font-sans); fill: var(--text-primary); }
.fig .lbl-xs {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase;
  fill: var(--text-muted);
}
.fig .lbl-sm { font-size: 11px; fill: var(--text-secondary); letter-spacing: .02em; }
.fig .lbl    { font-size: 13px; font-weight: 500; }
.fig .lbl-pop { font-size: 22px; font-weight: 600; letter-spacing: -.02em; fill: var(--text-primary); }
.fig .lbl-pop-sm { font-size: 18px; font-weight: 600; letter-spacing: -.02em; fill: var(--text-primary); }
.fig .lbl-pop-md { font-size: 16px; font-weight: 600; letter-spacing: -.02em; fill: var(--text-primary); }

.fig .stroke-line { stroke: var(--border-strong); fill: none; }
.fig .stroke-line-soft { stroke: var(--border); fill: none; }
.fig .fill-surface { fill: var(--bg-surface); }
.fig .fill-elevated { fill: var(--bg-elevated); }
.fig .fill-base { fill: var(--bg-base); }
.fig .fill-accent-soft { fill: var(--accent-soft); }

.fig .stroke-accent { stroke: var(--accent); fill: none; }
.fig .fill-accent { fill: var(--accent); }
.fig .text-accent { fill: var(--accent); }
.fig .text-muted { fill: var(--text-muted); }

.fig .stroke-green { stroke: var(--green); fill: none; }
.fig .fill-green { fill: var(--green); }
.fig .stroke-amber { stroke: var(--amber); fill: none; }
.fig .fill-amber { fill: var(--amber); }
.fig .stroke-rose { stroke: var(--rose); fill: none; }
.fig .fill-rose { fill: var(--rose); }
.fig .arrow { fill: var(--text-secondary); }

/* Article foot CTA */
.article-foot-cta {
  display: grid; grid-template-columns: 1fr auto; gap: var(--space-6);
  align-items: center;
  padding: var(--space-8);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-top: var(--space-12);
}
@media (max-width: 720px) { .article-foot-cta { grid-template-columns: 1fr; } }
.article-foot-cta h3 {
  font-size: var(--text-xl); font-weight: 600; margin: 0 0 var(--space-2);
  letter-spacing: -.01em;
}
.article-foot-cta p { font-size: var(--text-sm); color: var(--text-secondary); margin: 0; }

/* =========================================================
   Inline SVG icon system
   ========================================================= */
.icon {
  width: 1em; height: 1em;
  stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  fill: none;
  vertical-align: -0.15em; flex-shrink: 0;
}
.icon-sm { width: 14px; height: 14px; }
.icon-md { width: 16px; height: 16px; }
.icon-lg { width: 18px; height: 18px; }

/* =========================================================
   Reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
