/* Blog typography and layout. Loaded only on /blog/* pages. */

.blog-post { padding: 64px 0; }
.blog-index { padding: 120px 0 64px; }

.post-container { max-width: var(--max-grid); }

.post-header {
  max-width: var(--max-content);
  margin: 24px auto 32px;
}
.post-header h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.15;
  margin: 12px 0 16px;
  color: var(--text-primary);
}
.post-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 20px;
}
.post-byline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.post-byline .byline-author { color: var(--text-primary); font-weight: 600; }
.post-meta-tags { margin-bottom: 8px; }

.post-hero {
  max-width: var(--max-grid);
  margin: 0 auto 48px;
}
.post-hero img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.post-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  max-width: var(--max-grid);
  margin: 0 auto;
}
@media (max-width: 960px) {
  .post-grid { grid-template-columns: 1fr; }
}

.post-toc {
  position: sticky;
  top: 80px;
  align-self: start;
  font-size: 0.85rem;
}
.post-toc summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-primary);
  padding: 8px 0;
  list-style: none;
}
.post-toc summary::-webkit-details-marker { display: none; }
.post-toc .toc-body ul {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  border-left: 1px solid var(--border);
}
.post-toc .toc-body li { margin: 6px 0; }
.post-toc .toc-body a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 4px 12px;
  display: block;
  border-left: 2px solid transparent;
  margin-left: -1px;
}
.post-toc .toc-body a:hover { color: var(--cyan); }
.post-toc .toc-body a.toc-active {
  color: var(--cyan);
  border-left-color: var(--cyan);
}

.post-body {
  max-width: var(--max-content);
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--text-primary);
}
.post-body h2 {
  font-size: 1.65rem;
  margin: 2.5rem 0 1rem;
  color: var(--text-primary);
}
.post-body h3 {
  font-size: 1.25rem;
  margin: 1.75rem 0 0.75rem;
  color: var(--text-primary);
}
.post-body p { margin: 0 0 1.25rem; }
.post-body a { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; }
.post-body a:hover { color: #22d3ee; }
.post-body ul, .post-body ol { margin: 0 0 1.25rem 1.25rem; }
.post-body li { margin: 0.4rem 0; }
.post-body blockquote {
  border-left: 3px solid var(--cyan);
  background: var(--bg-surface);
  padding: 16px 20px;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.post-body blockquote p:last-child { margin-bottom: 0; }
.post-body code {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 0.9em;
}
.post-body pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 1.5rem 0;
}
.post-body pre code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 0.85rem;
}
.post-body img {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin: 1.5rem 0;
}
.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
  display: block;
  overflow-x: auto;
}
.post-body table thead { background: var(--bg-surface); }
.post-body th, .post-body td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
}
.post-body tr:nth-child(even) td { background: var(--bg-surface); }

.post-body .header-anchor { color: var(--text-muted); text-decoration: none; }

.cta-mid, .cta-end { max-width: var(--max-content); margin-left: auto; margin-right: auto; }

/* Blog index */
.blog-index-header { text-align: center; margin: 32px 0 64px; }
.blog-index-header h1 { font-size: 2.4rem; margin-bottom: 12px; }
.blog-index-header p { color: var(--text-secondary); max-width: 640px; margin: 0 auto; }
.post-grid-cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.post-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.post-card:hover { transform: translateY(-2px); border-color: var(--cyan); }
.post-card a { display: block; color: inherit; text-decoration: none; }
.post-card img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.post-card-body { padding: 16px 18px; }
.post-card h2 { font-size: 1.05rem; line-height: 1.35; margin: 6px 0; color: var(--text-primary); }
.post-card p { color: var(--text-secondary); font-size: 0.85rem; line-height: 1.5; margin: 0 0 12px; }
.post-card-meta { font-size: 0.75rem; color: var(--text-muted); display: flex; gap: 6px; }
.post-card-pillar h2 { font-size: 1.15rem; }

.pagination {
  display: flex;
  justify-content: center;
  gap: 16px;
  align-items: center;
  margin-top: 48px;
  color: var(--text-secondary);
}
.pagination a {
  color: var(--cyan);
  text-decoration: none;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.pagination a:hover { border-color: var(--cyan); }

/* TOC built by markdown-it-table-of-contents */
.toc { font-size: 0.85rem; }
.toc ul { list-style: none; padding-left: 12px; margin: 0; }
.toc li { margin: 4px 0; }
.toc a { color: var(--text-secondary); text-decoration: none; }
.toc a:hover { color: var(--cyan); }

/* Callouts */
.callout {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  background: var(--bg-surface);
}
.callout-warning { border-left: 3px solid var(--orange); }
.callout-info { border-left: 3px solid var(--cyan); }
.callout-success { border-left: 3px solid var(--green); }
.callout-danger { border-left: 3px solid var(--red); }
.callout-title { font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }

/* Focus states */
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 4px;
}
