/*
 * post.css: the shared shell for insights posts.
 *
 * Covers the hero, meta, kicker, author and checks; body typography; the
 * in-body and side-rail contents; the TL;DR; the figure frame (.fig, .fig-k,
 * .fig-t, .fig-src, .fig-brand, .fig-note, .fig-dl, .fig-wide); the .mk-*
 * markers, .lbl and .reg; and the FAQ, sources, inline CTA and related cards.
 *
 * Link it after styles.css and before the page's inline <style>:
 *   <link rel="stylesheet" href="../assets/styles.css" />
 *   <link rel="stylesheet" href="../assets/post.css" />
 *   <style> ...per-figure CSS... </style>
 *
 * Per-figure CSS stays inline in each post, and so does .vq: class names such
 * as .rule, .tline, .chain, .script and .formula mean different things in
 * different posts, and the older posts use a different .vq structure.
 * Rule order matters: several (0,1,1) ties are won by source order, e.g.
 * .related-post h3 over .post-body h3 and .tldr li over .post-body li.
 */

/* ---- Post shell (shared with other insights posts) ---- */
.post-hero { padding: clamp(56px, 7vw, 96px) 0 clamp(32px, 4vw, 48px); }
.post-meta { font-family: var(--font-mono); font-size: 11px; color: var(--ink-400); text-transform: uppercase; letter-spacing: 0.06em; display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.post-meta a { color: var(--ink-400); }
.post-meta a:hover { color: var(--ink-900); }
.post-hero h1 { font-size: clamp(1.9rem, 4.2vw, 3.1rem); line-height: 1.08; letter-spacing: -0.03em; font-weight: 500; max-width: 28ch; margin: 0; }
.post-hero .kicker { font-family: var(--font-mono); font-size: var(--fs-13); color: var(--ink-500); letter-spacing: 0.02em; margin-top: 18px; }
.post-author { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 24px 0; margin-top: 32px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.post-author .who { display: flex; gap: 12px; align-items: center; }
.post-author .name { font-size: var(--fs-14); font-weight: 500; }
.post-author .role { font-size: var(--fs-13); color: var(--ink-500); }
.post-checks { display: flex; gap: 20px; flex-wrap: wrap; }
.post-checks span { font-family: var(--font-mono); font-size: 11px; color: var(--ink-500); letter-spacing: 0.02em; display: inline-flex; align-items: center; gap: 7px; }
.post-checks span::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--ink-900); flex: none; }

.post-body { max-width: 70ch; margin: 0 auto; }
.post-body p { font-size: var(--fs-18); line-height: 1.75; color: var(--ink-700); margin: 0 0 24px; }
.post-body p.opening { font-size: var(--fs-20); line-height: 1.65; color: var(--ink-900); }
.post-body p.disclaimer { font-family: var(--font-mono); font-size: var(--fs-13); color: var(--ink-500); letter-spacing: 0.01em; }
.post-body h2 { font-size: var(--fs-32); letter-spacing: -0.025em; margin: 68px 0 20px; font-weight: 500; color: var(--ink-900); scroll-margin-top: 96px; }
.post-body h3 { font-size: var(--fs-24); letter-spacing: -0.015em; margin: 44px 0 12px; font-weight: 500; color: var(--ink-900); scroll-margin-top: 96px; }
.post-body ul, .post-body ol { padding-left: 1.4em; margin: 0 0 24px; color: var(--ink-700); font-size: var(--fs-18); line-height: 1.7; }
.post-body li { margin-bottom: 12px; }
.post-body a.link { text-decoration: underline; text-decoration-color: var(--paper-300); text-underline-offset: 3px; }
.post-body a.link:hover { text-decoration-color: var(--ink-900); }

.post-toc { background: var(--paper-100); border-radius: var(--r-6); padding: 24px 28px; margin: 40px 0; }
.post-toc .k, .tldr .k, .sources .k { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-400); margin-bottom: 12px; }
.post-toc ol { list-style: none; padding: 0 !important; margin: 0 !important; columns: 2; column-gap: 32px; }
@media (max-width: 640px) { .post-toc ol { columns: 1; } }
.post-toc li { margin: 0 !important; padding: 5px 0; font-size: var(--fs-14); line-height: 1.4; break-inside: avoid; }
.post-toc li a { color: var(--ink-700); display: flex; gap: 10px; align-items: baseline; }
.post-toc li a:hover { color: var(--ink-900); }
.post-toc li .n { font-family: var(--font-mono); font-size: 11px; color: var(--ink-400); flex: none; }

/* Side rail: wide screens only, sits in the empty left margin, never over the text */
.rail-toc { display: none; }
@media (min-width: 1480px) {
  .rail-toc { display: block; position: fixed; top: 120px; left: max(32px, calc(50% - 500px - 248px)); width: 208px; max-height: calc(100vh - 160px); overflow-y: auto; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease); z-index: 5; }
  .rail-toc.is-on { opacity: 1; pointer-events: auto; transform: none; }
}
.rail-toc .k { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-400); margin-bottom: 10px; }
.rail-toc ol { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--line-soft); }
.rail-toc a { display: block; font-size: var(--fs-13); line-height: 1.35; color: var(--ink-400); padding: 5px 0 5px 14px; margin-left: -1px; border-left: 1px solid transparent; transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.rail-toc a:hover { color: var(--ink-900); }
.rail-toc a.is-active { color: var(--ink-900); border-left-color: var(--ink-900); }
@media (prefers-reduced-motion: reduce) { .rail-toc { transition: none; } }

.tldr { border: 1px solid var(--paper-300); border-radius: var(--r-6); padding: 28px 32px; margin: 40px 0; }
.tldr .k { margin-bottom: 16px; }
.tldr ul { margin: 0; padding-left: 1.2em; }
.tldr li { font-size: var(--fs-16); line-height: 1.6; margin-bottom: 14px; }
.tldr li:last-child { margin-bottom: 0; }

/* ---- Figure frame ---- */
.fig { border: 1px solid var(--line-soft); border-radius: var(--r-6); padding: 28px; margin: 44px 0 0; background: var(--paper-000); }
.fig .fig-k { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-400); }
.fig .fig-t { font-size: var(--fs-16); font-weight: 500; color: var(--ink-900); margin: 6px 0 24px; letter-spacing: -0.01em; line-height: 1.4; }
.fig .fig-src { font-family: var(--font-mono); font-size: 11px; color: var(--ink-400); margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line-soft); line-height: 1.6; }
.fig .fig-src a { color: var(--ink-500); text-decoration: underline; text-decoration-color: var(--paper-300); text-underline-offset: 2px; }
.fig .fig-src a:hover { color: var(--ink-900); }
.fig .fig-brand { float: right; margin-left: 16px; color: var(--ink-900); font-weight: 500; letter-spacing: 0; }
.post-body .fig .fig-note { font-size: var(--fs-13); color: var(--ink-500); margin: 18px 0 0; line-height: 1.6; }
.fig-dl, .post-body p.fig-dl { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.02em; margin: 10px 0 44px !important; text-align: right; }
.post-body .fig-dl a { color: var(--ink-400); text-decoration: underline; text-decoration-color: var(--paper-300); text-underline-offset: 2px; }
.post-body .fig-dl a:hover { color: var(--ink-900); }
.fig-wide { width: min(1000px, calc(100vw - 48px)); margin-left: calc((min(1000px, 100vw - 48px) - 100%) / -2); }
.fig-wide + .fig-dl { width: min(1000px, calc(100vw - 48px)); margin-left: calc((min(1000px, 100vw - 48px) - 100%) / -2) !important; }
.mk { display: inline-block; flex: none; }
.mk-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-900); }
.mk-hatch { width: 12px; height: 12px; border-radius: 2px; border: 1px solid var(--ink-700); background: repeating-linear-gradient(135deg, var(--ink-700) 0 1.5px, transparent 1.5px 4px); }
.mk-risk, .mk-dev { width: 12px; height: 12px; border-radius: 2px; background: var(--error-500); }
.mk-ring { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--ink-400); }
.lbl { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-400); }
.reg { display: inline-block; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.04em; color: var(--ink-700); background: var(--paper-100); border-radius: var(--r-full); padding: 3px 9px; white-space: nowrap; }
.reg.risk { color: var(--error-700); background: var(--error-50); }

/* ---- FAQ, sources, CTA, related ---- */
.post-faq h3 { margin-top: 36px; }
.sources { margin: 48px 0 0; border-top: 1px solid var(--line-soft); padding-top: 28px; }
.sources .k { margin-bottom: 16px; }
.sources ul { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 40px; }
@media (max-width: 640px) { .sources ul { columns: 1; } }
.sources li { font-family: var(--font-mono); font-size: var(--fs-12); line-height: 1.5; padding: 5px 0; break-inside: avoid; margin: 0; }
.sources a { color: var(--ink-500); text-decoration: underline; text-decoration-color: var(--paper-300); text-underline-offset: 2px; }
.sources a:hover { color: var(--ink-900); }

.inline-cta { background: var(--paper-100); border-radius: var(--r-6); padding: 28px 32px; margin: 48px 0; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.inline-cta .text { font-size: var(--fs-16); color: var(--ink-900); font-weight: 500; max-width: 34ch; line-height: 1.4; }
.inline-cta .sub { font-size: var(--fs-13); color: var(--ink-500); margin-top: 4px; font-weight: 400; }

.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 32px; }
@media (max-width: 800px) { .related-grid { grid-template-columns: 1fr; } }
.related-post { padding: 24px; background: var(--paper-000); border: 1px solid var(--line); border-radius: var(--r-6); display: flex; flex-direction: column; gap: 8px; transition: transform var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease); }
.related-post:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.related-post .date { font-family: var(--font-mono); font-size: 11px; color: var(--ink-400); text-transform: uppercase; letter-spacing: 0.05em; }
.related-post h3 { font-size: var(--fs-16); font-weight: 500; line-height: 1.35; margin: 4px 0 0; letter-spacing: -0.01em; }
.related-post .link-quiet { margin-top: auto; padding-top: 12px; font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; }
