/* The blog's reading layout. Loaded after /style.css, whose tokens, fonts,
   aurora and footer it uses; it adds no colour of its own. No animation. */

.blog { max-width: 760px; }
.blog-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-top: calc(22px + env(safe-area-inset-top, 0px));
  padding-bottom: 22px;
  font-family: var(--mono); font-size: 12px;
}
.blog-head .home { display: inline-flex; align-items: center; }
.blog-head .home img { height: 22px; width: auto; display: block; }
.blog-head nav { display: flex; gap: 20px; }
.blog-head nav a { color: var(--muted); text-decoration: none; padding: 6px 0; }
.blog-head nav a[aria-current] { color: var(--bright); }
@media (hover: hover) { .blog-head nav a:hover { color: var(--aqua); } }

.bl-label {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--amber); margin: 0 0 14px;
}
.blog h1 {
  font-family: var(--display); font-weight: 650; color: var(--bright);
  font-size: clamp(34px, 6vw, 52px); line-height: 1.08; letter-spacing: -0.03em;
  margin: 28px 0 18px; text-wrap: balance;
}
/* The blog's index has no title of its own: its label is the page's heading. */
.blog h1.bl-label {
  font-family: var(--mono); font-weight: 400; font-size: 12px; line-height: 1.5;
  letter-spacing: 0.04em; color: var(--amber); margin: 0 0 24px;
}
.standfirst { font-size: clamp(19px, 2.4vw, 21px); line-height: 1.5; color: var(--paper); margin: 0 0 22px; }
.byline { font-family: var(--mono); font-size: 12px; color: var(--faint); margin: 0 0 40px; }
.byline span + span::before { content: "·"; margin: 0 10px; }

/* the article */
.prose { font-size: 18px; line-height: 1.65; max-width: 68ch; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1em; }
.prose li { margin: 0 0 0.4em; }
.prose a { color: var(--aqua); text-decoration: underline; text-decoration-color: rgba(125, 174, 163, 0.45); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: currentColor; }
.prose strong { color: var(--bright); font-weight: 600; }
.prose h2 {
  font-family: var(--display); font-weight: 600; color: var(--bright);
  font-size: clamp(24px, 3.4vw, 30px); line-height: 1.2; letter-spacing: -0.02em;
  margin: 2.2em 0 0.7em; scroll-margin-top: 24px;
}
.prose h2 a.anchor { color: var(--faint); text-decoration: none; margin-left: 10px; font-weight: 400; opacity: 0.6; }
.prose h2 a.anchor:hover, .prose h2 a.anchor:focus-visible { opacity: 1; color: var(--amber); }
.prose h3 { font-family: var(--display); color: var(--bright); font-size: 20px; margin: 1.6em 0 0.5em; }
.prose code { font-family: var(--mono); font-size: 0.82em; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-s); padding: 1px 5px; }
.prose pre { background: var(--term); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; overflow-x: auto; }
.prose pre code { background: none; border: 0; padding: 0; color: var(--term-fg); }
.prose sup a { text-decoration: none; font-family: var(--mono); font-size: 0.7em; padding: 0 1px; }

/* figures */
.prose figure { margin: 2em 0; }
.prose figure svg { display: block; width: 100%; height: auto; }
.prose figcaption { font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--muted); margin-top: 10px; }
.fig-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }

/* stat tiles: a number, what it counts, its source */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 16px 14px; }
.tile .n { font-family: var(--display); font-size: 36px; line-height: 1; color: var(--bright); letter-spacing: -0.02em; }
.tile .what { font-size: 15px; line-height: 1.45; margin: 10px 0 8px; color: var(--paper); }
.tile .src { font-family: var(--mono); font-size: 11.5px; color: var(--faint); line-height: 1.5; }

/* callouts: what we measured, and its limits */
.callout { border: 1px solid var(--warn-edge); background: var(--warn-bg); border-radius: var(--r); padding: 16px 18px; margin: 1.6em 0; }
.callout > :last-child { margin-bottom: 0; }
.callout .bl-label { margin-bottom: 8px; }

/* tables scroll sideways on a phone */
.table-scroll { overflow-x: auto; margin: 2em 0; border: 1px solid var(--line); border-radius: var(--r); }
.prose table { border-collapse: collapse; width: 100%; min-width: 640px; font-size: 14.5px; line-height: 1.45; }
.prose caption { text-align: left; font-family: var(--mono); font-size: 12px; color: var(--muted); padding: 12px 14px; caption-side: top; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 10px 14px; border-top: 1px solid var(--line); }
.prose thead th { font-family: var(--mono); font-size: 11.5px; font-weight: 500; color: var(--muted); background: var(--card); }
.prose tbody th { color: var(--bright); font-weight: 600; }
.prose tr.ours th, .prose tr.ours td { background: rgba(216, 166, 87, 0.07); }

/* references */
.refs { font-size: 15px; line-height: 1.55; padding-left: 1.6em; }
.refs li { margin-bottom: 0.7em; scroll-margin-top: 24px; }
.refs .kind { font-family: var(--mono); font-size: 11.5px; color: var(--faint); margin-left: 6px; }
.refs li:target { outline: 1px solid var(--amber); outline-offset: 4px; border-radius: 2px; }

/* the index */
.posts { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.posts li { border-bottom: 1px solid var(--line); }
.posts a { display: block; padding: 22px 0; text-decoration: none; }
.posts .bl-num { font-family: var(--mono); font-size: 12px; color: var(--amber); }
.posts h2 { font-family: var(--display); font-weight: 600; color: var(--bright); font-size: 26px; line-height: 1.2; margin: 6px 0 8px; letter-spacing: -0.02em; }
.posts p { margin: 0 0 8px; color: var(--paper); }
.posts .meta { font-family: var(--mono); font-size: 12px; color: var(--faint); }
@media (hover: hover) { .posts a:hover h2 { color: var(--aqua); } }

/* previous and next, the download */
.post-nav { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 56px 0 0; padding-top: 18px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 12px; }
.post-nav a { color: var(--muted); text-decoration: none; }
.post-nav a:hover { color: var(--aqua); }
.post-cta { margin: 36px 0 0; font-size: 16px; color: var(--muted); }
.post-cta a { color: var(--amber); }

@media (max-width: 760px) {
  .prose { font-size: 17px; }
  .fig-panel { padding: 12px; }
}

/* inline SVG figures: the site's colours as classes, labels as text */
.fig-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.fig-grid > div { min-width: 0; }
.fig-narrow { max-width: 460px; margin-inline: auto; }
svg .lbl { font-family: var(--mono); font-size: 13px; fill: var(--muted); }
svg .lbl-b { font-family: var(--sans); font-size: 15px; font-weight: 600; fill: var(--bright); }
svg .lbl-s { font-family: var(--mono); font-size: 12px; fill: var(--faint); }
svg .ln { stroke: var(--line-strong); stroke-width: 1.5; fill: none; }
svg .ln-amber { stroke: var(--amber); stroke-width: 2; fill: none; }
svg .ln-dash { stroke: var(--faint); stroke-width: 1.5; stroke-dasharray: 4 4; fill: none; }
svg .aqua { fill: var(--aqua); }
svg .pink { fill: #d3869b; }
svg .green { fill: var(--green); }
svg .cream { fill: var(--paper); }
svg .amber { fill: var(--amber); }
svg .muted { fill: var(--muted); }
svg .hollow { fill: none; stroke: var(--muted); stroke-width: 1.5; }
svg .on-amber { font-family: var(--mono); font-size: 13px; font-weight: 600; fill: var(--edge); }

/* Text keeps its measure; tables can run wider than it, centred on the page. */
.prose { max-width: none; }
.prose > p, .prose > ul, .prose > ol, .prose > h2, .prose > h3 { max-width: 68ch; }
.prose .fig-wide { max-width: 560px; }

/* The wide table: fixed columns that always fit, text wraps inside cells.
   Never scrolls sideways; on a phone each row becomes a card. */
.table-scroll.wide {
  overflow: visible;
  width: min(1000px, calc(100vw - 2 * var(--gutter)));
  margin-left: calc(50% - min(500px, 50vw - var(--gutter)));
}
.table-scroll.wide table { min-width: 0; table-layout: fixed; }
.prose .wide th, .prose .wide td { padding: 12px 14px; overflow-wrap: break-word; }
.prose .wide col.c1 { width: 19%; }
.prose .wide col.c2 { width: 14%; }
.prose .wide col.c3 { width: 19%; }
.prose .wide col.c4 { width: 20%; }
.prose .wide col.c5 { width: 28%; }
@media (max-width: 700px) {
  .table-scroll.wide { width: auto; margin-left: 0; border: 0; }
  .prose .wide table, .prose .wide tbody, .prose .wide tr, .prose .wide th, .prose .wide td { display: block; width: auto; }
  .prose .wide thead { display: none; }
  .prose .wide caption { display: block; padding: 0 0 10px; }
  .prose .wide tr { border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 10px; padding: 4px 0; }
  .prose .wide tbody th { border-top: 0; padding-bottom: 4px; }
  .prose .wide td { border-top: 0; padding: 4px 14px; display: grid; grid-template-columns: 9.5em minmax(0, 1fr); gap: 10px; }
  .prose .wide td::before { content: attr(data-label); font-family: var(--mono); font-size: 11.5px; color: var(--faint); padding-top: 2px; }
}

/* A post's sections, beside it on wide screens (blog.js fills it from the
   article's h2s; without JavaScript, or narrower, it isn't shown). */
.toc { display: none; }
@media (min-width: 1320px) {
  .blog.post { max-width: calc(1208px + 2 * var(--gutter)); }
  .post-grid { display: grid; grid-template-columns: 200px minmax(0, 760px) 200px; column-gap: 48px; }
  .post-grid > main { grid-column: 2; }
  .toc-col { grid-column: 1; grid-row: 1; }
  .toc:not([hidden]) {
    display: block; position: sticky; top: calc(32px + env(safe-area-inset-top, 0px));
    max-height: calc(100vh - 64px); overflow-y: auto;
    margin-top: 132px; font-size: 13.5px; line-height: 1.4;
  }
  .toc .toc-title { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); margin: 0 0 12px; }
  .toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
  .toc a { display: block; padding: 6px 0 6px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; }
  .toc a:hover { color: var(--bright); }
  .toc a[aria-current="true"] { color: var(--bright); border-left-color: var(--amber); }
  /* the wide table extends into the empty right column, never under the contents */
  .post .table-scroll.wide { width: calc(100% + 248px); margin-left: 0; }
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
