/* FinExperiments - shared styles. Large type, high contrast, mobile first. */
:root {
  color-scheme: light;
  --bg: #fbf8f2;
  --surface: #fffdf9;
  --surface-2: #f4eee3;
  --text: #1d1a16;
  --text-2: #5a5246;
  --text-3: #857b6c;
  --line: #e7dfd1;
  --axis: #cfc4b1;
  --link: #1c5cab;
  --accent: #1c5cab;
  --accent-ink: #ffffff;
  --warn-bg: #fff4d6;
  --warn-line: #c98500;
  --draft-bg: #8a1f1f;
  --pos: #0f6a3a;
  --neg: #a32121;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --cpi: #52514e;
  --radius: 10px;
  --amber: #a0761c;
  --gold: #f2b134;
  --serif: "Iowan Old Style", "Charter", "Source Serif Pro", Georgia, "Noto Serif", serif;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #14120f; --surface: #1c1915; --surface-2: #26221c; --amber: #e0b35a;
    --text: #f2ede4; --text-2: #c8bead; --text-3: #9a9081;
    --line: #2f2a22; --axis: #463f33; --link: #8fb8ee; --accent: #8fb8ee; --accent-ink: #0b0b0b;
    --warn-bg: #3a2e0c; --warn-line: #c98500; --draft-bg: #8a1f1f; --pos: #5fd394; --neg: #ff8a8a;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --cpi: #c3c2b7;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14120f; --surface: #1c1915; --surface-2: #26221c; --amber: #e0b35a;
  --text: #f2ede4; --text-2: #c8bead; --text-3: #9a9081;
  --line: #2f2a22; --axis: #463f33; --link: #8fb8ee; --accent: #8fb8ee; --accent-ink: #0b0b0b;
  --warn-bg: #3a2e0c; --warn-line: #c98500; --draft-bg: #8a1f1f; --pos: #5fd394; --neg: #ff8a8a;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --cpi: #c3c2b7;
}

* { box-sizing: border-box; }
html { font-size: 112.5%; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.55; }
a { color: var(--link); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, th:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 1.4em 0 .5em; }
h1 { font-size: 1.9rem; margin-top: .6em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: .5em 0 1em; }
small, .muted { color: var(--text-2); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.num { font-variant-numeric: tabular-nums; }

/* header & footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; padding-top: 12px; padding-bottom: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.15rem; color: var(--text); text-decoration: none; margin-right: auto; }
.brand b { font-weight: 800; color: var(--accent); }
.brand-mark { width: 32px; height: 32px; border-radius: 7px; display: block; }
.site-nav a { margin-right: 16px; font-weight: 500; }
.site-nav a[aria-current="page"] { color: var(--text); text-decoration: none; border-bottom: 3px solid var(--accent); }
.theme-btn { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 6px 10px; font: inherit; font-size: .85rem; cursor: pointer; }
footer.site-footer { margin-top: 48px; background: var(--surface); border-top: 1px solid var(--line); padding: 24px 0 32px; font-size: .9rem; color: var(--text-2); }
footer.site-footer nav a { margin-right: 16px; }
.draft-bar { background: var(--draft-bg); color: #fff; padding: 8px 0; font-size: .9rem; }
.draft-bar strong { letter-spacing: .04em; }

/* disclaimer banners */
.disc { border-left: 4px solid var(--warn-line); background: var(--warn-bg); padding: 8px 12px; border-radius: 6px; font-size: .85rem; color: var(--text); margin: 12px 0 8px; }
.illus { border-left: 4px solid var(--axis); background: var(--surface-2); padding: 8px 12px; border-radius: 6px; font-size: .85rem; margin: 8px 0; }

/* cards & layout */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 16px 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .k { font-size: .85rem; color: var(--text-2); }
.tile .v { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tool-card h2 { margin-top: 0; }
.status { display: inline-block; font-size: .78rem; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--text-2); }
.asof { font-size: .95rem; color: var(--text-2); }
.asof strong { color: var(--text); }
.stale { color: var(--neg); font-weight: 600; }

/* controls */
.controls { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: end; margin: 12px 0; }
.controls label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--text-2); }
select, input[type="number"], input[type="text"] { font: inherit; font-size: 1rem; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--axis); background: var(--surface); color: var(--text); min-height: 44px; }
input[type="number"] { width: 9em; }
button.btn { font: inherit; font-weight: 600; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; min-height: 44px; }
button.btn.secondary { background: transparent; color: var(--accent); }
button.btn:disabled { opacity: .45; cursor: not-allowed; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--axis); border-radius: 99px; padding: 6px 12px; cursor: pointer; font-size: .9rem; background: var(--surface); min-height: 40px; user-select: none; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip .sw { width: 12px; height: 12px; border-radius: 3px; background: var(--axis); }
.chip.on { border-color: var(--text-2); font-weight: 600; }
.chip:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
details > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; color: var(--text-2); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th[data-sort] { cursor: pointer; }
th[data-sort]::after { content: " ↕"; color: var(--text-3); }
th[aria-sort="ascending"]::after { content: " ▲"; color: var(--text); }
th[aria-sort="descending"]::after { content: " ▼"; color: var(--text); }
tbody tr:last-child td { border-bottom: 0; }
.sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 1; }
th.sticky-col { background: var(--surface-2); }
.up { color: var(--pos); } .down { color: var(--neg); }
.neg-real { color: var(--neg); font-weight: 600; }
table.kv th { width: 40%; white-space: normal; background: none; color: var(--text-2); font-size: .88rem; }

/* charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; }
.chart .zero-line { stroke: var(--text-2); stroke-width: 1.5; }
.chart text { fill: var(--text-2); font-size: 12px; font-family: var(--font); }
.chart .dlabel { fill: var(--text); font-size: 12px; font-weight: 600; }
.chart .xhair { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .tip { position: absolute; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--axis); border-radius: 8px; padding: 8px 10px; font-size: .82rem; box-shadow: 0 4px 14px rgba(0,0,0,.12); min-width: 160px; z-index: 5; }
.chart .tip .row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.chart .tip .sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .85rem; color: var(--text-2); margin: 4px 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 18px; height: 3px; border-radius: 2px; display: inline-block; }
.legend .sw.dash { background: repeating-linear-gradient(90deg, var(--cpi) 0 5px, transparent 5px 8px) !important; }
.chart-note { font-size: .8rem; color: var(--text-2); }

/* agreement gate */
.gate-backdrop { position: fixed; inset: 0; background: rgba(10,10,10,.6); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 12px; }
.gate { background: var(--surface); color: var(--text); border-radius: 14px; max-width: 760px; width: 100%; max-height: 92vh; overflow: auto; padding: 22px 24px; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.gate h2 { margin-top: 0; font-size: 1.5rem; }
.gate ul { padding-left: 1.2em; }
.gate li { margin: .35em 0; }
.gate .agree { display: flex; gap: 10px; align-items: center; font-weight: 600; margin: 16px 0; font-size: 1.05rem; }
.gate .agree input { width: 24px; height: 24px; }
.gate .actions { display: flex; justify-content: flex-end; }
body.gated { overflow: hidden; }

@media (max-width: 640px) {
  html { font-size: 106%; }
  h1 { font-size: 1.55rem; }
  .gate { padding: 18px 16px; border-radius: 10px; }
  .site-nav a { margin-right: 12px; }
}
@media print {
  .site-header, .controls, .chips, .theme-btn, .gate-backdrop { display: none !important; }
}
.flush { margin-top: 0; }
[hidden] { display: none !important; }

/* articles list */
.hero { max-width: 46em; }
.hero p { font-size: 1.1rem; color: var(--text-2); }
.post-list { list-style: none; padding: 0; margin: 0; }
.post-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 14px 0; }
.post-card h3 { margin: 0 0 6px; font-size: 1.25rem; }
.post-card h3 a { color: var(--text); text-decoration: none; }
.post-card h3 a:hover { text-decoration: underline; }
.post-card p { margin: 0 0 8px; color: var(--text-2); }
.post-meta { font-size: .85rem; color: var(--text-3); }


/* ===== Editorial theme (Nov 2026) ===== */
h1, h2, .serif { font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; }
h1 { font-size: 2rem; line-height: 1.15; }
h2 { font-size: 1.55rem; }
::selection { background: #f2b13455; }

/* header */
.site-header { background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); }
.site-header .wrap { padding-top: 16px; padding-bottom: 16px; gap: 8px 28px; }
.brand { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; letter-spacing: -.01em; }
.brand b { font-weight: 600; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; }
.site-nav a { color: var(--text-2); text-decoration: none; margin-right: 24px; font-size: .92rem; padding-bottom: 4px; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); border-bottom: 2px solid var(--gold); }
.theme-btn { width: 38px; height: 38px; padding: 0; display: inline-grid; place-items: center; border-radius: 99px; color: var(--text-2); }
.theme-btn:hover { color: var(--text); border-color: var(--axis); }
.theme-btn svg { width: 18px; height: 18px; }

/* page shells */
.page { max-width: 760px; padding-top: 56px; padding-bottom: 24px; }
.page h1 { font-size: 2.1rem; margin: 0 0 .4em; }
.page h2 { margin-top: 1.8em; }
.page li { margin: .3em 0; }
.kicker { font-family: var(--font); font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; color: var(--amber); font-weight: 600; margin: 0 0 14px; }
.lede { font-size: 1.12rem; color: var(--text-2); }

/* home */
.home-hero { padding: 26px 0 0; }
.home-hero h1 { font-size: 1.2rem; font-weight: 500; line-height: 1.35; margin: 0 0 4px; }
.home-hero p { font-size: .88rem; line-height: 1.6; color: var(--text-3); margin: 0; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 40px 0 20px; }
.sec-head h2 { font-family: var(--font); font-size: .8rem; letter-spacing: .18em; text-transform: uppercase; color: var(--text-2); font-weight: 600; margin: 0; }
.sec-head a { font-size: .92rem; text-decoration: none; }
.sec-head a:hover { text-decoration: underline; }

/* article feature / cards */
.feature { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; }
.cover { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; background: #1c5cab;
  background: linear-gradient(160deg, #1f63b6, #174c8f); color: #fff; border-radius: 8px; padding: 30px 30px 24px; aspect-ratio: 4 / 3;
  text-decoration: none; box-shadow: 0 18px 40px -18px #0e2d5a66; overflow: hidden; }
.cover:hover { transform: translateY(-2px); transition: transform .2s; }
.cover-meta { font-size: .78rem; color: #cfe0f7; letter-spacing: .02em; }
.cover-title { font-family: var(--serif); font-size: clamp(1.35rem, 2.5vw, 1.85rem); line-height: 1.08; font-weight: 600; color: #fff; }
.cover-title span { color: var(--gold); }
.cover svg { width: 100%; height: auto; display: block; }
.cover-cap { font-size: .72rem; color: #b9cff0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; }
.cover-cap span { white-space: nowrap; }
.feature-text .post-meta { display: block; margin-bottom: 8px; }
.feature-text h3 { font-family: var(--serif); font-weight: 500; font-size: clamp(1.35rem, 2.2vw, 1.7rem); line-height: 1.15; margin: 0 0 14px; }
.feature-text h3 a { color: var(--text); text-decoration: none; }
.feature-text h3 a:hover { color: var(--link); }
.feature-text p { font-size: 1.02rem; line-height: 1.7; color: var(--text-2); }
.more { display: inline-block; margin-top: 6px; font-weight: 600; text-decoration: none; border-bottom: 1.5px solid currentColor; padding-bottom: 1px; }
.figs { display: flex; gap: 28px; margin: 18px 0 20px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.figs b { display: block; font-family: var(--serif); font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.figs span { font-size: .78rem; color: var(--text-3); }

/* tools */
.tools { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--text); margin-bottom: 40px; }
.tool { padding: 26px 26px 26px 0; border-right: 1px solid var(--line); }
.tool + .tool { padding-left: 26px; }
.tool:last-child { border-right: 0; padding-right: 0; }
.tool .n { font-family: var(--serif); font-size: 2.6rem; line-height: 1; color: var(--axis); }
.tool h3 { font-family: var(--serif); font-weight: 500; font-size: 1.18rem; margin: 14px 0 8px; }
.tool p { color: var(--text-2); font-size: .94rem; line-height: 1.6; margin: 0 0 12px; }
.tool .st { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--amber); font-weight: 600; }

/* articles list */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-row { display: grid; grid-template-columns: 260px 1fr; gap: 32px; align-items: center; padding: 28px 0; border-bottom: 1px solid var(--line); }
.post-row:first-child { border-top: 1px solid var(--line); }
.post-row .cover { aspect-ratio: auto; padding: 18px 18px 14px; gap: 12px; }
.post-row .cover-meta { font-size: .7rem; }
.post-row .cover-cap { display: none; }
.post-row .cover-title { font-size: 1.25rem; }
.post-row h2 { font-size: 1.4rem; margin: 6px 0 10px; }
.post-row h2 a { color: var(--text); text-decoration: none; }
.post-row h2 a:hover { color: var(--link); }
.post-row p { color: var(--text-2); margin: 0 0 8px; }
.post-meta { font-size: .82rem; color: var(--text-3); }

/* footer */
footer.site-footer { margin-top: 72px; background: var(--surface-2); border-top: 1px solid var(--line); padding: 44px 0 36px; font-size: .86rem; }
.foot-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: start; }
.foot-brand { display: flex; gap: 10px; align-items: center; font-family: var(--serif); font-size: 1.15rem; color: var(--text); }
.foot-brand b { color: var(--accent); font-weight: 600; }
.foot-tag { color: var(--text-2); margin: 8px 0 0; }
footer.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: flex-end; }
footer.site-footer nav a { margin: 0; color: var(--text-2); text-decoration: none; }
footer.site-footer nav a:hover { color: var(--text); text-decoration: underline; }
.foot-legal { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 18px; color: var(--text-3); font-size: .8rem; line-height: 1.6; }
.foot-legal p { margin: 0 0 8px; }

/* article page: blend the article into the theme */
body.viz-article-page { background: var(--bg); }
body .viz-article { --surface: var(--bg); --surface-2: #f4eee3; --rule: #e7dfd1; --grid: #ece5d8; background: transparent; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) body .viz-article { --surface: var(--bg); --surface-2: #26221c; --rule: #2f2a22; --grid: #2a261f; } }
:root[data-theme="dark"] body .viz-article { --surface: var(--bg); --surface-2: #26221c; --rule: #2f2a22; --grid: #2a261f; }
body .viz-article .kicker { color: var(--amber); }
body .viz-article h1, body .viz-article h2 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }

@media (max-width: 760px) {
  .feature { grid-template-columns: 1fr; gap: 26px; }
  .cover { aspect-ratio: auto; }
  .cover-cap { font-size: .66rem; }
  .tools { grid-template-columns: 1fr; }
  .tool, .tool + .tool { padding: 22px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .post-row { grid-template-columns: 1fr; gap: 16px; }
  .foot-grid { grid-template-columns: 1fr; }
  footer.site-footer nav { justify-content: flex-start; }
  .home-hero { padding: 20px 0 0; }
  .page { padding-top: 36px; }
  .page h1 { font-size: 1.8rem; }
  .site-nav a { margin-right: 16px; }
}
.gate:focus { outline: none; }
.gate h2 { font-weight: 600; }
