/* BH5 — blog / article layer.
   Long-form typography + article index. Tokens only (tokens.css) so a rebrand
   there carries through. base.css styles h1-h4 globally but nothing for
   long-form body copy, and its `a { color: inherit; text-decoration: none }`
   would render article links invisible — both are corrected here, scoped to
   .article-body so the rest of the site is untouched. */

/* ---------- shared page furniture ---------- */
.blog-head { padding-block: clamp(3rem, 7vw, 5.5rem) var(--space-6); }
.blog-head .eyebrow { margin-bottom: var(--space-3); }
.blog-head h1 { max-width: 20ch; }
.blog-head .lead { margin-top: var(--space-4); max-width: 58ch; }

.crumbs { font-size: var(--fs-small); color: var(--text-muted); margin-bottom: var(--space-4); }
.crumbs a { color: var(--text-muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs span[aria-current] { color: var(--text); }
.crumbs .sep { padding-inline: .45rem; color: var(--text-faint); }

/* ---------- article ---------- */
.article { padding-bottom: var(--space-section); }

.article-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  margin-top: var(--space-5); padding-top: var(--space-4);
  border-top: var(--border-hair);
  font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text-muted);
}

.article-hero { margin-block: var(--space-6); border-radius: var(--r-lg); overflow: hidden; border: var(--border-hair); }
.article-hero img { width: 100%; height: auto; display: block; }

/* long-form body */
.article-body { max-width: var(--maxw-prose); font-size: var(--fs-body); line-height: var(--lh-body); color: var(--text); }
.article-body > * + * { margin-top: var(--space-5); }
.article-body p { color: var(--text-muted); }
.article-body h2 { font-size: var(--fs-h2); margin-top: var(--space-8); }
.article-body h3 { font-size: var(--fs-h3); margin-top: var(--space-7); }
.article-body h2 + p, .article-body h3 + p { margin-top: var(--space-4); }

/* base.css kills link affordance globally — restore it inside prose only */
.article-body a {
  color: var(--accent);              /* --blue-700, ~8:1 on --paper → WCAG AA */
  text-decoration: underline;
  text-underline-offset: .18em;
  text-decoration-thickness: 1px;
}
.article-body a:hover { color: var(--action-hover); text-decoration-thickness: 2px; }
.article-body a:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-sm); }

.article-body ul, .article-body ol { padding-left: 1.35rem; color: var(--text-muted); }
.article-body li + li { margin-top: var(--space-2); }
.article-body li::marker { color: var(--accent-bright); }

.article-body blockquote {
  margin-left: 0; padding: var(--space-4) var(--space-5);
  border-left: 3px solid var(--accent-bright);
  background: var(--bg-sunken); border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--text); font-size: var(--fs-lead); line-height: 1.5;
}

.article-body figure { margin-inline: 0; }
.article-body figure img { width: 100%; height: auto; border-radius: var(--r-md); border: var(--border-hair); }
.article-body figcaption {
  margin-top: var(--space-3); font-size: var(--fs-small);
  color: var(--text-faint); font-family: var(--font-mono);
}

.article-body code {
  font-family: var(--font-mono); font-size: .9em;
  background: var(--bg-sunken); border: var(--border-hair);
  padding: .12em .38em; border-radius: var(--r-sm);
}
.article-body pre {
  font-family: var(--font-mono); font-size: var(--fs-small); line-height: 1.55;
  background: var(--bg-invert); color: var(--text-on-invert);
  padding: var(--space-5); border-radius: var(--r-md); overflow-x: auto;
}
.article-body pre code { background: none; border: 0; padding: 0; color: inherit; }

.article-body table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.article-body th, .article-body td { text-align: left; padding: .7rem .8rem; border-bottom: var(--border-hair); }
.article-body th { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .06em; font-size: var(--fs-eyebrow); color: var(--text-muted); }
.table-scroll { overflow-x: auto; }

/* ---------- index ---------- */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-5); }

.post-card {
  display: flex; flex-direction: column;
  background: var(--bg-surface); border: var(--border-hair);
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-1);
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.post-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); border-color: var(--accent-bright); }
.post-card:focus-within { box-shadow: var(--focus-ring); }
.post-card-img { aspect-ratio: 16 / 9; background: var(--bg-sunken); }
.post-card-img img { width: 100%; height: 100%; object-fit: cover; }
.post-card-img.is-empty { display: grid; place-items: center; background: var(--bg-accent); border-bottom: var(--border-hair); }
.post-card-img.is-empty img { width: 56px; height: 56px; object-fit: contain; opacity: .5; }
.post-card-body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); flex: 1; }
.post-card-kw { font-family: var(--font-mono); font-size: var(--fs-eyebrow); text-transform: uppercase; letter-spacing: var(--tracking-eyebrow); color: var(--accent); }
.post-card h2 { font-size: var(--fs-h3); }
.post-card h2 a { color: inherit; }
.post-card h2 a:hover { color: var(--accent); }
.post-card h2 a:focus-visible { outline: none; }
.post-card p { color: var(--text-muted); font-size: var(--fs-small); line-height: 1.55; }
.post-card-foot { margin-top: auto; padding-top: var(--space-3); border-top: var(--border-hair); font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text-faint); }

.blog-empty {
  border: 1px dashed var(--border); border-radius: var(--r-lg);
  padding: var(--space-8) var(--space-5); text-align: center; color: var(--text-muted);
}

@media (max-width: 560px) {
  .post-grid { grid-template-columns: 1fr; }
  .article-body pre { padding: var(--space-4); }
}
