/* ============================================
   Engineering blog: styles every post shares.
   Posts are built by backend/build_blog.py from backend/data/blog/*.md.
   A post's own components (diagrams, demos) go in its post.css.
   ============================================ */

:root {
  --wsj-tan: #f5f1eb;
  --wsj-cream: #faf8f5;
  --wsj-dark: #1a1a1a;
  --wsj-nav: #352a21;
  --wsj-brown: #6b5b4f;
  --wsj-gold: #c4a35a;
  --wsj-blue: #026dab;
  --wsj-red: #b71c1c;
  --wsj-green: #2e7d32;
  --wsj-border: #d4c8b8;

  --bg: var(--wsj-tan);
  --bg-elevated: var(--wsj-cream);
  --bg-code: #fefcf9;
  --text: var(--wsj-dark);
  --text-dim: var(--wsj-brown);
  --accent: var(--wsj-blue);
  --success: var(--wsj-green);
  --warning: var(--wsj-gold);
  --error: var(--wsj-red);
  --border: var(--wsj-border);

  --elev-1: 0 1px 3px rgba(107, 91, 79, 0.08), 0 4px 12px rgba(107, 91, 79, 0.04);

  --font-serif: "Libre Baskerville", Georgia, serif;
  --font-sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-serif);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle paper texture overlay */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.025;
  z-index: 1000;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85em;
  background: var(--wsj-cream);
  padding: 0.15em 0.4em;
  border: 1px solid var(--border);
}

.content {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}

/* Article header: label, title, dek */
.article-header {
  text-align: center;
  padding-top: 48px;
  padding-bottom: 32px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.article-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--wsj-brown);
  margin-bottom: 16px;
}

.article-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(32px, 6vw, 44px);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin-bottom: 20px;
}

.article-subtitle {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--wsj-brown);
  line-height: 1.6;
  max-width: 600px;
  margin: 0 auto;
}

/* Body text */
h2 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  margin: 48px 0 20px;
  letter-spacing: -0.01em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* Linked headings land below the sticky menu. */
.content h2[id],
.content h3[id] {
  scroll-margin-top: 80px;
}

h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  margin: 32px 0 12px;
  color: var(--text);
}

h4 {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  margin: 24px 0 12px;
  color: var(--text);
}

p {
  margin-bottom: 20px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.8;
}

em {
  font-style: italic;
}

strong {
  font-weight: 700;
  color: var(--wsj-dark);
}

/* Quotes in the article text; quotes inside a post's own components keep their own styles. */
.content > blockquote {
  margin: 28px 0;
  padding: 20px 24px;
  border-left: 3px solid var(--wsj-gold);
  background: var(--bg-elevated);
}

.content > blockquote p {
  margin-bottom: 0;
}

.callout {
  background: var(--wsj-cream);
  border-left: 4px solid var(--wsj-gold);
  padding: 20px 24px;
  margin: 32px 0;
}

.callout p {
  margin: 0;
  color: var(--text);
  font-family: var(--font-serif);
}

/* Screenshots and images; each links to the full-size file. */
.post-figure {
  margin: 32px 0;
}

.post-figure a {
  display: block;
}

.post-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.post-figure figcaption {
  margin-top: 12px;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-dim);
}

.post-figure--mobile {
  max-width: 380px;
  margin-inline: auto;
}

.back-link {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-family: var(--font-sans);
}

/* Blocks fade in as they scroll into view (blog.js adds the classes). */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

footer {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-dim);
  font-size: 14px;
  border-top: 1px solid var(--border);
  font-family: var(--font-sans);
}

@media (max-width: 640px) {
  .content {
    padding: 32px 16px 60px;
  }

  h2 {
    font-size: 22px;
    margin: 36px 0 16px;
  }

  h3 {
    font-size: 17px;
  }

  .content > blockquote {
    padding: 16px;
  }
}
