/* ─── Blog — Claudin.io ───────────────────────────────────────────────────
 *
 * The blog is a MARKETING surface, so it takes the marketing palette (hex,
 * light-only, #1D4ED8) rather than the app shell's OKLCH hue-262 system. See
 * .agents/rules/design_system.md: the two are "a separate visual world on
 * purpose" and marketing values must never be moved into design-system.css.
 * This file shadows that file's :root the same way landing.html does inline —
 * the difference is that a section with more than one page gets a stylesheet
 * instead of a third copy-paste.
 *
 * Chart tokens live at the bottom. They are consumed by the SVGs generated by
 * scripts/blog_charts.py, which reference var(--chart-*) rather than baking in
 * hex — so a palette change here repaints every chart without regenerating.
 */

:root {
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Geist', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  color-scheme: light;
  --bg: #F8FAFC;
  --bg-subtle: #F1F5F9;
  --bg-elevated: #FFFFFF;
  --bg-raised: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-page: #F8FAFC;

  --border: #E2E8F0;
  --border-light: #CBD5E1;

  --text: #0F172A;
  --text-secondary: #475569;
  --text-tertiary: #64748B;
  --text-muted: #94A3B8;

  --accent: #1D4ED8;
  --accent-strong: #1D4ED8;
  --accent-hover: #1E40AF;
  --accent-text: #FFFFFF;
  --accent-subtle: rgba(29, 78, 216, 0.10);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.10);

  /* Prose measure. Long-form reading wants a narrower column than the
     landing page's 1100px section; charts break out of it deliberately. */
  --prose-width: 44rem;
  --figure-width: 56rem;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Nav ───────────────────────────────────────────────────────────────
 *
 * Two things design-system.css does NOT provide, despite the design doc saying
 * otherwise: `.nav` is `position: relative` there, not fixed, and `.nav-link`
 * does not exist at all — the landing page defines its own copy inline. A blog
 * page reusing those class names got an unstyled browser anchor (blue,
 * underlined) in a header that scrolled away. Both are fixed here rather than
 * in design-system.css, which the design rules reserve for the app shell.
 */

.blog-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-inline: var(--space-6);
  background: color-mix(in srgb, var(--bg-elevated) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.blog-nav-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}

.blog-nav-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex: none;
}

.blog-nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.blog-nav-link {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.blog-nav-link:hover { color: var(--text); background: var(--bg-subtle); }
.blog-nav-link[aria-current="page"] { color: var(--accent); font-weight: 600; }

@media (max-width: 720px) {
  .blog-nav-sep { display: none; }
  /* Keep the brand and the CTA; the section links are one tap away on the page. */
  .blog-nav-links { display: none; }
}

/* ─── Layout ─── */

/* No nav offset: the header is sticky, not fixed, so it occupies real space. */
.blog-main { padding: var(--space-12) var(--space-6) var(--space-16); }

.blog-wrap {
  max-width: var(--figure-width);
  margin: 0 auto;
}

/* Prose sits in a narrower column inside the wider figure column, so a chart
   can breathe without the paragraphs stretching to an unreadable measure. */
.prose > * {
  max-width: var(--prose-width);
  margin-left: auto;
  margin-right: auto;
}

/* ─── Post header ─── */

.post-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.post-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.25rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-4);
}

.post-dek {
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: var(--space-5);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-tertiary);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-10);
}

.post-meta .dot { color: var(--text-muted); }

/* ─── Prose ─── */

.prose h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: var(--space-12) auto var(--space-4);
}

.prose h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: var(--space-8) auto var(--space-3);
}

.prose p { margin-bottom: var(--space-5); }

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
.prose a:hover { color: var(--accent-hover); }

.prose ul, .prose ol {
  margin: 0 auto var(--space-5);
  padding-left: 1.35rem;
}
.prose li { margin-bottom: var(--space-2); }

.prose strong { font-weight: 600; }

.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.1em 0.35em;
}

.prose pre {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin-bottom: var(--space-6);
  overflow-x: auto;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-5);
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
}

/* A takeaway line — the one sentence a skimmer should leave with. */
.prose .takeaway {
  background: var(--accent-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-6);
  font-size: 1.02rem;
}
.prose .takeaway p:last-child { margin-bottom: 0; }

/* ─── Tables ─── */

.prose .table-scroll {
  max-width: var(--figure-width);
  overflow-x: auto;
  margin-bottom: var(--space-6);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.prose th {
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}
.prose td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.prose td.num, .prose th.num { text-align: right; font-family: var(--font-mono); font-size: 0.84rem; }

/* ─── Figures ─── */

.prose figure {
  max-width: var(--figure-width);
  margin: var(--space-10) auto;
}

.prose figure svg {
  width: 100%;
  height: auto;
  display: block;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.prose figcaption {
  max-width: var(--prose-width);
  margin: var(--space-3) auto 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-tertiary);
}

/* ─── Index ─── */

.blog-header { padding-bottom: var(--space-8); border-bottom: 1px solid var(--border); margin-bottom: var(--space-8); }
.blog-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-3);
}
.blog-header p { color: var(--text-secondary); font-size: 1.1rem; max-width: var(--prose-width); }

.post-list { list-style: none; display: flex; flex-direction: column; gap: var(--space-6); }

/* The whole card is the link, which is the one case design_system.md allows a
   hover shadow on a card. */
.post-card {
  display: block;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}
.post-card:hover { border-color: var(--border-light); box-shadow: var(--shadow-md); }
.post-card h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-2);
}
.post-card p { color: var(--text-secondary); margin-bottom: var(--space-3); }
.post-card .post-meta { border: 0; padding: 0; margin: 0; }

/* ─── Chart tokens ────────────────────────────────────────────────────────
 *
 * Validated with the dataviz skill's validator against the light surface, on
 * both the adjacent and the all-pairs lists:
 *   series-1 #1D4ED8 + series-2 #eb6834  → worst normal-vision ΔE 40.7
 *   series-1 + alert #DC2626 + warn #eda100 → worst ΔE 24.7, CVD 18.7
 * --chart-warn sits at 2.11:1 against the surface, under the 3:1 line, so the
 * relief rule applies: every mark using it carries a visible numeric label.
 * Do not add a fifth categorical hue without re-running the validator.
 */
:root {
  --chart-ink: #0F172A;
  --chart-ink-secondary: #475569;
  --chart-ink-muted: #94A3B8;
  --chart-grid: #E2E8F0;
  --chart-surface: #FFFFFF;

  --chart-series-1: #1D4ED8;  /* the measurement that stands, "after" */
  --chart-series-2: #eb6834;  /* the one it replaced, "before" */
  --chart-alert: #DC2626;     /* truncated — the failure the post is about */
  --chart-warn: #eda100;      /* timed out — labels mandatory, see above */

  --chart-ci-band: rgba(29, 78, 216, 0.16);
}

@media (max-width: 640px) {
  .blog-main { padding-left: var(--space-4); padding-right: var(--space-4); }
  .prose figure { margin-left: calc(-1 * var(--space-2)); margin-right: calc(-1 * var(--space-2)); }
}
