/* Blog article and chart styles. Built only from tokens.css values (ink, muted, rule, paper; serif + mono). */
.post { --measure: 660px; --wide: 780px; --body-ink: color-mix(in srgb, var(--ink) 84%, var(--paper)); }
.post-head { max-width: calc(var(--measure) + 2 * var(--gutter)); margin: 0 auto; padding: clamp(40px, 9vh, 96px) var(--gutter) 0; }
.post-head .meta { margin: 0 0 18px; text-align: center; font-size: 16px; color: var(--muted); }
.post-head .meta a { text-decoration: none; }
.post-head .meta .dot { margin: 0 8px; }
.post-head .byline-c { margin: 0; text-align: center; font-size: 17px; color: var(--muted); }
.post-head .fig { margin-left: calc((var(--measure) - var(--wide)) / 2); margin-right: calc((var(--measure) - var(--wide)) / 2); }
@media (max-width: 860px) { .post-head .fig { margin-left: 0; margin-right: 0; } }
.post-head .label { color: var(--muted); margin: 0 0 22px; }
.post-head .label a { text-decoration: none; }
.post-head h1 { width: min(940px, 17.5em, calc(100vw - 2 * var(--gutter))); margin: 0 0 22px 50%; transform: translateX(-50%); text-align: center; text-wrap: balance; font-weight: 400; font-size: clamp(30px, 3.4vw + 8px, 56px); line-height: 1.07; letter-spacing: -0.03em; }
.post-head .byline { margin: 0; color: var(--muted); }

.post-grid { display: grid; grid-template-columns: minmax(0, 1fr) min(var(--measure), calc(100% - 2 * var(--gutter))) minmax(0, 1fr); padding-bottom: var(--section-y); }
.post-body { grid-column: 2; min-width: 0; }
.toc { grid-column: 1; grid-row: 1; justify-self: end; align-self: start; position: sticky; top: 112px; width: 170px; margin: 56px 40px 0 0; padding: 0; }
.toc p { margin: 0 0 16px; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li + li { margin-top: 12px; }
.toc a { position: relative; display: block; padding: 0 0 0 16px; font-family: var(--serif); font-size: 15px; line-height: 22px; letter-spacing: -0.006em; white-space: nowrap; text-decoration: none; color: var(--muted); transition: color var(--t-quick); }
.toc a::before { content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 4px; background: var(--ink); opacity: 0; transition: opacity var(--t-quick); }
.toc a:hover, .toc a.on { color: var(--ink); }
.toc a.on::before { opacity: 1; }
@media (max-width: 1100px) { .toc { display: none; } }

.post-body h2 { margin: 56px 0 14px; font-weight: 600; font-size: 26px; line-height: 1.15; letter-spacing: -0.022em; scroll-margin-top: 32px; }
.post-body h3 { margin: 40px 0 12px; font-weight: 560; font-size: 20px; line-height: 1.2; letter-spacing: -0.014em; scroll-margin-top: 32px; }
.post-body p, .post-body li { margin: 0 0 24px; font-size: 19px; line-height: 1.47; letter-spacing: -0.012em; color: var(--body-ink); font-variant-numeric: lining-nums; }
.post-body strong { font-weight: 560; color: var(--ink); }
.post-body a { color: var(--ink); }

/* ============ Chart style system (documented in AGENTS.md, "Chart style") ============
   One bar: --bar-h tall, --bar-r corners, on a faint --track. Colours are mixed with the page background,
   so light and dark get their own values; never opacity on data marks. Accent = trained result or gain. */
.post, .chart, .svgchart {
  --bar-h: 12px; --bar-r: 0;
  --track: color-mix(in srgb, var(--ink) 6%, var(--paper));
  --grid: color-mix(in srgb, var(--ink) 9%, var(--paper));
  --base: color-mix(in srgb, var(--muted) 72%, var(--paper));
  --other: color-mix(in srgb, var(--muted) 42%, var(--paper));
  --acc-2: color-mix(in srgb, var(--accent) 58%, var(--paper));
  --acc-3: color-mix(in srgb, var(--accent) 30%, var(--paper));
  --ink-2: color-mix(in srgb, var(--ink) 62%, var(--paper));
}
.fig { margin: 36px 0 38px; }
figcaption { margin-top: 18px; padding-left: 14px; border-left: 1px solid var(--rule); font-family: var(--serif); font-size: 15px; line-height: 1.45; letter-spacing: -0.006em; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0 0 18px; font-family: var(--serif); font-size: 14px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: var(--bar-r); background: var(--base); }
.sw.acc { background: var(--accent); }
.sw.base { background: var(--base); }
.sw.faint { background: var(--other); }
.sw.hatch { background: repeating-linear-gradient(135deg, var(--base) 0 1.5px, var(--track) 1.5px 4px); }
.sw.dot { border-radius: 50%; width: 10px; height: 10px; }
.sw.ci { width: 18px; border-radius: 0; background: linear-gradient(var(--accent), var(--accent)) center / 100% 1px no-repeat, linear-gradient(var(--accent), var(--accent)) left / 1px 9px no-repeat, linear-gradient(var(--accent), var(--accent)) right / 1px 9px no-repeat; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--accent) !important; }

/* rows: label | plot | value */
.rows { position: relative; }
.chart { --lab: var(--lab-d, 200px); --val: var(--val-d, 64px); }
.row { position: relative; display: grid; grid-template-columns: var(--lab) 1fr var(--val); align-items: center; gap: 16px; padding: 7px 0; outline: none; transition: opacity var(--t-quick); }
.row .lab { font-size: 15px; line-height: 1.3; color: var(--ink); }
.row .lab small, .pg-head small { display: block; margin-top: 2px; font-family: var(--serif); font-size: 13px; line-height: 1.3; color: var(--muted); white-space: nowrap; }
.row .val { text-align: right; font-family: var(--mono); font-size: 13px; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row .val.dim { color: var(--muted); }
.row:focus-visible { outline: 1px solid var(--muted); outline-offset: 2px; }
.chart.has-hot .row:not(.hot) .lab, .chart.has-hot .row:not(.hot) .val, .chart.has-hot .row:not(.hot) .track, .chart.has-hot .row:not(.hot) .ci-plot { opacity: .4; }

.track, .ci-plot { position: relative; height: var(--bar-h); }
.ci-plot { height: 26px; }
.track .bg, .ci-plot .bg { position: absolute; left: 0; right: 0; top: 50%; height: var(--bar-h); margin-top: calc(var(--bar-h) / -2); border-radius: var(--bar-r); background: var(--track); }
.seg { position: absolute; top: 50%; height: var(--bar-h); margin-top: calc(var(--bar-h) / -2); left: 0; border-radius: var(--bar-r); background: var(--base); transform-origin: left center; transition: transform 1.1s var(--ease); }
.seg.acc { background: var(--accent); }
.seg.base { background: var(--base); }
.seg.faint { background: var(--other); }
.seg.hatch { background: repeating-linear-gradient(135deg, var(--base) 0 1.5px, var(--track) 1.5px 4px); }
.seg.l { border-radius: var(--bar-r) 0 0 var(--bar-r); }
.seg.r { border-radius: 0 var(--bar-r) var(--bar-r) 0; }
.chart:not(.in) .seg { transform: scaleX(0); }

/* gridlines sit behind the track and bars */
.gridlines { position: absolute; inset: -4px 0; pointer-events: none; }
.gridlines i { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid var(--grid); }
.gridlines i.zero { border-left-color: var(--muted); z-index: 2; }
.whisker { position: absolute; z-index: 3; top: 50%; height: 9px; transform: translateY(-50%); border-left: 1px solid var(--ink); border-right: 1px solid var(--ink); }
.whisker::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--ink); }
.pt { position: absolute; z-index: 4; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--paper); }
#c-general .whisker, #c-general .whisker::before { border-color: var(--accent); }
.chart:not(.in) .whisker, .chart:not(.in) .pt { opacity: 0; }
.whisker, .pt { transition: opacity .9s var(--ease); }
.sep { height: 1px; background: var(--rule); margin: 8px 0; }

.axis { display: grid; grid-template-columns: var(--lab) 1fr var(--val); gap: 16px; margin-top: 8px; }
.axis .ticks, .brd-axis .ticks { position: relative; height: 18px; border-top: 1px solid var(--rule); }
.axis .ticks span, .brd-axis .ticks span { position: absolute; top: 6px; transform: translateX(-50%); font-family: var(--mono); font-size: 11px; color: var(--muted); }
.axis .ticks span:first-child, .brd-axis .ticks span:first-child { transform: none; }
.axis .ticks span:last-child, .brd-axis .ticks span:last-child { transform: translateX(-100%); }
.axis .ticks span.mid, .brd-axis .ticks span.mid { transform: translateX(-50%); }
.axis-title { text-align: center; margin-top: 6px; font-family: var(--serif); font-size: 13px; color: var(--muted); }

/* headline: stacked base + gain */
.headline .row { grid-template-columns: 1fr; gap: 8px; padding: 9px 0; }
.headline .top-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.headline .read { font-family: var(--mono); font-size: 13px; color: var(--muted); white-space: nowrap; }
.headline .read b { font-weight: 400; color: var(--ink); }
.headline .axis { grid-template-columns: 1fr; }

/* paired results block */
.paired { --lab: var(--lab-d, 150px); }
.paired .pg-head { margin: 20px 0 4px; }
.paired .pg-head:first-child { margin-top: 0; }
.paired .pg-title { font-size: 16px; color: var(--ink); }

/* public-set comparison */
.board .rows.brd { display: grid; grid-template-columns: max-content 1fr var(--val); column-gap: 16px; }
.board .row { display: contents; }
.board .row .lab, .board .row .val { padding: 5px 0; align-self: center; }
.board .row .track { align-self: center; }
.board .b-ours .lab { font-weight: 600; }
.board.has-hot .row:not(.hot) .lab, .board.has-hot .row:not(.hot) .track, .board.has-hot .row:not(.hot) .val { opacity: .4; }
.board .rows.brd { padding-top: 26px; }
.bref { position: absolute; z-index: 3; width: 0; border-left: 1px dashed var(--acc-2); pointer-events: none; transition: opacity .8s var(--ease) .9s; }
.bref-l { position: absolute; top: 0; left: 0; white-space: nowrap; font-family: var(--mono); font-size: 11px; line-height: 1; padding: 2px 6px; color: var(--accent); background: var(--paper); }
.chart:not(.in) .bref { opacity: 0; }
.brd-axis .ticks { margin-top: 8px; }
.brd-title { text-align: center; }

/* donut */
.donut-wrap { display: flex; align-items: center; gap: 44px; }
.donut-svg svg { display: block; width: 200px; height: 200px; overflow: visible; }
.slice { stroke: var(--paper); stroke-width: 2; transition: transform var(--t-quick); transform-origin: 100px 100px; }
.slice.dim { fill-opacity: .35; }
.drow.dim { color: var(--muted); }
.slice.hot { transform: scale(1.03); }
.dc-n { fill: var(--ink); font-family: var(--serif); font-size: 34px; letter-spacing: -0.02em; }
.dc-l { fill: var(--muted); font-family: var(--serif); font-size: 13px; }
.donut-legend { flex: 1; min-width: 0; max-width: 340px; }
.drow { display: grid; grid-template-columns: 12px 1fr 44px 56px; align-items: center; gap: 12px; padding: 6px 0; font-size: 15px; transition: color var(--t-quick); outline: none; }
.drow .num { text-align: right; font-family: var(--mono); font-size: 13px; }
.drow .num.dim { color: var(--muted); }
.dsw { width: 12px; height: 12px; border-radius: var(--bar-r); }
.c0 { fill: var(--accent); background: var(--accent); }
.c1 { fill: var(--acc-2); background: var(--acc-2); }
.c2 { fill: var(--acc-3); background: var(--acc-3); }
.c3 { fill: var(--ink-2); background: var(--ink-2); }
.c4 { fill: var(--base); background: var(--base); }
.c5 { fill: var(--other); background: var(--other); }

/* svg line charts */
.svgchart { position: relative; width: 100%; touch-action: pan-y; }
.svgchart svg { display: block; width: 100%; overflow: visible; }
.svgchart .gl { stroke: var(--grid); stroke-width: 1; }
.svgchart .tk { fill: var(--muted); font-family: var(--mono); font-size: 11px; }
.svgchart .ln { fill: none; stroke: var(--accent); stroke-width: 1.75; stroke-linejoin: round; }
.svgchart .dt { fill: var(--accent); }
.svgchart .xh { stroke: var(--muted); stroke-dasharray: 3 3; stroke-width: 1; }
.svgchart .badge rect { fill: var(--ink); rx: 3px; }
.svgchart .badge text { fill: var(--paper); font-family: var(--mono); font-size: 11px; }

/* tooltip */
.tip { position: absolute; z-index: 10; pointer-events: none; min-width: 190px; max-width: 290px; padding: 10px 12px; background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; box-shadow: 0 6px 24px color-mix(in srgb, var(--ink) 12%, transparent); font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--ink); opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; }
.tip.on { opacity: 1; transform: none; }
.tip .t { margin-bottom: 6px; font-family: var(--serif); font-size: 14px; color: var(--ink); }
.tip .k { color: var(--muted); }
.tip div { display: flex; justify-content: space-between; gap: 16px; }

/* call to action */
.cta { margin: 56px 0 0; }
.cta .cta-line { color: var(--ink) !important; }
.cta .btn { display: inline-flex; align-items: center; gap: 10px; margin: 6px 0 26px; padding: 12px 18px; border: 1px solid var(--ink); font-family: var(--mono); font-size: var(--t-label); letter-spacing: .08em; text-transform: uppercase; text-decoration: none; transition: background var(--t-quick), color var(--t-quick); }
.cta .btn:hover { background: var(--ink); color: var(--paper); }
.cta .about { margin-top: 32px; padding-top: 22px; border-top: 1px solid var(--rule); color: var(--muted) !important; font-size: 16px !important; }

/* private notes, injected on localhost only */
.draft { margin: 0 0 32px; padding: 14px 16px; border: 1px dashed var(--muted); font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--ink); }
.draft p, .draft li { font-family: var(--mono); font-size: 12px; line-height: 1.6; margin: 0 0 8px; color: var(--ink); }
.draft ul { margin: 0; padding-left: 18px; }
.draft .label { color: var(--muted); }

/* blog index */
.index-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.index-list li { border-bottom: 1px solid var(--rule); }
.index-list a { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 22px 0; text-decoration: none; font-size: 24px; line-height: 1.25; letter-spacing: -0.012em; }
.index-list .label { color: var(--muted); align-self: center; }


@media (max-width: 640px) {
  .post-body h2 { font-size: 24px; margin-top: 48px; }
  .post-body p, .post-body li { font-size: 17.5px; line-height: 1.48; margin-bottom: 22px; }
  .chart { --lab: 112px; --val: 58px; }
  .row, .axis { gap: 10px; }
  .row .lab { font-size: 14px; }
  .row .val { font-size: 12px; }
  .axis .ticks span.nw { display: none; }
  .paired { --lab: 128px; }
  .chart.stack-m { --lab: 0px; }
  .chart.stack-m .row { grid-template-columns: 1fr var(--val); row-gap: 4px; padding: 8px 0; }
  .chart.stack-m .row .lab { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
  .chart.stack-m .row .lab small { margin: 0; }
  .chart.stack-m .row.head > :first-child { display: none; }
  .chart.stack-m .axis { grid-template-columns: 0 1fr var(--val); gap: 10px; }
  .board .rows.brd { grid-template-columns: 1fr var(--val); column-gap: 10px; }
  .board .row .lab { grid-column: 1 / -1; padding: 8px 0 0; }
  .board .row .lt { position: relative; z-index: 4; background: var(--paper); padding-right: 6px; }
  .board .row .val { padding: 0; }
  .donut-wrap { flex-direction: column; align-items: stretch; gap: 20px; }
  .donut-svg { align-self: center; }
  .donut-legend { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .seg, .whisker, .pt, .tip, .row, .bref { transition: none !important; }
  .chart:not(.in) .seg { transform: none; }
  .chart:not(.in) .whisker, .chart:not(.in) .pt, .chart:not(.in) .bref { opacity: 1; }
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nw { white-space: nowrap; }
.byline-c { display: flex; justify-content: center; }
.author { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 16px; line-height: 1; }
.author img { display: block; width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; }
.board .row .val { line-height: 1; }
@media (max-width: 640px) { .board .row .val { align-self: center; padding: 4px 0; } .board .row .track { margin: 4px 0; } }

/* chart actions: download or copy any chart as a PNG with its title, caption and our mark */
.fig[data-title] { position: relative; }
.fig-tools { position: absolute; top: -6px; right: 0; z-index: 5; display: flex; gap: 6px; opacity: 0; transition: opacity var(--t-quick); }
.fig[data-title]:hover .fig-tools, .fig-tools:focus-within { opacity: 1; }
@media (hover: none) { .fig-tools { opacity: 1; } }
.fig-tools button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); color: var(--muted); cursor: pointer; transition: color var(--t-quick), border-color var(--t-quick); }
.fig-tools button:hover { color: var(--ink); border-color: var(--ink); }
.fig-tools svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.fig-tools .ok { color: var(--accent); border-color: var(--accent); }
.fig-card { position: fixed; left: -10000px; top: 0; z-index: -1; padding: 40px 40px 30px; background: var(--paper); color: var(--ink); }
.fig-card .fig-head { margin: 0 0 28px; }
.fig-card .fig-head b { font-family: var(--serif); font-weight: 500; font-size: 22px; line-height: 1.25; letter-spacing: -0.015em; }
.fig-card .fig-foot { display: flex; align-items: center; gap: 6px; margin-top: 22px; font-family: var(--sans); font-size: 10.5px; letter-spacing: 0.01em; color: var(--muted); opacity: .8; }
.fig-card .fig-foot svg { width: 9px; height: 9px; fill: currentColor; }

/* citation */
.cite { margin-top: 56px; }
.cite-box { position: relative; margin: 0 0 18px; border: 1px solid var(--rule); border-radius: 10px; background: color-mix(in srgb, var(--ink) 3%, var(--paper)); }
.cite-box pre { margin: 0; padding: 16px 92px 16px 18px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.65; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.cite-box .copy { position: absolute; top: 10px; right: 10px; height: 30px; padding: 0 12px; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 13px; cursor: pointer; transition: border-color var(--t-quick), color var(--t-quick); }
.cite-box .copy:hover { border-color: var(--ink); }
.cite-box .copy.ok { color: var(--accent); border-color: var(--accent); }
.cite .about { margin-top: 36px; }
.fig-card figcaption { margin-top: 16px; padding-left: 10px; font-size: 12px; line-height: 1.45; }
