/* The blog (/blog/): article header, table of contents, figures, author box, related cards, and the index,
   category and search pages. Loaded after docs.css. Markup comes from site/scripts/build-blog.mjs. */

/* ------------------------------------------------------------ article header */
.docs.post-wrap { padding-top: 104px; row-gap: 0; }
.post-head { grid-column: 1 / -1; max-width: 984px; margin-bottom: 56px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--fg-2); transition: color .2s; }
.crumbs a:hover { color: var(--accent); }
.crumbs a:last-child { color: var(--accent); }
.post-head h1 { max-width: 24ch; margin: 0; font-size: clamp(32px, 5vw, 52px); line-height: 1.08; letter-spacing: -0.035em; text-wrap: balance; scroll-margin-top: 96px; }
.post-lede { max-width: 62ch; margin: 18px 0 26px; font-size: clamp(17px, 1.9vw, 20px); line-height: 1.55; color: var(--fg-2); text-wrap: pretty; }
.byline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.byline img { border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px var(--line); }
.byline > div { display: grid; line-height: 1.3; }
.byline-name { font-weight: 600; color: var(--fg); }
.byline-name:hover { color: var(--accent); }
.byline-role { font-size: 13px; color: var(--muted); }
.byline-meta { flex-basis: 100%; margin: 4px 0 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.post-cover { margin: 32px 0 0; }
.post-cover img, .post-fig img, .featured > a > img, .card > a > img, .post-related a > img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; background: #fbf6ef; box-shadow: var(--shadow-1); }
.post-cover img { border-radius: 22px; }

/* ------------------------------------------------------------ table of contents */
.post-wrap .toc { top: 88px; max-height: calc(100vh - 112px); overflow-y: auto; scrollbar-width: thin; }
.toc-title { margin: 0 0 6px; padding: 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.post-wrap .toc a { line-height: 1.35; }
/* The section being read (blog/toc.js), like the docs' active link. */
.post-wrap .toc a.is-here { color: var(--fg); background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.toc-m { display: none; }

/* ------------------------------------------------------------ figures */
.doc.post .post-fig { max-width: 100%; margin: 4px 0 28px; }
.post-fig img { border-radius: 16px; }
.post-fig figcaption { margin-top: 10px; font-size: 14.5px; line-height: 1.5; color: var(--muted); }

/* ------------------------------------------------------------ author box */
.doc.post .post-author { display: flex; gap: 18px; align-items: flex-start; max-width: 68ch; margin-top: 40px; padding: 24px; border-radius: 16px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); scroll-margin-top: 96px; }
.post-author img { flex: none; border-radius: 50%; object-fit: cover; }
.doc.post .post-author h2 { margin: 0; padding: 0; border: 0; font-size: 20px; letter-spacing: -0.02em; }
.doc.post .post-author p { margin: 8px 0 0; font-size: 16px; line-height: 1.6; }
.doc.post .post-author .post-author-label { margin: 0 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.doc.post .post-author .post-author-role { margin: 2px 0 0; font-size: 14px; color: var(--muted); }

/* ------------------------------------------------------------ related cards */
.doc.post .post-related { max-width: none; }
.doc.post .post-related ul { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 12px; }
.doc.post .post-related li { margin: 0; border: 0; font-size: 16px; }
.doc.post .post-related a { display: grid; align-content: start; gap: 8px; padding: 0; text-decoration: none; }
.post-related img { border-radius: 12px; transition: transform .25s var(--ease); }
.post-related a:hover img { transform: translateY(-2px); }
.post-related-title { line-height: 1.35; }

/* ------------------------------------------------------------ cards (index, category, search, related) */
.card-cat { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.card-by { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; font-size: 13.5px; color: var(--muted); }
.card-by img { flex: none; width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.featured .card-by img { width: 28px; height: 28px; }

/* ------------------------------------------------------------ index pages */
.blog-main { padding: 112px 0 88px; }
.blog-hero { max-width: 760px; margin-bottom: 48px; }
.blog-hero h1 { margin: 0; font-size: clamp(40px, 6vw, 60px); letter-spacing: -0.04em; line-height: 1.05; }
.blog-page-n { color: var(--muted); font-weight: 500; }
.blog-hero .lede { margin: 14px 0 26px; font-size: clamp(17px, 1.9vw, 20px); line-height: 1.55; color: var(--fg-2); }
.blog-search { display: flex; align-items: center; gap: 10px; max-width: 540px; padding: 6px 6px 6px 16px; border-radius: 999px; background: var(--panel); box-shadow: var(--shadow-1); transition: box-shadow .2s; }
.blog-search:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.blog-search svg { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.blog-search input { flex: 1; min-width: 0; height: 34px; border: 0; outline: 0; background: transparent; color: var(--fg); font: inherit; font-size: 16px; }
.blog-search input::-webkit-search-cancel-button { cursor: pointer; }
.blog-cats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.blog-cats a { padding: 7px 14px; border-radius: 999px; background: var(--sunk); color: var(--fg-2); font-size: 14px; transition: color .2s, background .2s; }
.blog-cats a:hover { color: var(--fg); }
.blog-cats a[aria-current="page"] { background: var(--fg); color: var(--bg); }

.featured a { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 44px; align-items: center; color: inherit; }
.featured > a > img { border-radius: 20px; transition: transform .3s var(--ease); }
.featured a:hover > img { transform: translateY(-3px); }
.featured h2 { margin: 10px 0 12px; font-size: clamp(26px, 3.2vw, 36px); line-height: 1.15; letter-spacing: -0.03em; text-wrap: balance; }
.featured a:hover h2 { color: var(--accent); }
.featured p { margin: 0; color: var(--fg-2); font-size: 17px; line-height: 1.6; }
.featured .card-by { margin-top: 18px; }

.blog-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 44px 28px; margin-top: 56px; }
.card a { display: grid; align-content: start; gap: 10px; color: inherit; }
.card > a > img { border-radius: 14px; transition: transform .25s var(--ease); }
.card a:hover > img { transform: translateY(-2px); }
.card h2, .card h3 { margin: 4px 0 0; font-size: 19px; line-height: 1.3; letter-spacing: -0.02em; text-wrap: pretty; }
.card a:hover h2, .card a:hover h3 { color: var(--accent); }
.card p { margin: 0; color: var(--fg-2); font-size: 15px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .card-by { display: flex; }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--line); font-size: 15px; }
.pager-nums { display: flex; gap: 6px; }
.pager-nums a, .pager-nums span { display: inline-grid; place-items: center; min-width: 38px; height: 38px; padding: 0 6px; border-radius: 10px; color: var(--fg-2); }
.pager-nums a:hover { background: var(--sunk); color: var(--fg); }
.pager-nums [aria-current="page"] { background: var(--fg); color: var(--bg); font-weight: 600; }
.pager-step { color: var(--fg); font-weight: 500; }
a.pager-step:hover { color: var(--accent); }
span.pager-step { color: var(--muted); opacity: .5; }

.blog-results .blog-grid { margin-top: 24px; }
.blog-results-count { margin: 0; color: var(--fg-2); }
.blog-all { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.blog-all li { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.blog-all a { color: var(--fg); font-weight: 500; }
.blog-all a:hover { color: var(--accent); }
.blog-all span { flex: none; color: var(--muted); font-size: 14px; }

/* ------------------------------------------------------------ dark mode: soften the cream illustrations */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .post-cover img, :root:not([data-theme="light"]) .post-fig img, :root:not([data-theme="light"]) .featured > a > img,
  :root:not([data-theme="light"]) .card > a > img, :root:not([data-theme="light"]) .post-related img { filter: brightness(.88); }
}
:root[data-theme="dark"] .post-cover img, :root[data-theme="dark"] .post-fig img, :root[data-theme="dark"] .featured > a > img,
:root[data-theme="dark"] .card > a > img, :root[data-theme="dark"] .post-related img { filter: brightness(.88); }
.card-by img, .byline img, .post-author img { filter: none !important; }

/* ------------------------------------------------------------ narrow screens */
@media (max-width: 1000px) {
  .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .docs.post-wrap { padding-top: 88px; }
  .post-head { margin-bottom: 32px; }
  .post-wrap .toc { display: none; }
  .toc-m { display: block; margin: 0 0 28px; border-radius: 14px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); }
  .toc-m summary { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; font-weight: 600; cursor: pointer; list-style: none; }
  .toc-m summary::-webkit-details-marker { display: none; }
  .toc-m summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-2px) rotate(45deg); transition: transform .2s; }
  .toc-m[open] summary::after { transform: translateY(2px) rotate(-135deg); }
  .toc-m nav { display: grid; padding: 0 8px 10px; }
  .toc-m nav a { padding: 9px 10px; border-radius: 8px; color: var(--fg-2); font-size: 15px; line-height: 1.35; text-decoration: none; }
  .toc-m nav a:hover { background: var(--sunk); color: var(--fg); }
  .featured a { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 640px) {
  .post-cover { margin-top: 24px; }
  .post-cover img { border-radius: 16px; }
  .doc.post .post-author { flex-direction: column; padding: 20px; }
  .doc.post .post-related ul { grid-template-columns: 1fr; gap: 14px; }
  .doc.post .post-related a { grid-template-columns: 120px minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 14px; row-gap: 4px; }
  .doc.post .post-related img { grid-row: 1 / 3; border-radius: 10px; }
  .blog-main { padding-top: 96px; }
  .blog-grid { grid-template-columns: 1fr; gap: 36px; margin-top: 40px; }
  .pager { justify-content: center; }
  .pager-step { order: 2; }
  .pager-nums { order: 1; flex-basis: 100%; justify-content: center; }
  .blog-all li { flex-direction: column; }
}
