/* Blog: articles and the index. Loaded after ../style.css, reuses its tokens, nav, buttons and footer. */
:root {
  --prose: #3a3a3c;
  --chart-grid: #e8e8ed;
  --chart-axis: #c7c7cc;
  --chart-muted: #8e8e93;
  --bar-other: #c7c7cc;
  --bar-other-hover: #aeaeb2;
}
:root[data-theme="dark"] {
  --prose: rgba(235, 235, 245, 0.78);
  --chart-grid: #2c2c31;
  --chart-axis: #3a3a3f;
  --chart-muted: #8e8e93;
  --bar-other: #48484d;
  --bar-other-hover: #5a5a60;
}

/* ───────── Article header ───────── */
.post-head { max-width: 820px; margin: 0 auto; padding: clamp(40px, 7vw, 80px) 0 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.86rem; color: var(--tertiary); margin: 0 0 18px; padding: 0; list-style: none; }
.crumbs li + li::before { content: "›"; margin-right: 6px; }
.crumbs a { color: var(--secondary); }
.crumbs a:hover { color: var(--accent); }
.post-head h1 { font-size: clamp(2.3rem, 5.2vw, 3.6rem); line-height: 1.04; letter-spacing: -0.035em; }
.post-head .dek { margin: 20px 0 0; font-size: clamp(1.1rem, 2vw, 1.3rem); line-height: 1.45; color: var(--secondary); letter-spacing: -0.01em; }
.byline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 26px; font-size: 0.9rem; color: var(--secondary); }
.byline img { width: 34px; height: 34px; border-radius: 9px; }
.byline b { color: var(--text); font-weight: 600; }
.byline .dot::before { content: "·"; margin-right: 14px; color: var(--tertiary); }
.post-hero { max-width: 1040px; margin: clamp(32px, 5vw, 52px) auto 0; }
.post-hero img { width: 100%; height: auto; border-radius: var(--radius); border: 0.5px solid var(--hairline); background: var(--bg-soft); }

/* ───────── Layout: body + sticky contents ───────── */
.post-layout { display: grid; grid-template-columns: minmax(0, 720px); justify-content: center; gap: 64px; margin-top: clamp(40px, 6vw, 64px); }
@media (min-width: 1140px) {
  .post-layout { grid-template-columns: minmax(0, 720px) 240px; }
}
.toc { display: none; }
@media (min-width: 1140px) {
  .toc { display: block; position: sticky; top: 90px; align-self: start; max-height: calc(100vh - 120px); overflow: auto; font-size: 0.86rem; }
}
.toc p { margin: 0 0 10px; font-weight: 600; color: var(--text); }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--hairline); }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 1px solid transparent; color: var(--secondary); line-height: 1.35; transition: color 150ms, border-color 150ms; }
.toc a:hover { color: var(--text); }
.toc a.on { color: var(--accent); border-left-color: var(--accent); }

/* ───────── Prose ───────── */
.prose { font-size: 1.075rem; line-height: 1.7; color: var(--prose); min-width: 0; }
.prose > * { margin: 0; }
.prose > * + * { margin-top: 1.15em; }
.prose h2 { margin-top: 2.4em; font-size: clamp(1.6rem, 3vw, 2rem); line-height: 1.15; letter-spacing: -0.028em; color: var(--text); scroll-margin-top: 80px; }
.prose h3 { margin-top: 1.9em; font-size: 1.28rem; line-height: 1.3; letter-spacing: -0.018em; color: var(--text); scroll-margin-top: 80px; }
.prose h2 + *, .prose h3 + * { margin-top: 0.7em; }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.prose a:hover { text-decoration-color: var(--accent); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.45em; }
.prose li::marker { color: var(--tertiary); }
.prose code { font: 0.88em/1.4 ui-monospace, "SF Mono", Menlo, monospace; background: var(--card); padding: 2px 6px; border-radius: 6px; color: var(--text); }
.prose pre { background: var(--card); border-radius: 14px; padding: 16px 18px; overflow-x: auto; font-size: 0.9rem; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { border-left: 3px solid var(--accent); padding: 2px 0 2px 18px; color: var(--secondary); font-style: normal; }
.prose hr { border: 0; border-top: 0.5px solid var(--hairline); margin: 2.4em 0; }
.prose .note { font-size: 0.9rem; color: var(--tertiary); line-height: 1.55; }

/* Figures */
.prose figure { margin-left: 0; margin-right: 0; }
.prose figure img { width: 100%; height: auto; border-radius: 16px; border: 0.5px solid var(--hairline); }
.prose figcaption { margin-top: 10px; font-size: 0.86rem; line-height: 1.5; color: var(--tertiary); }
@media (min-width: 900px) { .prose figure.wide { margin-left: -60px; margin-right: -60px; } }

/* Callouts */
.tldr { background: var(--bg-soft); border: 0.5px solid var(--hairline); border-radius: 18px; padding: 22px 24px; }
.tldr > p:first-child { margin: 0 0 8px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); }
.tldr ul { margin: 0; padding-left: 1.15em; }
.tldr li { font-size: 1rem; }
.callout { border-radius: 16px; padding: 16px 20px; background: var(--accent-soft); color: var(--text); font-size: 0.98rem; line-height: 1.6; }
.callout.warn { background: color-mix(in srgb, var(--orange) 12%, transparent); }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 0.5px solid var(--hairline); border-radius: 16px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.92rem; line-height: 1.45; }
.prose th, .prose td { text-align: left; padding: 11px 14px; vertical-align: top; border-bottom: 0.5px solid var(--hairline); }
.prose thead th { background: var(--bg-soft); color: var(--text); font-weight: 600; white-space: nowrap; font-size: 0.86rem; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody th { color: var(--text); font-weight: 600; white-space: nowrap; }
.prose tr.us td, .prose tr.us th { background: var(--accent-soft); }
.prose td.num, .prose th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.yes { color: var(--green); font-weight: 600; }
.no { color: var(--tertiary); }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--bg-soft); border: 0.5px solid var(--hairline); border-radius: 16px; padding: 16px 18px; }
.stat b { display: block; font-size: 2rem; line-height: 1.1; letter-spacing: -0.03em; color: var(--text); font-weight: 650; }
.stat span { display: block; margin-top: 6px; font-size: 0.86rem; line-height: 1.4; color: var(--secondary); }

/* App entries in lists */
.pick { border: 0.5px solid var(--hairline); border-radius: 20px; padding: 22px 24px; background: var(--surface); }
.pick.us { border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pick-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.pick-head h3 { margin: 0 !important; font-size: 1.35rem; }
.pick-head .rank { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.pick-head .best { font-size: 0.82rem; font-weight: 600; color: var(--secondary); background: var(--card); padding: 3px 10px; border-radius: 999px; }
.pick dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 14px 0 0; font-size: 0.94rem; }
.pick dt { color: var(--tertiary); }
.pick dd { margin: 0; color: var(--text); }
.pick .pros-cons { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 14px; font-size: 0.95rem; }
@media (max-width: 620px) { .pick .pros-cons { grid-template-columns: 1fr; } }
.pick .pros-cons p { margin: 0 0 4px; font-weight: 600; color: var(--text); font-size: 0.86rem; }
.pick .pros-cons ul { margin: 0; padding-left: 1.1em; }
.pick > p { margin: 14px 0 0; }

/* ───────── Charts ───────── */
.chart-fig { background: var(--surface); border: 0.5px solid var(--hairline); border-radius: 20px; padding: 20px 20px 16px; position: relative; }
.chart-fig .chart-title { display: block; font-size: 1rem; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.chart-fig .chart-sub { display: block; margin-top: 2px; font-size: 0.86rem; color: var(--secondary); line-height: 1.45; }
.chart-fig svg { display: block; width: 100%; height: auto; margin-top: 14px; overflow: visible; }
.chart-fig .grid line { stroke: var(--chart-grid); stroke-width: 1; }
.chart-fig .axis line { stroke: var(--chart-axis); stroke-width: 1; }
.chart-fig text { font: 12px -apple-system, BlinkMacSystemFont, system-ui, sans-serif; fill: var(--chart-muted); }
.chart-fig text.label { fill: var(--text); font-size: 13px; }
.chart-fig text.label.us { font-weight: 600; }
.chart-fig text.value { fill: var(--secondary); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.chart-fig text.value.us { fill: var(--text); font-weight: 600; }
.chart-fig .bar { fill: var(--bar-other); transition: fill 120ms; }
.chart-fig .bar.us { fill: var(--accent); }
.chart-fig .row:hover .bar, .chart-fig .row:focus .bar { fill: var(--bar-other-hover); }
.chart-fig .row:hover .bar.us, .chart-fig .row:focus .bar.us { fill: var(--accent-press); }
.chart-fig .row { outline: none; cursor: default; }
.chart-fig .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-fig .dot { stroke: var(--surface); stroke-width: 2; }
.chart-fig .legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 0.84rem; color: var(--secondary); }
.chart-fig .legend li { display: flex; align-items: center; gap: 7px; }
.chart-fig .legend i { width: 14px; height: 3px; border-radius: 2px; background: currentColor; }
.chart-fig .source { margin: 10px 0 0; font-size: 0.8rem; color: var(--tertiary); line-height: 1.5; }
.chart-tip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); font-size: 0.8rem; line-height: 1.35; padding: 7px 10px; border-radius: 9px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); opacity: 0; transition: opacity 120ms; z-index: 2; }
.chart-tip.on { opacity: 1; }
.chart-tip b { font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.chart-fig details { margin-top: 8px; font-size: 0.84rem; }
.chart-fig details summary { cursor: pointer; color: var(--accent); width: max-content; }
.chart-fig details .table-wrap { margin-top: 10px; }

/* ───────── CTA ───────── */
.cta-card { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; align-items: center; background: var(--bg-soft); border: 0.5px solid var(--hairline); border-radius: 22px; padding: 22px 24px; }
.cta-card img { grid-row: span 2; width: 60px; height: 60px; border-radius: 14px; }
.cta-card .t { margin: 0; color: var(--text); font-weight: 650; font-size: 1.1rem; letter-spacing: -0.015em; line-height: 1.3; }
.cta-card .d { margin: 0; font-size: 0.95rem; line-height: 1.5; color: var(--secondary); }
.cta-card .actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 12px; }
.cta-card .actions .btn { height: 42px; padding: 0 20px; font-size: 0.95rem; text-decoration: none; }
.cta-card .actions .btn-primary { color: #fff; }
.cta-card .actions .btn-secondary { color: var(--text); }
.cta-card .actions small { font-size: 0.84rem; color: var(--tertiary); }
@media (max-width: 520px) { .cta-card { grid-template-columns: 1fr; } .cta-card img { grid-row: auto; width: 48px; height: 48px; } }

/* FAQ inside an article */
.prose .faq { max-width: none; margin-top: 0.4em; }
.prose .faq summary { color: var(--text); font-size: 1.02rem; padding: 18px 0; }
.prose .faq details p { margin: -4px 0 20px; font-size: 1rem; }

/* Author + sources */
.author-box { display: flex; gap: 16px; align-items: flex-start; border-top: 0.5px solid var(--hairline); padding-top: 28px; margin-top: 3em !important; }
.author-box img { width: 48px; height: 48px; border-radius: 12px; flex: none; }
.author-box p { margin: 0; font-size: 0.95rem; line-height: 1.55; }
.author-box b { color: var(--text); }
.sources { font-size: 0.86rem; line-height: 1.55; color: var(--tertiary); }
.sources ol { padding-left: 1.2em; }
.sources a { color: var(--secondary); word-break: break-word; }

/* ───────── Related + index cards ───────── */
.related { max-width: 1040px; margin: clamp(72px, 10vw, 112px) auto 0; }
.related h2, .blog-head h1 { letter-spacing: -0.035em; }
.related h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin-bottom: 24px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; }
.card { display: flex; flex-direction: column; border: 0.5px solid var(--hairline); border-radius: 20px; overflow: hidden; background: var(--surface); transition: transform 200ms var(--ease), box-shadow 200ms var(--ease); }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card img { width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; background: var(--bg-soft); border-bottom: 0.5px solid var(--hairline); }
.card .body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .kicker { font-size: 0.78rem; font-weight: 600; color: var(--accent); }
.card h3 { font-size: 1.12rem; line-height: 1.3; }
.card p { margin: 0; font-size: 0.92rem; line-height: 1.5; color: var(--secondary); }
.card .meta { margin-top: auto; padding-top: 6px; font-size: 0.8rem; color: var(--tertiary); }

.blog-head { max-width: 820px; padding: clamp(48px, 8vw, 96px) 0 clamp(32px, 5vw, 48px); }
.blog-head h1 { font-size: clamp(2.6rem, 6vw, 4.2rem); line-height: 1; }
.blog-head p { margin: 18px 0 0; }
.feature-card { display: grid; grid-template-columns: 1.25fr 1fr; border: 0.5px solid var(--hairline); border-radius: 24px; overflow: hidden; background: var(--surface); margin-bottom: 20px; }
.feature-card img { width: 100%; height: 100%; object-fit: cover; border-right: 0.5px solid var(--hairline); }
.feature-card .body { padding: clamp(22px, 3vw, 36px); display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.feature-card h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); line-height: 1.12; letter-spacing: -0.03em; }
.feature-card p { margin: 0; color: var(--secondary); }
@media (max-width: 820px) { .feature-card { grid-template-columns: 1fr; } .feature-card img { border-right: 0; border-bottom: 0.5px solid var(--hairline); } }

/* 404 */
.lost { text-align: center; padding: clamp(80px, 14vw, 160px) 0 0; }
.lost h1 { font-size: clamp(2.6rem, 7vw, 4.4rem); }
.lost p { margin: 16px auto 28px; max-width: 460px; }

/* Horizontal bars (HTML) */
.hb-rows { display: grid; gap: 10px; margin-top: 16px; }
.hb-row { display: grid; grid-template-columns: minmax(110px, 30%) 1fr; align-items: center; gap: 14px; border-radius: 8px; outline: none; }
.hb-label { font-size: 0.9rem; color: var(--text); line-height: 1.25; }
.hb-row.us .hb-label { font-weight: 650; }
.hb-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hb-bar { height: 22px; border-radius: 0 5px 5px 0; background: var(--bar-other); flex: none; transition: background-color 120ms; }
.hb-row.us .hb-bar { background: var(--accent); }
.hb-row:hover .hb-bar, .hb-row:focus-visible .hb-bar { background: var(--bar-other-hover); }
.hb-row.us:hover .hb-bar, .hb-row.us:focus-visible .hb-bar { background: var(--accent-press); }
.hb-row:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.hb-val { font-size: 0.84rem; color: var(--secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hb-row.us .hb-val { color: var(--text); font-weight: 650; }
@media (max-width: 560px) {
  .hb-row { grid-template-columns: 1fr; gap: 4px; }
}

/* Line chart: SVG geometry stretched to the plot box, HTML text and dots on top */
.ln-wrap { position: relative; margin-top: 14px; padding: 4px 0 0; }
.ln-ylabel { display: block; font-size: 0.78rem; color: var(--tertiary); margin-bottom: 8px; }
.ln-plot { position: relative; margin: 0 clamp(120px, 27%, 190px) 26px 38px; }
.ln-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; overflow: visible; }
.ln-plot .grid line { stroke: var(--chart-grid); stroke-width: 1; }
.ln-plot .line { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.ln-yt, .ln-xt { position: absolute; font-size: 0.74rem; color: var(--tertiary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ln-yt { right: calc(100% + 8px); transform: translateY(-50%); }
.ln-xt { top: calc(100% + 8px); transform: translateX(-50%); }
.ln-dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--surface); outline: none; }
.ln-dot::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; }
.ln-dot:hover, .ln-dot:focus-visible { transform: scale(1.3); }
.ln-ends { position: absolute; left: calc(100% + 10px); top: 0; bottom: 0; width: 180px; }
.ln-end { position: absolute; left: 0; transform: translateY(-50%); display: flex; align-items: center; gap: 6px; font-size: 0.8rem; line-height: 1.2; color: var(--secondary); white-space: nowrap; }
.ln-end i { width: 10px; height: 3px; border-radius: 2px; flex: none; }
.ln-end.us { color: var(--text); font-weight: 650; }
.ln-xlabel { display: block; text-align: center; font-size: 0.78rem; color: var(--tertiary); margin: 4px 0 0 38px; }
.chart-fig .legend { display: none; }
@media (max-width: 560px) {
  .chart-fig .legend { display: flex; }
  .ln-ends { display: none; }
  .ln-plot { margin-right: 6px; }
}

/* Phones: crop the hero to its centre so the visual stays legible; no leading separator on a wrapped byline. */
@media (max-width: 640px) {
  .post-hero img { aspect-ratio: 4 / 3; object-fit: cover; }
  .byline .dot:first-of-type::before { display: none; }
}
.prose figure > a { display: block; cursor: zoom-in; }
