/* ── Color system ── */
:root {
  --bg: #faf7f2;
  --bg-warm: #f5f0e8;
  --bg-card: #ffffff;
  --bg-deep: #111210;
  --bg-deep-surface: #191a18;
  --bg-deep-card: #1f201e;

  --text: #1a1815;
  --text-dim: rgba(26,24,21,0.52);
  --text-faint: rgba(26,24,21,0.30);
  --text-aside: rgba(26,24,21,0.50);

  --text-on-dark: #e8e4dc;
  --text-on-dark-dim: rgba(232,228,220,0.50);
  --text-on-dark-faint: rgba(232,228,220,0.25);

  --border: rgba(26,24,21,0.09);
  --border-dark: rgba(232,228,220,0.08);

  --header-bg: rgba(250,247,242,0.9);
  --mark-bg: rgba(245,158,11,0.18);
  --card-shadow: rgba(0,0,0,0.06);
  --cta-banner-btn-bg: #ffffff;
  --cta-banner-btn-text: #111210;

  --c-model: #22c55e;
  --c-simulate: #06b6d4;
  --c-learn: #3b82f6;
  --c-collaborate: #f59e0b;
  --c-verify: #ef4444;
  --c-compute: #8b5cf6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111210;
    --bg-warm: #161714;
    --bg-card: #1a1b19;
    --bg-deep: #0a0b0a;
    --bg-deep-surface: #0e0f0e;
    --bg-deep-card: #141514;

    --text: #e8e4dc;
    --text-dim: rgba(232,228,220,0.58);
    --text-faint: rgba(232,228,220,0.30);
    --text-aside: rgba(232,228,220,0.52);

    --text-on-dark: #e8e4dc;
    --text-on-dark-dim: rgba(232,228,220,0.50);
    --text-on-dark-faint: rgba(232,228,220,0.28);

    --border: rgba(232,228,220,0.08);
    --border-dark: rgba(232,228,220,0.06);

    --header-bg: rgba(17,18,16,0.9);
    --mark-bg: rgba(245,158,11,0.14);
    --card-shadow: rgba(0,0,0,0.3);
    --cta-banner-btn-bg: #e8e4dc;
    --cta-banner-btn-text: #0a0b0a;

    --c-model: #34d569;
    --c-simulate: #22d3ee;
    --c-learn: #60a5fa;
    --c-collaborate: #fbbf24;
    --c-verify: #f87171;
    --c-compute: #a78bfa;
  }
}

/* ── Reset ── */
* { margin: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; }

img { max-width: 100%; height: auto; }
a { color: var(--text); }

/* ── Header ── */
header {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(14px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s, border-color 0.3s;
}
header .inner {
  max-width: 1080px; margin: 0 auto;
  padding: 0 2rem; height: 3.5rem;
  display: flex; align-items: center; justify-content: space-between;
}
header .logo {
  display: flex; align-items: center; gap: 0.5rem;
  text-decoration: none; color: var(--text);
  font-weight: 800; font-size: 1.15rem;
}
header .logo .logo-svg { height: 1.6rem; width: auto; }
header nav { display: flex; gap: 1.5rem; align-items: center; }
header nav a {
  color: var(--text-dim); text-decoration: none;
  font-size: 0.88rem; font-weight: 400;
  transition: color 0.2s;
}
header nav a:hover { color: var(--text); }
header nav a.app-link {
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-weight: 600; font-size: 0.82rem;
  transition: all 0.2s;
}
header nav a.app-link:hover {
  background: var(--text); color: var(--bg);
  border-color: var(--text);
}

/* ── Footer ── */
footer {
  background: var(--bg-deep);
  color: var(--text-on-dark-faint);
  border-top: 1px solid var(--border-dark);
}
footer .inner {
  max-width: 1080px; margin: 0 auto;
  padding: 2rem;
  display: flex; justify-content: space-between;
  font-size: 0.82rem;
}
footer a { color: var(--text-on-dark-dim); text-decoration: none; }
footer a:hover { color: var(--text-on-dark); }
.footer-links { display: flex; gap: 2.5rem; }
footer nav { display: flex; gap: 1.5rem; }

/* ── Prose (blog posts) ── */
.prose {
  max-width: 680px;
  margin: 0 auto;
  padding: 4rem 2rem;
}
.prose h1 {
  font-family: 'Fraunces', serif;
  font-size: 2.4rem; font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  line-height: 1.15;
}
.prose .post-date {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem; color: var(--text-faint);
  margin-bottom: 2.5rem;
  display: block;
}
.prose h2 {
  font-family: 'Fraunces', serif;
  font-size: 1.6rem; font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2.5rem; margin-bottom: 0.75rem;
}
.prose h3 {
  font-size: 1.15rem; font-weight: 600;
  margin-top: 2rem; margin-bottom: 0.5rem;
}
.prose p { margin-bottom: 1.1rem; }
.prose ul, .prose ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.prose li { margin-bottom: 0.35rem; }
.prose blockquote {
  border-left: 3px solid var(--c-collaborate);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--text-dim);
  font-style: italic;
}
.prose a { text-decoration: underline; text-underline-offset: 2px; color: var(--text); }
.prose img { border-radius: 6px; margin: 1.5rem 0; }

/* ── Prose utilities (shared) ── */
.prose figure { margin: 2.5rem 0; }
.prose figure svg { width: 100%; height: auto; display: block; }
.prose figcaption {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem; color: var(--text-faint);
  text-align: center; margin-top: 0.6rem; letter-spacing: 0.02em;
}
.prose .callout {
  background: var(--bg-warm);
  border-left: 3px solid var(--c-collaborate);
  padding: 1rem 1.25rem;
  border-radius: 0 6px 6px 0;
  margin: 2rem 0; font-size: 0.95rem; color: var(--text-dim);
}
.prose .callout strong {
  color: var(--text); display: block; margin-bottom: 0.25rem;
  font-size: 0.82rem; font-family: 'IBM Plex Mono', monospace;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.prose .mark {
  background: linear-gradient(180deg, transparent 58%, var(--mark-bg) 58%);
  padding: 0 2px;
}
.prose hr {
  border: none; border-top: 1px solid var(--border); margin: 3rem 0;
}

/* ── Post / page CTA block ── */
.post-cta {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.post-cta p {
  font-size: 0.92rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 0;
  max-width: 440px;
}
.post-cta-links {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}
.post-cta-links a {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  text-decoration: none;
  padding: 0.4rem 0.9rem;
  border-radius: 5px;
  transition: all 0.2s;
}
.post-cta-links a.primary {
  background: var(--text);
  color: var(--bg);
}
.post-cta-links a.primary:hover { opacity: 0.85; }
.post-cta-links a.secondary {
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.post-cta-links a.secondary:hover { color: var(--text); border-color: var(--text); }

/* ── Shared section headings ── */
.section-title {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  line-height: 1.15;
}
.section-lead {
  color: var(--text-dim);
  font-size: 1.05rem;
  line-height: 1.65;
  margin-bottom: 2.5rem;
  max-width: 560px;
}

code, pre {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.88em;
}
pre {
  padding: 1rem 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
  background: var(--bg-deep);
  color: var(--text-on-dark);
  margin-bottom: 1.25rem;
}
code:not(pre code) {
  padding: 0.15em 0.35em;
  border-radius: 3px;
  background: var(--border);
}
