/* Blog: the public list, a post and its prose (Leer). Core tokens only (--cnx-*): a child
   re-skins it by redefining them in its own stylesheet, loaded after this one. Flat surface, hairline
   rules, no shadows or cards; the yellow accent is the one .cnx-rule under the title. */

.blog {
  /* The kit ships three sizes (small, body, title). The editorial scale is derived from the body
     token, so a child that resizes it resizes the blog too (DESIGN.md, blog exceptions). */
  --blog-fs-lead: calc(var(--cnx-fs-body) * 1.1875);
  --blog-fs-entry: calc(var(--cnx-fs-body) * 1.375);
  --blog-fs-prose: calc(var(--cnx-fs-body) * 1.0625);
  --blog-fs-h2: calc(var(--cnx-fs-body) * 1.5);
  --blog-fs-h3: calc(var(--cnx-fs-body) * 1.25);
  --blog-fs-code: calc(var(--cnx-fs-body) * 0.9375);
  max-width: 65ch; font-family: var(--cnx-font-text); color: var(--cnx-text);
}
.blog :where(p) { margin: 0; }
.blog-head { margin-bottom: var(--cnx-s-6); }
.blog-head .cnx-rule { margin-bottom: var(--cnx-s-4); }
.blog-head .cnx-lead { font-size: var(--blog-fs-lead); line-height: 1.6; margin-bottom: var(--cnx-s-3); }
.blog-meta { font-size: var(--cnx-fs-small); color: var(--cnx-text-muted); font-variant-numeric: tabular-nums; }
.blog-head > .blog-meta:first-child { margin-bottom: var(--cnx-s-2); }

/* List: one hairline-separated column, no cards. */
.blog-list { list-style: none; margin: 0; padding: 0; }
.blog-entry { padding-block: var(--cnx-s-5); border-top: 1px solid var(--cnx-border); }
.blog-entry:last-child { border-bottom: 1px solid var(--cnx-border); }
.blog-entry__title { margin: var(--cnx-s-1) 0 var(--cnx-s-2); font-size: var(--blog-fs-entry); line-height: 1.3; font-weight: var(--cnx-strong-weight); text-wrap: pretty; }
.blog-entry__title a { color: var(--cnx-text); }
.blog-entry__summary { color: var(--cnx-text-muted); text-wrap: pretty; }

.blog-empty { display: flex; align-items: center; gap: var(--cnx-s-3); padding-block: var(--cnx-s-6); border-top: 1px solid var(--cnx-border); color: var(--cnx-text-muted); }
.blog-empty svg { flex: none; }

/* One row: the status on the left, the buttons together on the right. */
.blog-pager { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cnx-s-3); margin-top: var(--cnx-s-6); }
.blog-pager__status { margin-inline-end: auto; font-size: var(--cnx-fs-small); color: var(--cnx-text-muted); font-variant-numeric: tabular-nums; }

.blog-foot { margin-top: var(--cnx-s-7); padding-top: var(--cnx-s-4); border-top: 1px solid var(--cnx-border); }

/* Cover: 16:9, filled by the image change through the blog_cover block. */
.blog-cover { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; margin-bottom: var(--cnx-s-6); border-radius: var(--cnx-radius); background: var(--cnx-selection); }

/* Prose: the stored body, already sanitized (h2 to h4, lists, quotes, tables, figures). */
.cnx-prose { font-size: var(--blog-fs-prose); line-height: 1.7; overflow-wrap: break-word; text-wrap: pretty; }
.cnx-prose > * + * { margin-top: var(--cnx-s-4); }
.cnx-prose :where(h2, h3, h4) { font-weight: var(--cnx-strong-weight); line-height: 1.3; text-wrap: balance; }
.cnx-prose h2 { margin-top: var(--cnx-s-7); font-size: var(--blog-fs-h2); }
.cnx-prose h3 { margin-top: var(--cnx-s-6); font-size: var(--blog-fs-h3); }
.cnx-prose h4 { margin-top: var(--cnx-s-5); font-size: var(--blog-fs-prose); }
.cnx-prose :where(ul, ol) { padding-left: var(--cnx-s-5); }
.cnx-prose li + li { margin-top: var(--cnx-s-2); }
.cnx-prose blockquote { margin-inline: 0; padding-block: var(--cnx-s-3); border-block: 1px solid var(--cnx-border); font-size: var(--blog-fs-lead); font-style: italic; }
.cnx-prose blockquote > * + * { margin-top: var(--cnx-s-3); }
.cnx-prose hr { border: 0; border-top: 1px solid var(--cnx-border); margin-block: var(--cnx-s-6); }
.cnx-prose img { display: block; max-width: 100%; height: auto; border-radius: var(--cnx-radius); }
.cnx-prose figure { margin-inline: 0; }
.cnx-prose figcaption { margin-top: var(--cnx-s-2); font-size: var(--cnx-fs-small); color: var(--cnx-text-muted); }
.cnx-prose :where(code, pre) { font-family: ui-monospace, monospace; font-size: var(--blog-fs-code); }
.cnx-prose code { padding: 0 var(--cnx-s-1); background: var(--cnx-selection); border-radius: var(--cnx-radius); }
.cnx-prose pre { overflow-x: auto; padding: var(--cnx-s-4); background: var(--cnx-selection); border-radius: var(--cnx-radius); line-height: 1.5; }
.cnx-prose pre code { padding: 0; background: none; }

/* A table scrolls inside its own region (the sanitizer wraps it in .cnx-prose__scroll, focusable
   so a keyboard can scroll it), never the page. The table is as wide as its content needs (min:
   the column), and a cell is capped so one long text column wraps at a readable measure instead
   of being squeezed to the minimum while the others stay one line high. */
.cnx-prose__scroll {
  max-width: 100%;
  overflow-x: auto;
  /* a visible scrollbar (a track, not only a thumb), and a hairline on each side that still has
     content hidden (see the animation below); the kit allows neither shadows nor gradients */
  scrollbar-width: thin;
  scrollbar-color: var(--cnx-border-input) var(--cnx-selection);
  border-inline: 1px solid transparent;
}
@supports (animation-timeline: scroll()) {
  .cnx-prose__scroll { animation: cnx-more-to-scroll linear both; animation-timeline: scroll(self inline); }
}
@keyframes cnx-more-to-scroll {
  0% { border-inline-start-color: transparent; border-inline-end-color: var(--cnx-text-muted); }
  2% { border-inline-start-color: var(--cnx-text-muted); }
  98% { border-inline-end-color: var(--cnx-text-muted); }
  100% { border-inline-start-color: var(--cnx-text-muted); border-inline-end-color: transparent; }
}
.cnx-prose table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: var(--cnx-fs-small); font-variant-numeric: tabular-nums; }
.cnx-prose :where(th, td) { min-width: 7rem; max-width: 30rem; padding: var(--cnx-s-2) var(--cnx-s-3); border-bottom: 1px solid var(--cnx-border); text-align: left; vertical-align: top; }
.cnx-prose th { font-weight: var(--cnx-strong-weight); border-bottom-color: var(--cnx-border-input); white-space: nowrap; }

@media (max-width: 600px) {
  .cnx-prose { font-size: var(--cnx-fs-body); }
  .blog-pager__status { flex-basis: 100%; }
  .blog-pager .cnx-button { flex: 1; min-height: var(--cnx-touch-mobile); }
}
