/* Blog-only structural styles.
 *
 * Measure, type scale, link treatment, `.table-scroll`, `.display` and `.lede`
 * come from site.css (Concept C). This file holds only what is blog-specific:
 * the editorial list, provenance grid, optional cover, inline CTA and related
 * list. Only what is genuinely blog-specific lives here.
 *
 * External on purpose. cp-web serves an ENFORCING CSP whose style-src is
 * "'self' 'nonce-<per-request>'" (apps/_shared/middleware.py), so an inline
 * <style> without a nonce is dropped silently: the page still returns 200 and
 * still paints, and only the behaviour disappears. A stylesheet served from
 * the same origin needs no nonce and cannot fail that way.
 */

/* Article body: the shared `.article > * + *` rhythm only reaches direct
   children, and the body Markdown sits one level down. */
.blog-article-content > * + * { margin-top: 16px; }
.blog-article-content > h2 { margin-top: 40px; }
.blog-article-content > h3 { margin-top: 28px; }
.blog-article-content ul,
.blog-article-content ol { padding-left: 22px; }
.blog-article-content li + li { margin-top: 6px; }
.blog-article-content code {
  overflow-wrap: anywhere;
  font-size: 0.92em;
}
/* Code blocks scroll locally; a long line never widens the page. */
.blog-article-content pre { max-width: 100%; overflow-x: auto; }
.blog-article-content pre code { overflow-wrap: normal; white-space: pre; }

/* A decision table can exceed a phone's width. The wrapper is the shared
   `.table-scroll` (surface, hairline border, radius) and scrolls the TABLE,
   never the page. blog.py emits role=region + tabindex=0 + aria-labelledby
   pointing at the table's caption, so it is keyboard-reachable and announced. */
.blog-table-scroll {
  overflow-x: auto;
  max-width: 100%;
}
.blog-table-scroll table { min-width: 520px; }
.blog-table-scroll th {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  vertical-align: bottom;
}
.blog-table-scroll td { vertical-align: top; }
.blog-table-scroll:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Breadcrumbs are an <ol> for the semantics — screen readers announce
   position — but must not render as a numbered list. Separator is a ::before
   on siblings so it is never read out as content. */
.blog-breadcrumb-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 13px;
  color: var(--muted);
}
.blog-breadcrumb-item { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.blog-breadcrumb-item + .blog-breadcrumb-item::before {
  content: "/";
  margin-right: 8px;
  color: var(--muted);
}
.blog-breadcrumb-item a { color: var(--muted); }

/* Provenance (front-matter facts only): hairline-ruled grid, two columns on a
   tablet and up, one on a phone. */
.blog-article-provenance {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
  border-block: 1px solid var(--line);
  padding: 12px 0;
  margin: 20px 0;
}
.blog-article-provenance-item { min-width: 0; }
.blog-article-provenance dt {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.blog-article-provenance dd {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
  overflow-wrap: anywhere;
}
@media (max-width: 599px) {
  .blog-article-provenance { grid-template-columns: minmax(0, 1fr); }
}

/* Optional cover. The box is 16:9 whether or not the image has loaded. */
.blog-article-hero {
  margin: 0 0 24px;
  aspect-ratio: 16 / 9;
  background: var(--bg-hover);
  border-radius: var(--radius-container);
  overflow: hidden;
}
.blog-article-hero img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  border-radius: 0;
}

/* CTAs: hairline-ruled strips, not cards. */
.blog-article-cta {
  border-block: 1px solid var(--line);
  padding: 16px 0;
  margin-block: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
}
.blog-article-cta p { margin: 0; max-width: 48ch; }
.article a.btn-primary { color: var(--surface); text-decoration: none; }
.article a.btn-primary:hover { color: var(--surface); }
.blog-article-footer { margin-top: 40px; }
.blog-article-footer > * + * { margin-top: 12px; }
.blog-article-source-review,
.blog-article-non-affiliation { font-size: 13px; color: var(--muted); margin: 0; }

/* Related articles: ruled rows with 48px targets. */
.blog-article-related-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--line);
}
.blog-article-related-item { margin: 0; border-bottom: 1px solid var(--line); }
.blog-article-related-item a {
  display: flex;
  align-items: center;
  min-height: 48px;
  font-weight: 600;
}

/* Index: ruled list, one entry per article. */
.blog-index-header .lede { max-width: 60ch; margin-bottom: 24px; }
.blog-index-list { border-top: 1px solid var(--line); }
.blog-index-card { padding: 24px 0; border-bottom: 1px solid var(--line); }
.blog-index-card > * + * { margin-top: 8px; }
.blog-index-card-title {
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.3;
  margin: 0 0 6px;
}
.blog-index-card-title a { color: var(--ink); text-decoration: none; }
.blog-index-card-title a:hover { color: var(--blue); text-decoration: underline; }
.blog-index-card-header time { font-size: 13px; color: var(--muted); }
.blog-index-card-excerpt { margin: 0; }
.blog-index-card-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.blog-index-empty {
  border-block: 1px solid var(--line);
  padding: 32px 0;
}
.blog-index-empty > * + * { margin-top: 12px; }
