/* ============================================================
   Blog (Journal) styles — scoped via /blog and /blog/<slug> routes
   only. Loaded via {% block extra_css %} in blogs.html and
   blog_post.html. No selectors leak globally.
   ============================================================ */

.blog-scope {
  --accent: #8B0000;
  --ink: #111;
  --muted: #555;
  --faint: #888;
  --rule: #e6e6e6;
  --rule-strong: #d8d8d8;
  --bg: #fff;
  --bg-tint: #fafafa;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  background: var(--bg);
}
.blog-scope a { color: inherit; text-decoration: none; }
.blog-scope .mono { font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
.blog-scope .tnum { font-variant-numeric: tabular-nums; }
.blog-scope .eyebrow {
  font-size: 11px; font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.16em; text-transform: uppercase;
  margin-bottom: 20px;
}

/* ----- Hero ----- */
.blog-scope .hero {
  max-width: 1200px; margin: 0 auto;
  padding: 72px 32px 48px;
  border-bottom: 1px solid var(--rule);
}
.blog-scope .hero h1 {
  font-size: clamp(40px, 5.6vw, 68px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0 0 20px 0;
  max-width: 16ch;
}
.blog-scope .hero .lede {
  font-size: clamp(16px, 1.4vw, 19px);
  color: var(--muted);
  font-weight: 400;
  max-width: 60ch;
  line-height: 1.55;
  margin: 0;
}

/* ----- Featured / lead post ----- */
.blog-scope .lead {
  max-width: 1200px; margin: 0 auto;
  padding: 56px 32px 64px;
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: start;
}
.blog-scope .lead-meta { display: flex; flex-direction: column; gap: 24px; }
.blog-scope .lead-stamp {
  font-size: 11px; font-weight: 600;
  color: var(--faint);
  letter-spacing: 0.14em; text-transform: uppercase;
}
.blog-scope .lead-stamp .accent { color: var(--accent); }
.blog-scope .lead-numbers {
  display: grid; grid-template-columns: 1fr 1fr; gap: 28px;
  margin-top: 8px;
  border-top: 1px solid var(--rule);
  padding-top: 24px;
}
.blog-scope .stat-label {
  font-size: 10px; font-weight: 600; color: var(--faint);
  letter-spacing: 0.12em; text-transform: uppercase;
  margin-bottom: 6px;
}
.blog-scope .stat-num {
  font-size: 28px; font-weight: 800; color: var(--ink);
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.blog-scope .stat-num .delta { color: var(--accent); }
.blog-scope .lead-body h2 {
  font-size: clamp(28px, 3.2vw, 40px);
  font-weight: 800;
  letter-spacing: -0.022em;
  line-height: 1.1;
  margin: 0 0 18px 0;
}
.blog-scope .lead-body h2 a { transition: color 120ms; }
.blog-scope .lead-body h2 a:hover { color: var(--accent); }
.blog-scope .lead-body p {
  font-size: 17px; color: var(--muted); line-height: 1.6;
  margin: 0 0 22px 0;
}
.blog-scope .read-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600;
  color: var(--ink); letter-spacing: 0.04em;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
  transition: color 120ms, border-color 120ms;
}
.blog-scope .read-link:hover { color: var(--accent); border-color: var(--accent); }
.blog-scope .read-link .arr { font-size: 14px; }

/* ----- Archive ----- */
.blog-scope .archive {
  max-width: 1200px; margin: 0 auto;
  padding: 56px 32px 96px;
}
.blog-scope .archive-head {
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 14px;
}
.blog-scope .archive-head h3 {
  font-size: 12px; font-weight: 700;
  color: var(--ink); letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0;
}
.blog-scope .archive-head .count {
  font-size: 12px; color: var(--faint); font-weight: 500;
  letter-spacing: 0.04em;
}
.blog-scope .row {
  display: grid;
  grid-template-columns: 120px 1fr 220px;
  gap: 32px;
  padding: 28px 0;
  border-bottom: 1px solid var(--rule);
  align-items: start;
  transition: background 120ms;
}
.blog-scope .row:hover { background: var(--bg-tint); }
.blog-scope .row .date {
  font-size: 12px; color: var(--faint);
  font-weight: 500; letter-spacing: 0.04em;
  padding-top: 4px; text-transform: uppercase;
}
.blog-scope .row .body h4 {
  font-size: 21px; font-weight: 700; line-height: 1.25;
  letter-spacing: -0.012em;
  margin: 0 0 8px 0;
}
.blog-scope .row .body h4 a { transition: color 120ms; }
.blog-scope .row:hover .body h4 a { color: var(--accent); }
.blog-scope .row .body p {
  font-size: 14px; color: var(--muted); line-height: 1.55;
  margin: 0; max-width: 60ch;
}
.blog-scope .row .meta {
  display: flex; flex-direction: column; gap: 10px;
  align-items: flex-start; padding-top: 4px;
}
.blog-scope .tag {
  font-size: 10px; font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.14em; text-transform: uppercase;
}
.blog-scope .author { font-size: 12px; color: var(--muted); }
.blog-scope .author .who { color: var(--ink); font-weight: 600; }
.blog-scope .source-pill {
  display: inline-block;
  font-size: 9px; font-weight: 600;
  color: var(--faint);
  letter-spacing: 0.12em; text-transform: uppercase;
  border: 1px solid var(--rule-strong);
  padding: 2px 6px;
  margin-top: 2px;
}

/* ----- Empty state ----- */
.blog-scope .empty {
  max-width: 1200px; margin: 0 auto;
  padding: 96px 32px 96px;
  text-align: center;
}
.blog-scope .empty h2 {
  font-size: 24px; font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 12px 0;
}
.blog-scope .empty p { color: var(--muted); margin: 0 0 24px 0; }
.blog-scope .empty .btn {
  display: inline-block;
  background: var(--ink); color: white;
  padding: 10px 18px; font-weight: 600;
  font-size: 13px; letter-spacing: 0.04em;
}
.blog-scope .empty .btn:hover { background: var(--accent); }

/* ============================================================
   Post page
   ============================================================ */
.blog-scope .shell {
  max-width: 1200px; margin: 0 auto;
  padding: 0 32px;
}
.blog-scope .back-link {
  display: inline-block;
  margin-top: 28px;
  font-size: 12px; font-weight: 600;
  color: var(--faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 120ms;
}
.blog-scope .back-link:hover { color: var(--accent); }

.blog-scope .article-head {
  padding: 36px 0 40px;
  border-bottom: 1px solid var(--ink);
}
.blog-scope .stamp {
  font-size: 11px; font-weight: 700;
  color: var(--faint);
  letter-spacing: 0.16em; text-transform: uppercase;
  margin-bottom: 28px;
}
.blog-scope .stamp .accent { color: var(--accent); }
.blog-scope .article-head h1 {
  font-size: clamp(36px, 4.6vw, 56px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.07;
  margin: 0 0 28px 0;
  max-width: 22ch;
}
.blog-scope .article-head .standfirst {
  font-size: clamp(18px, 1.6vw, 22px);
  color: var(--muted);
  font-weight: 400;
  max-width: 60ch;
  line-height: 1.5;
  margin: 0 0 32px 0;
}
.blog-scope .byline {
  display: flex; gap: 28px; flex-wrap: wrap;
  font-size: 12px; color: var(--faint);
  letter-spacing: 0.04em;
}
.blog-scope .byline .who { color: var(--ink); font-weight: 600; }
.blog-scope .byline .label {
  font-size: 10px; color: var(--faint); font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  display: block; margin-bottom: 4px;
}

/* ----- Article body — the rendered post HTML drops in here ----- */
.blog-scope .article-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 0 80px;
  counter-reset: section-counter fig-counter list-counter;
}
.blog-scope .article-body p {
  font-size: 18px;
  line-height: 1.7;
  color: var(--ink);
  margin: 0 0 26px 0;
}
.blog-scope .article-body p strong { font-weight: 700; color: var(--ink); }
.blog-scope .article-body p strong em,
.blog-scope .article-body p em strong {
  font-style: normal;
  font-weight: 700;
  color: var(--accent);
}
.blog-scope .article-body em { color: var(--muted); }

/* First paragraph reads as the lede */
.blog-scope .article-body > p:first-of-type {
  font-size: 21px; line-height: 1.6;
  color: var(--ink);
  margin-bottom: 26px;
}

/* h2 = numbered question / section */
.blog-scope .article-body h2 {
  counter-increment: section-counter;
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin: 64px 0 28px;
  font-size: clamp(24px, 2.6vw, 32px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.18;
}
.blog-scope .article-body h2::before {
  content: counter(section-counter, decimal-leading-zero);
  flex: 0 0 56px;
  border-top: 2px solid var(--accent);
  padding-top: 8px;
  font-size: 14px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  align-self: flex-start;
}

/* Figure with iframe + auto-numbered caption */
.blog-scope .article-body figure {
  counter-increment: fig-counter;
  margin: 36px 0;
  padding: 0;
}
.blog-scope .article-body figure iframe {
  width: 100%;
  border: 1px solid var(--rule-strong);
  background: var(--bg);
  display: block;
}
.blog-scope .article-body figure figcaption {
  margin-top: 12px;
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}
.blog-scope .article-body figure figcaption::before {
  content: "Fig. " counter(fig-counter, decimal-leading-zero) " · ";
  color: var(--accent);
}

/* Bare iframes (no figure) get a sensible default */
.blog-scope .article-body > iframe {
  width: 100%;
  border: 1px solid var(--rule-strong);
  background: var(--bg);
  display: block;
  margin: 36px 0;
}

/* h3 + ul = closing checklist with numbered markers */
.blog-scope .article-body h3 {
  font-size: 13px; font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.16em; text-transform: uppercase;
  margin: 64px 0 18px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}
.blog-scope .article-body h3 + ul {
  list-style: none;
  padding: 0;
  margin: 0 0 26px 0;
  counter-reset: list-counter;
}
.blog-scope .article-body h3 + ul li {
  counter-increment: list-counter;
  font-size: 17px;
  line-height: 1.55;
  padding: 12px 0;
  border-bottom: 1px dashed var(--rule);
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  align-items: baseline;
  color: var(--ink);
}
.blog-scope .article-body h3 + ul li::before {
  content: counter(list-counter, decimal-leading-zero);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.blog-scope .article-body h3 + ul li:last-child {
  border-bottom: none;
}

/* hr = data-note divider */
.blog-scope .article-body hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 56px 0 18px;
}
.blog-scope .article-body hr + p,
.blog-scope .article-body p.data-note,
.blog-scope .article-body > p:last-of-type em {
  font-size: 12px; line-height: 1.6;
  color: var(--faint);
  font-style: italic;
}

/* ----- Paywall (replaces the dev-tools-detection blur logic) ----- */
.blog-scope .paywall-shell { position: relative; max-width: 720px; margin: 0 auto; padding: 56px 0 0; }
.blog-scope .paywall-preview { font-size: 18px; line-height: 1.7; color: var(--ink); }
.blog-scope .paywall-fade {
  height: 280px;
  background: linear-gradient(to bottom, var(--bg-tint), white);
  border: 1px solid var(--rule);
  margin-top: 24px;
  position: relative;
}
.blog-scope .paywall-modal {
  position: absolute; left: 50%; top: 60px;
  transform: translateX(-50%);
  max-width: 420px; width: calc(100% - 32px);
  background: white;
  border: 1px solid var(--rule-strong);
  padding: 32px;
  text-align: center;
}
.blog-scope .paywall-modal h3 {
  font-size: 13px; font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.16em; text-transform: uppercase;
  margin: 0 0 16px 0;
}
.blog-scope .paywall-modal p {
  font-size: 15px; color: var(--muted); line-height: 1.55;
  margin: 0 0 24px 0;
}
.blog-scope .paywall-modal .btn-primary {
  display: block;
  background: var(--ink); color: white;
  padding: 12px 18px; margin-bottom: 8px;
  font-weight: 600; font-size: 13px; letter-spacing: 0.04em;
  transition: background 120ms;
}
.blog-scope .paywall-modal .btn-primary:hover { background: var(--accent); }
.blog-scope .paywall-modal .btn-link {
  display: block;
  color: var(--muted);
  padding: 8px;
  font-size: 12px; font-weight: 500;
}
.blog-scope .paywall-modal .btn-link:hover { color: var(--ink); }

/* ----- Article-end / related ----- */
.blog-scope .article-end {
  max-width: 1200px;
  margin: 0 auto;
  padding: 64px 32px 80px;
  border-top: 1px solid var(--rule);
}
.blog-scope .filed {
  display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 12px;
  font-size: 12px; color: var(--faint); letter-spacing: 0.04em;
  margin-bottom: 64px;
}
.blog-scope .filed .label {
  font-size: 10px; font-weight: 700; color: var(--ink);
  letter-spacing: 0.16em; text-transform: uppercase;
  margin-right: 12px;
}
.blog-scope .filed .tag {
  color: var(--accent); font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; font-size: 11px;
}
.blog-scope .related h3 {
  font-size: 12px; font-weight: 700; color: var(--ink);
  letter-spacing: 0.16em; text-transform: uppercase;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 14px;
  margin: 0;
}

/* ----- Responsive ----- */
@media (max-width: 800px) {
  .blog-scope .hero { padding: 48px 20px 32px; }
  .blog-scope .lead { grid-template-columns: 1fr; gap: 32px; padding: 36px 20px 48px; }
  .blog-scope .archive { padding: 36px 20px 64px; }
  .blog-scope .row { grid-template-columns: 90px 1fr; }
  .blog-scope .row .meta { display: none; }
  .blog-scope .shell { padding: 0 20px; }
  .blog-scope .article-body { padding: 36px 0 56px; }
  .blog-scope .article-body p,
  .blog-scope .article-body h3 + ul li { font-size: 16px; }
  .blog-scope .article-body > p:first-of-type { font-size: 18px; }
  .blog-scope .article-body h2 { gap: 12px; }
  .blog-scope .article-body h2::before { flex-basis: 36px; }
  .blog-scope .article-end { padding: 48px 20px 56px; }
}
