/* =====================================================================
   /blog/ — the blog on design system v2 (DESIGN.md § 9).

   A v2 page like /links: body.v2.blog on css/toys.css tokens (putty
   surface, ink, one cobalt accent, physical depth, springy motion, light
   and dark), Geist for text and headings, Geist Mono for dates, labels,
   tags and credits. Loaded after /blog/kit/blog-kit.css: it maps the kit's
   --bk-* custom properties onto the v2 tokens and styles the kit's bk-*
   markup. Used by /blog/ (blog/index.html) and by every generated post and
   tag page (blog/template.html). The vendored kit in blog/kit/ is never
   restyled in place (README.md, Blog).

   Type: fixed rem steps changed at breakpoints, never viewport-width
   scaling (.kiro/steering/product.md); headings text-wrap: balance.
   ===================================================================== */

body.blog {
  --t-display: "Geist", ui-sans-serif, system-ui, sans-serif;
  /* The header island names its own face (css/nav.css); on the blog it is the page's Geist. */
  --nav-font: var(--t-display);
  --b-gutter: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
  --b-measure: 66ch;
  --b-link: var(--toy-text);
  --b-card-depth: inset 0 0 0 1.5px var(--t-line), inset 0 -6px 0 rgba(0, 0, 0, 0.07), 0 16px 30px -24px rgba(0, 0, 0, 0.45);
  --b-key-face: var(--t-card);
  --b-key-depth: inset 0 0 0 1.5px var(--t-line), inset 0 -4px 0 rgba(0, 0, 0, 0.1);
  --b-key-depth-pressed: inset 0 0 0 1.5px var(--t-line), inset 0 -1px 0 rgba(0, 0, 0, 0.1);

  --bk-accent: var(--t-cobalt);
  --bk-text: var(--t-ink);
  --bk-muted: var(--t-ink-2);
  --bk-tag-bg: var(--t-card);
  --bk-tag-text: var(--t-ink);
  --bk-chip-border: var(--t-line);
  --bk-chip-hover-bg: var(--t-cobalt);
  --bk-chip-hover-text: #fff;
  --bk-chip-active-bg: var(--t-ink);
  --bk-chip-active-text: var(--t-surface);
  --bk-chip-count: var(--t-ink-2);
  --bk-chip-focus: var(--t-ink);
  --bk-radius: var(--t-r-m);
  --bk-gap: 0;
  --bk-media-radius: var(--t-r-m);
  --bk-rating-fill: var(--t-cobalt);
  --bk-rating-track: var(--t-surface-2);
  --bk-yt-play-bg: var(--t-cobalt);
  --bk-yt-play-hover: var(--t-cobalt-deep);
  --bk-share-size: 2.75rem;
  --bk-share-fg: var(--t-ink);
  --bk-share-bg: var(--b-key-face);
  --bk-share-border: transparent;
  --bk-share-hover-fg: #fff;
  --bk-share-hover-bg: var(--t-cobalt);
  --bk-share-focus: var(--t-ink);
  --bk-toast-bg: var(--t-ink);
  --bk-toast-fg: var(--t-surface);

  /* The shared header (css/nav.css) floats fixed over the page; the body clears it. */
  padding-top: var(--header-h);
  font-family: var(--t-display);
  font-variation-settings: normal;
}
html:has(body.blog) { scroll-padding-top: calc(var(--header-h) + 18px); }
@media (prefers-color-scheme: dark) {
  body.blog {
    --b-card-depth: inset 0 0 0 1.5px var(--t-line), inset 0 -6px 0 rgba(0, 0, 0, 0.35), 0 16px 30px -24px rgba(0, 0, 0, 0.8);
    --b-key-face: var(--t-surface-2);
    --b-key-depth: inset 0 0 0 1.5px var(--t-line), inset 0 -4px 0 rgba(0, 0, 0, 0.4);
    --b-key-depth-pressed: inset 0 0 0 1.5px var(--t-line), inset 0 -1px 0 rgba(0, 0, 0, 0.4);
    --bk-tag-bg: var(--t-surface-2);
  }
}

body.blog a { color: inherit; }
body.blog h1, body.blog h2, body.blog h3 { text-wrap: balance; }
.muted, .bk-loading, .bk-empty, .bk-error { color: var(--t-ink-2); font: 500 0.875rem/1.5 var(--t-mono); }

/* ---------- index: masthead ---------- */

.blog-index {
  width: min(100% - 2 * var(--b-gutter), 1240px);
  margin-inline: auto;
  padding-bottom: 56px;
}
.intro { padding: 28px 0 32px; }
.blog-kicker { margin: 0 0 14px; color: var(--t-ink-2); }
.intro h1 {
  margin: 0;
  max-width: 11ch;
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.02em;
  animation: b-rise 0.7s var(--t-spring) both;
}
.lede { margin: 18px 0 0; max-width: 40ch; color: var(--t-ink); font-size: 1.125rem; line-height: 1.45; text-wrap: pretty; }
@keyframes b-rise { from { transform: translateY(24px) scale(0.98); } }

/* ---------- index: the post grid ---------- */

/* #posts holds the kit's output: an optional filter line, one article per post, pagination.
   The first post of every page is the featured cobalt slab; the rest are neutral cards. */
.posts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: stretch; }
/* While the feed loads, hold a window's height for the posts, so the topics and the footer
   start below the fold instead of jumping out of view when the posts arrive (layout shift). */
.posts:not(:has(> .bk-post, > .bk-empty, > .bk-error)) { min-height: 100svh; }
.posts > :not(.bk-post) { grid-column: 1 / -1; }

.posts > .bk-post {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 0;
  padding: 10px 10px 8px;
  border: 0;
  border-radius: var(--t-r-l);
  background: var(--t-card);
  color: var(--t-ink);
  box-shadow: var(--b-card-depth);
}
/* Every child but the picture sits on the card's text inset. */
.posts > .bk-post > :not(.bk-media) { margin-inline: 8px; }
/* The picture comes first visually; the DOM keeps the heading first for screen readers. */
.posts > .bk-post > .bk-media { order: -1; }

.bk-post-header { display: flex; flex-direction: column-reverse; gap: 10px; margin: 16px 0 10px; }
.bk-post-date { display: block; color: var(--t-ink-2); font: 500 0.75rem/1.2 var(--t-mono); letter-spacing: 0.08em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.bk-post-title { margin: 0; font-size: 1.375rem; font-weight: 700; line-height: 1.12; letter-spacing: -0.015em; }
.bk-post-link { color: inherit; text-decoration: none; }
.bk-post-link:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.18em; }

/* Excerpt: the list shows each post's first paragraph, clamped; the full text is on its page. */
.posts .bk-post-body { color: var(--t-ink-2); font-size: 1rem; line-height: 1.5; }
.posts .bk-post-body p { display: -webkit-box; margin: 0; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; }
.posts .bk-post-body p + p { display: none; }
/* Excerpt links read like body links (cobalt text token); the featured slab keeps them white (below). */
.posts .bk-post-body a { color: var(--b-link); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; }
.posts .bk-post-body a:hover { text-decoration-thickness: 3px; }

/* Card picture: inset in the card, concentric radius, a calm 3:2 crop. */
.bk-media { margin: 0; }
.bk-media img, .bk-media video { display: block; width: 100%; max-width: 100%; height: auto; border-radius: var(--t-r-m); background: var(--t-surface-2); }
/* Index cards: every picture in a fixed 3:2 box with a cover crop, before and after it loads. */
.posts .bk-media img { aspect-ratio: 3 / 2; object-fit: cover; }
/* Post pages show the picture whole, at its own ratio. The page build writes the file's
   width/height on the <img>, so the browser reserves exactly that box before it loads (no
   author aspect-ratio here, or it would override the attributes' ratio). A picture of unknown
   size (remote, missing) reserves 3:2 until it loads, then keeps its own ratio. YouTube posters
   keep the kit's fixed 16:9 button. */
.bk-post-page > .bk-media-image img:not([width][height]) { aspect-ratio: auto 3 / 2; }
.posts .bk-media video { aspect-ratio: 3 / 2; object-fit: cover; background: #141414; }
.posts .bk-media-image, .posts .bk-media-link { overflow: hidden; border-radius: var(--t-r-m); }
.bk-media-link { display: block; cursor: pointer; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .posts .bk-media-image img { transition: transform var(--t-slow) var(--t-out); }
  .posts > .bk-post:hover .bk-media-image img { transform: scale(1.025); }
}
.bk-media figcaption {
  margin: 8px 4px 0;
  color: var(--t-ink-2);
  font: 500 0.75rem/1.4 var(--t-mono);
  letter-spacing: 0.02em;
  text-align: left;
  opacity: 1;
}
.bk-media figcaption a { color: inherit; text-decoration: underline; text-underline-offset: 0.2em; }
/* Neutral cards: the credit is a small ink label on the picture's bottom edge, so a credited
   card's date and title line up with its row neighbours'. The featured slab keeps it below, and
   so does a video, whose own controls sit on that edge. */
.posts > .bk-post:not(:first-of-type) > .bk-media:not(.bk-media-video) { position: relative; }
.posts > .bk-post:not(:first-of-type) > .bk-media:not(.bk-media-video) figcaption {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 1;
  max-width: calc(100% - 16px);
  margin: 0;
  padding: 5px 9px;
  border-radius: var(--t-r-s);
  background: rgba(20, 20, 20, 0.86);
  color: #fff;
  font-size: 0.6875rem;
}

/* YouTube click-to-play poster (kit youtube-embed.js; nothing loads from YouTube before the click). */
.bk-yt-preview { border-radius: var(--t-r-m); background: #141414; }
.bk-media .bk-yt-preview img { background: none; border-radius: 0; }
.bk-yt-frame { border-radius: var(--t-r-m); background: #141414; }

/* Tags: mono chips; the visible chip stays compact, its hit area is 44px tall. */
.bk-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.bk-tag {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0 0.75rem;
  border-radius: 999px;
  background: var(--bk-tag-bg);
  color: var(--t-ink);
  box-shadow: inset 0 0 0 1.5px var(--t-line);
  font: 500 0.8125rem/1 var(--t-mono);
  text-decoration: none;
  transition: background-color var(--t-base) var(--t-out), color var(--t-base) var(--t-out);
}
.bk-tag::after { content: ""; position: absolute; inset: -6px 0; }
.bk-tag:hover, .bk-tag:focus-visible { background: var(--t-cobalt); color: #fff; box-shadow: none; text-decoration: none; }
/* Neutral cards set the chip face through the kit variable, so the cobalt hover/focus fill above still wins. */
.posts .bk-tags { --bk-tag-bg: var(--t-surface); }

/* The card's foot: compact share bar, then the reactions; pushed to the bottom of the card. */
.posts .bk-share-compact { margin-top: auto; padding-top: 18px; }

/* ---------- featured: the first post of each page, a cobalt slab ---------- */

.posts > .bk-post:first-of-type {
  --b-on: #fff;
  background: var(--t-cobalt);
  color: var(--b-on);
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.18), 0 20px 40px -24px rgba(0, 0, 0, 0.45);
  padding-bottom: 14px;
}
.posts > .bk-post:first-of-type .bk-post-title { font-size: 1.875rem; font-weight: 800; line-height: 1.02; letter-spacing: -0.02em; }
.posts > .bk-post:first-of-type .bk-post-date,
.posts > .bk-post:first-of-type .bk-post-body,
.posts > .bk-post:first-of-type .bk-media figcaption { color: var(--b-on); }
.posts > .bk-post:first-of-type .bk-post-body { font-size: 1.0625rem; }
.posts > .bk-post:first-of-type .bk-post-body p { -webkit-line-clamp: 6; line-clamp: 6; }
.posts > .bk-post:first-of-type .bk-media img { background: var(--t-cobalt-deep); }
/* «Newest» on page one of the full list only (no filter, no «Newer» link). */
.posts:not(:has(.bk-filter, .bk-prev)) > .bk-post:first-of-type .bk-post-date::before { content: "Newest · "; }
.posts > .bk-post:first-of-type .bk-tag { background: transparent; color: var(--b-on); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.55); }
.posts > .bk-post:first-of-type .bk-tag:hover,
.posts > .bk-post:first-of-type .bk-tag:focus-visible { background: #fff; color: var(--t-cobalt-deep); box-shadow: none; }
.posts > .bk-post:first-of-type .bk-share-btn { background: transparent; color: var(--b-on); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.55); }
.posts > .bk-post:first-of-type .bk-share-btn:hover,
.posts > .bk-post:first-of-type .bk-share-btn:focus-visible { background: #fff; color: var(--t-cobalt-deep); box-shadow: none; }
.posts > .bk-post:first-of-type .bk-vote { --vote-face: #fff; --vote-ink: var(--t-cobalt-deep); --vote-on: #141414; --vote-on-ink: #fff; --vote-spark: #fff; }
.posts > .bk-post:first-of-type .bk-rating-bar { background: rgba(255, 255, 255, 0.28); box-shadow: none; }
.posts > .bk-post:first-of-type .bk-rating-fill { background: #fff; }
.posts > .bk-post:first-of-type .bk-rating-text,
.posts > .bk-post:first-of-type .bk-reactions-note { color: var(--b-on); }
.posts > .bk-post:first-of-type .bk-post-body a { color: var(--b-on); }

/* ---------- topics: the floating tag cloud, quieter than the posts ---------- */

/* A title row (the «Topics» label, and the pause toggle once the cloud floats, which comes first
   in the DOM so keyboard users reach it before the moving chips), then the cloud. The row keeps
   the toggle's 44px height with or without it, so nothing moves when it arrives. */
.blog-topics {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr;
  column-gap: 12px;
  margin-top: 40px;
  padding: 12px;
  border-radius: var(--t-r-l);
  background: var(--t-surface-2);
}
.blog-topics-title { grid-area: 1 / 1; display: flex; align-items: center; min-height: 2.75rem; margin: 0 0 0 6px; color: var(--t-ink-2); font: 500 0.75rem/1.4 var(--t-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.blog-topics > .bk-cloud-motion { grid-area: 1 / 2; }
/* The cloud fills the rest of the well and centres itself in any room left over (desktop). */
#tag-cloud { grid-area: 2 / 1 / 3 / 3; display: flex; flex-direction: column; justify-content: center; font-size: 0.9375rem; }
/* While the feed loads: quiet chip shapes where the cloud will be (the kit's render replaces
   them), pulsing gently for under five seconds (DESIGN.md motion rule), still with reduced motion. */
.topics-skeleton { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.8rem 0.9rem; padding: 9px 13px; }
.topics-skeleton span { width: 6.5rem; height: 2rem; border-radius: 999px; background: var(--t-card); opacity: 0.75; }
.topics-skeleton span:nth-child(4n + 1) { width: 5.25rem; }
.topics-skeleton span:nth-child(4n + 2) { width: 8.5rem; }
.topics-skeleton span:nth-child(5n) { width: 4.25rem; }
.topics-skeleton span:nth-child(7n) { width: 9.75rem; }
@media (prefers-reduced-motion: no-preference) {
  .topics-skeleton span { animation: topics-wait 1.1s ease-in-out 4 alternate; }
  .topics-skeleton span:nth-child(3n + 2) { animation-delay: 0.18s; }
  .topics-skeleton span:nth-child(3n) { animation-delay: 0.36s; }
}
@keyframes topics-wait { from { opacity: 0.75; } to { opacity: 0.35; } }
/* No feed, no topics: the well goes when the feed fails or carries no tags. */
.blog-index:has(#posts > .bk-error) .blog-topics,
.blog-topics:has(> #tag-cloud:empty) { display: none; }
.bk-cloud-tag { font-family: var(--t-display); background: var(--t-card); box-shadow: none; }
.bk-cloud-tag[aria-current="page"] .bk-cloud-count, .bk-cloud-tag-active .bk-cloud-count { color: inherit; }
.bk-cloud-count { font-family: var(--t-mono); }

/* Floating topics (blog/tag-float.js): each chip wanders a seeded loop of five
   waypoints around its slot, up to --f-reach-x across and --f-reach-y up/down, and rocks
   up to 4deg on a second, slower animation. The padding plus the chip margins cover the
   reach, the rotated corners and the hover pop, so chips never leave the widget box; the
   gaps keep a chip's centre clear of its neighbours, so a brush between two chips is
   brief and every topic stays clickable. Translate/rotate/scale only, so it all stays on
   the compositor. A hovered chip stops and pops above its neighbours; the whole cloud
   stops while focus is inside it, while it is off-screen and once the «Pause motion»
   button under it is used (WCAG 2.2.2). Reduced motion: no animation, chips sit still
   and the toggle is hidden. */
.bk-tag-cloud.bk-cloud-float { --f-reach-x: 16px; --f-reach-y: 9px; padding: 9px 13px; }
.bk-cloud-float .bk-cloud-tag { position: relative; margin-block: 0.4rem; margin-inline: 0.45rem; margin-inline-start: calc(0.45rem + var(--bk-cloud-shift, 0px)); }
.bk-cloud-float .bk-cloud-tag:hover, .bk-cloud-float .bk-cloud-tag:focus-visible { z-index: 1; box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.35); }
@media (max-width: 600px) {
  .bk-tag-cloud.bk-cloud-float { --f-reach-x: 11px; --f-reach-y: 6px; padding: 7px 11px; }
  .bk-cloud-float .bk-cloud-tag { margin-block: 0.3rem; margin-inline: 0.25rem; margin-inline-start: calc(0.25rem + var(--bk-cloud-shift, 0px)); }
}
@media (prefers-reduced-motion: no-preference) {
  .bk-cloud-float .bk-cloud-tag {
    animation:
      bk-cloud-wander var(--f-dur, 8s) cubic-bezier(0.33, 0.12, 0.67, 0.88) var(--f-delay, 0s) infinite,
      bk-cloud-sway var(--f-sway-dur, 7s) ease-in-out var(--f-sway-delay, 0s) infinite alternate;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .15s ease, scale .2s ease, box-shadow .2s ease;
  }
  .bk-cloud-float .bk-cloud-tag:hover,
  .bk-cloud-float .bk-cloud-tag:focus-visible { scale: 1.04; }
  .bk-cloud-float .bk-cloud-tag:hover,
  .bk-cloud-float:focus-within .bk-cloud-tag,
  .bk-cloud-paused .bk-cloud-tag,
  .bk-cloud-offscreen .bk-cloud-tag { animation-play-state: paused; }
}
/* The pause toggle (blog/tag-float.js): a small quiet key at the right end of the title row,
   pause bars and «Pause motion» while the chips move, a play triangle and «Resume motion»
   once paused (.bk-cloud-motion-paused). A 44px target (DESIGN.md controls rule). */
.bk-cloud-motion {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  margin: 0;
  padding: 0 0.85rem;
  border: 0;
  border-radius: var(--t-r-btn);
  background: transparent;
  color: var(--t-ink-2);
  box-shadow: inset 0 0 0 1.5px var(--t-line);
  cursor: pointer;
  transition: background-color var(--t-base) var(--t-out), color var(--t-base) var(--t-out);
}
.bk-cloud-motion:hover { background: var(--t-card); color: var(--t-ink); }
.bk-cloud-motion-paused { background: var(--t-card); color: var(--t-ink); }
.bk-cloud-motion-icon { width: 0.5rem; height: 0.6rem; border-inline: 0.16rem solid currentColor; box-sizing: border-box; }
.bk-cloud-motion-paused .bk-cloud-motion-icon { border: 0; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
@media (prefers-reduced-motion: reduce) {
  .bk-cloud-motion { display: none; }
}
@keyframes bk-cloud-wander {
  0%, 100% { translate: calc(var(--f-x1, 0) * var(--f-reach-x)) calc(var(--f-y1, 0) * var(--f-reach-y)); }
  21% { translate: calc(var(--f-x2, 0) * var(--f-reach-x)) calc(var(--f-y2, 0) * var(--f-reach-y)); }
  40% { translate: calc(var(--f-x3, 0) * var(--f-reach-x)) calc(var(--f-y3, 0) * var(--f-reach-y)); }
  61% { translate: calc(var(--f-x4, 0) * var(--f-reach-x)) calc(var(--f-y4, 0) * var(--f-reach-y)); }
  80% { translate: calc(var(--f-x5, 0) * var(--f-reach-x)) calc(var(--f-y5, 0) * var(--f-reach-y)); }
}
@keyframes bk-cloud-sway {
  0% { rotate: var(--f-r1, 0deg); }
  50% { rotate: var(--f-r2, 0deg); }
  100% { rotate: var(--f-r3, 0deg); }
}

/* ---------- filter line and pagination ---------- */

.bk-filter { margin: 0 0 4px; color: var(--t-ink-2); font: 500 0.875rem/1.5 var(--t-mono); }
.bk-filter strong { color: var(--t-ink); font-weight: 600; }
.bk-clear-filter { color: var(--b-link) !important; text-underline-offset: 0.2em; }
.bk-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 0; }
.bk-page-status { color: var(--t-ink-2); font: 500 0.8125rem/1 var(--t-mono); font-variant-numeric: tabular-nums; }
.bk-pagination .bk-next { margin-inline-start: auto; }
.bk-page-link, .bk-post-nav-all, .blog-page > p > a[href="/blog/"] {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 1.1rem 2px;
  border-radius: var(--t-r-btn);
  background: var(--b-key-face);
  color: var(--t-ink) !important;
  box-shadow: var(--b-key-depth);
  font-weight: 700;
  text-decoration: none;
  transition: transform var(--t-slow) var(--t-spring), background-color var(--t-base) var(--t-out), color var(--t-base) var(--t-out);
}
.bk-page-link:hover, .bk-post-nav-all:hover, .blog-page > p > a[href="/blog/"]:hover { background: var(--t-ink); color: var(--t-surface) !important; text-decoration: none; }
.bk-page-link:active, .bk-post-nav-all:active, .blog-page > p > a[href="/blog/"]:active { transform: translateY(2px) scale(0.98); box-shadow: var(--b-key-depth-pressed); transition-duration: var(--t-fast); }

/* ---------- share bar (kit render.js renderShareBar + share.js) ---------- */

.bk-share { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 28px 0 0; }
.bk-share-label { flex: 1 0 100%; margin: 0 0 6px; color: var(--t-ink-2); font: 500 0.75rem/1.4 var(--t-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.bk-share-btn {
  min-height: var(--bk-share-size);
  border: 0;
  border-radius: var(--t-r-btn);
  background: var(--bk-share-bg);
  color: var(--bk-share-fg);
  box-shadow: var(--b-key-depth);
  text-decoration: none;
  transition: transform var(--t-slow) var(--t-spring), background-color var(--t-base) var(--t-out), color var(--t-base) var(--t-out);
  -webkit-tap-highlight-color: transparent;
}
.bk-share-btn:hover, .bk-share-btn:focus-visible { box-shadow: none; text-decoration: none; }
.bk-share-btn:active { transform: translateY(2px) scale(0.97); transition-duration: var(--t-fast); }
.bk-share-compact { gap: 6px; margin: 16px 0 0; }
.bk-share-compact .bk-share-btn { --bk-share-size: 2.75rem; }
/* Neutral cards set the key face through the kit variable, so the kit's cobalt hover/focus fill still wins. */
.posts .bk-share-compact { --bk-share-bg: var(--t-surface); }
.bk-share-toast { border-radius: var(--t-r-btn); font: 600 0.9375rem/1.3 var(--t-display); box-shadow: 0 16px 30px -18px rgba(0, 0, 0, 0.5); }
@media (max-width: 560px) {
  .bk-share-btn { width: var(--bk-share-size); padding: 0; }
  .bk-share-btn .bk-share-text { display: none; }
}

/* ---------- reactions (kit reactions-widget.js) ----------
   Rating bar + % on one side, Like / Boo on the other, wrapping on narrow screens; the kit
   shows a derived score only and hides the bar until the first like. The keys never move
   when the bar appears: they come first in the row and the hidden bar keeps its
   slot (visibility only), so a first like just fills in the score beside them. */
.bk-reactions-slot:empty { display: none; }
.bk-reactions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; margin: 14px 0 0; }
/* Visual order only: the keys show first, but the DOM (and screen readers) keeps the kit's
   rating-then-keys order; fine while the rating row stays non-focusable. */
.bk-reactions-buttons { order: -1; flex-wrap: wrap; gap: 8px; }
.bk-reactions-rating { gap: 10px; margin: 0; }
/* !important beats css/toys.css's global [hidden] { display: none !important }. */
.bk-reactions-rating[hidden] { display: flex !important; visibility: hidden; }
.bk-rating-bar { flex: 0 0 7rem; height: 0.5rem; background: var(--bk-rating-track); }
.bk-rating-fill { background: var(--bk-rating-fill); transform-origin: left center; }
.bk-rating-text { min-width: 4ch; color: var(--t-ink-2); font: 600 0.8125rem/1 var(--t-mono); font-variant-numeric: tabular-nums; }
.bk-reactions-note { flex: 1 0 100%; min-height: 1.4em; margin: 0; color: var(--t-ink-2); font: 500 0.8125rem/1.4 var(--t-mono); }
@media (max-width: 600px) {
  .bk-reactions { gap: 10px 14px; }
  .bk-rating-bar { flex-basis: 4.5rem; }
}

/* Like / Boo: two v2 keys on the shared --t-r-btn shape — a flat face, an inset outline and a
   bottom lip. Hover lifts, press squashes the key and its lip; a vote fills the key (Like in
   cobalt, Boo in ink) and pops a ring plus a six-spark burst. */
.bk-vote {
  --vote-face: var(--b-key-face);
  --vote-ink: var(--t-ink);
  --vote-on: var(--t-cobalt);
  --vote-on-ink: #fff;
  --vote-spark: var(--t-cobalt);
  position: relative;
  isolation: isolate;
  min-height: 2.75rem;
  padding: 0 1.05rem 2px;
  border: 0;
  border-radius: var(--t-r-btn);
  background: var(--vote-face);
  color: var(--vote-ink);
  box-shadow: var(--b-key-depth);
  -webkit-tap-highlight-color: transparent;
}
.posts .bk-vote { --vote-face: var(--t-surface); }
.bk-vote-boo { --vote-on: var(--t-ink); --vote-on-ink: var(--t-surface); --vote-spark: var(--t-ink-2); }
/* Beats the kit's flat accent hover/focus fill. */
.bk-vote:hover:not(:disabled), .bk-vote:focus-visible:not(:disabled) { background: var(--vote-face); color: var(--vote-ink); }
.bk-vote:disabled { opacity: 0.5; box-shadow: var(--b-key-depth-pressed); }
.bk-vote.bk-voted,
.bk-vote.bk-voted:hover:not(:disabled),
.bk-vote.bk-voted:focus-visible:not(:disabled) {
  background: var(--vote-on);
  color: var(--vote-on-ink);
  opacity: 1;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25);
}
/* Burst layers: ::before a ring, ::after six sparks (box-shadow dots) around the centre. */
.bk-vote::before,
.bk-vote::after { content: ""; position: absolute; pointer-events: none; opacity: 0; }
.bk-vote::before { inset: -1px; z-index: -1; border: 2px solid var(--vote-spark); border-radius: inherit; }
.bk-vote::after {
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  box-shadow:
    0 -30px 0 var(--vote-spark), 34px -16px 0 var(--vote-spark), 34px 16px 0 var(--vote-spark),
    0 30px 0 var(--vote-spark), -34px 16px 0 var(--vote-spark), -34px -16px 0 var(--vote-spark);
}
@media (prefers-reduced-motion: no-preference) {
  .bk-vote { transition: transform var(--t-slow) var(--t-spring), background-color var(--t-base) var(--t-out), color var(--t-base) var(--t-out), opacity var(--t-base) ease; }
  .bk-vote:hover:not(:disabled) { transform: translateY(-2px); }
  .bk-vote:active:not(:disabled) {
    transform: translateY(2px) scale(1.03, 0.92);
    transition-duration: var(--t-fast);
    box-shadow: var(--b-key-depth-pressed);
  }
  .bk-vote-pop { animation: bk-vote-pop 520ms var(--t-spring); }
  .bk-vote-pop::before { animation: bk-vote-ring 600ms var(--t-out); }
  .bk-vote-pop::after { animation: bk-vote-burst 640ms var(--t-out); }
  .bk-reactions-rating:not([hidden]) { animation: bk-rating-in 450ms var(--t-out); }
  .bk-reactions-rating:not([hidden]) .bk-rating-fill { animation: bk-fill-in 900ms var(--t-out); }
}
@keyframes bk-vote-pop {
  0% { transform: scale(1); }
  25% { transform: scale(1.06, 0.86); }
  60% { transform: scale(0.96, 1.08); }
  100% { transform: scale(1); }
}
@keyframes bk-vote-ring {
  0% { opacity: 0.85; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.3, 1.75); }
}
@keyframes bk-vote-burst {
  0% { opacity: 1; transform: scale(0.35); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.25); }
}
@keyframes bk-rating-in { from { transform: translateY(4px); } }
@keyframes bk-fill-in { from { transform: scaleX(0); } }

/* ---------- key type ----------
   The shared v2 sheet resets every button with `body.v2 button { font: inherit }`, which
   outranks a single class. Prefixing body.blog lifts the keys' own type above it without
   !important, for the <button> and the <a> variants alike. */
body.blog .bk-share-btn { font: 600 0.9375rem/1 var(--t-display); letter-spacing: normal; }
body.blog .bk-vote { font: 700 0.9375rem/1.2 var(--t-display); letter-spacing: normal; }
body.blog .bk-cloud-motion { font: 500 0.75rem/1 var(--t-mono); letter-spacing: 0.04em; }

/* ---------- generated post page ---------- */

/* main is the measuring container: the article column keeps a reading measure and the hero
   breaks out of it, up to 1040px, without 100vw (no horizontal scroll under a scrollbar). */
.blog-page {
  container-type: inline-size;
  padding: 28px var(--b-gutter) 64px;
}
.bk-post-page, .blog-page > .bk-post-nav, .blog-page > h1, .blog-page > .bk-tag-list, .blog-page > p {
  width: 100%;
  max-width: 720px;
  margin-inline: auto;
}
.bk-post-page { display: flex; flex-direction: column; margin-top: 0; margin-bottom: 0; padding: 0; border: 0; color: var(--t-ink); }
.bk-post-page > .bk-post-date { order: -1; margin: 0 0 16px; }
.bk-post-page > .bk-post-title, .blog-page > h1 {
  /* Block margins only: the tag page's h1 keeps the 720px column's auto inline margins. */
  margin-block: 0 28px;
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.02em;
  animation: b-rise 0.7s var(--t-spring) both;
}
.bk-post-page > .bk-media {
  --hero: min(100cqi, 1040px);
  width: var(--hero);
  max-width: none;
  margin: 0 0 12px calc((100% - var(--hero)) / 2);
}
.bk-post-page > .bk-media img { border-radius: var(--t-r-l); }
.bk-post-page > .bk-media .bk-yt-preview, .bk-post-page > .bk-media .bk-yt-frame { border-radius: var(--t-r-l); }
.bk-post-page > .bk-media-link img, .bk-post-page .bk-media-link { border-radius: var(--t-r-l); }
/* A portrait video sits in a putty well instead of filling the column top to bottom. */
.bk-post-page > .bk-media-video { padding: 0; }
.bk-post-page > .bk-media-video video { width: auto; max-width: 100%; height: min(78svh, 860px); aspect-ratio: auto 9 / 16; margin-inline: auto; border-radius: var(--t-r-l); background: #141414; }
.bk-post-page > .bk-media figcaption { margin: 10px 4px 0; }
.bk-post-page > .bk-media + .bk-post-body { margin-top: 28px; }

.bk-post-page .bk-post-body { max-width: var(--b-measure); font-size: 1.125rem; line-height: 1.65; text-wrap: pretty; }
/* Set on the paragraphs themselves: the kit's .bk-post-body p { line-height: 1.6 } would win over the inherited 1.65. */
.bk-post-page .bk-post-body > p { margin: 0 0 1.1em; line-height: 1.65; }
.bk-post-page .bk-post-body > p:first-child { font-size: 1.15em; line-height: 1.5; }
.bk-post-page .bk-post-body > p:last-child { margin-bottom: 0; }
/* body.blog raises it above the global body.v2 a / body.blog a { color: inherit } (css/toys.css). */
body.blog .bk-post-page .bk-post-body a { color: var(--b-link); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; }
body.blog .bk-post-page .bk-post-body a:hover { text-decoration-thickness: 3px; }
.bk-post-body blockquote { margin: 1.4em 0; padding: 0.2em 0 0.2em 1.1em; box-shadow: inset 4px 0 0 var(--t-cobalt); font-size: 1.15em; line-height: 1.45; }
.bk-post-body ul, .bk-post-body ol { margin: 0 0 1.1em; padding-inline-start: 1.3em; }
.bk-post-body li + li { margin-top: 0.35em; }
.bk-post-body img { display: block; max-width: 100%; height: auto; margin: 1.4em 0; border-radius: var(--t-r-m); }

.bk-post-page > .bk-tags { margin-top: 32px; padding-top: 24px; box-shadow: inset 0 1.5px 0 var(--t-line); }
.bk-post-page > .bk-share { margin-top: 28px; }

/* Neighbour navigation: two neutral cards, then the way back to the list. */
.bk-post-nav { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 48px; }
.bk-post-nav-newer, .bk-post-nav-older {
  display: block;
  padding: 18px 18px 22px;
  border-radius: var(--t-r-m);
  background: var(--t-card);
  color: var(--t-ink);
  box-shadow: var(--b-card-depth);
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.3;
  text-decoration: none;
  text-wrap: pretty;
  transition: transform var(--t-slow) var(--t-spring);
}
@media (hover: hover) { .bk-post-nav-newer:hover, .bk-post-nav-older:hover { transform: translateY(-4px); } }
.bk-post-nav-newer:active, .bk-post-nav-older:active { transform: translateY(2px) scale(0.99); transition-duration: var(--t-fast); }
.bk-post-nav-all { justify-self: start; margin-top: 4px; }

/* ---------- generated tag page ---------- */

.blog-page > h1 { margin-bottom: 20px; }
.bk-tag-list { margin-top: 0; margin-bottom: 28px; padding: 0; list-style: none; }
.bk-tag-list li {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding: 20px 0 22px;
  box-shadow: inset 0 1.5px 0 var(--t-line);
}
.bk-tag-list li > a { order: 1; color: var(--t-ink); font-size: 1.375rem; font-weight: 700; line-height: 1.15; letter-spacing: -0.015em; text-decoration: none; text-wrap: balance; }
.bk-tag-list li > a::after { content: ""; position: absolute; inset: 0; border-radius: var(--t-r-s); }
.bk-tag-list li > a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.18em; }
.bk-tag-list li > a:focus-visible { outline: 0; }
.bk-tag-list li > a:focus-visible::after { outline: 4px solid var(--t-ink); outline-offset: 4px; }
.bk-tag-list .bk-post-date { order: 0; margin: 0 0 8px; }
.bk-tag-excerpt { order: 2; margin: 8px 0 0; max-width: 62ch; color: var(--t-ink-2); line-height: 1.5; }

/* ---------- consent card on the v2 tokens (light and dark) ---------- */

body.blog #sosw-consent-banner {
  --sc-bg: var(--t-card);
  --sc-fg: var(--t-ink);
  --sc-border: var(--t-line);
  --sc-link: var(--b-link);
  --sc-btn-bg: var(--t-ink);
  --sc-btn-fg: var(--t-surface);
  --sc-btn-hover: var(--t-ink-2);
  --sc-focus: var(--t-ink);
  --sc-radius: var(--t-r-m);
  --sc-shadow: inset 0 0 0 1.5px var(--t-line), 0 20px 40px -20px rgba(0, 0, 0, 0.45);
  border: 0;
}
body.blog #sosw-consent-banner .sosw-consent-btn { border-radius: var(--t-r-btn); min-height: 44px; }
/* While the consent card floats at the bottom, the page can still scroll its last controls clear. */
body.blog:has(#sosw-consent-banner) { padding-bottom: 150px; }

/* ---------- breakpoints: fixed rem steps ---------- */

@media (min-width: 380px) {
  .intro h1 { font-size: 3.25rem; }
}
@media (min-width: 600px) {
  .intro { padding: 44px 0 40px; }
  .intro h1 { font-size: 4.5rem; }
  .lede { font-size: 1.25rem; }
  .posts > .bk-post:first-of-type .bk-post-title { font-size: 2.5rem; }
  .bk-post-page > .bk-post-title, .blog-page > h1 { font-size: 3rem; }
  .bk-post-page .bk-post-body { font-size: 1.1875rem; }
  .bk-post-nav { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .bk-post-nav:not(:has(.bk-post-nav-newer)) .bk-post-nav-older,
  .bk-post-nav:not(:has(.bk-post-nav-older)) .bk-post-nav-newer { grid-column: 1 / -1; }
  .bk-post-nav-older { text-align: right; }
  .bk-post-nav-all { grid-column: 1 / -1; }
  .bk-tag-list li { grid-template-columns: 10.5rem minmax(0, 1fr); column-gap: 20px; }
  .bk-tag-list .bk-post-date { grid-column: 1; grid-row: 1 / span 2; margin: 0.45rem 0 0; }
  .bk-tag-list li > a, .bk-tag-excerpt { grid-column: 2; }
}
@media (min-width: 760px) {
  .posts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .posts > .bk-post:first-of-type { grid-column: 1 / -1; }
  /* Two across: a card left alone in the last row runs full width. */
  .posts > .bk-post:nth-of-type(even):last-of-type { grid-column: 1 / -1; }
}
@media (min-width: 960px) {
  /* The featured slab: picture left, story right; share and reactions settle at the foot. */
  .posts > .bk-post:first-of-type {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    grid-template-rows: auto auto auto 1fr auto auto;
    column-gap: 22px;
    padding: 12px 22px 22px 12px;
  }
  .posts > .bk-post:first-of-type > * { grid-column: 2; margin-inline: 0; }
  /* The picture fills the slab's height (cover crop) when the story runs longer than 3:2. */
  .posts > .bk-post:first-of-type > .bk-media { grid-column: 1; grid-row: 1 / -1; align-self: stretch; display: flex; flex-direction: column; }
  .posts > .bk-post:first-of-type > .bk-media-image > img,
  .posts > .bk-post:first-of-type > .bk-media-image > .bk-media-link { flex: 1 0 auto; }
  .posts > .bk-post:first-of-type > .bk-media-image > .bk-media-link { display: flex; }
  .posts > .bk-post:first-of-type > .bk-media-image > .bk-media-link > img { flex: 1 0 auto; }
  .posts > .bk-post:first-of-type > .bk-post-header { grid-row: 1; margin-top: 14px; }
  .posts > .bk-post:first-of-type > .bk-post-body { grid-row: 2; }
  .posts > .bk-post:first-of-type > .bk-tags { grid-row: 3; }
  .posts > .bk-post:first-of-type > .bk-share { grid-row: 5; }
  .posts > .bk-post:first-of-type > .bk-reactions-slot { grid-row: 6; }
  /* A post without a picture: the story runs the slab's full width, no empty picture column. */
  .posts > .bk-post:first-of-type:not(:has(> .bk-media)) { grid-template-columns: minmax(0, 1fr); padding: 12px 28px 22px; }
  .posts > .bk-post:first-of-type:not(:has(> .bk-media)) > * { grid-column: 1; }
  .posts > .bk-post:first-of-type:not(:has(> .bk-media)) .bk-post-body { max-width: var(--b-measure); }
  .posts > .bk-post:first-of-type .bk-post-title { font-size: 2.75rem; }
  .posts > .bk-post:first-of-type .bk-post-body { font-size: 1.125rem; }
  /* The slab has room for the story's second paragraph too. */
  .posts > .bk-post:first-of-type .bk-post-body p + p { display: -webkit-box; margin-top: 0.75em; -webkit-line-clamp: 3; line-clamp: 3; }
  .posts > .bk-post:first-of-type .bk-post-body p + p + p { display: none; }
  .bk-post-page > .bk-post-title, .blog-page > h1 { font-size: 3.5rem; }
  .blog-page { padding-top: 44px; }
}
@media (min-width: 1100px) {
  .blog-index {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    grid-template-areas: "intro topics" "posts posts";
    column-gap: 40px;
    align-items: end;
  }
  .intro { grid-area: intro; padding: 56px 0 44px; }
  .intro h1 { font-size: 5.5rem; }
  .lede { font-size: 1.375rem; }
  .posts > .bk-post:first-of-type { padding: 14px 28px 20px 14px; column-gap: 32px; }
  .posts > .bk-post:first-of-type .bk-post-title { font-size: 3.25rem; }
  .posts > .bk-post:first-of-type .bk-post-body { font-size: 1.1875rem; }
  /* Beside the masthead on wide screens; after the posts (its DOM place) everywhere else.
     The well stretches over the masthead row, from just under its top to the lede's last line,
     so its box is the same before and after the feed: the cloud arriving inside it moves
     nothing (no layout shift), whatever its height, as long as it fits. A cloud taller than
     the masthead grows the row instead, never overlapping the posts. */
  .blog-topics { grid-area: topics; align-self: stretch; margin: 16px 0 44px; }
  /* Wide enough for at most six balanced rows (the kit's text-wrap: balance stops beyond six lines). */
  #tag-cloud { font-size: 0.875rem; }
  .posts { grid-area: posts; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
  .posts > .bk-post:nth-of-type(even):last-of-type { grid-column: auto; }
  /* Three across: a card left alone in the last row runs full width. */
  .posts > .bk-post:nth-of-type(3n + 2):last-of-type { grid-column: 1 / -1; }
}
@media (min-width: 1280px) {
  .intro h1 { font-size: 6.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  .intro h1, .bk-post-page > .bk-post-title, .blog-page > h1 { animation: none; }
  .bk-vote, .bk-share-btn, .bk-page-link, .bk-post-nav-newer, .bk-post-nav-older, .bk-post-nav-all, .bk-tag { transition: none; }
  .bk-share-btn:active, .bk-page-link:active, .bk-post-nav-newer:hover, .bk-post-nav-older:hover, .bk-post-nav-newer:active, .bk-post-nav-older:active, .bk-post-nav-all:active { transform: none; }
}
