/* ── Blog index ── */
.blog-header {
  padding: clamp(64px, 10vw, 110px) 0 clamp(40px, 6vw, 64px);
  border-bottom: 1px solid var(--rule);
}
.blog-header h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 700; line-height: 1.05;
  letter-spacing: -0.025em; text-wrap: balance;
  max-width: 16ch; margin: 0 0 16px;
}
.blog-header h1 em { font-style: normal; color: var(--blue); }

.post-grid {
  display: grid; grid-template-columns: 1fr;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}
@media (min-width: 760px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1060px) { .post-grid { grid-template-columns: repeat(3, 1fr); } }

.post-card {
  padding: 28px 24px;
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  display: flex; flex-direction: column;
  transition: background .2s var(--ease);
  color: inherit; text-decoration: none;
}
.post-card:hover { background: var(--paper-3); }

.post-card-meta {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.post-date {
  font-size: 13px; color: var(--ink-3);
}
.post-read {
  font-size: 13px; color: var(--blue);
}
.post-card h2 {
  font-family: var(--font-display);
  font-size: clamp(18px, 1.7vw, 21px);
  font-weight: 700; line-height: 1.22;
  letter-spacing: -0.02em; color: var(--ink);
  margin: 0 0 10px; transition: color .2s var(--ease);
}
.post-card:hover h2 { color: var(--blue); }
.post-card p {
  font-size: 14px; color: var(--ink-2);
  line-height: 1.55; flex: 1; margin: 0 0 16px;
}
.read-more {
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px;
  transition: color .2s var(--ease);
}
.post-card:hover .read-more { color: var(--blue); }
.read-more .ext { color: var(--blue); }

/* ── Post header ── */
.post-header {
  padding: clamp(52px, 8vw, 100px) 0 clamp(40px, 6vw, 72px);
  border-bottom: 1px solid var(--rule);
  position: relative; overflow: hidden;
}

.back-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px;
  color: var(--ink-3); margin-bottom: 28px;
  transition: color .2s var(--ease);
}
.back-link:hover { color: var(--blue); }

.post-meta {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.post-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.6vw, 50px);
  font-weight: 700; line-height: 1.06; text-wrap: balance;
  letter-spacing: -0.025em; color: var(--ink);
  max-width: 22ch; margin: 0 0 20px;
}
.post-title em { font-style: normal; color: var(--blue); }
.post-deck {
  font-size: clamp(17px, 1.4vw, 20px);
  color: var(--ink-2); line-height: 1.6;
  max-width: 58ch; margin: 0;
}

/* ── Article body ── */
.post-body { padding: clamp(52px, 8vw, 96px) 0; }
.post-wrap { max-width: 720px; margin: 0 auto; padding: 0 var(--gutter); }

.post-body h2 {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 700; line-height: 1.18;
  letter-spacing: -0.015em; max-width: 100%;
  margin: 44px 0 14px; color: var(--ink);
}
.post-body h2:first-child { margin-top: 0; }
.post-body h2 em { color: var(--blue); font-style: normal; }

.post-body h3 {
  font-family: var(--font-display);
  font-size: clamp(17px, 1.8vw, 20px);
  font-weight: 700; line-height: 1.25; letter-spacing: -0.02em;
  margin: 32px 0 10px; max-width: 100%;
  color: var(--ink);
}

.post-body p {
  font-size: 17px; color: var(--ink-2);
  line-height: 1.7; margin: 0 0 1.2em;
}
.post-body p strong { color: var(--ink); font-weight: 600; }

.post-body ul, .post-body ol {
  margin: 0 0 1.4em; padding: 0; list-style: none;
}
.post-body li {
  font-size: 17px; color: var(--ink-2);
  line-height: 1.65; padding: 8px 0 8px 24px;
  position: relative; border-bottom: 1px solid var(--rule);
}
.post-body li:first-child { border-top: 1px solid var(--rule); }
.post-body li strong { color: var(--ink); font-weight: 600; }
.post-body ul li::before {
  content: "→"; position: absolute; left: 0;
  color: var(--blue); font-weight: 600;
}
.post-body ol { counter-reset: ol-c; }
.post-body ol li::before {
  content: counter(ol-c); counter-increment: ol-c;
  position: absolute; left: 0;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--blue); top: 11px; letter-spacing: 0.05em;
}

.post-body pre {
  background: var(--paper-2); border: 1px solid var(--rule);
  border-radius: 6px; padding: 20px 24px;
  overflow-x: auto; margin: 0 0 1.4em;
}
.post-body code {
  font-family: var(--font-mono); font-size: 13px;
  color: var(--ink); line-height: 1.7;
}
.post-body p code, .post-body li code {
  background: var(--paper-2); border: 1px solid var(--rule);
  padding: 2px 6px; border-radius: 3px; font-size: 14px;
}
.post-body pre code { background: none; border: none; padding: 0; }

/* ── Author bio ── */
.post-author-section {
  border-top: 1px solid var(--rule);
  padding: 36px 0;
}
.author-card {
  max-width: 720px; margin: 0 auto; padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 16px;
}
.author-portrait {
  width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--rule); flex-shrink: 0; overflow: hidden;
}
.author-portrait img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center 15%;
}
.author-name {
  font-family: var(--font-display);
  font-weight: 700; font-size: 15px; color: var(--ink);
}
.author-bio { font-size: 13px; color: var(--ink-3); margin-top: 2px; }

/* ── Post CTA ── */
.post-cta-section {
  background: var(--ink); color: var(--paper);
  padding: clamp(52px, 8vw, 96px) 0;
  position: relative; overflow: hidden;
}
.post-cta-inner {
  max-width: 720px; margin: 0 auto; padding: 0 var(--gutter);
  position: relative; z-index: 1;
}
.post-cta-section .eyebrow {
  color: color-mix(in oklab, var(--paper) 45%, transparent);
}
.post-cta-section h2 {
  color: var(--paper); max-width: 22ch;
  margin-bottom: 16px; font-size: clamp(28px, 4vw, 44px);
}
.post-cta-section h2 em { color: var(--blue-inv); }
.post-cta-section p {
  color: color-mix(in oklab, var(--paper) 70%, transparent);
  font-size: 17px; max-width: 52ch; margin-bottom: 28px; line-height: 1.6;
}
.post-cta-section .btn {
  background: var(--paper); color: var(--ink); border-color: var(--paper);
}
.post-cta-section .btn:hover { background: var(--paper-2); border-color: var(--paper-2); }
.post-cta-section .btn-ghost { background: transparent; color: var(--paper); border-color: color-mix(in oklab, var(--paper) 35%, transparent); }
.post-cta-section .btn-ghost:hover { background: color-mix(in oklab, var(--paper) 10%, transparent); border-color: var(--paper); }
.post-cta-section .eyebrow .dot { background: var(--blue-inv); }
.post-cta-inner .btn + .btn { margin-left: 8px; margin-top: 8px; }
a.author-name:hover { color: var(--blue); }
.blog-header .eyebrow, .post-cta-section .eyebrow { margin-bottom: 18px; }
.post-body a { color: var(--blue); border-bottom: 1px solid color-mix(in oklab, var(--blue) 35%, transparent); }
.post-body a:hover { border-bottom-color: var(--blue); }

/* ── Post: updated date ── */
.post-updated { font-size: 13px; color: var(--ink-3); margin: 16px 0 0; }

/* ── Post: table of contents ──
   Inline <details> above the body on narrow screens; a sticky rail beside
   the body from 1180px. Only one is ever displayed. */
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
.post-body .toc li { font-size: 14px; line-height: 1.4; padding: 0; border: 0; }
.post-body .toc li::before { content: none; }
.post-body .toc a {
  display: block; margin-left: -1px; padding: 6px 0 6px 12px;
  border: 0; border-left: 2px solid transparent;
  color: var(--ink-2); transition: color .2s var(--ease), border-color .2s var(--ease);
}
.post-body .toc a:hover { color: var(--ink); }
.post-body .toc a[aria-current="location"] { color: var(--ink); font-weight: 500; border-left-color: var(--blue); }

.toc-inline {
  border: 1px solid var(--rule); border-radius: var(--radius-lg);
  padding: 14px 18px; margin: 0 0 40px;
}
.toc-inline summary {
  cursor: pointer; list-style: none;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 600; color: var(--ink);
}
.toc-inline summary::-webkit-details-marker { display: none; }
.toc-inline summary::after { content: "+"; color: var(--ink-3); font-weight: 400; font-size: 18px; line-height: 1; }
.toc-inline[open] summary::after { content: "−"; }
.toc-inline ol { margin-top: 12px; }

.post-body .toc-label {
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 14px;
}
.toc-rail { display: none; }

@media (min-width: 1180px) {
  .post-layout {
    display: grid; grid-template-columns: minmax(0, 720px) 220px;
    justify-content: center; gap: 64px; padding: 0 var(--gutter);
  }
  .post-layout .post-wrap { margin: 0; padding: 0; }
  .toc-inline { display: none; }
  .toc-rail { display: block; }
  .toc-rail .toc { position: sticky; top: 96px; }
}

/* ── Post: keep reading ── */
.post-related { padding: clamp(52px, 8vw, 88px) 0; }
.post-related-inner { max-width: 720px; margin: 0 auto; padding: 0 var(--gutter); }
.post-related-label {
  font-family: var(--font-body);
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 18px;
}
.related-list { list-style: none; margin: 0 0 24px; padding: 0; border-top: 1px solid var(--rule); }
.related-list li { border-bottom: 1px solid var(--rule); }
.related-item { display: block; padding: 20px 0; color: inherit; text-decoration: none; }
.related-title {
  display: block; margin-top: 10px;
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
  line-height: 1.25; letter-spacing: -0.02em; color: var(--ink);
  transition: color .2s var(--ease);
}
.related-item:hover .related-title { color: var(--blue); }
.related-desc { display: block; margin-top: 6px; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.related-all { font-size: 14px; font-weight: 500; color: var(--blue); }

/* ── Post: figures ── */
.post-figure { margin: 8px 0 1.6em; }
.post-figure img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--rule); border-radius: var(--radius-lg);
  background: var(--paper-2);
}
.post-figure figcaption { margin-top: 10px; font-size: 13px; line-height: 1.5; color: var(--ink-3); }

/* ── Post: code block with a copy button ── */
.code-block { position: relative; }
.code-block pre { padding-top: 44px; }
.code-block .copy-btn { position: absolute; top: 8px; right: 8px; }

/* ── Post: inline lead box ── */
.lead-box {
  margin: 2em 0 2.4em; padding: 28px 28px 24px;
  background: var(--paper-3);
  border: 1px solid var(--rule); border-left: 3px solid var(--blue);
  border-radius: var(--radius-lg);
}
.lead-box .eyebrow { margin-bottom: 12px; }
.post-body .lead-box h3 { margin-top: 0; }
.lead-box h3 em { font-style: normal; color: var(--blue); }
.post-body .lead-box p { font-size: 16px; }
.lead-box form { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.post-body .lead-box .lead-note { font-size: 13px; color: var(--ink-3); margin: 0; max-width: 42ch; }
.lead-done {
  margin-top: 16px; padding: 16px 18px;
  border: 1px solid var(--blue); border-radius: var(--radius);
  background: var(--blue-soft);
}
.lead-done:focus { outline: none; }
.post-body .lead-done p { margin-bottom: 6px; }
.post-body .lead-done .lead-note { max-width: none; }
