/* ─── Blog index ─────────────────────────────────────────────────────────────── */
.blog-wrap { padding: 4rem 0 7rem; }

.blog-index-header {
  margin-bottom: 3rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border);
}
.blog-index-header h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-bottom: 0.5rem; }
.blog-index-header p  { color: var(--text-muted); font-size: 1rem; max-width: 520px; }

.blog-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem;
}

.blog-card {
  display: flex; flex-direction: column; gap: 0.75rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.75rem;
  text-decoration: none; color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.blog-card:hover {
  border-color: var(--accent); color: inherit;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.blog-card-tag {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--accent);
}
.blog-card-title {
  font-size: 1.05rem; font-weight: 700; line-height: 1.35;
  color: var(--text); letter-spacing: -0.015em;
}
.blog-card-excerpt {
  font-size: 0.875rem; line-height: 1.7; color: var(--text-muted); flex: 1;
}
.blog-card-meta {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.8rem; color: var(--text-faint); margin-top: auto;
}
.blog-card-dot { color: var(--border-2); }

/* ─── Blog post layout ───────────────────────────────────────────────────────── */
.blog-post-wrap { padding: 4rem 0 7rem; }
.blog-post-layout {
  display: grid; grid-template-columns: 1fr 260px;
  gap: 4rem; align-items: start;
}
/* Prevent grid children from overflowing their column */
.blog-post,
.blog-post-sidebar { min-width: 0; }

/* ─── Post header ────────────────────────────────────────────────────────────── */
.blog-post-header { margin-bottom: 2.5rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border); }
.blog-post-tag {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--accent); margin-bottom: 0.75rem;
}
.blog-post-header h1 {
  font-size: clamp(1.7rem, 4vw, 2.4rem); margin-bottom: 0.75rem; line-height: 1.25;
}
.blog-post-meta {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.82rem; color: var(--text-faint); margin-bottom: 1.25rem;
}
.blog-post-lede {
  font-size: 1rem; line-height: 1.75; color: var(--text-muted);
}

/* ─── Post body ──────────────────────────────────────────────────────────────── */
.blog-post-body h2 {
  font-size: 1.2rem; font-weight: 700;
  margin: 2.5rem 0 0.75rem; padding-top: 2.5rem;
  border-top: 1px solid var(--border);
  color: var(--text); scroll-margin-top: 90px;
}
.blog-post-body h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.blog-post-body h3 { font-size: 1rem; font-weight: 700; margin: 1.5rem 0 0.5rem; color: var(--text); }
.blog-post-body p  { font-size: 0.9rem; line-height: 1.8; color: var(--text-muted); margin-bottom: 1rem; }
.blog-post-body ul,
.blog-post-body ol { padding-left: 1.4rem; margin-bottom: 1rem; }
.blog-post-body li { font-size: 0.9rem; line-height: 1.75; color: var(--text-muted); margin-bottom: 0.35rem; }
.blog-post-body strong { color: var(--text); font-weight: 600; }
.blog-post-body a  { color: var(--accent); }
.blog-post-body a:hover { color: var(--accent-hover); }

.blog-post-body pre {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  overflow-x: auto; margin: 1.25rem 0;
}
.blog-post-body pre code {
  font-family: var(--mono); font-size: 0.82rem; line-height: 1.65;
  color: var(--text); background: none; padding: 0; border-radius: 0;
}
.blog-post-body code {
  font-family: var(--mono); font-size: 0.84em;
  background: var(--surface-2); padding: 0.1em 0.4em;
  border-radius: 4px; color: var(--text);
}

/* ─── In-post CTA ────────────────────────────────────────────────────────────── */
.blog-post-cta {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.75rem;
  margin: 2.5rem 0 0;
}
.blog-post-cta strong { display: block; font-size: 1rem; margin-bottom: 0.4rem; color: var(--text); }
.blog-post-cta p { font-size: 0.875rem; margin-bottom: 1rem; }
.blog-post-cta .btn { margin-top: 0.25rem; }

/* ─── Post footer ────────────────────────────────────────────────────────────── */
.blog-post-footer { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.blog-back { font-size: 0.875rem; color: var(--text-muted); }
.blog-back:hover { color: var(--accent); }

/* ─── Sidebar ────────────────────────────────────────────────────────────────── */
.blog-post-sidebar { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 1.5rem; }

.blog-sidebar-toc {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
}
.blog-sidebar-label {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--text-faint); margin-bottom: 0.75rem;
}
.blog-sidebar-toc ol { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.blog-sidebar-toc a {
  font-size: 0.82rem; color: var(--text-muted); display: block;
  padding: 0.28rem 0.5rem; border-radius: 5px; transition: all 0.12s; line-height: 1.45;
}
.blog-sidebar-toc a:hover { color: var(--accent); background: rgba(99,102,241,0.06); }

.blog-sidebar-cta {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem 1.25rem 1.5rem;
}
.blog-sidebar-cta strong { display: block; font-size: 0.9rem; margin-bottom: 0.35rem; color: var(--text); }
.blog-sidebar-cta p { font-size: 0.82rem; line-height: 1.6; color: var(--text-muted); margin-bottom: 1rem; }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .blog-post-layout { grid-template-columns: 1fr; gap: 3rem; }
  .blog-post-sidebar { position: static; }
}
@media (max-width: 540px) {
  .blog-wrap { padding: 2.5rem 0 5rem; }
  .blog-post-wrap { padding: 2.5rem 0 5rem; }
}
