/* The blog (/blog/ and /blog/<slug>/, built by tools/blog.mjs). It sits on course.css (hero, sections, crumbs) and
   uses the same tokens and type scale: 13, 15, 16 (buttons), 18 (17 under 960 px), 20, 24, then h2 and h1. */
.page-blog .nav-links a[aria-current="page"] { color: #fff; }

/* ---------- cards ---------- */
.post-card { position: relative; display: flex; flex-direction: column; background: var(--paper); color: var(--text); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; text-decoration: none; transition: transform .2s var(--ease-out), box-shadow .2s; }
.post-card[hidden] { display: none; }
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.post-card:active { transform: scale(.99); }
.post-cover { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--ink); }
.post-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease-out); }
.post-card:hover .post-cover img { transform: scale(1.04); }
.post-meta { display: flex; justify-content: space-between; gap: 12px; padding: 18px 22px 0; font-size: 13px; color: var(--text-3); }
.post-topic { font-family: var(--f-mono); color: var(--violet); }
.post-title { padding: 8px 22px 0; font-size: 20px; font-weight: 600; line-height: 1.25; text-wrap: balance; }
.post-dek { padding: 8px 22px 0; font-size: 15px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-date { margin-top: auto; padding: 16px 22px 20px; font-size: 13px; color: var(--text-3); }
.post-card-big .post-title { font-size: 24px; }
.post-card-big .post-dek { font-size: 18px; -webkit-line-clamp: 4; }
.post-grid-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.fav-grid { display: grid; grid-template-columns: 1.4fr 1fr; grid-template-rows: auto auto; gap: 20px; }
.fav-grid .post-card-big { grid-row: span 2; }
.fav-grid .post-card:not(.post-card-big) { display: grid; grid-template-columns: 42% 1fr; grid-template-rows: auto auto 1fr auto; }
.fav-grid .post-card:not(.post-card-big) .post-cover { grid-row: 1 / -1; aspect-ratio: auto; height: 100%; }
.fav-grid .post-card:not(.post-card-big) .post-dek { -webkit-line-clamp: 2; }

/* ---------- index ---------- */
.blog-hero .cp-copy h1 { max-width: 11em; }
.blog-fav { padding-bottom: 0; }
.all-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px 24px; margin-bottom: 24px; }
.all-head h2 { margin-bottom: 0; }
.find { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px; border-radius: var(--r-pill); background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); width: min(100%, 320px); color: var(--text-3); }
.find:focus-within { box-shadow: inset 0 0 0 2px var(--violet); }
.find svg { width: 18px; height: 18px; flex: none; }
.find input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: 16px; color: var(--text); outline: none; }
.topics { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; scroll-margin-top: 96px; }
.topic { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--r-pill); background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); font-size: 15px; font-weight: 600; text-decoration: none; scroll-margin-top: 96px; transition: background .15s, color .15s; }
.topic .mono { font-size: 13px; font-weight: 400; color: var(--text-3); }
.topic:hover { background: var(--violet-50); }
.topic[aria-current="true"] { background: var(--violet); color: #fff; box-shadow: none; }
.topic[aria-current="true"] .mono { color: rgba(255,255,255,.8); }
.find-none { color: var(--text-2); margin-bottom: 24px; }

/* the closing band: a course to go deeper */
.blog-cta { background: linear-gradient(160deg, var(--violet), var(--violet-deep)); }
.blog-cta-in { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 24px 48px; }
.blog-cta h2 { margin: 0; max-width: 16em; }
.blog-cta .label { color: rgba(255,255,255,.84); }
.blog-cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.blog-cta-free { background: #fff; color: var(--violet-deep); }
.blog-cta-free:hover { background: var(--violet-50); transform: translateY(-1px); }

/* ---------- article ---------- */
.read-bar { position: fixed; inset: 64px 0 auto 0; height: 3px; z-index: 9; pointer-events: none; }
.read-bar i { display: block; height: 100%; background: var(--violet-300); transform: scaleX(0); transform-origin: 0 50%; }
.post-hero { padding-top: calc(64px + clamp(32px, 5vw, 64px)); background: radial-gradient(120% 90% at 0% 0%, #2A1670 0%, rgba(14,11,31,0) 60%), linear-gradient(180deg, #0E0B1F, #211A4A); overflow: hidden; }
.post-hero-in { position: relative; z-index: 1; }
.post-hero h1 { font-size: clamp(2.5rem, 4.6vw, 4rem); max-width: 14em; margin: 16px 0 18px; }
.post-hero .lede { max-width: 36em; }
.post-hero-art { position: absolute; right: max(var(--pad), calc((100vw - var(--maxw)) / 2)); top: 50%; translate: 0 -40%; width: min(34vw, 460px); border-radius: var(--r-xl); opacity: .9; mask-image: radial-gradient(closest-side, #000 70%, transparent); }
.post-hero:has(.post-hero-art) .post-hero-in > * { max-width: min(760px, 58vw); }
.byline { display: flex; align-items: center; gap: 12px; margin-top: 28px; }
.byline .headshot { width: 44px; height: 44px; border-radius: 50%; box-shadow: 0 0 0 2px var(--violet-300); }
.byline > span { display: flex; flex-direction: column; line-height: 1.3; }
.byline b { font-weight: 600; color: var(--fg); }
.byline .mono { font-size: 13px; color: var(--fg-2); }

.post-main { padding-top: clamp(40px, 5vw, 64px); }
.post-grid { display: grid; grid-template-columns: 220px minmax(0, 720px); gap: 56px; justify-content: center; }
.post-side { position: sticky; top: 96px; align-self: start; display: grid; gap: 32px; font-size: 15px; }
.toc ol { list-style: none; padding: 0; display: grid; gap: 2px; counter-reset: toc; }
.toc a { display: block; padding: 6px 0 6px 14px; color: var(--text-2); text-decoration: none; line-height: 1.35; box-shadow: inset 2px 0 0 var(--line); transition: color .15s, box-shadow .15s; }
.toc a:hover { color: var(--text); }
.toc a[aria-current="true"] { color: var(--violet); box-shadow: inset 2px 0 0 var(--violet); font-weight: 600; }
.share { display: flex; flex-wrap: wrap; gap: 8px; }
.share .label { width: 100%; margin: 0; }
.share a, .share button { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: var(--r-pill); border: 0; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; }
.share a:hover, .share button:hover { background: var(--violet-50); }

.prose { font-size: 18px; line-height: 1.75; color: var(--text); min-width: 0; }
.prose > p { margin-bottom: 1.15em; }
.prose h2 { font-size: var(--t-h3); font-stretch: 100%; letter-spacing: 0; font-weight: 600; line-height: 1.25; margin: 2em 0 .6em; scroll-margin-top: 96px; }
.prose a { color: var(--violet); font-weight: 600; text-underline-offset: 3px; }
.prose strong { font-weight: 700; }
.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.4em; display: grid; gap: .4em; }
.prose li::marker { color: var(--violet); font-family: var(--f-mono); font-size: 15px; }
.pull { margin: 1.6em 0; padding: 4px 0 4px 24px; box-shadow: inset 3px 0 0 var(--violet); }
.pull p { font-size: var(--t-h3); line-height: 1.35; font-weight: 600; font-stretch: 90%; color: var(--text); text-wrap: balance; }
.fig { margin: 2em 0; }
.fig-zoom { display: block; width: 100%; padding: 0; border: 0; background: var(--paper); border-radius: var(--r-md); box-shadow: var(--shadow-1); overflow: hidden; cursor: zoom-in; }
.fig-zoom img { width: 100%; }
.fig figcaption { margin-top: 10px; font-size: 15px; color: var(--text-3); }
.post-note { font-size: 15px; line-height: 1.5; color: var(--text-2); padding: 12px 16px; border-radius: var(--r-md); box-shadow: inset 0 0 0 1px var(--line); margin-bottom: 2em !important; }
.post-source { font-size: 15px; color: var(--text-2); margin-top: 2.4em; padding-top: 1.4em; border-top: 1px solid var(--line); }
.tags { list-style: none; padding: 0 !important; display: flex !important; flex-wrap: wrap; gap: 8px !important; margin-top: 1em !important; }
.tags li { font-family: var(--f-mono); font-size: 13px; padding: 4px 10px; border-radius: var(--r-pill); background: var(--violet-50); color: var(--violet-deep); }
.author { display: flex; gap: 20px; align-items: flex-start; margin-top: 40px; padding: 24px; background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow-1); font-size: 15px; line-height: 1.55; color: var(--text-2); }
.author img { width: 72px; height: 72px; border-radius: 50%; flex: none; }
.author b { font-size: 18px; color: var(--text); }
.author .text-link { margin-top: 8px; }
.post-more { padding-top: 24px; }

.zoom { border: 0; padding: 0; background: none; max-width: 96vw; max-height: 94vh; }
.zoom::backdrop { background: rgba(14,11,31,.88); }
.zoom img { max-width: 96vw; max-height: 86vh; width: auto; border-radius: var(--r-md); }
.zoom form { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.zoom-close { min-height: 40px; padding: 0 16px; border: 0; border-radius: var(--r-pill); background: #fff; color: var(--text); font-weight: 600; cursor: pointer; }

@media (max-width: 1100px) {
  .post-hero-art { display: none; }
  .post-hero:has(.post-hero-art) .post-hero-in > * { max-width: none; }
}
@media (max-width: 959px) {
  .post-grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fav-grid { grid-template-columns: 1fr; }
  .fav-grid .post-card-big { grid-row: auto; }
  .post-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .post-side { position: static; order: 2; margin-top: 32px; }
  .post-side .toc { display: none; }
  .prose { font-size: 17px; }
  .read-bar { top: 56px; }
}
@media (max-width: 640px) {
  .post-grid-cards { grid-template-columns: minmax(0, 1fr); }
  .fav-grid .post-card:not(.post-card-big) { display: flex; }
  .fav-grid .post-card:not(.post-card-big) .post-cover { aspect-ratio: 16 / 10; height: auto; }
  .find { width: 100%; }
  .topics { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(-1 * var(--pad)); padding-inline: var(--pad); scrollbar-width: none; }
  .topic { flex: none; }
  .author { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .post-card, .post-cover img { transition: none; }
  .post-card:hover { transform: none; }
  .post-card:hover .post-cover img { transform: none; }
}
