:root {
  --bg: #fffff8;
  --ink: #111;
  --ink-2: #5b5a55;
  --context: #b5b2a8;
  --context-2: #8d8a80;
  --rule: #e2dfd4;
  --signal: #a8322d;
  --up: #2f5d50;
  --serif: "Newsreader", "ET Book", Palatino, Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151513; --ink: #e8e6df; --ink-2: #a8a59c; --context: #5a5852; --context-2: #7d7a72;
    --rule: #2f2e2a; --signal: #e0645c; --up: #7fb3a3;
  }
}
:root[data-theme="dark"] {
  --bg: #151513; --ink: #e8e6df; --ink-2: #a8a59c; --context: #5a5852; --context-2: #7d7a72;
  --rule: #2f2e2a; --signal: #e0645c; --up: #7fb3a3;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.5 var(--serif); font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: var(--context); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--ink); }
code { font-size: .85em; }

.shell { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 40px; max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* rail */
.rail { position: sticky; top: 0; align-self: start; height: 100vh; padding: 36px 0; font: 13px/1.4 var(--sans); }
.rail .brand { display: block; font: 500 15px/1.2 var(--serif); text-decoration: none; margin-bottom: 22px; }
.rail ol { list-style: none; margin: 0; padding: 0; }
.rail li a { display: flex; justify-content: space-between; padding: 3px 0; text-decoration: none; color: var(--ink-2); }
.rail li a:hover { color: var(--ink); }
.rail li a.current { color: var(--ink); }
.rail li a.current::before { content: ""; position: absolute; left: -12px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: var(--ink); }
.rail li a { position: relative; }
.rail li span { font-variant-numeric: tabular-nums; color: var(--context-2); }
.rail-meta { margin-top: 24px; color: var(--ink-2); font-size: 12px; }


/* sections */
.section { padding-top: 40px; border-top: 1px solid var(--rule); margin-top: 40px; }
.section:first-of-type { border-top: 0; margin-top: 0; padding-top: 35px; }   /* glyph tops line up with the rail brand (36px + its smaller half-leading) */
.section-head h2 { font: 400 38px/1.1 var(--serif); margin: 0 0 26px; letter-spacing: -.005em; }
.section-head p { text-wrap: balance;  margin: 4px 0 18px; color: var(--ink-2); font-style: italic; }

/* sparkline table */
.sparktable { width: 100%; border-collapse: collapse; font: 13px/1.3 var(--sans); margin-bottom: 28px; font-variant-numeric: tabular-nums; }
.sparktable th { text-align: left; font-weight: 400; color: var(--ink-2); font-size: 11px; padding: 0 10px 5px 0; border-bottom: 1px solid var(--rule); }
.sparktable td { padding: 5px 10px 5px 0; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.sparktable td a { text-decoration: none; }
.sparktable td a:hover { text-decoration: underline; }
.sparktable .num { text-align: right; white-space: nowrap; }
.sparktable .c-spark { width: 196px; }
.spark { display: block; overflow: visible; max-width: 100%; height: auto; }
.spark polyline { fill: none; stroke: var(--ink); stroke-width: 1; stroke-linejoin: round; }
.spark circle { fill: var(--ink); }
td.up { color: var(--up); }
td.down { color: var(--signal); }
.stale-dot { font-size: 10px; color: var(--signal); border: 1px solid currentColor; border-radius: 3px; padding: 0 3px; }

.facets { display: grid; gap: 24px; }
.facet-title { font: 12px var(--sans); color: var(--ink-2); margin: 0 0 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.colophon { border-top: 1px solid var(--rule); margin: 60px 0 80px; padding-top: 30px; }
.colophon h2 { font: 400 24px var(--serif); margin: 0 0 16px; }
.sources { list-style: none; margin: 0; padding: 0; font-size: 13px; line-height: 1.5; columns: 2 300px; column-gap: 48px; }
.sources li { padding: 6px 0; border-top: 1px solid var(--rule); break-inside: avoid; }
.src-host { color: var(--ink); text-decoration: none; font-weight: 500; }
.src-host:hover { text-decoration: underline; }
.src-lic { color: var(--context-2); font-size: 11px; margin-left: 4px; }
.src-uses { display: block; color: var(--ink-2); }
.src-uses a { color: inherit; text-decoration: none; }
.src-uses a:hover { color: var(--ink); text-decoration: underline; }

/* cards: lead first and full width, then pairs; an odd last card spans the row (set server-side) */
/* Subgrid: every card spans 4 rows (head, subtitle, chart, foot) that line up across its row,
   so titles, subtitles and plots start at the same height without reserving blank lines. */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row dense; column-gap: 48px; row-gap: 0; }
.card { position: relative; min-width: 0; display: grid; grid-row: span 4; grid-template-rows: subgrid; row-gap: 0; padding-bottom: 44px; }
.card.span2 { grid-column: 1 / -1; }
.card > * { min-width: 0; }   /* grid items default to min-width: auto: a long nowrap title would widen the card past the screen */
.card:hover, .card:focus-within { z-index: 10; }   /* tooltips overflow onto neighbours */
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card h3 { font: 500 19px/1.3 var(--serif); margin: 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.lead h3 { font-size: 22px; }
.card h3 a { text-decoration: none; }
/* balanced wrapping: two-line subtitles break into even halves instead of leaving an orphan word */
.subtitle { margin: 3px 0 20px; font: 13px/1.4 var(--sans); color: var(--ink-2); align-self: start; text-wrap: balance; max-width: 60ch; }
.chart { position: relative; flex: none; }
.chart svg { display: block; overflow: visible; }
.chart.empty, .chart-error { display: flex; align-items: center; justify-content: center; color: var(--ink-2); font: italic 14px var(--serif); border: 1px dashed var(--rule); }
.foot { margin: 0; padding-top: 16px; align-self: start; font: 10px/1.4 var(--sans); color: var(--context-2); opacity: .55;   /* dimmed like the info button */ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stale { color: var(--signal); }
.muted { color: var(--ink-2); }

/* info button */
.info { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; margin: -4px -5px 0 0; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--context-2); opacity: .55; cursor: pointer; transition: opacity .15s; }
.info:hover, .info:focus-visible { opacity: 1; color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
.info:focus-visible { outline: 1px solid var(--ink-2); outline-offset: 1px; }
.info-glyph { display: inline-block; vertical-align: -2px; color: var(--ink-2); }
.sparktable .c-info { width: 30px; text-align: right; padding-right: 0; }
.sparktable .info { width: 22px; height: 22px; margin: 0; }
.sparktable tr.is-row td:first-child a { text-decoration: underline dotted var(--context); }
.row-hint { font-size: 10px; color: var(--context-2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* modal */
dialog#modal { width: min(880px, 94vw); max-height: 90vh; padding: 0; border: 1px solid var(--rule); border-radius: 6px;
  background: var(--bg); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog#modal::backdrop { background: rgba(10, 10, 8, .55); }
dialog#modal .modal-body { padding: 26px 30px 30px; max-height: 90vh; overflow: auto; box-sizing: border-box; }
dialog#modal .close { position: absolute; top: 10px; right: 12px; width: 32px; height: 32px; border: 0; background: none;
  color: var(--ink-2); font: 26px/1 var(--sans); cursor: pointer; border-radius: 50%; z-index: 2; }
dialog#modal .close:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
.m-title { font: 400 26px/1.2 var(--serif); margin: 0 40px 4px 0; }
.modal-body .subtitle { margin-bottom: 14px; }
.modal-body .chart { margin: 4px 0 6px; }
.m-unit { font: 11.5px var(--sans); color: var(--ink-2); margin: 0 0 18px; }

table.data { border-collapse: collapse; font: 12px var(--sans); font-variant-numeric: tabular-nums; margin-top: 18px; }
table.data th, table.data td { padding: 2px 18px 2px 0; text-align: left; border-bottom: 1px solid var(--rule); }
table.data th { font-weight: 400; color: var(--ink-2); }
.num { text-align: right; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; gap: 0; padding: 0 16px; }
  .rail { position: sticky; top: 0; z-index: 5; height: auto; padding: 10px 0; background: var(--bg); border-bottom: 1px solid var(--rule); overflow-x: auto; }
  .rail .brand, .rail-meta { display: none; }
  .rail ol { display: flex; gap: 14px; white-space: nowrap; }
  .rail li span { margin-left: 4px; }
  .cards { grid-template-columns: 1fr; }
  .card.span2 { grid-column: auto; }
  dialog#modal .modal-body { padding: 22px 18px; }
  .sparktable .c-spark { width: 80px; }
  .sparktable th:nth-child(4), .sparktable td:nth-child(4) { display: none; }
}

.facets > div { position: relative; }
.facets > div:hover { z-index: 2; }

/* curated tables */
table.reported { width: 100%; margin-top: 4px; }
table.reported td { padding: 5px 16px 5px 0; vertical-align: top; }
table.reported td:nth-child(3) { font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
table.reported .secondary { color: var(--ink-2); font-size: 11px; }


/* "Also tracked": supporting signals as compact tiles; click opens the full chart */
.minis { margin-top: 8px; }
.minis-head { font: 500 11px/1.3 var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); margin: 0 0 10px; }
.minis-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 32px; }
.mini { display: grid; gap: 4px; align-content: start; text-align: left; padding: 12px 0 14px; border: 0; border-top: 1px solid var(--rule);
  background: none; color: var(--ink); font: 13px/1.35 var(--sans); cursor: pointer; }
.mini:hover .mini-title, .mini:focus-visible .mini-title { text-decoration: underline; text-decoration-color: var(--context); text-underline-offset: 2px; }
.mini:focus-visible { outline: 1px solid var(--ink-2); outline-offset: 2px; }
.mini-title { color: var(--ink); }
.mini-value { font-variant-numeric: tabular-nums; color: var(--ink); font-size: 15px; }
.mini-date, .mini-note { color: var(--ink-2); font-size: 11px; }
.mini .spark { width: 100%; height: auto; margin-top: 4px; }
.mini .stale { font-size: 11px; }

/* modal text: explanation in a 2×2 grid, pipeline details in one quiet row below */
.m-text { display: grid; gap: 22px; margin-top: 6px; max-width: 75%; }
.m-text h4, .m-meta h4 { font: 500 10.5px/1.3 var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); margin: 0 0 5px; }
.m-text p { margin: 0; font: 15px/1.5 var(--serif); text-wrap: pretty; }
.m-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px 28px; margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--rule);
  font: 12px/1.45 var(--sans); color: var(--ink-2); }
.m-meta p { margin: 0; }
.m-meta ul { margin: 0; padding: 0; list-style: none; }
.m-meta li + li { margin-top: 4px; }
.m-meta a { color: var(--ink); }
.m-meta code { font-size: 11px; overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .m-text { max-width: none; }
  .m-meta { grid-template-columns: 1fr 1fr; }
}

/* charts (assets/chart/): Inter 11px tabular figures, grey context, ink subject */
.wib { font: 11px var(--sans); font-variant-numeric: tabular-nums; -webkit-user-select: none; user-select: none; }
.wib text { fill: var(--ink-2); }
.wib .grid line { stroke: var(--ink-2); stroke-opacity: .14; }   /* hairlines at y ticks, barely there */
.wib .tick { stroke: var(--ink-2); }
.wib .hit { fill: transparent; cursor: crosshair; touch-action: pan-y; }
.wib .ghost { opacity: .2; }   /* what lies right of the crosshair */
.wib tspan.up { fill: var(--up); }
.wib tspan.down { fill: var(--signal); }

/* scrubbing: the resting end labels (and the unit line) step aside while the hover labels follow the crosshair */
.wib .rest { transition: opacity 150ms; }
.wib.scrubbing .rest { opacity: 0; }

/* scrub motion: labels, dots and crosshair glide to new positions (and slide past each other
   when series swap order); the first frame of a hover jumps into place */
.scrub text, .scrub circle, .scrub line { transition: transform 180ms cubic-bezier(.2, .7, .2, 1); }
.scrub.jump text, .scrub.jump circle, .scrub.jump line { transition: none; }

/* categorical charts: the hovered row stays, the rest step back */
.wib.rows .row { transition: opacity 150ms; }
.wib.rows.focus .row:not(.on) { opacity: .3; }
.wib .row-hit { fill: transparent; }
@media (prefers-reduced-motion: reduce) {
  .scrub text, .scrub circle, .scrub line, .wib .rest, .wib.rows .row { transition: none; }
}

/* chart labels: "Oracle $28.5B" — the key steps back, the value carries (set by setLabelText in chart/core.js) */
.chart .lk { fill-opacity: .62; }
.chart .lv { font-weight: 500; }
