/* Post detail page (mockup port). Palette tokens (--h-*), .wrap, .mono, .dots, header/footer live in base.css. */
.post-main { padding: 0; }
.post-main + .site-footer { margin-top: 0; }
.post-page { background: var(--h-bg); color: var(--h-ink); }
.post-page a { color: inherit; text-decoration: none; }
.post-page :focus-visible { outline-color: var(--h-focus); }
.post-hero :focus-visible { outline-color: var(--sky); }
.post-page h1, .post-page h2, .post-page ul, .post-page ol, .post-page p { margin: 0; padding: 0; }
.post-page ul, .post-page ol { list-style: none; }

/* hero */
.post-hero { background-color: var(--navy); color: #fff; }
.post-hero-in { display: flex; flex-direction: column; gap: 24px; padding-block: 40px 56px; }
.post-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--navy-muted); }
.post-crumbs a { transition: color .15s; } .post-crumbs a:hover { color: #fff; }
.post-cats { display: flex; flex-wrap: wrap; gap: 10px; }
.post-cats a { display: inline-block; padding: 5px 12px; border-radius: 999px; background: #fef3c7; color: #78350f; font-size: 12px; font-weight: 700; line-height: 1.8; }
.post-title { max-width: 900px; font-size: 44px; line-height: 1.5; font-weight: 700; }
.post-lead { max-width: 760px; font-size: 17px; line-height: 2; color: var(--navy-soft); }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; padding-top: 8px; font-size: 13px; color: var(--navy-soft); }
.post-author-chip { display: flex; align-items: center; gap: 10px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--sky); color: var(--navy); display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.who { display: flex; flex-direction: column; line-height: 1.6; }
.who b { color: #fff; font-size: 14px; }
.sep { width: 1px; height: 28px; background: rgba(255, 255, 255, .15); }
.m-item { display: flex; align-items: center; gap: 6px; }

/* layout */
.post-body { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 28px; padding-block: 40px 96px; }
.post-col { flex: 999 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.post-side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.post-card { background: var(--h-card); border: 1px solid var(--h-line); border-radius: 28px; padding: 48px; display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.post-cover { width: 100%; height: auto; max-height: 360px; object-fit: cover; border-radius: 20px; margin-bottom: 8px; }

/* article typography (scoped to the post body only) */
.post-prose { font-size: 16px; line-height: 2.1; color: var(--h-muted); }
.post-prose > * + * { margin-top: 22px; }
.post-prose > :first-child { font-size: 18px; color: var(--h-ink); }
.post-prose p, .post-prose ul, .post-prose ol { margin-block: 0; }
.post-prose > * + * { margin-bottom: 0; }
.post-prose h2, .post-prose h3, .post-prose h4 { color: var(--h-ink); line-height: 1.6; scroll-margin-top: 96px; }
.post-prose h2 { margin: 38px 0 0; padding: 0; border: 0; font-size: 26px; }
.post-prose h3 { margin: 30px 0 0; font-size: 21px; }
.post-prose h4 { margin: 24px 0 0; font-size: 18px; }
.post-prose a { color: var(--h-link); text-decoration: underline; text-underline-offset: .25em; text-decoration-thickness: 1px; word-break: break-word; }
.post-prose a:hover { text-decoration-thickness: 2px; }
.post-prose ul, .post-prose ol { padding-inline-start: 22px; display: flex; flex-direction: column; gap: 8px; }
.post-prose ul { list-style: disc; } .post-prose ol { list-style: decimal; }
.post-prose li { margin: 0; }
.post-prose img { max-width: 100%; height: auto; border-radius: 20px; margin: 0; }
.post-prose figure { margin: 28px 0; }
.post-prose figure img { display: block; margin-inline: auto; }
.post-prose figcaption { margin-top: 10px; font-size: 13px; color: var(--h-faint); text-align: center; }
.post-prose blockquote { margin: 28px 0; padding: 20px 22px; border: 0; border-radius: 18px; background: #e0f2fe; color: #0b3a6b; font-size: 15px; line-height: 1.95; }
.post-prose blockquote p { margin: 0; } .post-prose blockquote p + p { margin-top: 8px; }
.post-prose hr { border: 0; border-top: 1px solid var(--h-line); margin: 32px 0; }
.post-prose :not(pre) > code { padding: 2px 7px; border: 0; border-radius: 6px; background: var(--h-soft); color: #0b3a6b; font-family: var(--mono); font-size: .86em; direction: ltr; unicode-bidi: isolate; }
.post-prose table { display: block; width: 100%; max-width: 100%; overflow-x: auto; border-collapse: separate; border-spacing: 0; margin: 28px 0; font-size: 14px; border: 1px solid var(--h-line); border-radius: 14px; }
.post-prose th, .post-prose td { padding: 10px 14px; border: 0; border-bottom: 1px solid var(--h-line); text-align: start; }
.post-prose tr:last-child td { border-bottom: 0; }
.post-prose th { background: var(--h-soft); color: var(--h-ink); font-weight: 700; }
.post-prose iframe, .post-prose video { max-width: 100%; border-radius: 18px; }

/* code blocks: dark navy panel like the mockup; long lines scroll inside the box */
.code-wrap { position: relative; margin: 28px 0; border-radius: 18px; overflow: hidden; }
.post-prose pre { margin: 28px 0; padding: 18px 20px; max-width: 100%; overflow-x: auto; border: 0; border-radius: 18px; background: var(--navy); color: #d6e2f0;
  font-family: var(--mono); font-size: 13px; line-height: 1.9; tab-size: 2; direction: ltr; text-align: left; }
.code-wrap pre { margin: 0; padding-top: 60px; border-radius: 0; }
.post-prose pre code { background: none; color: inherit; font-size: inherit; padding: 0; white-space: pre; unicode-bidi: normal; }
.post-prose pre.plain { font-family: var(--font); white-space: pre-wrap; direction: rtl; text-align: start; }
.code-copy { position: absolute; top: 8px; inset-inline-end: 12px; height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .14); background: transparent;
  color: #cfe9fa; font: 11px var(--mono); cursor: pointer; transition: background .15s; }
.code-copy:hover { background: rgba(255, 255, 255, .1); }
.code-copy:focus-visible { outline-color: var(--sky); }
.code-wrap::before { content: attr(data-lang); position: absolute; inset: 0 0 auto; height: 42px; padding-inline: 16px; border-bottom: 1px solid rgba(255, 255, 255, .08);
  background: var(--navy); color: var(--navy-muted); font: 12px/42px var(--mono); text-align: left; direction: ltr; z-index: 1; pointer-events: none; }
.code-copy { z-index: 2; }
.post-prose .chroma, .post-prose .bg { background: var(--navy); color: #d6e2f0; }
.post-prose .chroma .line { display: inline; }
.post-prose .chroma .hl { background: rgba(255, 255, 255, .08); }
.post-prose .chroma span[class^="k"] { color: #c792ea; font-weight: 400; }
.post-prose .chroma .kt, .post-prose .chroma .nc, .post-prose .chroma .nn { color: #ffcb6b; font-weight: 400; }
.post-prose .chroma span[class^="s"] { color: #c3e88d; }
.post-prose .chroma span[class^="c"] { color: #8fa3bf; font-style: italic; }
.post-prose .chroma span[class^="m"] { color: #f78c6c; }
.post-prose .chroma .nf, .post-prose .chroma .fm, .post-prose .chroma .nb, .post-prose .chroma .bp { color: #82aaff; font-weight: 400; }
.post-prose .chroma .na, .post-prose .chroma .nd, .post-prose .chroma .nt, .post-prose .chroma .no, .post-prose .chroma .nl { color: #5cc8ff; font-weight: 400; }
.post-prose .chroma .o, .post-prose .chroma .ow, .post-prose .chroma .p { color: #89ddff; }
.post-prose .chroma .err { color: #ff8b8b; background: none; }
.post-prose .chroma .ln, .post-prose .chroma .lnt { color: #7d8ca3; }

/* footer of article: tags + share */
.post-foot { margin-top: 16px; padding-top: 24px; border-top: 1px solid var(--h-line); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.post-tags a, .pop-tags a { display: inline-block; padding: 6px 14px; border-radius: 999px; background: var(--h-bg); color: var(--h-muted); font-size: 13px; line-height: 1.8; transition: background .15s, color .15s; }
.pop-tags a { padding-inline: 12px; }
.post-tags a:hover, .pop-tags a:hover { background: #e0f2fe; color: #0468d7; }
.post-share { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--h-muted); }
.post-share a, .share-copy { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--h-line); background: transparent; color: var(--h-ink); display: grid; place-items: center; cursor: pointer; transition: background .15s; }
.post-share a:hover, .share-copy:hover { background: var(--h-soft); }
.share-copy.is-done { color: #047857; border-color: #047857; }

/* prev / next */
.post-pn { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.post-pn a { display: flex; flex-direction: column; gap: 6px; padding: 22px 24px; border-radius: 20px; background: var(--h-card); border: 1px solid var(--h-line); transition: border-color .15s; }
.post-pn a:hover { border-color: var(--h-link); }
.post-pn span { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--h-faint); }
.post-pn b { font-size: 15px; line-height: 1.8; }
.pn-next { text-align: left; } .pn-next span { justify-content: flex-end; }

/* comments: restyle the shared thread to the mockup box (markup/HTMX untouched) */
.post-comments .comments { margin: 0; padding: 32px 40px; border-radius: 28px; background: var(--h-card); border: 1px solid var(--h-line); display: flex; flex-direction: column; gap: 16px; }
.post-comments .c-title { margin: 0; font-size: 20px; }
.post-comments .c-subtitle { margin: 8px 0 0; font-size: 17px; }
.post-comments .c-item { margin-block: 12px; }
.post-comments .c-form { gap: 16px; }
.post-comments .c-form label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 4px; font-size: 13px; color: var(--h-muted); font-weight: 400; }
.post-comments .c-form label > :is(input, textarea, select) { flex: 1 0 100%; }
.post-comments .c-form input[type=text], .post-comments .c-form input[type=email], .post-comments .c-form textarea {
  border-radius: 14px; border: 1px solid var(--h-btn-line); background: var(--h-bg); color: var(--h-ink); padding: 14px 16px; font-size: 14px; }
.post-comments .c-form .btn { height: 46px; padding: 0 22px; border-radius: 12px; border-color: #0468d7; background: #0468d7; color: #fff; font-size: 14px; font-weight: 700; transition: filter .15s, transform .15s; }
.post-comments .c-form .btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.post-comments .c-form .btn-link { background: none; border-color: transparent; color: var(--h-link); }
.post-comments .c-reply { color: var(--h-link); }
.post-comments .c-date { color: var(--h-faint); }

/* sidebar */
.side-card { padding: 24px; border-radius: 24px; background: var(--h-card); border: 1px solid var(--h-line); display: flex; flex-direction: column; gap: 14px; }
.side-card h2 { font-size: 16px; line-height: 1.6; }
.toc { position: sticky; top: 88px; gap: 6px; max-height: calc(100vh - 104px); overflow-y: auto; }
.toc .side-head { margin-bottom: 8px; }
.toc ol { display: flex; flex-direction: column; gap: 4px; }
.toc a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--h-muted); font-size: 14px; line-height: 1.7; transition: background .15s, color .15s; }
.toc .is-sub a { padding-inline-start: 34px; font-size: 13px; }
.toc a .mono { flex: none; font-size: 12px; }
.toc a:hover { background: var(--h-soft); color: var(--h-ink); }
.toc a.is-active { background: #e0f2fe; color: #0468d7; font-weight: 700; }
.toc-progress { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--h-faint); }
.toc-progress progress { width: 100%; height: 6px; border: 0; border-radius: 3px; background: var(--h-soft); overflow: hidden; appearance: none; -webkit-appearance: none; }
.toc-progress progress::-webkit-progress-bar { background: var(--h-soft); }
.toc-progress progress::-webkit-progress-value { background: #0468d7; border-radius: 3px; }
.toc-progress progress::-moz-progress-bar { background: #0468d7; border-radius: 3px; }
.author-row { display: flex; align-items: center; gap: 12px; }
.avatar-lg { width: 52px; height: 52px; border-radius: 16px; background: var(--navy); color: var(--sky); display: grid; place-items: center; font-size: 20px; font-weight: 700; }
.author .who b { color: var(--h-ink); font-size: 15px; } .author .who small { font-size: 12px; color: var(--h-faint); }
.side-btn { display: flex; align-items: center; justify-content: center; height: 44px; border-radius: 12px; border: 1px solid var(--h-btn-line); font-size: 13px; font-weight: 700; transition: background .15s; }
.side-btn:hover { background: var(--h-soft); }
.rel-list { display: flex; flex-direction: column; gap: 16px; }
.rel { display: flex; gap: 12px; align-items: center; }
.rel img, .rel-ph { width: 64px; height: 64px; flex: none; border-radius: 14px; object-fit: cover; }
.rel-ph { display: grid; place-items: center; background: #e0f2fe; color: #0468d7; font-size: 14px; font-weight: 700; }
.rel-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rel-txt strong { font-size: 14px; line-height: 1.8; font-weight: 700; transition: color .15s; }
.rel:hover strong { color: var(--h-link); }
.rel-txt small { font-size: 12px; color: var(--h-faint); }
.pop-tags { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 1080px) { .toc { position: static; max-height: none; } }
@media (max-width: 640px) {
  .post-hero-in { padding-block: 28px 40px; gap: 18px; }
  .post-title { font-size: 28px; line-height: 1.55; }
  .post-lead { font-size: 16px; }
  .post-body { padding-block: 24px 56px; gap: 20px; }
  .post-card, .post-comments .comments { padding: 24px; border-radius: 22px; }
  .post-prose h2 { font-size: 22px; }
  .post-prose > :first-child { font-size: 17px; }
  .post-pn { grid-template-columns: 1fr; }
  .post-foot { flex-direction: column; align-items: flex-start; }
}
