/*
 * PATCH-3500 — shell for the blog (blog/index.html and every blog/<slug>.html).
 *
 * The long-document pattern the legal pages use (see the header of legal.css):
 * plain documents, no design-system components, no DC runtime. These pages
 * deliberately do NOT load `_ds_bundle.css` / `styles.css` — those pin html/body
 * to a fixed 100dvh with overflow:hidden (the PATCH-1098 trap), and a long post
 * would be clipped with no way to scroll to its end. `test/blog.test.mjs` pins
 * that. Only `fonts.css` is pulled in.
 *
 * Tokens are the CURRENT home-page values (marketing/index.html :root), which is
 * why --text-muted is #948e85 (PATCH-1151) here, as in legal.css since
 * PATCH-3501. Every colour below this block is a var(); keep raw colours in :root.
 */

:root {
  /* PATCH-4131: the page behind everything is the Films page's #141413, so the
     cross-fade to and from /films/ keeps one colour. --bg-app stays the app's
     #1f1f1e for anything that is a surface. */
  --bg-page: #141413;
  --bg-app: #1f1f1e; --bg-rail: #1a1a19; --bg-raised: #221d1a; --bg-input: #1a1a19;
  --text: #ece8e1; --text-secondary: #b8b3aa; --text-muted: #948e85; --text-faint: #66625a;
  --accent: #d97757; --accent-hover: #e2876a; --accent-text: #f0a98e; --accent-soft: rgba(217,119,87,0.15);
  --border: rgba(255,253,247,0.09); --border-soft: rgba(255,253,247,0.055); --border-strong: rgba(255,253,247,0.16);
  --hover: rgba(255,253,247,0.05);
  --r-sm: 6px; --r-md: 9px; --r-lg: 13px; --r-pill: 999px;
  --font-ui: "Hanken Grotesk", "Hanken Grotesk Fallback", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  /* Reading measure for a post body. */
  --measure: 760px;
  /* PATCH-4641: the Listen player, a bar under the hero image (PATCH-4753) and a dock. */
  --listen-track: rgba(255,253,247,0.18);
  --dock-rail: rgba(255,253,247,0.1); --dock-shadow: rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0; background: var(--bg-page); color: var(--text);
  font-family: var(--font-ui); font-size: 16px; line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* PATCH-3788: the header and footer are the site's shared ones. Their rules
   are in ../site-chrome.css, which each blog page loads after this file. */

/* PATCH-3827: the column is the header's, so the first heading starts under
   the logo: --chrome-width is site-chrome.css's, which every page that loads
   this file loads too, and the 24px is .site-nav's side padding.
   PATCH-4141 (owner ask 2026-10-15): what sits in the column now spans it,
   1132px, as the home page's How it works grid and the Films page do:
   the post list. A post is long-form reading, and keeps its
   --measure.
   Running text keeps a reading width of its own, as How it works' intro
   does: a rule below that sets a narrower max-width still wins. */
main { max-width: var(--chrome-width); margin: 0 auto; padding: clamp(36px,5vw,64px) 24px 80px; }
main > * { max-width: 1132px; }
.kicker {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent-text); margin-bottom: 12px;
}
/* PATCH-7272 (design review M1): every inner page's h1 and section heading sizes, site-chrome.css's. */
h1 {
  margin: 0 0 12px; font-size: var(--chrome-h1-size); font-weight: 700;
  letter-spacing: -0.025em; line-height: 1.1;
}
.intro { margin: 0 0 40px; max-width: 600px; font-size: 18px; color: var(--text-secondary); }

/* ---- Index: the post list ------------------------------------------------ */

/* PATCH-4447: each card leads with its post's image, which runs to the card's
   edges at the top, so the card's own corner radius rounds it; the text sits
   in .card-body below it. One column on phones, two from 760px, three from
   1120px where each card has at least 344px for full titles and metadata.
   Each card is a column, so a short
   card's "Read the post" sits level with its neighbour's. */
.posts { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.posts > li { display: flex; min-width: 0; }
.card {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-raised); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); color: var(--text);
}
.card-image {
  display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover;
  background: var(--bg-rail); border-bottom: 1px solid var(--border-soft);
}
.card-body { flex: 1; display: flex; flex-direction: column; padding: 20px 24px 22px; overflow-wrap: anywhere; }
@media (min-width: 760px) {
  .posts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
}
@media (min-width: 1120px) {
  .posts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.card:is(:hover, :focus-visible) { text-decoration: none; border-color: var(--border-strong); }
/* PATCH-6008: each card item on its own line, in Cat's order and gaps: the
   eyebrow 6px above the title (the h2's own top margin), the Published line
   8px under it, "By <name>" 4px under that, the description 12px down. The
   categories and the CTA are the card's foot, pushed to its bottom together. */
.card-eyebrow, .card-date, .card-categories { display: block; font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }
.card-byline { display: block; font-size: 14px; color: var(--text-secondary); }
.card-date + .card-byline { margin-top: 4px; }
.card .card-byline + p { margin-top: 12px; }
.card-foot { margin-top: auto; display: flex; flex-direction: column; }
.card-categories { padding-top: 16px; }

/* PATCH-4484, PATCH-4485: the filter rows above the cards, on the index and
   on every category and author page. Plain links styled as pills; the page
   you are on is filled. Each row wraps. PATCH-6100: below 1024px
   phone-navigation.css swaps these rows for two closed disclosures. */
.filters { margin: -8px 0 32px; }
.filters-desktop { display: grid; gap: 12px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.filter-label {
  min-width: 88px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-muted);
}
.filter-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.filter-links a {
  display: inline-block; padding: 6px 14px; font-size: 14px; line-height: 1.5; color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: var(--r-pill);
}
.filter-links a:is(:hover, :focus-visible) { text-decoration: none; color: var(--text); border-color: var(--border-strong); }
.filter-links a[aria-current] { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent); }
/* PATCH-5366: numbered archive/search links wrap at phone widths. */
.pagination { margin-top: 32px; }
.pagination ul { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.pagination a {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px;
  padding: 8px 14px; font-size: 14px; color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: var(--r-pill);
}
.pagination a:is(:hover, :focus-visible) { text-decoration: none; color: var(--text); border-color: var(--border-strong); }
.pagination a[aria-current] { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent); }
/* PATCH-4520: an agent's short title label, "(PM)", muted beside the name;
   it takes the link's colour when the link is hovered, focused or current. */
.filter-role { color: var(--text-muted); }
.filter-links a:is(:hover, :focus-visible, [aria-current]) .filter-role { color: inherit; }
/* PATCH-4486: the search form, above the filter rows on the index and at the
   top of the results page. Laid out as one more row, its label in the filter
   labels' column. The input is 16px so a phone does not zoom in on focus. */
.search { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: -8px 0 20px; }
.search + .filters { margin-top: 0; }
/* The results page has no intro: the form follows the h1, so it takes its own gap. */
h1 + .search { margin-top: 28px; }
.search-label {
  min-width: 88px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-muted);
}
.search-row { flex: 1; display: flex; gap: 8px; max-width: 520px; min-width: 0; }
.search-input {
  flex: 1; min-width: 0; padding: 7px 14px; font: inherit; font-size: 16px; line-height: 1.5; color: var(--text);
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--r-pill);
}
.search-input:hover { border-color: var(--border-strong); }
.search-input:focus-visible { border-color: var(--accent); }
/* PATCH-7272 (design review M2): the button takes every button's 9px corners; the field beside it keeps its pill. */
.search-button {
  padding: 6px 16px; font: inherit; font-size: 14px; line-height: 1.5; color: var(--text); cursor: pointer;
  background: var(--bg-raised); border: 1px solid var(--border-strong); border-radius: var(--r-md);
}
.search-button:is(:hover, :focus-visible) { border-color: var(--accent); color: var(--accent-text); }
/* The results page: how many matched, or that none did, above the cards. */
.search-count { margin: 0 0 24px; font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }
.search-empty { font-family: var(--font-ui); font-size: 16px; color: var(--text-secondary); }
/* PATCH-4485: an author page's role line, between its name and its bio. */
.author-role { margin: 0 0 12px; font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }
.card h2 { margin: 6px 0 8px; font-size: 21px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; }
.card p { margin: 0; max-width: 720px; font-size: 15px; color: var(--text-secondary); }
/* PATCH-3838: the card's last line leans toward the post. */
.card .more {
  display: inline-block; align-self: flex-start; padding-top: 12px; font-size: 14px; color: var(--accent-text);
  transition: translate var(--motion-slow) var(--ease-out-soft);
}
.card:hover .more, .card:focus-visible .more { translate: 3px; }

/* ---- Post: long-form typography ----------------------------------------- */

/* PATCH-4475 (owner ask 2026-10-19): the post's one reading column sits in
   the middle of the page, text still left-aligned inside it. The index keeps
   its full-width list (PATCH-4141). */
.post { max-width: var(--measure); margin-inline: auto; }
/* PATCH-4223, PATCH-6008: the top of a post, written from blog/posts.json,
   each item its own line under the h1's 12px: the Published line (once the
   post is public) 8px above the byline, the reading time 4px under it, and
   the hero's 28px top margin closes the block. */
.published { margin: 0 0 8px; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.byline { margin: 0; font-size: 14px; color: var(--text-secondary); }
.read-time { margin: 4px 0 0; font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }
/* PATCH-6008: the details block after the article (and the owner's note),
   before Sources: the build-log date, PATCH-4473's reviewer and review date,
   then PATCH-4484's categories, each a link to its page. 36px down, a rule,
   16px in; 36px on to Sources, which drops its own 44px after it.
   PATCH-4485: the byline's name links the author's page. The byline's,
   reviewer's and categories' links take one quiet underline. */
.post-details { margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.post-details p { margin: 0; }
.event-date { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }
.post-details .reviewed { margin-top: 8px; font-size: 14px; color: var(--text-muted); }
.post-details .reviewed-on { margin-top: 4px; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.post-details .categories { margin-top: 12px; font-size: 14px; color: var(--text-muted); }
.post-details > :first-child { margin-top: 0; }
:is(.byline, .reviewed, .categories) a { color: var(--text-secondary); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
:is(.byline, .reviewed, .categories) a:is(:hover, :focus-visible) { color: var(--text); text-decoration-color: currentColor; }
.post-hero { margin: 28px 0 36px; }
/* PATCH-6048: the hero's and a card's image sit in a <picture> of their
   copies at each width; it is the image's box, so it takes the block the
   image took. */
.post-hero picture, .card > picture { display: block; }
.post-hero img {
  display: block; width: 100%; height: auto;
  border-radius: var(--r-lg); border: 1px solid var(--border-soft); background: var(--bg-rail);
}
/* PATCH-4641: on a post with audio, a Listen player in the hero figure.
   PATCH-4753 (owner 2026-10-20: "I would rather it just be below the image
   and the same width as the image"): one bar in the page flow under the
   image, its edges on the image's, and nothing on the image. It shows only
   once blog-audio.js marks the figure ready, so a reader without JavaScript
   sees no dead button. Before play the bar is the pill; pressed, the strip's
   controls take its place; once the strip scrolls away while playing, a dock
   holds the controls at the bottom of the window. */
.listen-pill, .listen-strip { display: none; }
.listen.is-ready .listen-pill, .listen.is-started .listen-strip { display: flex; }
.listen.is-started .listen-pill { display: none; }
.listen-pill, .listen-strip {
  width: 100%; margin: 12px 0 0; align-items: center;
  background: var(--bg-raised); border: 1px solid var(--border-strong); border-radius: var(--r-lg);
}
.listen-pill {
  gap: 14px; padding: 8px 22px 8px 8px;
  font: inherit; text-align: left; color: var(--text); cursor: pointer;
}
.listen-strip { gap: 12px; padding: 8px 14px 8px 8px; }
.listen-icon, .listen-play {
  flex: none; display: grid; place-items: center; width: 52px; height: 52px; padding: 0;
  border: 0; border-radius: 50%; color: var(--bg-page); background: var(--accent);
  transition: var(--motion-fast) var(--ease-out-soft); transition-property: background-color, scale;
}
.listen-play { cursor: pointer; }
.listen-pill:hover .listen-icon, .listen-play:hover { background: var(--accent-hover); scale: 1.04; }
.listen-icon svg, .listen-play svg { display: block; width: 22px; height: 22px; }
.listen-label { display: flex; flex-direction: column; }
.listen-title { font-size: 16px; font-weight: 600; line-height: 1.3; color: var(--text); }
.listen-sub { font-family: var(--font-mono); font-size: 12px; line-height: 1.5; color: var(--text-secondary); }
.listen-pill.is-unavailable { cursor: default; }
.listen-pill.is-unavailable .listen-icon { background: var(--text-faint); scale: none; }
.listen-time { flex: none; font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.listen-range {
  --progress: 0%;
  flex: 1; min-width: 0; height: 18px; margin: 0; cursor: pointer; appearance: none; background: transparent;
}
.listen-range::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--progress), var(--listen-track) var(--progress));
}
.listen-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--listen-track); }
.listen-range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
.listen-range::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; margin-top: -5px; border: 0; border-radius: 50%; background: var(--text); }
.listen-range::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--text); }
.listen-speed {
  flex: none; min-width: 56px; padding: 4px 10px; cursor: pointer;
  font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary);
  background: transparent; border: 1px solid var(--border-strong); border-radius: var(--r-pill);
}
.listen-speed:hover { color: var(--text); border-color: var(--text-muted); }
.listen-dock {
  position: fixed; z-index: 50; left: 0; right: 0; bottom: max(14px, env(safe-area-inset-bottom));
  width: min(var(--measure), calc(100% - 24px)); margin-inline: auto;
  display: none; align-items: center; gap: 12px; padding: 10px 12px; overflow: hidden;
  background: var(--bg-raised); border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  box-shadow: 0 12px 40px var(--dock-shadow);
  translate: 0 calc(100% + 40px);
  transition: var(--motion-surface) var(--ease-out-soft); transition-property: translate, display; transition-behavior: allow-discrete;
}
.listen-dock.is-shown { display: flex; translate: 0 0; }
@starting-style { .listen-dock.is-shown { translate: 0 calc(100% + 40px); } }
.listen-dock .listen-play { width: 40px; height: 40px; }
.listen-dock .listen-play svg { width: 18px; height: 18px; }
.dock-thumb { flex: none; width: 64px; height: 34px; object-fit: cover; border-radius: var(--r-sm); }
.dock-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dock-title { font-size: 14px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-sub { font-family: var(--font-mono); font-size: 12px; line-height: 1.5; color: var(--text-secondary); }
.dock-sub .listen-time { font-size: inherit; }
.dock-bar { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--dock-rail); }
.dock-bar span { display: block; width: var(--progress, 0%); height: 100%; background: var(--accent); }
.dock-close {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; cursor: pointer;
  color: var(--text-muted); background: transparent; border: 0; border-radius: 50%;
}
.dock-close:hover { color: var(--text); background: var(--hover); }
.dock-close svg { width: 16px; height: 16px; }
/* The dock slides up as it appears. Centred by its margins, never by a
   translate, so motion.css's reduced-motion rule, which turns translate and
   every transition off, leaves it in place and only drops the slide. */
/* While the dock shows, the page keeps room for it, so it never covers the last lines. */
html.listen-docked body { padding-bottom: calc(var(--listen-dock-height, 64px) + 28px + env(safe-area-inset-bottom)); }
/* PATCH-7273 (Cat's L6): a 44px-tall tap target, as the watch pages' back
   link is (films.css); the text stays 14px. No negative margin: the audio
   bar's guard (test/blog-audio.test.mjs) refuses one beside it. */
.back { display: inline-flex; align-items: center; min-height: 44px; margin: 0 0 16px; font-size: 14px; color: var(--text-secondary); }
.back:is(:hover, :focus-visible) { color: var(--text); text-decoration: none; }
.prose h2 {
  margin: 44px 0 12px; font-size: var(--chrome-h2-size); font-weight: 600;
  letter-spacing: -0.015em; line-height: 1.3; color: var(--text); scroll-margin-top: calc(var(--chrome-header-h, 58px) + 18px);
}
.prose h3 { margin: 32px 0 8px; font-size: 18px; font-weight: 600; color: var(--text); scroll-margin-top: calc(var(--chrome-header-h, 58px) + 18px); }
.prose p, .prose li { color: var(--text-secondary); }
.prose p { margin: 0 0 18px; }
/* PATCH-5828: the two- or three-sentence summary that opens a post's prose, read as its lead. */
.prose .summary { margin: 0 0 28px; padding-bottom: 10px; border-bottom: 1px solid var(--border-soft); }
.prose .summary p { color: var(--text); font-size: 18px; }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 24px; }
.prose li { margin-bottom: 8px; }
.prose li::marker { color: var(--text-muted); }
.prose strong { color: var(--text); font-weight: 600; }
.prose blockquote {
  margin: 0 0 18px; padding: 4px 0 4px 18px; border-left: 2px solid var(--accent);
}
.prose blockquote p { color: var(--text); font-size: 18px; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code {
  font-family: var(--font-mono); font-size: 0.86em; color: var(--accent-text);
  background: var(--bg-raised); border: 1px solid var(--border-soft);
  border-radius: var(--r-sm); padding: 1px 5px;
}
.prose pre {
  margin: 0 0 18px; padding: 16px 18px; overflow-x: auto;
  background: var(--bg-rail); border: 1px solid var(--border-soft); border-radius: var(--r-lg);
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.6; color: var(--text);
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }
.prose figure { margin: 0 0 22px; }
.prose figure img { display: block; max-width: 100%; height: auto; border-radius: var(--r-lg); border: 1px solid var(--border-soft); }
.prose figcaption { margin-top: 8px; font-size: 13px; color: var(--text-muted); }
.prose hr { border: 0; border-top: 1px solid var(--border-soft); margin: 36px 0; }
/* PATCH-4223: the end of a post. The owner's note is an aside in the card
   colour, present only when the post's entry has one; Sources follow. */
.owner-note {
  margin: 44px 0 0; padding: 18px 20px;
  background: var(--bg-raised); border: 1px solid var(--border-soft); border-radius: var(--r-lg);
}
.owner-note-label {
  margin: 0 0 6px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent-text);
}
.owner-note p:last-child { margin: 0; color: var(--text); }
.sources { margin-top: 44px; }
.post-details + .sources { margin-top: 36px; }
.sources h2 { margin: 0 0 12px; font-size: var(--chrome-h2-size); font-weight: 600; color: var(--text); scroll-margin-top: calc(var(--chrome-header-h, 58px) + 18px); }
.sources ol { margin: 0; padding-left: 24px; font-size: 14px; color: var(--text-muted); }
.sources li { margin-bottom: 6px; overflow-wrap: anywhere; }

@media (max-width: 560px) {
  body { font-size: 15.5px; }
  .intro { font-size: 16px; }
  .card-body { padding: 16px 18px 18px; }
  .search-label { flex-basis: 100%; }
  .search-row { max-width: none; }
  .listen-icon, .listen-play { width: 44px; height: 44px; }
  .listen-icon svg, .listen-play svg { width: 18px; height: 18px; }
  .listen-title { font-size: 15px; }
  .listen-pill { gap: 10px; padding: 6px 16px 6px 6px; }
  .listen-strip { gap: 10px; padding: 6px 10px 6px 6px; }
  .listen-time.is-left, .dock-thumb { display: none; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
