/*
 * MetaHashtags 2: the blog (index, archives, single posts). Loaded on blog
 * views only (mh2_is_blog_view()), on top of main.css and its tokens.
 * Article boxes allowed in post content: .post-answer (the short answer at
 * the top), .post-note (a caveat or definition), .post-cta (a tool suggestion).
 */

/* ---------- Index and archives ---------- */
.blog-index { padding-bottom: 64px; }
.blog-head .page-lede { max-width: 58ch; }
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { color: var(--ink); }
.author-head { display: flex; align-items: center; gap: 16px; }

.post-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; }
@media (min-width: 640px) { .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .post-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; } }

.post-tile {
  height: 100%; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-card); transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.post-tile:hover { border-color: var(--line-strong); box-shadow: var(--shadow-panel); }
.post-tile-link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.post-tile-link:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; border-radius: var(--r-lg); }
.post-tile-media { display: block; background: var(--chip); }
.post-tile-media img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }
.post-tile-body { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 18px 20px 20px; }
.post-kicker { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--link); }
.post-tile-title { font: 800 20px/1.25 var(--font-display); letter-spacing: -0.01em; color: var(--ink); }
.post-tile-link:hover .post-tile-title { color: var(--link); }
.post-tile-excerpt { font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.post-tile-meta { margin-top: auto; padding-top: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }

/* The first post on the blog index: full width, image beside the text on wide screens. */
.post-grid-item.is-featured { grid-column: 1 / -1; }
.is-featured .post-tile-title { font-size: clamp(24px, 3.2vw, 32px); line-height: 1.15; letter-spacing: -0.02em; }
.is-featured .post-tile-excerpt { font-size: 16px; }
@media (min-width: 900px) {
  .is-featured .post-tile-link { flex-direction: row; }
  .is-featured .post-tile-media { flex: 0 0 58%; }
  .is-featured .post-tile-media img { height: 100%; }
  .is-featured .post-tile-body { justify-content: center; gap: 12px; padding: 32px 36px; }
}

/* ---------- Single post ---------- */
.post-article { padding-bottom: 64px; }
.post-head { max-width: 840px; display: flex; flex-direction: column; gap: 14px; padding-block: 28px 24px; }
@media (min-width: 720px) { .post-head { padding-block: 44px 28px; } }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 14px; font-weight: 700; color: var(--muted); }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--link); }
.post-title { font: 900 clamp(32px, 5.4vw, 48px)/1.08 var(--font-display); letter-spacing: -0.025em; color: var(--ink); }
.post-dek { font-size: clamp(17px, 2.3vw, 20px); line-height: 1.5; color: var(--ink-2); max-width: 62ch; }
.byline { display: flex; align-items: center; gap: 12px; margin-top: 4px; font-size: 15px; color: var(--ink-2); }
.byline a { color: var(--ink); font-weight: 800; text-decoration: none; }
.byline a:hover { color: var(--link); }
.byline .sep { margin-inline: 4px; color: var(--muted); }
.byline .nowrap { white-space: nowrap; }

.avatar {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--blue); color: #fff; font: 900 15px/1 var(--font-display); letter-spacing: 0.02em;
}
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }

.post-cover { margin: 0; }
.post-cover img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--chip); }
@media (min-width: 720px) { .post-cover img { aspect-ratio: 16 / 9; } }

/* Narrow screens: cover, contents, article in one column (.post-main's children join the flex
   column through display: contents). Wide screens: cover + article | sticky contents. */
.post-layout { display: flex; flex-direction: column; gap: 16px; }
.post-main { display: contents; }
.post-main .post-cover { order: 1; }
.post-layout .toc { order: 2; }
.post-main .post-card-body { order: 3; }
.post-layout:not(.has-toc) { max-width: 900px; }
@media (min-width: 1120px) {
  .post-layout.has-toc { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 40px; align-items: start; }
  .post-layout.has-toc .post-main { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
  .post-layout.has-toc .toc { position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow-y: auto; }
}

/* Table of contents: a collapsed box above the text, a plain sticky list beside it on wide
   screens (single.php opens the <details> there). */
.toc { font-size: 14px; }
.toc details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 18px; }
.toc summary { cursor: pointer; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); list-style-position: inside; }
.toc ol { margin: 10px 0 0; padding-left: 1.9em; display: flex; flex-direction: column; gap: 8px; }
.toc li::marker { color: var(--muted); font-weight: 700; }
.toc a { color: var(--ink-2); font-weight: 700; text-decoration: none; line-height: 1.35; }
.toc a:hover { color: var(--link); }
@media (min-width: 1120px) {
  .toc details { background: transparent; border: 0; padding: 4px 0 0; }
  .toc summary { list-style: none; cursor: default; pointer-events: none; }
  .toc summary::-webkit-details-marker { display: none; }
}

.post-card-body { min-width: 0; }
.post-prose { max-width: 720px; }
.post-prose h2 { scroll-margin-top: 96px; }
.post-prose table { margin-block: 1.4em; }
.post-prose thead th { border-bottom: 2px solid var(--line); white-space: nowrap; }
.post-prose td { font-variant-numeric: tabular-nums; }
.post-prose blockquote p { font-size: 17px; }

/* Infographics inside articles: 1080x1350 images, shown at a readable size, centered */
.post-prose .post-figure { margin: 2em auto; max-width: 540px; display: flex; flex-direction: column; gap: 10px; }
.post-prose .post-figure img { display: block; width: 100%; height: auto; border-radius: var(--r-md); border: 1px solid var(--line); box-shadow: var(--shadow-card); }
.post-prose .post-figure figcaption { margin: 0; text-align: center; font-size: 14px; line-height: 1.45; color: var(--ink-2); }

/* Article boxes */
.post-answer, .post-note, .post-cta { margin-block: 1.4em; padding: 16px 20px; border-radius: var(--r-md); }
.post-answer > * + *, .post-note > * + *, .post-cta > * + * { margin-top: 0.6em; }
.post-answer { background: var(--blue-wash); font-size: 18px; line-height: 1.6; }
.post-note { background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--line-strong); font-size: 16px; }
.post-cta { background: var(--teal-wash); border-left: 4px solid var(--teal); font-size: 16px; }
.post-cta a { color: var(--teal-link); font-weight: 800; }

/* Author box at the end of the article */
.author-box { display: flex; gap: 16px; align-items: flex-start; max-width: 720px; margin: 40px auto 0; padding-top: 28px; border-top: 1px solid var(--line); }
.author-box > div { display: flex; flex-direction: column; gap: 4px; }
.author-name { font-weight: 800; font-size: 17px; }
.author-name a { color: var(--ink); text-decoration: none; }
.author-name a:hover { color: var(--link); }
.author-box .muted { font-size: 15px; line-height: 1.55; }

.post-nudge { margin-top: 32px; }
.related { margin-top: 56px; }
