/* Who Got Richer? — in the site's shared look (shared/theme.css): white,
 * black type, Helvetica with tabular figures, the one blue for links and
 * controls. Series colors are a fixed categorical order (validated for
 * colorblind separation); every line is also labeled at its end and the
 * numbers are in a table, since three of the six fall below 3:1 on white. */
:root {
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300;
  --ref: #8a8a8a;
  --grid: #ececec;
}
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--appnav-h, 0px) + 20px); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.5 var(--sans); font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-underline-offset: 2px; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); max-width: 1500px; margin: 0 auto; }
.side {
  position: sticky; top: var(--appnav-h, 0px);
  height: calc(100vh - var(--appnav-h, 0px)); height: calc(100dvh - var(--appnav-h, 0px));
  overflow-y: auto; border-right: 1px solid var(--rule-soft); scrollbar-width: thin;
}
.side-inner { padding: 1.3rem 1.2rem 1.6rem 1.35rem; }
.kicker { font-size: .8rem; font-weight: 700; margin: 0 0 .4rem; }
h1 { font-size: 2.1rem; line-height: 1.05; letter-spacing: -.02em; margin: 0 0 .6rem; }
.lede { color: var(--ink-2); font-size: 15px; margin: 0 0 .4rem; }
.side-h {
  font-size: .8rem; font-weight: 700; margin: 1rem 0 .45rem; padding-top: .7rem;
  border-top: 1px solid var(--rule-soft);
}
.note { font-size: 13px; color: var(--ink-3); margin: .25rem 0 0; }

.seg { display: flex; border: 1px solid var(--ink); border-radius: 6px; overflow: hidden; margin: 0 0 .35rem; }
.seg button {
  flex: 1 1 0; padding: .4rem .3rem; border: 0; border-right: 1px solid var(--ink);
  background: transparent; cursor: pointer; font-size: 14px;
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.seg button:hover:not([aria-pressed="true"]) { background: var(--wash); }
.seg-sm { max-width: 44rem; margin: .1rem 0 .35rem; }
.seg-sm button { font-size: 13px; padding: .3rem .4rem; white-space: nowrap; }
@media (max-width: 560px) { .seg-sm button { white-space: normal; } }

.chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.chips button {
  padding: .2rem .6rem; border: 1px solid var(--rule-soft); border-radius: 999px;
  background: transparent; cursor: pointer; font-size: 14px;
}
.chips button:hover { border-color: var(--ink); }
.chips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.ctl label { font-size: 15px; }
.ctl select { padding: .1rem .2rem; border: 1px solid var(--rule-soft); border-radius: 4px; background: var(--paper); }
.check { display: flex; gap: .5rem; align-items: flex-start; font-size: 15px; margin: .6rem 0 0; }
.check input { margin-top: .3rem; accent-color: var(--blue); }
.check small { display: block; color: var(--ink-3); font-size: 13px; }

.readout .big { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; margin: 0; }
.readout .big small { font-size: .9rem; font-weight: 400; color: var(--ink-2); letter-spacing: 0; }
.readout p { margin: .3rem 0 0; font-size: 14.5px; color: var(--ink-2); }
.readout strong { color: var(--ink); }
.side-foot { margin-top: 1.1rem; font-size: 13px; color: var(--ink-3); }

/* ---------- main column ---------- */
.main { min-width: 0; padding: 1rem 1.4rem 1rem; }
.findings h2 { font-size: 1.25rem; margin: 0; }
.f-note { font-size: 13px; color: var(--ink-3); margin: .1rem 0 .5rem; }
.f-list {
  list-style: none; margin: 0 0 1.2rem; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .5rem;
}
.f-list button {
  display: flex; flex-direction: column; justify-content: flex-start; width: 100%; height: 100%; text-align: left; cursor: pointer;
  padding: .6rem .75rem; border: 1px solid var(--rule-soft); border-left: 3px solid var(--hue);
  border-radius: 4px; background: var(--paper); font-size: 14px; line-height: 1.42; color: var(--ink-2);
}
.f-list button b { display: block; color: var(--ink); font-size: 15px; margin-bottom: .2rem; }
.f-list button:hover { background: var(--wash); }
.f-list button[aria-pressed="true"] { border-color: var(--ink); border-left-color: var(--ink); background: var(--wash); }

.fig { margin: 0 0 1.6rem; padding-top: .9rem; border-top: 1px solid var(--rule-soft); }
.cap { font-size: 15px; color: var(--ink-2); margin: 0 0 .3rem; }
.cap b { color: var(--ink); font-size: 1.08rem; margin-right: .3rem; }
.plot { position: relative; height: 400px; }
#plot-stress { height: 300px; }
.plot-rows { height: auto; }
.plot svg { display: block; width: 100%; overflow: visible; }
.axis-note { font-size: 13px; color: var(--ink-3); margin: .3rem 0 0; }

.key { display: flex; flex-wrap: wrap; gap: .25rem .9rem; font-size: 13.5px; color: var(--ink-2); margin: 0 0 .25rem; }
.key button { border: 0; background: none; padding: .1rem 0; cursor: pointer; color: var(--ink-2); font-size: 13.5px; }
.key button:hover, .key button[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.key i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: 4px; margin-right: .35rem; }
.key i.ref { height: 0; border-top: 2px dashed var(--ref); background: none; }
.key .k-from, .key .k-to { width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px; }
.key .k-from { border: 2px solid var(--ink-3); background: var(--paper); }
.key .k-to { background: var(--ink); }

/* svg */
.grid line { stroke: var(--grid); }
.grid .zero { stroke: var(--ink-3); }
.ax text { font-size: 11.5px; fill: var(--ink-3); }
.ax .yr.on { fill: var(--ink); font-weight: 700; }
.ser path { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ser circle { stroke: var(--paper); stroke-width: 2; }
.ser.ref path { stroke: var(--ref); stroke-dasharray: 5 4; stroke-width: 1.6; }
.ser.ref circle { fill: var(--ref); }
.ser.dim { opacity: .14; }
.end { font-size: 12px; fill: var(--ink-2); paint-order: stroke; stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; }
.end b, .end .v { font-weight: 700; fill: var(--ink); }
.cross { stroke: var(--ink-3); stroke-width: 1; }
.from-band { fill: var(--wash); }
.hit { fill: transparent; }

.row text { font-size: 13px; fill: var(--ink); }
.row .lab { fill: var(--ink); }
.row .pct { font-weight: 700; }
.row .pct.dn { fill: #b3261e; }
.row .pct.up { fill: #1b6e3a; }
.row .sub { fill: var(--ink-3); font-size: 11.5px; }
.row .rail { stroke: var(--grid); }
.row .bar { stroke-width: 3; stroke-linecap: round; }
.row .d-from { fill: var(--paper); stroke: var(--ink-3); stroke-width: 2; }
.row.all .lab { font-weight: 700; }
.row:hover .rail { stroke: var(--rule-soft); }
.row-hit { fill: transparent; }
.row:hover .row-hit { fill: var(--wash); }

.tip {
  position: fixed; z-index: 50; pointer-events: none; max-width: 270px;
  background: var(--ink); color: #fff; border-radius: 5px; padding: .45rem .6rem;
  font-size: 13px; line-height: 1.4; box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.tip table { border-collapse: collapse; margin-top: .2rem; }
.tip td { padding: 0 .5rem 0 0; }
.tip td:last-child { text-align: right; padding-right: 0; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .3rem; }

.numbers summary { cursor: pointer; font-size: 14px; color: var(--blue); margin-top: .4rem; }
.tbl-wrap { overflow-x: auto; }
.numbers table { border-collapse: collapse; font-size: 13px; margin: .5rem 0; }
.numbers th, .numbers td { padding: .2rem .6rem .2rem 0; text-align: right; border-bottom: 1px solid var(--rule-soft); white-space: nowrap; }
.numbers th:first-child, .numbers td:first-child { text-align: left; }
.numbers th { color: var(--ink-3); font-weight: 500; }

/* ---------- reading + sources ---------- */
.reading, .sources, .changelog { max-width: 46rem; margin: 0 auto; padding: 1.8rem 1.25rem 0; }
.reading h2, .sources h2, .changelog h2 { font-size: 1.4rem; margin: 0 0 .6rem; }
.sources ul { padding-left: 1.1rem; }
.sources li { margin: .35rem 0; }
.sources a { overflow-wrap: anywhere; }
.changelog { padding-bottom: 3rem; }
.changelog ul { list-style: none; padding: 0; }
.changelog li { font-size: 15px; margin: .3rem 0; }
.changelog time { font-size: .85rem; color: var(--ink-3); margin-right: .6rem; }

@media (max-width: 900px) {
  .layout { display: block; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--rule-soft); overflow: visible; }
  .main { padding: 1rem; }
  .plot { height: 340px; }
}
@media (max-width: 480px) {
  .side-inner { padding: 1.1rem 1rem 1.2rem; }
  h1 { font-size: 1.85rem; }
  .plot { height: 300px; }
  .reading, .sources, .changelog { padding-left: 1rem; padding-right: 1rem; }
}
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
