/* blog.css — the writing surface.
   Loaded after style.css, and reuses its tokens (--panel, --line, --red…),
   so the blog never drifts from the rest of the site. Hand-edited; the pages
   under blog/ are generated by tools/build-blog.mjs. */

.wrap-narrow { max-width: 760px; }

.back {
  display: inline-block; font-family: var(--mono); font-size: 12px;
  letter-spacing: .06em; color: var(--dim); text-decoration: none; margin-bottom: 22px;
}
.back:hover { color: var(--red-soft); }

/* ---------------------------------------------------------------- index */

.blog-hero { padding-top: 46px; }
.blog-hero h1 {
  font-family: var(--disp); font-weight: 700; color: var(--strong);
  font-size: clamp(30px, 5vw, 44px); letter-spacing: -.015em; margin: 6px 0 12px;
}
.blog-hero .meta a { color: var(--red-soft); }

.tag-bar .wrap { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 6px; }

.tag {
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--cloud); background: var(--panel2); border: 1px solid var(--line);
  border-radius: 20px; padding: 4px 11px; text-decoration: none; display: inline-block;
}
a.tag:hover { border-color: var(--red-deep); color: var(--strong); }
.tag span { color: var(--dimmer); margin-left: 4px; }

.post-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 24px; }
@media (min-width: 720px) { .post-grid { grid-template-columns: 1fr 1fr; } }

.post-card {
  display: flex; flex-direction: column; gap: 6px; text-decoration: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px;
  transition: border-color .18s, background .18s, transform .18s;
}
.post-card:hover { border-color: var(--dim); background: var(--panel2); transform: translateY(-2px); }
.post-meta {
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--dim);
}
.post-card h3 { margin: 4px 0 0; font-size: 19px; color: var(--strong); line-height: 1.3; letter-spacing: -.01em; }
.post-card p { margin: 6px 0 0; font-size: 14.5px; color: var(--cloud); line-height: 1.65; }
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* ----------------------------------------------------------------- post */

.post { padding-top: 40px; }
.post h1 {
  font-family: var(--disp); font-weight: 700; color: var(--strong);
  font-size: clamp(28px, 4.6vw, 40px); line-height: 1.15; letter-spacing: -.015em; margin: 8px 0 14px;
}
.post-lede { font-family: var(--serif); font-size: 19px; line-height: 1.6; color: var(--cloud); margin: 0 0 20px; }

.byline {
  display: flex; flex-wrap: wrap; gap: 16px; padding: 14px 0; margin-bottom: 30px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--dim);
}
.byline b { color: var(--cloud); font-weight: 500; }

.toc {
  background: var(--panel); border: 1px solid var(--line); border-left: 2px solid var(--red-deep);
  border-radius: 10px; padding: 18px 22px; margin: 0 0 30px;
}
.toc-h {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--dim);
}
.toc ol { margin: 10px 0 0; padding-left: 20px; color: var(--cloud); font-size: 14.5px; line-height: 1.9; }
.toc a { color: var(--cloud); text-decoration: none; }
.toc a:hover { color: var(--red-soft); }

/* ---- prose: the rendered markdown body */

.prose { font-family: var(--serif); font-size: 17.5px; line-height: 1.75; color: var(--cloud); }
.prose > :first-child { margin-top: 0; }
.prose h2 {
  font-family: var(--disp); font-weight: 600; color: var(--strong); font-size: 25px;
  letter-spacing: -.01em; margin: 44px 0 14px; scroll-margin-top: 90px;
}
.prose h3 {
  font-family: var(--disp); font-weight: 600; color: var(--strong); font-size: 19.5px;
  margin: 32px 0 10px; scroll-margin-top: 90px;
}
.prose h4 {
  font-family: var(--mono); font-weight: 500; color: var(--red-soft); font-size: 13px;
  letter-spacing: .1em; text-transform: uppercase; margin: 26px 0 8px;
}
.prose p { margin: 0 0 18px; }
.prose a { color: var(--strong); border-bottom: 1px solid var(--red); text-decoration: none; }
.prose a:hover { border-bottom-color: var(--red-soft); color: var(--red-soft); }
.prose strong { color: var(--strong); font-weight: 600; }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 24px; }
.prose li { margin: 0 0 8px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0; }
.prose img { max-width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); display: block; margin: 24px 0; }

.prose blockquote {
  margin: 24px 0; padding: 4px 0 4px 22px; border-left: 2px solid var(--red-deep);
  color: var(--cloud); font-style: italic;
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose code {
  font-family: var(--mono); font-size: .86em; background: var(--ink);
  border: 1px solid var(--line); border-radius: 5px; padding: 1.5px 5px; color: var(--red-soft);
}
.prose pre {
  background: var(--ink); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 20px; overflow-x: auto; margin: 0 0 22px;
}
.prose pre code {
  font-family: var(--mono); font-size: 13.5px; line-height: 1.7; background: none;
  border: 0; padding: 0; color: var(--cloud);
}

.table-wrap { overflow-x: auto; margin: 0 0 24px; }
.prose table { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: 14.5px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 9px 13px; text-align: left; }
.prose th {
  background: var(--panel2); color: var(--strong); font-family: var(--mono); font-size: 11px;
  letter-spacing: .08em; text-transform: uppercase; font-weight: 500;
}
.prose td { color: var(--cloud); }

.post-foot-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 34px 0 0; }

/* ---- after the post */

.post-cta {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px; margin: 44px 0 0;
}
.post-cta h2 { font-family: var(--disp); font-weight: 600; color: var(--strong); font-size: 21px; margin: 0 0 10px; }
.post-cta p { color: var(--cloud); font-size: 15px; line-height: 1.7; margin: 0 0 20px; }
.post-cta .cta { display: flex; flex-wrap: wrap; gap: 12px; }

.post-nav { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 26px 0 0; }
@media (min-width: 640px) { .post-nav { grid-template-columns: 1fr 1fr; } }
.pn {
  display: flex; flex-direction: column; gap: 5px; text-decoration: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px;
  transition: border-color .18s;
}
.pn:hover { border-color: var(--dim); }
.pn span {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--dim);
}
.pn b { color: var(--cloud); font-size: 14.5px; font-weight: 500; line-height: 1.4; }
.pn.next { text-align: right; }

/* ---- ad slots ------------------------------------------------------------
   Only rendered when AdSense is switched on in tools/build-blog.mjs; with it
   off, no markup is emitted at all, so there is no empty box on the page. That
   matters for the AdSense review itself — reviewers look at the live site, and
   reserved-but-empty placeholders read as an unfinished page.

   min-height reserves the space in the same paint as the rest of the article,
   so the ad cannot shove the text down as it loads. */
.ad-slot{
  margin:38px 0;padding:12px;border:1px solid var(--line);border-radius:12px;
  background:var(--panel);min-height:150px;display:flex;flex-direction:column;gap:8px;
}
.ad-slot .ad-label{
  font-family:var(--mono);font-size:9.5px;letter-spacing:.16em;text-transform:uppercase;
  color:var(--dimmer);
}
.ad-slot ins{flex:1;min-height:110px}
@media(min-width:720px){.ad-slot{min-height:180px}.ad-slot ins{min-height:140px}}
