/* Blog post template. Tokens come from main.css (Cloth and Foil). */
.is-post { --foil-wash: #f1ead9; --ok: #1d5a3c; --ok-bg: #e4f1ea; --bad: #8a2a1e; --bad-bg: #fbe9e7; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

/* ---------- Head ---------- */
.post-head { background: var(--paper); border-bottom: 1px solid var(--line); padding: 28px 0 clamp(32px, 4vw, 52px); }
.post-head .crumbs { margin-bottom: clamp(22px, 3vw, 38px); }
.post-title { max-width: 30ch; margin: 0 0 .35em; font-size: clamp(2rem, 1.3rem + 2.4vw, 3.1rem); font-weight: 500; line-height: 1.12; letter-spacing: -0.02em; text-wrap: balance; }
.post-dek { max-width: 62ch; margin: 0 0 1.5em; font: 400 clamp(1.08rem, 1rem + .3vw, 1.25rem)/1.55 var(--serif); color: var(--slate); }
.post-byline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; margin: 0; padding-top: 18px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.post-byline strong { color: var(--ink); font-weight: 600; }
.post-byline > span + span::before { content: ""; display: inline-block; width: 4px; height: 4px; margin: 0 12px; border-radius: 50%; background: currentColor; opacity: .45; vertical-align: middle; }

/* ---------- Layout ---------- */
.post-shell { display: grid; grid-template-columns: minmax(0, 700px) 340px; justify-content: space-between; column-gap: 48px; align-items: start; padding-top: clamp(36px, 5vw, 60px); padding-bottom: clamp(48px, 6vw, 72px); }
.post-article { min-width: 0; }
.post-aside { min-width: 0; }
.post-aside__inner { position: sticky; top: calc(var(--tap-hh, 130px) + 20px); }
.post-end { padding-bottom: 0; }
.post-end .cta-band { margin-top: 0; }

/* ---------- Article body ---------- */
.post-body.entry { padding: 0; font-size: 1.0625rem; line-height: 1.72; }
.post-body.entry > * { max-width: none; margin-left: 0; margin-right: 0; }
.post-body > p:first-child { font: 400 1.22rem/1.6 var(--serif); letter-spacing: -0.005em; }
.post-body h2 { margin: 2.1em 0 .6em; font-size: clamp(1.45rem, 1.2rem + .8vw, 1.8rem); line-height: 1.2; scroll-margin-top: calc(var(--tap-hh, 130px) + 16px); }
.post-body h3 { margin: 1.7em 0 .5em; font-size: 1.25rem; }
.post-body ul, .post-body ol { padding-left: 1.3em; }
.post-body li::marker { color: var(--cloth); }
.post-body a:not(.btn) { text-decoration-color: rgba(31, 61, 54, .4); }
.post-body a:not(.btn):hover { text-decoration-color: currentColor; }
.post-body blockquote { margin: 1.6em 0; padding: .2em 0 .2em 1.3em; border-left: 3px solid var(--cloth); font: italic 400 1.15rem/1.6 var(--serif); color: var(--slate); }
.post-body img { border-radius: var(--radius); }
.post-body section { margin-bottom: 0; }

/* Key takeaways */
.post-body .post-takeaways { margin: 2em 0; padding: clamp(20px, 3vw, 28px) clamp(20px, 3vw, 32px); background: var(--foil-wash); border: 1px solid var(--foil-soft); border-top: 4px solid var(--foil); border-radius: var(--radius); }
.post-body .post-takeaways h2 { margin: 0 0 .65em; font-size: 1.2rem; }
.post-body .post-takeaways ul { margin: 0; }
.post-body .post-takeaways li { margin-bottom: .5em; }
.post-body .post-takeaways li:last-child { margin-bottom: 0; }

/* In this article */
.post-body .post-toc { margin: 2em 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.post-toc summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; list-style: none; cursor: pointer; font: 600 .78rem/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.post-toc summary::-webkit-details-marker { display: none; }
.post-toc summary::after { content: ""; width: 8px; height: 8px; margin-top: -4px; border: solid var(--cloth); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .15s; }
.post-toc[open] summary::after { margin-top: 3px; transform: rotate(-135deg); }
.post-toc ol { margin: 0; padding: 0 22px 18px; list-style: none; counter-reset: toc; columns: 2; column-gap: 32px; }
.post-toc li { position: relative; margin: 0 0 8px; padding-left: 2.1em; break-inside: avoid; font-size: .97rem; line-height: 1.4; counter-increment: toc; }
.post-toc li::before { content: counter(toc, decimal-leading-zero); position: absolute; left: 0; top: .1em; font: 600 .78rem/1.6 var(--sans); color: var(--muted); }
.post-toc a { color: var(--ink); text-decoration: none; }
.post-toc a:hover { color: var(--cloth); text-decoration: underline; }

/* Tables */
.post-body .table-wrap { margin: 1.7em 0; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); -webkit-overflow-scrolling: touch; }
.post-body table { width: 100%; min-width: 520px; margin: 0; border-collapse: collapse; font-size: .95rem; line-height: 1.5; }
.post-body th, .post-body td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.post-body thead th { background: var(--cloth); color: #fff; border-bottom: 0; font: 600 .78rem/1.3 var(--sans); letter-spacing: .05em; text-transform: uppercase; }
.post-body tbody tr:last-child td { border-bottom: 0; }
.post-body tbody td:first-child { font-weight: 600; }
.post-body tbody tr:nth-child(even) td { background: var(--paper); }

/* FAQ block already styled in main.css; tighten its spacing here */
.post-body section.faq-block { margin: 2.4em 0 0; }

/* Keep reading and topic line (added by the internal-links layer) */
.post-body .related-guides { margin: 3em 0 0; padding: 1.8em 0 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.post-body .related-guides h2 { margin: 0 0 .6em; font-size: 1.3rem; }
.post-body .related-guides-list { margin: 0; padding: 0; list-style: none; }
.post-body .related-guides-list li { margin: 0; padding: 14px 0; border-bottom: 1px solid var(--line); }
.post-body .related-guides-list li:last-child { border-bottom: 0; }
.post-body .related-guides-list a { display: block; font: 600 1.05rem/1.35 var(--serif); color: var(--ink); text-decoration: none; }
.post-body .related-guides-list a:hover { color: var(--cloth); text-decoration: underline; }
.post-body .related-guides-list span { display: block; margin-top: 4px; font-size: .92rem; line-height: 1.5; color: var(--muted); opacity: 1; }
.post-body .topic-hub { margin: 1.6em 0 0; padding: 14px 18px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); font-size: .95rem; color: var(--muted); }

/* ---------- Sidebar lead form ---------- */
.post-lead { background: var(--white); border: 1px solid var(--line); border-top: 5px solid var(--foil); border-radius: var(--radius); padding: clamp(20px, 2.4vw, 28px); box-shadow: 0 14px 36px rgba(21, 43, 38, .1); }
.pl-title { margin: 0 0 .3em; font: 600 1.4rem/1.2 var(--serif); color: var(--cloth-deep); }
.pl-sub { margin: 0 0 16px; color: var(--muted); font-size: .95rem; line-height: 1.5; }
.pl-form p { margin: 0 0 12px; }
.pl-form label { display: block; margin-bottom: 5px; font: 600 13.5px/1.2 var(--sans); }
.pl-opt { font-weight: 400; color: var(--muted); }
.pl-form input[type=text], .pl-form input[type=email], .pl-form select { width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--white); color: var(--ink); font: 400 16px/1.4 var(--sans); }
.pl-form input:focus, .pl-form select:focus { border-color: var(--cloth); outline: 2px solid rgba(31, 61, 54, .15); outline-offset: 0; }
.pl-form .btn { width: 100%; }
.pl-form > p:last-child { margin: 0; }
.pl-form .pl-fine { margin: 10px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.pl-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.post-lead .lead-msg { margin: 0 0 14px; padding: 12px 16px; border-radius: var(--radius); font-weight: 500; }
.post-lead .lead-msg[hidden] { display: none; }
.post-lead .lead-msg.is-ok { background: var(--ok-bg); color: var(--ok); }
.post-lead .lead-msg.is-error { background: var(--bad-bg); color: var(--bad); }
.pl-form.is-sending .btn { opacity: .7; pointer-events: none; }
.pl-form.is-done { display: none; }

/* ---------- Reading progress and mobile quote bar ---------- */
.post-progress { position: fixed; top: 0; left: 0; right: 0; z-index: 120; height: 3px; pointer-events: none; }
.post-progress span { display: block; height: 100%; background: var(--foil); transform: scaleX(0); transform-origin: 0 50%; }
.post-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--white); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(21, 43, 38, .1); transform: translateY(110%); visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s; }
.post-bar.is-on { transform: none; visibility: visible; transition-delay: 0s; }
.post-bar .btn { width: 100%; }
@media (min-width: 901px) { .post-bar { display: none; } }
@media (prefers-reduced-motion: reduce) { .post-bar { transition: none; } .post-toc summary::after { transition: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
	.post-shell { grid-template-columns: minmax(0, 1fr); row-gap: 48px; }
	.post-aside__inner { position: static; }
}
@media (max-width: 640px) {
	.post-toc ol { columns: 1; }
	.post-byline > span + span::before { margin: 0 9px; }
}
@media (max-height: 680px) {
	.post-aside__inner { position: static; }
}
