/* Blog pages (rendered by worker/public.js), in the v7 design.
   Loaded after css/site.css, which supplies the tokens (--paper, --ink, --muted,
   --line, --violet, --lav), the Space font, the header, the footer, .wrap, .btn and
   .text-btn. v7 sets large global sizes on h1-h3 and zero margins on p; every
   rule here is scoped under .blog-page so it wins without !important.
   Bump BLOG_CSS_VERSION in worker/templates.js when this file changes. */

.blog-page main { display: block; }
.blog-page .container { width: min(1240px, calc(100% - 100px)); margin: 0 auto; }
@media (max-width: 900px) { .blog-page .container { width: calc(100% - 56px); } }
@media (max-width: 560px) { .blog-page .container { width: calc(100% - 40px); } }

/* ---------- Shared bits ---------- */
.blog-page .breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 0 0 32px; font-size: 13px; color: var(--muted); }
.blog-page .breadcrumb a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.blog-page .breadcrumb a:hover { color: var(--ink); }
.blog-page .breadcrumb [aria-current] { color: var(--ink); }
.blog-page .kicker { display: flex; align-items: center; gap: 12px; margin: 0 0 24px; font-size: 13px; color: var(--muted); }
.blog-page .kicker::after { content: ''; width: 40px; height: 1px; background: currentColor; opacity: .4; }
.blog-page .tag-pill { display: inline-block; padding: 4px 10px; border-radius: 100px; background: var(--lav); color: var(--violet); font-size: 12px; text-decoration: none; line-height: 1.4; }
.blog-page a.tag-pill:hover { background: color-mix(in srgb, var(--violet) 18%, var(--lav)); }
.blog-page .btn-secondary { background: none; color: var(--ink); min-height: 0; padding: 10px 0; border-radius: 0; border-bottom: 1px solid currentColor; gap: 16px; }
.blog-page .btn-secondary:hover { background: none; transform: none; color: var(--violet); }
.blog-page .section-head { margin: 0 0 40px; }
.blog-page .section-head h2 { font-size: clamp(32px, 4vw, 52px); line-height: 1.1; letter-spacing: -.045em; }

/* ---------- Index and archives ---------- */
.blog-page .hero { padding: 72px 0 56px; border-bottom: 1px solid var(--line); }
.blog-page .hero h1 { max-width: 14em; font-size: clamp(46px, 6vw, 82px); line-height: 1.06; letter-spacing: -.045em; text-wrap: balance; }
.blog-page .hero .lede { max-width: 40em; margin-top: 24px; font-size: clamp(17px, 1.4vw, 20px); line-height: 1.6; }
.blog-page .archive-note { margin-top: 24px; font-size: 13px; }
.blog-page .archive-note a { color: var(--muted); }
.blog-page .archive-note a:hover { color: var(--ink); }
.blog-page .hero + section { padding: 56px 0 24px; }
.blog-page .blog-empty { padding: 64px 0; text-align: center; }

.blog-page .blog-listing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 32px; }
@media (max-width: 1000px) { .blog-page .blog-listing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .blog-page .blog-listing-grid { grid-template-columns: 1fr; } }

.blog-page .blog-card { display: flex; flex-direction: column; gap: 18px; color: inherit; text-decoration: none; border-top: 1px solid var(--line); padding-top: 20px; }
.blog-page .blog-media { aspect-ratio: 16 / 9; border-radius: 3px; overflow: hidden; background: var(--white); }
.blog-page .blog-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.blog-page .blog-card:hover .blog-media img { transform: scale(1.02); }
.blog-page .blog-card-body { display: flex; flex-direction: column; flex: 1; }
.blog-page .post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 12px; color: var(--muted); margin: 0 0 12px; }
.blog-page .blog-card h3 { font-size: 24px; line-height: 1.22; letter-spacing: -.025em; margin: 0 0 10px; }
.blog-page .blog-card p { font-size: 14px; line-height: 1.7; margin: 0 0 18px; flex: 1; }
.blog-page .blog-card .read-more { align-self: flex-start; font-size: 13px; border-bottom: 1px solid currentColor; padding-bottom: 4px; }
.blog-page .blog-card:hover h3, .blog-page .blog-card:hover .read-more { color: var(--violet); }

.blog-page .blog-pagination { display: flex; justify-content: space-between; margin-top: 56px; }

/* ---------- Post ---------- */
.blog-page .blog-post { padding: 40px 0 72px; }
.blog-page .blog-post > .container { width: min(760px, calc(100% - 40px)); }
.blog-page .blog-post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 20px; font-size: 13px; color: var(--muted); }
.blog-page .post-updated::before { content: '·'; margin-right: 14px; }
.blog-page .blog-post h1 { font-size: clamp(38px, 5vw, 60px); line-height: 1.08; letter-spacing: -.045em; margin: 0 0 36px; text-wrap: balance; }
.blog-page .blog-hero-image { margin: 0 0 40px; border-radius: 3px; overflow: hidden; }
.blog-page .blog-hero-image img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }

.blog-page .key-takeaways { margin: 0 0 40px; padding: 24px 28px; background: var(--lav); border-left: 2px solid var(--violet); border-radius: 0 3px 3px 0; }
.blog-page .key-takeaways h2 { font-size: 13px; letter-spacing: 0; color: var(--violet); margin: 0 0 12px; }
.blog-page .key-takeaways ul { margin: 0; padding-left: 20px; }
.blog-page .key-takeaways li { margin: 0 0 8px; line-height: 1.6; }
.blog-page .key-takeaways li:last-child { margin-bottom: 0; }

.blog-page .post-toc { margin: 0 0 48px; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.blog-page .post-toc h2 { font-size: 13px; letter-spacing: 0; color: var(--muted); margin: 0 0 12px; }
.blog-page .post-toc ul { list-style: none; margin: 0; padding: 0; }
.blog-page .post-toc ul ul { margin: 6px 0 6px 18px; }
.blog-page .post-toc li { margin: 0 0 8px; line-height: 1.45; font-size: 14px; }
.blog-page .post-toc a { color: var(--muted); text-decoration: none; }
.blog-page .post-toc a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* Editor output (Quill), sanitised by worker/sanitize.js. */
.blog-page .blog-content { font-size: 17px; line-height: 1.75; color: var(--ink); }
.blog-page .blog-content p { color: var(--ink); margin: 0 0 24px; }
.blog-page .blog-content .blog-lead { font-size: 20px; line-height: 1.6; color: var(--muted); margin-bottom: 32px; }
.blog-page .blog-content h2 { font-size: 32px; line-height: 1.18; letter-spacing: -.035em; margin: 56px 0 18px; }
.blog-page .blog-content h3 { font-size: 23px; line-height: 1.3; letter-spacing: -.02em; margin: 40px 0 14px; }
.blog-page .blog-content h4 { font-size: 18px; font-weight: 400; margin: 28px 0 12px; }
.blog-page .blog-content strong, .blog-page .blog-content b { font-weight: 400; color: var(--ink); background: linear-gradient(transparent 62%, var(--lav) 62%); }
.blog-page .blog-content em, .blog-page .blog-content i { font-style: italic; }
.blog-page .blog-content a { color: var(--violet); text-decoration: underline; text-underline-offset: 3px; }
.blog-page .blog-content a:hover { color: var(--ink); }
.blog-page .blog-content ul, .blog-page .blog-content ol { margin: 0 0 24px; padding-left: 24px; }
.blog-page .blog-content li { margin-bottom: 8px; }
.blog-page .blog-content li > ul, .blog-page .blog-content li > ol { margin: 8px 0 0; }
.blog-page .blog-content blockquote { margin: 0 0 24px; padding: 4px 0 4px 20px; border-left: 2px solid var(--violet); color: var(--muted); font-size: 20px; line-height: 1.55; }
.blog-page .blog-content blockquote p { color: inherit; }
.blog-page .blog-content blockquote p:last-child { margin-bottom: 0; }
.blog-page .blog-content pre { margin: 0 0 24px; padding: 16px 20px; overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: 3px; font: 14px/1.6 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; }
.blog-page .blog-content code { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: .88em; background: var(--white); border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; }
.blog-page .blog-content pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.blog-page .blog-content img { display: block; max-width: 100%; height: auto; border-radius: 3px; margin: 0 0 24px; }
.blog-page .blog-content figure { margin: 0 0 24px; }
.blog-page .blog-content figure img { margin-bottom: 0; }
.blog-page .blog-content figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); text-align: center; }
.blog-page .blog-content hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
.blog-page .blog-content table { display: block; overflow-x: auto; width: 100%; margin: 0 0 24px; border-collapse: collapse; font-size: 14px; line-height: 1.55; }
.blog-page .blog-content th, .blog-page .blog-content td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.blog-page .blog-content th { background: var(--white); font-weight: 400; }
.blog-page .blog-content u { text-underline-offset: 3px; }
.blog-page .blog-content .ql-align-center { text-align: center; }
.blog-page .blog-content .ql-align-right { text-align: right; }
.blog-page .blog-content .ql-align-justify { text-align: justify; }
.blog-page .blog-content .ql-indent-1 { padding-left: 2em; }
.blog-page .blog-content .ql-indent-2 { padding-left: 4em; }
.blog-page .blog-content .ql-indent-3 { padding-left: 6em; }
.blog-page .blog-content iframe, .blog-page .blog-content .ql-video, .blog-page .blog-content video { display: block; width: 100%; max-width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; border-radius: 3px; margin: 0 0 24px; }
.blog-page .heading-anchor { margin-left: 10px; color: var(--muted); text-decoration: none; opacity: 0; transition: opacity .15s; }
.blog-page .blog-content :is(h2, h3, h4):hover .heading-anchor, .blog-page .heading-anchor:focus-visible { opacity: 1; }
@media (hover: none) { .blog-page .heading-anchor { display: none; } }

.blog-page .post-faq { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--line); }
.blog-page .post-faq h2 { font-size: 32px; letter-spacing: -.035em; margin: 0 0 24px; }
.blog-page .post-faq h3 { font-size: 19px; line-height: 1.35; letter-spacing: -.01em; margin: 24px 0 8px; }
.blog-page .post-faq p { line-height: 1.7; margin: 0 0 16px; }
.blog-page .post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 40px; }

.blog-page .author-box { display: flex; gap: 20px; align-items: flex-start; margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--line); }
.blog-page .author-avatar { flex: none; width: 64px; height: 64px; border-radius: 50%; overflow: hidden; background: var(--lav); }
.blog-page .author-avatar img { width: 100%; height: 100%; object-fit: cover; }
.blog-page .author-name { font-size: 18px; margin: 0 0 2px; }
.blog-page .author-name a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.blog-page .author-title { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.blog-page .author-box p { font-size: 14px; line-height: 1.7; max-width: 52ch; }

.blog-page .blog-nav-row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--line); }
.blog-page .related-posts { padding: 72px 0 24px; border-top: 1px solid var(--line); }

.blog-page .preview-banner { position: sticky; top: 0; z-index: 50; padding: 10px 20px; background: var(--lav); color: var(--ink); font-size: 14px; text-align: center; }
.blog-page .preview-banner a { color: var(--violet); text-decoration: underline; }

/* ---------- Closing band (CTA_BAND) ---------- */
.blog-page .blog-close { margin-top: 72px; padding: 88px 0 104px; border-top: 1px solid var(--line); }
.blog-page .blog-close-grid { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 32px 64px; }
.blog-page .blog-close h2 { max-width: 13em; font-size: clamp(36px, 4.4vw, 60px); line-height: 1.1; letter-spacing: -.045em; text-wrap: balance; }
.blog-page .blog-close .btn { min-width: 240px; font-size: 15px; }
@media (max-width: 640px) {
  .blog-page .hero { padding: 48px 0 40px; }
  .blog-page .blog-close { padding: 56px 0 72px; }
  .blog-page .blog-close-grid { flex-direction: column; align-items: flex-start; }
  .blog-page .blog-close .btn { width: 100%; }
}

/* The footer: v7 hides it while the Protocol is open; on the blog it always shows. */
.blog-page .site-footer { display: block; }
