/* =========================================================================
   Page — the developer blog ({en,de,nl}/blog.html, {en,de,nl}/blog-post.html)
   -------------------------------------------------------------------------
   ONE FILE FOR TWO PAGES, and the reason is `apps.css`'s: `pages/` is split so
   two page BRANCHES do not edit one file, and these two ship in one branch as
   one surface. The index card and the article body are the same typography
   rendered at two sizes; splitting them would be two places to keep one
   typography in step.

   The article body's rules (`.blog-body` and its blocks) are also the body of a
   developer resource (`blocks.js`, `pages/resources.css`), so the redesign's
   prose sizes are scoped to `.blog-prose`, the blog post's own card (U-2281).

   The grammar is DESIGN_TOKENS.md §8.2 and §9:

   DEPTH (§9.1). A card rests on `--doc-panel`. What recedes inside it — a
   quote's rule — uses `--sd-sunk`. The one SIDES shadow is a hover's.

   COLOUR (§9.3). An article carries a category and any number of tags, and
   EVERY ONE OF THEM IS A FACET — something the post IS. None gets a semantic
   colour. The covers are theme-invariant dark grounds under the motif tile,
   like the hero band (§8.2).

   WIDTH. Text runs to its container (U-1647): the article takes the column
   beside the contents, and the whole measure where there is no contents.
   ========================================================================= */

/* The breadcrumb on the hero band is the shared components/crumbs.css (R8d). */

/* ---- The meta line -------------------------------------------------------- *
 * Date · author · reading time, separated by a rule rather than by a character
 * a screen reader reads out. `::before` on every item but the first gives the
 * separator no text node at all.
 * ------------------------------------------------------------------------- */

.blog-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm) 14px;
  margin: 0;
  font-size: var(--text-caption);
  line-height: var(--text-caption-lh);
  color: var(--doc-ink-soft);
}

.blog-meta > * + *::before {
  content: "";
  display: inline-block;
  width: 1px;
  height: 12px;
  margin-right: 14px;
  vertical-align: -2px;
  background: var(--sd-border);
}

.blog-author {
  font-weight: 600;
  color: var(--sd-text);
}

/* §9.5 — a date and a count of minutes are figures a reader compares down a
   column of cards, so they line up as columns. */
.blog-date,
.blog-reading {
  font-variant-numeric: tabular-nums;
}

/* The tags: chips, so no rule between them (the badge's own `::before` rule,
   at higher specificity, already hides it). */
.blog-facets {
  gap: 6px;
}

/* A tag is a slug — an identifier, never prose — so it is set in the face that
   says so. §9.5: `--mono` where characters are compared one by one. */
.blog-tag {
  font-family: var(--mono);
  font-size: var(--text-caption);
}

/* On the hero band the line takes the band's quiet ink (§8.2). */
.page-hero .blog-meta {
  color: var(--hero-ink-quiet);
}

.page-hero .blog-meta > * + *::before {
  background: var(--on-dark-line);
}

/* ---- The byline under the post's title --------------------------------- */

.blog-byline {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: 0;
}

.page-hero .blog-byline .blog-author {
  color: var(--brand-on-dark);
}

.blog-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--hero-glow);
  color: var(--brand-mint-hover);
  font-size: var(--text-caption);
  font-weight: 700;
}

/* ---- The index ------------------------------------------------------------ */

.blog-filter-notice {
  margin: 0 0 var(--space-lg);
  font-size: var(--text-body);
  color: var(--doc-ink-soft);
}

.blog-index-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  margin: 0 0 var(--space-lg);
}

.blog-index-heading {
  margin: 0;
  font-size: var(--text-title-lg);
  line-height: var(--text-title-lg-lh);
  font-weight: 700;
}

.blog-count {
  margin: 0;
  font-size: var(--text-caption);
  color: var(--doc-ink-soft);
  font-variant-numeric: tabular-nums;
}

/* One column, three from 768 px (the redesign session's three-card rule). A
   last card alone in its row takes the whole row, laid out like the lead card,
   so no row closes on a lone tile (guards-narrow-render). */
.blog-index {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

/* ---- A card --------------------------------------------------------------- *
 * The panel without padding: the cover runs to its edges, the text sits in
 * its own box. `.marketing-page` for the specificity of the frame's card rule
 * in pages/marketing.css.
 * ------------------------------------------------------------------------- */

.marketing-page .blog-card {
  padding: 0;
  gap: 0;
  overflow: hidden;
  transition: box-shadow .15s, border-color .15s;
}

.marketing-page .blog-card:has(.blog-card-link:hover) {
  border-color: var(--doc-line);
  box-shadow: var(--shadow-overlay);
}

/* The cover: the dark motif tile over one bloom on a dark ground, in three
   tints down the index. The category chip sits in its corner. */
.blog-cover {
  --cover-at: 85% 80%;
  --cover-bloom: var(--cover-glow);
  --cover-base: var(--cover-ground);
  position: relative;
  min-height: 160px;
  padding: var(--space-md);
  background:
    url('../../img/motif/mol-tile-dark.svg') repeat,
    radial-gradient(320px 220px at var(--cover-at), var(--cover-bloom), transparent 70%),
    var(--cover-base);
}

.blog-index > :nth-child(3n+2) .blog-cover {
  --cover-at: 20% 90%;
  --cover-bloom: var(--cover-glow-blue);
  --cover-base: var(--cover-ground-blue);
}

.blog-index > :nth-child(3n) .blog-cover {
  --cover-at: 80% 20%;
  --cover-bloom: var(--cover-glow-amber);
  --cover-base: var(--cover-ground-amber);
}

.blog-card-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--space-sm);
  padding: 20px;
}

.blog-card-title {
  margin: 0;
  font-size: var(--text-title-lg);
  line-height: var(--text-title-lg-lh);
  font-weight: 700;
}

.blog-card-link {
  color: var(--doc-ink);
  text-decoration: none;
}

.blog-card-link:hover,
.blog-card-link:focus-visible {
  color: var(--doc-ink);
  text-decoration: underline;
}

.blog-card-summary {
  margin: 0;
  font-size: var(--text-body);
  line-height: var(--text-body-lh);
  color: var(--doc-ink-soft);
}

/* The lead card: the newest post, cover beside text from 768 px. */
.marketing-page .blog-card-feature {
  margin-bottom: 40px;
}

.blog-card-feature .blog-card-title {
  font: var(--font-display-md);
}

.blog-card-feature .blog-card-summary {
  font: var(--font-lead);
}

@media (min-width: 768px) {
  .blog-index {
    grid-template-columns: repeat(3, 1fr);
  }

  .blog-index > .blog-card:last-child:nth-child(3n+1) {
    grid-column: 1 / -1;
  }

  .marketing-page .blog-card-feature,
  .marketing-page .blog-index > .blog-card:last-child:nth-child(3n+1) {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
  }

  .blog-card-feature .blog-cover {
    min-height: 320px;
  }

  .blog-card-feature .blog-card-text {
    justify-content: center;
    gap: 12px;
    padding: 32px;
  }
}

/* ---- The article ---------------------------------------------------------- *
 * The post on its card and, from 1024 px, the contents beside it. Below that
 * the contents stand above the post.
 * ------------------------------------------------------------------------- */

.blog-article {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-lg);
  align-items: start;
}

.blog-article > .blog-toc {
  order: -1;
}

@media (min-width: 1024px) {
  .blog-article:has(> .blog-toc) {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 64px;
  }

  .blog-article > .blog-toc {
    order: 0;
    position: sticky;
    top: 96px;
  }
}

.marketing-page .blog-prose {
  gap: 0;
  padding: 48px;
}

.marketing-page .blog-prose > .blog-lede {
  margin: 0;
  font: var(--font-lead);
  color: var(--doc-ink);
}

.blog-prose > .blog-note {
  margin: var(--space-md) 0 0;
}

.blog-prose .blog-body {
  margin-top: var(--space-lg);
}

.blog-prose .blog-paragraph,
.blog-prose .blog-list {
  font: var(--font-prose);
}

.blog-prose h2.blog-heading {
  margin: 32px 0 var(--space-md);
  font-size: var(--text-page-title);
  line-height: var(--text-page-title-lh);
}

/* The code block on a public page is the dark one (§8.2). */
.blog-prose .blog-code {
  background: var(--code-ground);
  border-color: transparent;
  color: var(--hero-ink-lead);
}

.blog-prose > .blog-facets {
  margin-top: var(--space-lg);
}

.blog-toc {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.blog-toc nav {
  display: flex;
  flex-direction: column;
  border-left: var(--border-w-strong) solid var(--doc-line);
}

.blog-toc nav a {
  margin-left: calc(-1 * var(--border-w-strong));
  padding: 6px 0 6px var(--space-md);
  border-left: var(--border-w-strong) solid transparent;
  font-size: var(--text-body);
  line-height: var(--text-body-lh);
  color: var(--doc-ink-soft);
  text-decoration: none;
}

.blog-toc nav a:hover {
  border-left-color: var(--accent-bar);
  color: var(--doc-ink);
}

/* ---- The article body ----------------------------------------------------- */

.blog-lede {
  margin: 16px 0 0;
  font-size: 18px;
  line-height: 1.6;
  color: var(--sd-text-soft);
}

.blog-body {
  margin-top: 32px;
}

.blog-paragraph {
  margin: 0 0 18px;
  line-height: 1.75;
  color: var(--sd-text-soft);
}

.blog-heading {
  margin: 36px 0 12px;
  line-height: 1.3;
  color: var(--doc-ink);
}

.blog-list {
  margin: 0 0 18px;
  padding-left: 22px;
  line-height: 1.75;
  color: var(--sd-text-soft);
}

/* A body list in a developer resource stacks its items 16 px apart, as it did
   before U-2281 moved the blog index off this class. The blog post keeps its
   list a list, with its markers (the canvas). */
.blog-body .blog-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.blog-prose .blog-body .blog-list {
  display: block;
}

.blog-list li {
  margin-bottom: 6px;
}

/* A quote is set into the page rather than raised off it: the recess ground and
   ONE hairline on the leading edge (§9.1, §9.2). No shadow, no second border. */
.blog-quote {
  margin: 0 0 18px;
  padding: 14px 18px;
  border-left: 3px solid var(--sd-secondary);
  background: var(--sd-sunk);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.blog-quote p {
  margin: 0 0 10px;
  line-height: 1.7;
  color: var(--sd-text-soft);
}

.blog-quote p:last-child {
  margin-bottom: 0;
}

.blog-rule {
  margin: 32px 0;
  border: 0;
  border-top: 1px solid var(--doc-line);
}

/* A code block scrolls inside itself, so a long line never makes the page body
   scroll sideways (guideline §9, audit rule H-5). */
.blog-code {
  margin: 0 0 18px;
  padding: 16px 18px;
  background: var(--doc-code-bg);
  border: 1px solid var(--doc-line);
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  color: var(--doc-ink);
}

.blog-code code {
  font-family: inherit;
  white-space: pre;
}

.blog-code-inline {
  font-family: var(--mono);
  font-size: .92em;
  padding: 1px 5px;
  background: var(--sd-sunk);
  border: 1px solid var(--sd-divider);
  border-radius: 4px;
  color: var(--doc-ink);
  /* An identifier inside a sentence must be able to break, or a long one makes
     the column wider than the page (H-5, from the other direction). */
  word-break: break-word;
}

.blog-link {
  color: var(--sd-secondary);
}

/* A paragraph that is only a link to a file (`blocks.js`, U-860). Two lines —
   label and the author's platform-and-size note — so `.btn`'s fixed height
   and single line are lifted; at 320 px the note wraps inside the button. */
.blog-download {
  margin: 0 0 18px;
}

.blog-download-button {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  height: auto;
  max-width: 100%;
  padding: 10px 18px;
  line-height: 1.3;
  text-align: left;
}

.blog-download-note {
  font-size: 13px;
  font-weight: 400;
}

.blog-back {
  margin: 40px 0 0;
}

/* ---- Continuation --------------------------------------------------------- */

.blog-more {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}

.blog-more[hidden] {
  display: none;
}

/* ---- The no-JavaScript fallback ------------------------------------------- */

.blog-fallback {
  padding: 24px;
  background: var(--sd-sunk);
  border: 1px solid var(--doc-line);
  border-radius: var(--radius-lg);
}

.blog-fallback p {
  margin: 0 0 12px;
  color: var(--sd-text-soft);
  line-height: 1.65;
}

.blog-fallback .cta-actions {
  margin-top: 20px;
}

/* ---- Narrow ---------------------------------------------------------------- */

@media (max-width: 639px) {
  .marketing-page .blog-prose {
    padding: var(--space-lg);
  }

  .blog-lede {
    font-size: 16px;
  }
}
