/* Investment Indexer: ink navy and a teal accent; numbers in the sans face. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  color-scheme: light;
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --ink: #0F1B2D;
  --ink2: #4A5568;
  --ink3: #7A8597;
  --navy: #14294B;
  --accent: #0E7C7B;
  --accent-soft: #DDF0EF;
  --border: rgba(15,27,45,0.10);
  --grid: #E8EBF0;
  --axis: #C3C9D3;
  --up: #006300;
  --down: #B42318;
  /* validated categorical slots 1-4 for the growth chart */
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --serif: 'DM Serif Display', Georgia, serif;
  --sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
body { font-family: var(--sans); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.6; overflow-x: hidden; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 0.85em; background: #EEF1F5; padding: 0.05rem 0.3rem; border-radius: 4px; }

nav.top { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.9rem 2rem; background: rgba(246,247,249,0.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.nav-left { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.nav-back { font-size: 0.8rem; font-weight: 500; color: var(--ink2); text-decoration: none; padding: 0.35rem 0.85rem; border: 1px solid var(--border); border-radius: 999px; white-space: nowrap; }
.nav-back:hover { color: var(--accent); border-color: var(--accent); }
.nav-logo { font-family: var(--serif); font-size: 1.2rem; white-space: nowrap; }
.nav-code { font-size: 0.88rem; font-weight: 500; text-decoration: none; white-space: nowrap; }

.hero { max-width: 1100px; margin: 0 auto; padding: 3.5rem 2rem 1.5rem; }
.eyebrow { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.9rem; }
h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.1rem, 5vw, 3.3rem); line-height: 1.08; max-width: 820px; margin-bottom: 1rem; }
h1 em { color: var(--accent); }
.lede { font-size: 1.08rem; color: var(--ink2); max-width: 720px; }

main { max-width: 1100px; margin: 0 auto; padding: 0 2rem 3rem; }
.filters { display: flex; gap: 1.25rem; flex-wrap: wrap; align-items: flex-end; margin: 1.5rem 0 1rem; position: sticky; top: 57px; z-index: 10; background: var(--bg); padding: 0.6rem 0; }
.filter { display: flex; flex-direction: column; gap: 0.3rem; }
.filter-label { font-size: 0.75rem; font-weight: 500; color: var(--ink2); }
select { font: inherit; font-size: 0.9rem; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.45rem 0.65rem; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; flex-wrap: wrap; }
.seg button { font: inherit; font-size: 0.85rem; border: none; background: none; color: var(--ink2); padding: 0.32rem 0.7rem; border-radius: 7px; cursor: pointer; }
.seg button[aria-checked="true"] { background: var(--navy); color: #fff; font-weight: 700; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8rem; margin-bottom: 1rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 0.9rem 1rem; }
.tile .label { font-size: 0.78rem; color: var(--ink2); }
.tile .value { font-size: 1.45rem; font-weight: 700; line-height: 1.2; margin: 0.15rem 0; letter-spacing: -0.01em; }
.tile .detail { font-size: 0.8rem; color: var(--ink3); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.25rem 1.4rem; margin-bottom: 1rem; }
.card h2, .about h2 { font-family: var(--serif); font-weight: 400; font-size: 1.35rem; line-height: 1.25; }
.card h3 { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink3); margin-bottom: 0.4rem; }
.card-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.sub { font-size: 0.85rem; color: var(--ink3); }
.hint { font-size: 0.8rem; color: var(--ink3); margin-top: 0.5rem; }
.small { font-size: 0.82rem; color: var(--ink2); }

.boards { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.board { list-style: none; }
.board li { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: 0.25rem 0.6rem; align-items: center; padding: 0.38rem 0; border-bottom: 1px solid var(--grid); }
.board .rk { font-size: 0.8rem; color: var(--ink3); font-variant-numeric: tabular-nums; }
.board .nm { font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board .nm small { color: var(--ink3); font-size: 0.75rem; margin-left: 0.3rem; }
.board .vl { font-size: 0.9rem; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.board .bar { grid-column: 2 / 4; height: 6px; background: var(--grid); border-radius: 3px; position: relative; overflow: visible; }
.board .bar span { position: absolute; top: 0; bottom: 0; background: var(--accent); border-radius: 3px; }
.board .bar span.neg { background: var(--down); }
.board .bar i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); border-radius: 1px; }
.board li.is-market .nm { font-weight: 700; }

.chart { width: 100%; height: 340px; position: relative; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .gridline { stroke: var(--grid); }
.chart .baseline { stroke: var(--axis); }
.chart .axis text { fill: var(--ink3); font-size: 11px; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; }
.chart .label { font-size: 11.5px; font-weight: 700; font-family: var(--sans); fill: var(--ink2); }
.chart .crosshair { stroke: var(--ink2); stroke-width: 1; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.key { display: flex; gap: 0.9rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--ink2); max-width: 520px; }
.key span { display: inline-flex; align-items: center; gap: 0.35rem; }
.key i { width: 16px; border-top: 2px solid; }
.key button { border: none; background: none; color: var(--ink3); cursor: pointer; font-size: 0.9rem; line-height: 1; padding: 0 0.1rem; }

.table-wrap { max-height: 560px; overflow: auto; border-top: 1px solid var(--grid); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th { position: sticky; top: 0; background: var(--surface); text-align: left; z-index: 1; }
th button { font: inherit; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink2); background: none; border: none; cursor: pointer; padding: 0.6rem 0.5rem; white-space: nowrap; }
th button[aria-sort]::after { content: " ↓"; }
th button[aria-sort="ascending"]::after { content: " ↑"; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num button { width: 100%; text-align: right; }
td { padding: 0.45rem 0.5rem; border-top: 1px solid var(--grid); white-space: nowrap; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #F3F6FA; }
tbody tr.picked { background: var(--accent-soft); }
tbody tr.is-market td:nth-child(2) { font-weight: 700; }
td .swatch { display: inline-block; width: 14px; border-top: 2px solid; margin-right: 0.4rem; vertical-align: middle; }
td.neg { color: var(--down); }

.insight .persist { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; margin: 1rem 0; }
.insight .p { background: var(--bg); border-radius: 12px; padding: 0.9rem 1rem; }
.insight .p b { display: block; font-size: 1.45rem; }
.insight .p span { font-size: 0.8rem; color: var(--ink2); }
.insight > p:last-child { color: var(--ink2); max-width: 760px; }

.about { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin: 2rem 0; }
.about > div { min-width: 0; }
.about ol { padding-left: 1.2rem; display: grid; gap: 0.6rem; margin-top: 0.75rem; color: var(--ink2); font-size: 0.92rem; }
.about b { color: var(--ink); }
pre { background: var(--navy); color: #E6EDF7; border-radius: 12px; padding: 1rem; overflow-x: auto; font-size: 0.75rem; line-height: 1.6; margin: 0.75rem 0; }
pre code { background: none; padding: 0; font-size: inherit; }

footer { border-top: 1px solid var(--border); padding-top: 1rem; font-size: 0.8rem; color: var(--ink3); display: grid; gap: 0.4rem; }

.tooltip { position: fixed; z-index: 50; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 6px 20px rgba(15,27,45,0.14); padding: 0.55rem 0.7rem; font-size: 0.8rem; min-width: 160px; }
.tooltip .tt-title { font-weight: 700; margin-bottom: 0.25rem; }
.tooltip .tt-row { display: flex; align-items: center; gap: 0.45rem; }
.tooltip .tt-row b { font-variant-numeric: tabular-nums; }
.tooltip .tt-row span { color: var(--ink2); }
.tooltip .tt-key { width: 12px; border-top: 2px solid; }

@media (max-width: 860px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .boards, .about { grid-template-columns: 1fr; }
  .insight .persist { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  nav.top { padding: 0.8rem 1rem; }
  .nav-back .long, .nav-logo { display: none; }
  .hero { padding: 2rem 1rem 1rem; }
  main { padding: 0 1rem 2.5rem; }
  .filters { position: static; }
  .card { padding: 1rem; }
  .chart { height: 280px; }
}
