/* Articles, the blog and its lists. Uses the tokens from assets/css/tokens.css; loaded after site.css. */

/* ---------- article hero ---------- */
.hero--post .post-hero { display: grid; gap: var(--space-lg); padding-block: var(--space-2xl) var(--space-xl); }
.hero--post h1 { font-size: var(--text-display-s); max-width: 24ch; overflow-wrap: break-word; min-width: 0; }
.hero--post .lead { max-width: 60ch; color: var(--color-ink-2); }
.byline { display: flex; align-items: center; gap: var(--space-md); }
.byline-photo { width: 56px; height: 56px; border-radius: var(--radius-pill); object-fit: cover; background: var(--color-paper-3); }
.byline-text { display: grid; gap: var(--space-3xs); }
.byline-name { font-weight: 600; }
.byline-name a { color: var(--color-ink); text-decoration-color: var(--color-accent); text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
.byline-name a:hover { color: var(--color-accent-hover); }
.byline-role { margin-left: var(--space-sm); font-weight: 400; color: var(--color-muted); }
.byline-meta { display: flex; flex-wrap: wrap; gap: var(--space-2xs) var(--space-lg); font-size: var(--text-sm); color: var(--color-muted); }
.post-figure { margin-block: 0 var(--space-xl); }
.post-figure img { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; border-radius: var(--radius-card); background: var(--color-paper-3); }
.post-figure figcaption { margin-top: var(--space-xs); font-size: var(--text-xs); color: var(--color-muted); }
.post-figure figcaption a { color: inherit; }

/* ---------- reading column and contents list ---------- */
.post-section { padding-top: var(--space-3xl) !important; }
.post-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-xl) var(--gap-columns); align-items: start; }
.toc { grid-column: 1 / span 3; position: sticky; top: calc(76px + var(--space-lg)); max-height: calc(100vh - 76px - var(--space-2xl)); overflow-y: auto; padding-left: var(--space-md); border-left: 3px solid var(--color-field); }
.toc-title { font-weight: 600; font-size: var(--text-sm); margin-bottom: var(--space-xs); }
.toc ol { display: grid; gap: var(--space-2xs); margin: 0; padding: 0; list-style: none; }
.toc a { display: block; padding: var(--space-2xs) 0; font-size: var(--text-sm); line-height: 1.4; color: var(--color-ink-2); text-decoration: none; }
.toc a:hover { color: var(--color-accent-hover); text-decoration: underline; text-decoration-color: var(--color-accent); }
.toc a:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.post-body { grid-column: 4 / span 7; min-width: 0; }
.post-grid > .post-body:only-child { grid-column: 3 / span 8; }

/* ---------- article type: the site's display face, sized for reading ---------- */
.post-body { font-size: 1.0625rem; line-height: 1.7; gap: var(--space-lg); }
.post-body > * { max-width: 68ch; }
.post-body h2 { font-size: clamp(1.5rem, 1.1vw + 1.1rem, 2.125rem); line-height: 1.12; max-width: 30ch; margin-top: var(--space-2xl); scroll-margin-top: calc(76px + var(--space-lg)); overflow-wrap: break-word; min-width: 0; }
.post-body h2:first-child { margin-top: 0; }
.post-body h3 { font-size: var(--text-title); margin-top: var(--space-lg); scroll-margin-top: calc(76px + var(--space-lg)); }
.post-body ul, .post-body ol { display: grid; gap: var(--space-xs); padding-left: 1.25em; }
.post-body li::marker { color: var(--color-accent); font-weight: 600; }
.post-body strong { font-weight: 600; }
.post-body blockquote { margin: 0; padding: var(--space-md) var(--space-lg); border-left: 4px solid var(--color-accent); background: var(--color-paper-2); border-radius: 0 var(--radius-card) var(--radius-card) 0; }
.post-body code { font-size: 0.92em; padding: 0.1em 0.35em; background: var(--color-paper-2); border-radius: var(--radius-btn); }
.post-body pre { max-width: 100%; overflow-x: auto; padding: var(--space-md); background: var(--color-night); color: var(--color-night-ink); border-radius: var(--radius-card); font-size: var(--text-sm); }
.post-body pre code { padding: 0; background: none; }
.post-body hr { border: 0; border-top: 1px solid var(--color-rule); }

/* tables: comparison and cost tables scroll sideways on phones instead of squeezing */
.post-body table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: var(--text-sm); line-height: 1.5; }
.post-body th, .post-body td { padding: var(--space-sm) var(--space-md); border-bottom: 1px solid var(--color-rule); text-align: left; vertical-align: top; }
.post-body thead th { border-bottom: 2px solid var(--color-rule-strong); font-weight: 600; white-space: nowrap; }
.post-body tbody tr:nth-child(even) { background: var(--color-paper-2); }

/* images from the content system: a wp:image block with a caption */
.post-body figure { margin: var(--space-md) 0; max-width: 100%; }
.post-body figure img { display: block; width: 100%; height: auto; border: 1px solid var(--color-rule); border-radius: var(--radius-card); }
.post-body figcaption { margin-top: var(--space-xs); font-size: var(--text-sm); color: var(--color-muted); }

/* the key takeaway and checklist boxes the content system can write */
.post-body .takeaway { padding: var(--space-lg); background: var(--color-field); color: var(--color-field-ink); border-radius: var(--radius-card); }
.post-body .takeaway p + p { margin-top: var(--space-xs); }
.post-body .takeaway-title { font-family: var(--font-display); font-weight: 600; font-size: var(--text-lg); }
.post-body .faq { max-width: 68ch; }

/* ---------- author box ---------- */
.author-band { padding-block: var(--space-3xl) !important; }
.author-box { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: var(--space-xl); align-items: start; max-width: 60rem; }
.author-photo { width: 120px; height: 120px; border-radius: var(--radius-pill); object-fit: cover; background: var(--color-paper-3); }
.author-text { display: grid; gap: var(--space-xs); }
.author-text p { max-width: 60ch; }
.author-label, .author-role { font-size: var(--text-sm); color: var(--color-muted); }
.author-name { font-size: var(--text-2xl); text-transform: none; max-width: none; }
.author-name a { color: var(--color-ink); text-decoration: none; }
.author-name a:hover { color: var(--color-accent-hover); }
.author-links { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-lg); font-weight: 600; }
.author-links a { color: var(--color-ink); text-decoration-color: var(--color-accent); text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
.author-links a:hover { color: var(--color-accent-hover); }
.author-name a:focus-visible, .author-links a:focus-visible, .byline-name a:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

/* ---------- article cards ---------- */
.list-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-md); margin-bottom: var(--space-xl); }
.list-head h2 { font-size: var(--text-section); }
.list-more { font-weight: 600; color: var(--color-ink); text-decoration-color: var(--color-accent); text-decoration-thickness: 2px; text-underline-offset: 0.25em; }
.list-more:hover { color: var(--color-accent-hover); }
.list-more:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.post-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2xl) var(--gap-columns); margin: 0; padding: 0; list-style: none; }
.post-card { position: relative; display: grid; gap: var(--space-md); align-content: start; }
.post-card-media { aspect-ratio: 1200 / 630; overflow: hidden; border-radius: var(--radius-card); background: var(--color-paper-3); }
.post-card-media img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-long) var(--ease-out); }
.post-card:hover .post-card-media img { transform: scale(1.03); }
.post-card-body { display: grid; gap: var(--space-xs); }
.post-card-cat { font-size: var(--text-sm); font-weight: 600; color: var(--color-accent); }
.post-card h3 { font-size: var(--text-title); max-width: none; }
.post-card h3 a { color: var(--color-ink); text-decoration: none; }
.post-card h3 a::after { content: ""; position: absolute; inset: 0; }
.post-card:hover h3 a { text-decoration: underline; text-decoration-color: var(--color-accent); text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
.post-card h3 a:focus-visible { outline: none; }
.post-card:focus-within { outline: 2px solid var(--color-focus); outline-offset: 6px; border-radius: var(--radius-card); }
.post-card p { color: var(--color-ink-2); }
.post-card .post-card-meta { font-size: var(--text-sm); color: var(--color-muted); }
.post-pager { margin-top: var(--space-2xl); }
.post-pager .nav-links { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.post-pager .page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 var(--space-sm); border: 1px solid var(--color-rule); border-radius: var(--radius-btn); color: var(--color-ink); text-decoration: none; font-weight: 600; }
.post-pager .page-numbers.current { background: var(--color-ink); color: var(--color-paper); border-color: var(--color-ink); }
.post-pager a.page-numbers:hover { border-color: var(--color-ink); }
.post-pager a.page-numbers:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

/* ---------- smaller screens ---------- */
@media (max-width: 68rem) {
  .toc { display: none; }
  .post-body, .post-grid > .post-body:only-child { grid-column: 1 / -1; }
  .post-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 40rem) {
  .post-cards { grid-template-columns: minmax(0, 1fr); }
  .author-box { grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); }
  .author-photo { width: 96px; height: 96px; }
  .byline-role { display: block; margin-left: 0; }
  .post-section { padding-top: var(--space-2xl) !important; }
}
@media (prefers-reduced-motion: reduce) {
  .post-card-media img { transition: none; }
  .post-card:hover .post-card-media img { transform: none; }
}
