/* ════════════════════════════════════════════════════════════════════
   BLOG POST DETAIL PAGE
   Wraps existing markdown-converted HTML in <article class="post-content">
   Reuses .doc-content typography from doc.css; this adds post-specific
   header, author block, sidebar, share bar, and tags row.
   ════════════════════════════════════════════════════════════════════ */

.post-layout {
  padding: 40px 0 80px;
}

/* ── 3-col grid: content | sidebar ── */
.post-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 48px;
  align-items: start;
  margin-top: 24px;
}

@media (max-width: 1024px) {
  .post-grid { grid-template-columns: 1fr; gap: 32px; }
}

/* ════════════ POST HEADER ════════════ */
.post-page-head {
  padding-bottom: 28px;
  margin-bottom: 36px;
  border-bottom: 1px solid var(--line);
}

.post-page-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

.post-page-cat {
  padding: 3px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--line-accent);
  border-radius: 2px;
  font-weight: 700;
  text-decoration: none;
}

.post-page-cat:hover {
  background: var(--accent);
  color: var(--accent-ink);
}

.post-page-date {
  color: var(--ink-3);
}

.post-page-title {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--ink);
  margin: 0 0 18px;
}

@media (max-width: 640px) {
  .post-page-title { font-size: 30px; }
}

.post-page-deck {
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 720px;
  margin: 0 0 22px;
}

/* Share bar under header */
.post-share-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

.post-share-bar-label {
  margin-right: 4px;
}

.post-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink-2);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all .12s ease;
}

.post-share-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ════════════ POST CONTENT ════════════ */
/* Reuses .doc-content styles from doc.css.
   .post-content is an alias with identical rules. */

.post-content {
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink-2);
  max-width: 760px;
  min-width: 0;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  font-family: var(--font-display);
  color: var(--ink);
  letter-spacing: -0.015em;
  scroll-margin-top: 24px;
}

.post-content h1 { font-size: 36px; font-weight: 700; line-height: 1.15; margin: 0 0 18px; letter-spacing: -0.025em; }
.post-content h2 { font-size: 26px; font-weight: 700; line-height: 1.25; margin: 48px 0 16px; }
.post-content h3 { font-size: 20px; font-weight: 600; line-height: 1.3;  margin: 36px 0 12px; }
.post-content h4 { font-size: 16px; font-weight: 600; margin: 28px 0 10px; }
.post-content h5,
.post-content h6 { font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); margin: 24px 0 8px; }

.post-content p {
  margin: 0 0 18px;
  color: var(--ink-2);
}

.post-content p:last-child { margin-bottom: 0; }

.post-content strong,
.post-content b {
  color: var(--ink);
  font-weight: 600;
}

.post-content em,
.post-content i {
  font-style: italic;
  color: var(--ink-2);
}

/* First paragraph treated as lede */
.post-content > p:first-of-type {
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
}

/* Links */
.post-content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  transition: border-color .12s ease, color .12s ease;
}

.post-content a:hover {
  color: var(--accent-deep);
  border-bottom-color: var(--accent);
}

/* Lists */
.post-content ul,
.post-content ol {
  margin: 0 0 18px;
  padding-left: 24px;
}

.post-content li {
  margin-bottom: 8px;
  line-height: 1.65;
}

.post-content ul li::marker { color: var(--accent); }
.post-content ol li::marker { color: var(--accent); font-family: var(--font-mono); font-weight: 700; }

/* Code — inline */
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 2px 7px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--accent);
}

/* Code — fenced */
.post-content pre {
  position: relative;
  margin: 0 0 20px;
  padding: 18px 20px;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;

  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.post-content pre::-webkit-scrollbar { height: 8px; }
.post-content pre::-webkit-scrollbar-track { background: transparent; }
.post-content pre::-webkit-scrollbar-thumb {
  background-color: var(--line-strong);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.post-content pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--ink);
  font-size: 13px;
}

/* Optional code block file-label header */
.post-content pre[data-lang]::before,
.post-content pre.has-label::before {
  content: attr(data-lang);
  display: block;
  margin: -18px -20px 14px;
  padding: 8px 20px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  background: var(--bg-elev-2);
  border-bottom: 1px solid var(--line);
}

/* Blockquote */
.post-content blockquote {
  margin: 22px 0;
  padding: 16px 22px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  color: var(--ink);
}

.post-content blockquote p {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.post-content blockquote p + p { margin-top: 10px; }

/* Tables */
.post-content table {
  width: 100%;
  margin: 22px 0;
  border-collapse: collapse;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  font-size: 13.5px;
}

.post-content thead { background: var(--bg-elev-2); }

.post-content th,
.post-content td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.post-content th {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.post-content td { color: var(--ink-2); }
.post-content tr:last-child td { border-bottom: none; }
.post-content tr:hover td { background: var(--bg-elev-2); }

/* Horizontal rule */
.post-content hr {
  margin: 40px 0;
  border: none;
  height: 1px;
  background: var(--line);
}

/* Images */
.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  border: 1px solid var(--line);
  margin: 16px 0;
  display: block;
}

.post-content figure {
  margin: 22px 0;
}

.post-content figcaption {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: center;
  font-style: italic;
}

.post-content kbd {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 2px 6px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 3px;
  color: var(--ink);
}

/* Note callouts if posts use class="note"/"warn"/"tip" */
.post-content .note,
.post-content .info {
  margin: 22px 0;
  padding: 16px 20px;
  background: var(--info-soft);
  border-left: 3px solid var(--info);
  border-radius: 0 4px 4px 0;
  color: var(--ink);
}

.post-content .warn,
.post-content .warning {
  margin: 22px 0;
  padding: 16px 20px;
  background: var(--warn-soft);
  border-left: 3px solid var(--warn);
  border-radius: 0 4px 4px 0;
  color: var(--ink);
}

.post-content .tip,
.post-content .success {
  margin: 22px 0;
  padding: 16px 20px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  color: var(--ink);
}

/* ════════════ FOOTER OF ARTICLE ════════════ */
.post-foot {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.post-tags-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-4);
  margin-right: 4px;
}

.post-tag {
  display: inline-flex;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--ink-2);
  text-decoration: none;
  transition: all .12s ease;
}

.post-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Bottom CTA strip */
.post-bottom-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding: 18px 22px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 4px;
}

@media (max-width: 640px) {
  .post-bottom-cta {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
}

.post-bottom-cta-text {
  font-size: 13.5px;
  color: var(--ink-2);
}

.post-bottom-cta-text strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
  font-size: 15px;
}

/* ════════════ SIDEBAR ════════════ */
.post-sidebar {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.post-sidebar::-webkit-scrollbar { width: 6px; }
.post-sidebar::-webkit-scrollbar-track { background: transparent; }
.post-sidebar::-webkit-scrollbar-thumb {
  background-color: var(--line-strong);
  border-radius: 3px;
}

@media (max-width: 1024px) {
  .post-sidebar { position: relative; max-height: none; }
}

/* Sidebar card */
.psb-card {
  padding: 18px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.psb-head {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-4);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

/* In-this-post TOC */
.psb-toc-nav {
  display: flex;
  flex-direction: column;
}

.psb-toc-link {
  padding: 5px 0 5px 12px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ink-3);
  text-decoration: none;
  border-left: 1px solid var(--line);
  transition: all .12s ease;
}

.psb-toc-link:hover {
  color: var(--ink);
  border-left-color: var(--ink-3);
}

.psb-toc-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.psb-toc-link.toc-h3 {
  padding-left: 22px;
  font-size: 12px;
}

/* Category list */
.psb-cat-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.psb-cat-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 3px;
  text-decoration: none;
  color: var(--ink-2);
  font-size: 13px;
  transition: background .12s ease, color .12s ease;
}

.psb-cat-link:hover {
  background: var(--bg-elev-2);
  color: var(--ink);
}

.psb-cat-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.psb-cat-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-4);
}

/* CTA card */
.psb-cta {
  padding: 20px;
  background: linear-gradient(180deg, var(--bg-elev) 0%, var(--bg-elev-2) 100%);
  border: 1px solid var(--line-accent);
  border-radius: 4px;
}

.psb-cta-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 10px;
}

.psb-cta-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 8px;
  line-height: 1.25;
}

.psb-cta-body {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-3);
  margin-bottom: 14px;
}

.psb-cta .btn {
  width: 100%;
  justify-content: center;
}

/* ════════════ RELATED POSTS ════════════ */
.related-posts {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.related-posts-head {
  margin-bottom: 20px;
}

.related-posts-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 6px;
}

.related-posts-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

@media (max-width: 640px) {
  .related-grid { grid-template-columns: 1fr; }
}
