/* The blog: the list of posts (/blog) and each post. Loaded after pages.css on blog
   pages only. Most of a post is written by scripts/blog-build.mjs from the text: the
   byline, "On this page", the sources, the author box, the cards under "Read next",
   and on /blog the guides and the list of posts. Calm on purpose: one accent colour,
   no pop-ups, nothing that moves unless the reader scrolls or clicks. */

/* Reading progress: a thin line under the navigation, drawn by post.js. */
.read-bar { position: fixed; inset: 0 0 auto 0; z-index: 40; height: 3px; pointer-events: none; }
.read-bar i { display: block; height: 100%; width: 100%; transform: scaleX(var(--p, 0)); transform-origin: 0 50%; background: linear-gradient(90deg, var(--accent), #8f8dff); }

/* The top of a post: where it sits, the title, who wrote it and when. */
.crumbs { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; margin-bottom: 18px; font-size: 13.5px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent-text); }
.crumbs span[aria-hidden] { color: var(--faint); }
.crumbs .tag { margin-left: 2px; }
.byline { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; margin-top: 20px; font-size: 14.5px; color: var(--muted); }
.byline-who { display: inline-flex; align-items: center; gap: 9px; color: var(--ink-2); }
.byline-who svg { width: 26px; height: 26px; flex: none; }
.byline-who a { font-weight: 500; color: var(--ink); }
.byline-who a:hover { color: var(--accent-text); }
.byline .dot { color: var(--faint); }
.byline .updated { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; background: #eaf7ef; color: #1d6b3d; font-weight: 500; }
.byline .updated::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #2f9e5b; }

/* Text, contents and the empty column: the text stays the same width and centred;
   on a wide screen "On this page" stays in view on its left. */
.post-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 680px) minmax(0, 1fr); column-gap: 48px; margin-top: 40px; }
.post-grid > .post-body { grid-column: 2; width: 100%; min-width: 0; margin-top: 0; }
.post-toc { grid-column: 1; grid-row: 1; justify-self: end; width: min(230px, 100%); }
.post-toc-in { position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow: auto; }
.post-toc summary { list-style: none; cursor: default; font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.post-toc summary::-webkit-details-marker { display: none; }
.post-toc ol { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 2px; border-left: 1px solid var(--line); }
.post-toc a { display: block; margin-left: -1px; padding: 5px 0 5px 14px; border-left: 2px solid transparent; font-size: 14px; line-height: 1.4; color: var(--muted); transition: color .15s ease, border-color .15s ease; }
.post-toc a:hover { color: var(--ink); }
.post-toc a.on { color: var(--accent-text); border-left-color: var(--accent); font-weight: 500; }

@media (max-width: 1179px) {
  .post-grid { grid-template-columns: minmax(0, 1fr); max-width: 680px; margin-inline: auto; }
  .post-grid > .post-body, .post-toc { grid-column: 1; }
  .post-toc { grid-row: auto; justify-self: stretch; width: auto; margin-bottom: 32px; }
  .post-toc-in { position: static; max-height: none; padding: 14px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
  .post-toc summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
  .post-toc summary::after { content: ""; width: 8px; height: 8px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg) translateY(-2px); transition: transform .2s ease; }
  .post-toc details[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
  .post-toc ol { margin-top: 10px; }
}

/* Headings can be linked to: post.js adds the # on hover. */
.prose h2 { position: relative; scroll-margin-top: 88px; }
.prose h3[id] { scroll-margin-top: 88px; }
.prose .h-link { position: absolute; left: -1.1em; top: 0; padding-right: .3em; color: var(--faint); font-family: var(--body); font-weight: 400; text-decoration: none; opacity: 0; transition: opacity .15s ease; }
.prose h2:hover .h-link, .prose .h-link:focus-visible { opacity: 1; }

/* In short: the answer first, for readers who only need that. */
.post-short { margin-top: 28px; padding: 20px 22px 20px 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 18px 40px -34px rgba(24, 25, 29, .35); }
.post-short > b { display: block; margin-bottom: 10px; font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-text); }
.prose .post-short ul { gap: 8px; padding: 0; list-style: none; }
.prose .post-short li { position: relative; padding-left: 26px; font-size: 16px; line-height: 1.6; }
.prose .post-short li::before { content: ""; position: absolute; left: 2px; top: .5em; width: 12px; height: 7px; border: solid var(--accent); border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.prose .note + .post-short, .prose .post-lede + .post-short { margin-top: 24px; }

/* Facts dated on the page: "Prices checked on …". */
.checked { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 6px 12px; border-radius: 999px; background: var(--canvas); font-size: 13.5px; color: var(--ink-2); }
.checked::before { content: ""; width: 14px; height: 14px; flex: none; background: var(--accent); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm-1.2 14.2-4-4 1.4-1.4 2.6 2.6 5.6-5.6 1.4 1.4z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm-1.2 14.2-4-4 1.4-1.4 2.6 2.6 5.6-5.6 1.4 1.4z'/%3E%3C/svg%3E") center / contain no-repeat; }

/* Tables: easier to follow along a row, and wide ones scroll with the tool's name in view. */
.prose .table { margin-top: 18px; border-radius: 14px; background: var(--panel); box-shadow: 0 18px 40px -36px rgba(24, 25, 29, .4); }
.prose .table table { font-size: 14.5px; }
.prose .table.wide table { min-width: 760px; }
/* Beside the contents on a wide screen, a wide table also takes the empty column on the right. */
@media (min-width: 1181px) { .post-grid .table.wide { width: calc(100% + min(260px, (100vw - 1180px) / 2 + 120px)); max-width: none; } }
.prose .table thead th { position: sticky; top: 0; z-index: 1; padding-block: 12px; background: var(--canvas); color: var(--ink-2); }
.prose .table tbody tr:nth-child(even) td { background: #fafafc; }
.prose .table tbody tr:hover td { background: var(--accent-soft); }
.prose .table td:first-child, .prose .table th:first-child { position: sticky; left: 0; z-index: 1; background: var(--panel); }
.prose .table thead th:first-child { z-index: 2; background: var(--canvas); }
.prose .table tbody tr:nth-child(even) td:first-child { background: #fafafc; }
.prose .table td a { font-weight: 500; }
.prose .table + p, .prose .table + .checked { margin-top: 14px; }
.mk { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.mk.y { background: #eaf7ef; color: #1d6b3d; }
.mk.n { background: #f4f4f6; color: #5d606a; }
.mk.p { background: var(--warn-soft); color: #7a5508; }
.table-hint { display: none; margin-top: 8px; font-size: 13px; color: var(--muted); }
@media (max-width: 760px) { .table.wide + .table-hint { display: block; } }

/* Screenshots */
.prose .shot { margin: 26px 0 0; }
.prose .shot img { border-radius: 14px; box-shadow: 0 24px 48px -38px rgba(24, 25, 29, .45); }
.prose .shot + p, .prose .shot + h3 { margin-top: 18px; }
.prose .shot figcaption { font-size: 14px; line-height: 1.5; }

/* A worked example: what the memory holds, what comes in, and the match. */
.example { display: grid; gap: 1px; margin-top: 18px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--line); }
.example > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 4px 16px; padding: 12px 16px; background: var(--panel); }
.example span { font-size: 13px; font-weight: 600; color: var(--muted); }
.example p { font-size: 15.5px !important; line-height: 1.55 !important; color: var(--ink) !important; }
.example del { color: #a33b2b; text-decoration-thickness: 1.5px; }
.example ins { color: #1d6b3d; text-decoration: none; background: #eaf7ef; border-radius: 3px; padding: 0 2px; }
@media (max-width: 560px) { .example > div { grid-template-columns: minmax(0, 1fr); } }

/* Questions: each opens on its own; the answers are in the page for everyone. */
.prose .qa-item { margin-top: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); transition: border-color .15s ease; }
.prose .qa-item:hover { border-color: var(--line-strong); }
.prose .qa-item[open] { border-color: var(--accent-tint); }
.prose .qa-item summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; cursor: pointer; list-style: none; }
.prose .qa-item summary::-webkit-details-marker { display: none; }
.prose .qa-item summary h3 { margin: 0; font-size: 16.5px; line-height: 1.4; font-weight: 600; color: var(--ink); }
.prose .qa-item summary::after { content: "+"; flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--canvas); font: 400 18px/1 var(--body); color: var(--ink-2); transition: transform .2s ease, background .2s ease; }
.prose .qa-item[open] summary::after { transform: rotate(45deg); background: var(--accent-soft); color: var(--accent-text); }
.prose .qa-item > div { padding: 0 18px 16px; }
.prose .qa-item > div p { font-size: 16px; }
.prose h2 + .qa-item { margin-top: 18px; }

/* Sources: every page the post cites, in the order it cites them.
   Folded into one line until opened; each source on one line, its site after it. */
.prose .src-box { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.prose .src-box summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; padding: 11px 44px 11px 16px; position: relative; cursor: pointer; list-style: none; font-size: 14px; color: var(--muted); }
.prose .src-box summary::-webkit-details-marker { display: none; }
.prose .src-box summary b { font-weight: 600; color: var(--ink); }
.prose .src-box summary::after { content: "+"; position: absolute; right: 12px; top: 50%; translate: 0 -50%; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--canvas); font: 400 16px/1 var(--body); color: var(--ink-2); transition: rotate .2s ease; }
.prose .src-box[open] summary::after { rotate: 45deg; }
.prose .src-box summary:hover b { color: var(--accent-text); }
.prose .src-list { display: block; margin: 0; padding: 4px 16px 12px 40px; border-top: 1px solid var(--line); }
.prose .src-list li { margin: 0; padding: 3px 0; font-size: 14px; line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prose .src-list li::marker { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.prose .src-list small { font-size: 12.5px; color: var(--muted); }

/* Who wrote it, and how to tell us about a mistake. */
.post-author { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 16px; margin-top: 56px; padding: 22px 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.post-author svg { width: 52px; height: 52px; }
.post-author .pa-k { font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.post-author b { display: block; margin-top: 2px; font: 400 22px/1.2 var(--display); color: var(--ink); }
.prose .post-author p:not(.pa-k) { margin-top: 8px; font-size: 15px; line-height: 1.6; }
.post-author + .post-end { margin-top: 18px; }

/* Read next, as cards with their covers. */
.prose .next-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; padding: 0; list-style: none; }
.prose .next-cards a { display: grid; height: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--ink); text-decoration: none; transition: border-color .15s ease, transform .2s ease; }
.prose .next-cards a:hover { border-color: var(--accent); transform: translateY(-2px); }
.prose .next-cards img { display: block; width: 100%; height: auto; aspect-ratio: 1000 / 372; object-fit: cover; background: var(--accent-soft); }
.prose .next-cards .nc-text { display: grid; gap: 6px; align-content: start; padding: 14px 16px 16px; }
.prose .next-cards .tag { justify-self: start; }
.prose .next-cards b { font: 400 19px/1.25 var(--display); letter-spacing: -.01em; }
.prose .next-more { margin-top: 16px; }
.prose .next-more li { font-size: 15.5px; }
@media (max-width: 640px) { .prose .next-cards { grid-template-columns: minmax(0, 1fr); } }

/* ---------- /blog ---------- */
.blog-head { display: grid; gap: 14px; padding-block: 72px 36px; }
.blog-head h1 { font: 300 clamp(40px, 6vw, 72px)/1 var(--display); letter-spacing: -.025em; }
.blog-head .doc-lede { max-width: 62ch; }
.blog-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-top: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chips button { height: 34px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--panel); font: 500 13.5px/1 var(--body); color: var(--ink-2); cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.chips button:hover { border-color: var(--accent); color: var(--accent-text); }
.chips button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--panel); }

.guides { padding-block: 8px 48px; }
.guides h2 { font: 400 26px/1.2 var(--display); letter-spacing: -.015em; }
.guides > p { margin-top: 6px; color: var(--muted); font-size: 15px; }
.guide-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 18px 0 0; padding: 0; list-style: none; }
.guide-grid a { position: relative; display: grid; gap: 8px; align-content: start; height: 100%; padding: 18px 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(160deg, var(--accent-soft), var(--panel) 62%); transition: border-color .15s ease, transform .2s ease; }
.guide-grid a:hover { border-color: var(--accent); transform: translateY(-2px); }
.guide-grid .g-n { font: 300 34px/1 var(--display); color: var(--accent-text); }
.guide-grid b { font: 400 19px/1.25 var(--display); color: var(--ink); }
.guide-grid span:last-child { font-size: 14px; color: var(--muted); }

.post-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 28px; margin: 0; padding: 32px 0 0; list-style: none; border-top: 1px solid var(--line); }
.post-card { position: relative; display: grid; gap: 14px; align-content: start; }
.post-card .post-thumb { border-radius: 14px; }
.post-card h2 { font: 400 23px/1.2 var(--display); letter-spacing: -.015em; }
.post-card h2 a::after { content: ""; position: absolute; inset: 0; }
.post-card:hover h2 a { color: var(--accent-text); }
.post-card:hover .post-thumb img { transform: scale(1.025); }
.post-card p { font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.post-card.lead { grid-column: 1 / -1; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px 48px; align-items: center; padding-bottom: 40px; border-bottom: 1px solid var(--line); }
.post-card.lead h2 { font-size: clamp(28px, 3.2vw, 40px); line-height: 1.1; }
.post-card.lead p { font-size: 16.5px; }
.post-card .post-when .upd { color: #1d6b3d; }
.post-card[hidden] { display: none; }
.post-list-empty { padding: 32px 0; color: var(--muted); }

@media (max-width: 1100px) {
  .guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .post-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .blog-head { padding-block: 44px 24px; }
  .post-card.lead { grid-template-columns: minmax(0, 1fr); padding-bottom: 32px; }
}
@media (max-width: 640px) {
  .guide-grid, .post-list { grid-template-columns: minmax(0, 1fr); }
  .post-author { grid-template-columns: minmax(0, 1fr); }
  .byline { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .guide-grid a, .prose .next-cards a { transition: none; }
  .guide-grid a:hover, .prose .next-cards a:hover { transform: none; }
}
@media print {
  .read-bar, .post-toc, .listen, .post-end, .next-cards { display: none !important; }
  .post-grid { display: block; }
}
