/* Copied from ae/web/static/style.css, with the public-only rules at the end. Change both together. */
/* Site styles. Every color, size and space comes from tokens.css (scripts/check_tokens.py enforces it).
   Change a token there and the whole site follows. Change a component here and every page follows.

   Components (one place each):
     .site-head .brand .nav .lookup .theme    header
     .tape .tape-item                          headline strip under the header
     .toolbar .seg .dates                      market and date controls
     .crumbs .page-head .eyebrow .lede         page title block
     .ticker .delta .badge .mkc                inline atoms
     .stat .stat-grid                          big-number cards
     .card .cards .section-head                containers
     table.data .num .tree .caret .spark       data tables and the index tree
     .chart-wrap .method .note .prose          charts and text
*/

/* ---------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"]  { color-scheme: dark; }
body {
  margin: 0; background: var(--ae-bg); color: var(--ae-text);
  font-family: var(--ae-font-body); font-size: var(--ae-fs-3); line-height: var(--ae-lh);
  font-feature-settings: "tnum" 1, "cv11" 1;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--ae-accent); }
:focus-visible { outline: none; box-shadow: var(--ae-ring); border-radius: var(--ae-r-1); }
h1, h2, h3 { font-family: var(--ae-font-display); line-height: var(--ae-lh-tight); letter-spacing: -0.01em; margin: 0; }
h1 { font-size: var(--ae-fs-7); font-weight: 600; }
h2 { font-size: var(--ae-fs-5); font-weight: 600; }
h3 { font-size: var(--ae-fs-4); font-weight: 600; }
p { margin: 0 0 var(--ae-sp-3); }
b, strong { font-weight: 600; }
code { font-family: var(--ae-font-mono); font-size: 0.9em; background: var(--ae-surface-2); padding: 0 var(--ae-sp-1); border-radius: var(--ae-r-1); }
button, input, select { font: inherit; color: inherit; }
svg { display: block; }
.muted { color: var(--ae-muted); }
.small { font-size: var(--ae-fs-2); }
.num { text-align: left; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hide { display: none !important; }
.wrap { width: min(100% - 2 * var(--ae-sp-4), var(--ae-measure)); margin-inline: auto; }

/* ---------- header */
.site-head { border-bottom: 1px solid var(--ae-line); background: var(--ae-surface); }
.site-head .wrap { display: flex; align-items: center; gap: var(--ae-sp-4); min-height: 56px; }
.brand { display: flex; align-items: center; gap: var(--ae-sp-2); font-family: var(--ae-font-display); font-weight: 700; font-size: var(--ae-fs-5); letter-spacing: -0.01em; white-space: nowrap; }
.brand:hover { color: inherit; }
.brand-mark { width: 28px; height: 28px; flex: none; display: block; }      /* the logo, public/logo.png */
.nav { display: flex; gap: var(--ae-sp-1); margin-left: var(--ae-sp-2); }
.nav a { padding: var(--ae-sp-2) var(--ae-sp-2); border-radius: var(--ae-r-2); color: var(--ae-text-2); font-weight: 500; font-size: var(--ae-fs-3); white-space: nowrap; }
.nav a:hover { background: var(--ae-surface-2); color: var(--ae-text); }
.nav a.on { color: var(--ae-text); box-shadow: inset 0 -2px 0 var(--ae-accent); border-radius: var(--ae-r-2) var(--ae-r-2) 0 0; }
.head-right { margin-left: auto; display: flex; align-items: center; gap: var(--ae-sp-2); }
.lookup { position: relative; }
.lookup input {
  width: 20rem; padding: var(--ae-sp-2) var(--ae-sp-3); font-family: var(--ae-font-body); font-size: var(--ae-fs-3);
  background: var(--ae-bg); color: var(--ae-text); border: 1px solid var(--ae-line); border-radius: var(--ae-r-2);
}
.lookup input:focus { outline: none; border-color: var(--ae-line-2); box-shadow: var(--ae-ring); }
.lookup input::placeholder { color: var(--ae-muted); }
.lookup input::-webkit-search-cancel-button { display: none; }
/* suggestions under the header search (public/search.js) */
.lookup-list { position: absolute; top: calc(100% + 4px); right: 0; z-index: 50; width: max(100%, 24rem); max-width: calc(100vw - 2 * var(--ae-sp-4));
  margin: 0; padding: var(--ae-sp-1); list-style: none; background: var(--ae-surface); border: 1px solid var(--ae-line-2);
  border-radius: var(--ae-r-2); box-shadow: var(--ae-shadow-2); }
.lookup-list li { display: flex; align-items: center; gap: var(--ae-sp-2); padding: var(--ae-sp-2); border-radius: var(--ae-r-1); cursor: pointer; font-size: var(--ae-fs-3); color: var(--ae-text-2); }
.lookup-list li.on, .lookup-list li:hover { background: var(--ae-surface-2); color: var(--ae-text); }
.lookup-list .lookup-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lookup-list .lookup-name b { color: var(--ae-text); font-weight: 600; }
.lookup-list .lookup-kind { color: var(--ae-muted); font-size: var(--ae-fs-1); text-transform: uppercase; letter-spacing: 0.06em; }
.lookup-list .lookup-none { cursor: default; color: var(--ae-muted); }
.theme { width: 32px; height: 32px; border: 1px solid var(--ae-line); background: var(--ae-bg); border-radius: var(--ae-r-2); cursor: pointer; color: var(--ae-text-2); display: grid; place-items: center; }
.theme:hover { color: var(--ae-text); border-color: var(--ae-line-2); }
.theme svg { width: 16px; height: 16px; }
html[data-theme="light"] .theme .moon, .theme .sun { display: none; }
html[data-theme="light"] .theme .sun { display: block; }

/* iPhones zoom the page into any text box whose text is under 16px, and stay zoomed (owner, 2026-11-09): on touch
   screens every box gets 1rem text */
@media (hover: none) and (pointer: coarse) {
  input[type="search"], input[type="text"], input:not([type]), select, textarea { font-size: var(--ae-fs-4); }
}

/* ---------- headline tape: scrolls continuously, pauses on hover, two copies of the items make the loop seamless */
.tape { position: relative; border-bottom: 1px solid var(--ae-line); background: var(--ae-surface); overflow: hidden; height: 36px; display: flex; align-items: center; }
.tape-track { display: flex; gap: 0; width: max-content; padding-left: var(--ae-sp-6); white-space: nowrap; animation: tape-scroll calc(var(--tape-n, 8) * 6s) linear infinite; }
.tape:hover .tape-track { animation-play-state: paused; }
@keyframes tape-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .tape-track { animation: none; } .tape { overflow-x: auto; } }
.tape-item { display: inline-flex; margin-right: var(--ae-sp-6); align-items: baseline; gap: var(--ae-sp-2); font-size: var(--ae-fs-2); }
.tape-item .t-name { color: var(--ae-text-2); font-weight: 500; }
.tape-item .t-fac { color: var(--c); font-weight: 600; }
.tape-item .t-sym { font-family: var(--ae-font-mono); font-weight: 600; letter-spacing: 0.02em; color: var(--ae-muted); font-size: var(--ae-fs-1); }
.tape-item .t-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.tape-item:hover .t-name { color: var(--ae-accent); }
.tape .as-of { position: absolute; right: 0; top: 0; bottom: 0; display: flex; align-items: center; padding: 0 var(--ae-sp-4); background: var(--ae-surface); border-left: 1px solid var(--ae-line); color: var(--ae-muted); font-size: var(--ae-fs-1); text-transform: uppercase; letter-spacing: 0.08em; }

/* ---------- faction toggles (header) and chart tools */
.chart-box { background: var(--ae-surface); border: 1px solid var(--ae-line); border-radius: var(--ae-r-3); overflow: hidden; display: flex; flex-direction: column; }
.chart-box .chart-wrap { border: 0; border-radius: 0; flex: 1; }
.chart-box.short .chart-wrap { height: 220px; }
.chart-tools { display: flex; align-items: center; gap: var(--ae-sp-1); padding: var(--ae-sp-2) var(--ae-sp-3) 0; }
.chart-tools button { font-size: var(--ae-fs-1); font-weight: 600; letter-spacing: 0.04em; padding: 0.15rem 0.5rem; border: 1px solid transparent; border-radius: var(--ae-r-1); background: transparent; color: var(--ae-muted); cursor: pointer; }
.chart-tools button:hover { color: var(--ae-text); background: var(--ae-surface-2); }
.chart-tools button.on { color: var(--ae-accent); border-color: var(--ae-line-2); background: var(--ae-surface-2); }
.chart-tools .chart-lines { margin-left: auto; }
.chart-lines { display: inline-flex; gap: var(--ae-sp-3); margin-left: var(--ae-sp-3); font-size: var(--ae-fs-2); }
.chart-lines label { display: inline-flex; align-items: center; gap: var(--ae-sp-1); cursor: pointer; color: var(--ae-text-2); user-select: none; }
.chart-lines input { accent-color: var(--c); width: 14px; height: 14px; margin: 0; cursor: pointer; }
.chart-lines .dot { margin: 0; }
.chart-lines label.spread { margin-left: var(--ae-sp-2); padding-left: var(--ae-sp-3); border-left: 1px solid var(--ae-line); }

/* ---------- toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ae-sp-3) var(--ae-sp-5); margin: var(--ae-sp-5) 0 var(--ae-sp-5); font-size: var(--ae-fs-2); }
.seg { display: inline-flex; border: 1px solid var(--ae-line); border-radius: var(--ae-r-2); overflow: hidden; background: var(--ae-surface); }
.seg a { padding: var(--ae-sp-1) var(--ae-sp-3); color: var(--ae-text-2); font-weight: 500; display: inline-flex; align-items: center; gap: var(--ae-sp-2); border-right: 1px solid var(--ae-line); }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--ae-surface-2); color: var(--ae-text); }
.seg a.lvl.on { color: var(--ae-accent); }
.seg a .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); display: inline-block; }
.dates { display: inline-flex; align-items: center; gap: var(--ae-sp-2); color: var(--ae-muted); }
.dates input { padding: var(--ae-sp-1) var(--ae-sp-2); background: var(--ae-surface); border: 1px solid var(--ae-line); border-radius: var(--ae-r-2); color: var(--ae-text); font-size: var(--ae-fs-2); }
.btn { padding: var(--ae-sp-1) var(--ae-sp-3); background: var(--ae-surface); border: 1px solid var(--ae-line); border-radius: var(--ae-r-2); cursor: pointer; font-size: var(--ae-fs-2); color: var(--ae-text-2); }
.btn:hover { border-color: var(--ae-line-2); color: var(--ae-text); }
.btn.primary { background: var(--ae-accent); color: var(--ae-accent-ink); border-color: transparent; font-weight: 600; }
.toolbar .latest { margin-left: auto; color: var(--ae-muted); }

/* ---------- page head */
main { padding-bottom: var(--ae-sp-7); }
.crumbs { display: flex; flex-wrap: wrap; gap: var(--ae-sp-2); color: var(--ae-muted); font-size: var(--ae-fs-2); margin: 0 0 var(--ae-sp-2); }
.crumbs a:hover { color: var(--ae-text); }
.crumbs .sep { opacity: 0.6; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--ae-sp-3) var(--ae-sp-5); margin-bottom: var(--ae-sp-5); }
.page-head h1 { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ae-sp-3); }
/* the page's reading in words, under its tables (owner, 2026-11-16: never a block of text above the data): quiet,
   prose width, after a rule */
.page-note { margin-top: var(--ae-sp-7); padding-top: var(--ae-sp-5); border-top: 1px solid var(--ae-line); max-width: var(--ae-prose); color: var(--ae-text-2); font-size: var(--ae-fs-3); }
.page-note h2 { font-size: var(--ae-fs-4); color: var(--ae-text); margin-bottom: var(--ae-sp-2); }
.page-note p { margin: 0 0 var(--ae-sp-3); }
.page-note a { text-decoration: underline; text-underline-offset: 2px; }
.page-head .aside { margin-left: auto; display: flex; gap: var(--ae-sp-2); align-items: center; }
.eyebrow { font-size: var(--ae-fs-1); text-transform: uppercase; letter-spacing: 0.12em; color: var(--ae-accent); font-weight: 600; margin: 0 0 var(--ae-sp-1); }
.lede { color: var(--ae-text-2); max-width: var(--ae-prose); margin: var(--ae-sp-2) 0 0; }
.section-head { display: flex; align-items: baseline; gap: var(--ae-sp-3); margin: var(--ae-sp-6) 0 var(--ae-sp-3); }
.section-head h2 { margin: 0; }
.section-head .more { margin-left: auto; font-size: var(--ae-fs-2); color: var(--ae-muted); }
.section-head .more:hover { color: var(--ae-accent); }
.section-head .sub { color: var(--ae-muted); font-size: var(--ae-fs-2); }

/* ---------- inline atoms */
.ticker {
  font-family: var(--ae-font-mono); font-weight: 600; font-size: var(--ae-fs-2); letter-spacing: 0.04em; line-height: 1;
  padding: 0.2em 0.45em; border-radius: var(--ae-r-1); background: var(--ae-surface-2); color: var(--ae-text-2); border: 1px solid var(--ae-line);
  display: inline-block; vertical-align: middle; white-space: nowrap;
}
.ticker.lg { font-size: var(--ae-fs-4); padding: 0.25em 0.5em; color: var(--ae-accent); border-color: var(--ae-line-2); }
.ticker.sm { font-size: var(--ae-fs-1); font-weight: 600; color: var(--ae-muted); }
a.ticker:hover, a:hover .ticker { color: var(--ae-accent); border-color: var(--ae-accent); }
.delta { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.delta.up { color: var(--ae-up); } .delta.down { color: var(--ae-down); } .delta.flat { color: var(--ae-muted); font-weight: 500; }
.delta.up::before { content: "▲"; font-size: 0.65em; margin-right: 0.3em; vertical-align: 0.15em; }
.delta.down::before { content: "▼"; font-size: 0.65em; margin-right: 0.3em; vertical-align: 0.15em; }
.badge { display: inline-block; font-size: var(--ae-fs-1); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.15em 0.55em; border-radius: var(--ae-r-pill); background: var(--ae-surface-2); color: var(--ae-muted); border: 1px solid var(--ae-line); vertical-align: middle; white-space: nowrap; }
.badge.estimate { color: var(--ae-estimate); border-color: var(--ae-estimate); background: transparent; }
.badge.prelim { color: var(--ae-text-2); border-style: dashed; }
.badge.warn { color: var(--ae-warn); border-color: var(--ae-warn); background: transparent; }
.badge.ok { color: var(--ae-up); border-color: var(--ae-up); background: transparent; }
.mkc { color: var(--c); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); display: inline-block; vertical-align: middle; margin-right: var(--ae-sp-1); }
.mkt { display: inline-flex; align-items: center; gap: var(--ae-sp-1); font-size: var(--ae-fs-1); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ae-muted); font-weight: 600; }
.mkt .dot { margin: 0; }

.fmark { display: inline-flex; align-items: center; justify-content: center; width: 1.15em; height: 1.15em; border-radius: 50%; background: var(--c); color: var(--ae-on-color); font-family: var(--ae-font-display); font-weight: 700; font-size: 0.8em; line-height: 1; vertical-align: -0.15em; }
th .fmark { font-size: 0.95em; }
.stat .big.compare { display: flex; align-items: center; gap: var(--ae-sp-2); font-size: var(--ae-fs-6); margin: 0; }
.stat .big.compare .delta { font-family: var(--ae-font-display); }
.stat .big.compare .fmark { font-size: 0.55em; }
.stat .big.compare .vs { font-size: var(--ae-fs-2); color: var(--ae-muted); font-family: var(--ae-font-body); font-weight: 500; margin: 0 -2px; }
/* ---------- money: 12g 34s 56c with small drawn coins after each number */
.money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.money > span + span { margin-left: 0.3em; }
.money > .m-sign + span { margin-left: 0.1em; }
/* ---------- sortable headers (static/sort.js) */
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover, table.data th.sortable:focus-visible { color: var(--ae-text); outline: none; }
table.data th.sort-asc::after, table.data th.sort-desc::after { display: inline-block; margin-left: 0.3em; font-size: 0.8em; color: var(--ae-accent); }
table.data th.sort-asc::after { content: "▲"; }
table.data th.sort-desc::after { content: "▼"; }
.coin { display: inline-block; width: 0.62em; height: 0.62em; border-radius: 50%; margin-right: 0.15em; vertical-align: -0.02em;
        background: radial-gradient(circle at 35% 35%, var(--ae-on-color) 0, var(--c) 28%, var(--c) 70%, var(--ae-accent-ink) 100%); opacity: 0.95; }
.coin.gold { --c: var(--ae-coin-gold); } .coin.silver { --c: var(--ae-coin-silver); } .coin.copper { --c: var(--ae-coin-copper); }
.stat .big .coin { width: 0.5em; height: 0.5em; margin-right: 0.12em; vertical-align: 0.05em; }
/* ---------- game icons (fetched through the Blizzard API into static/icons; placeholder until then) */
.icon { width: 22px; height: 22px; border-radius: var(--ae-r-1); border: 1px solid var(--ae-line-2); vertical-align: middle; margin-right: var(--ae-sp-1); flex: none; object-fit: cover; background: var(--ae-surface-2); }
.icon.md { width: 32px; height: 32px; } .icon.lg { width: 56px; height: 56px; border-radius: var(--ae-r-2); border-width: 2px; }
.icon.ph { display: inline-grid; place-items: center; font-family: var(--ae-font-mono); font-size: 0.6rem; font-weight: 600; color: var(--ae-muted); }
.icon.lg.ph { font-size: var(--ae-fs-4); }
.icon.q-poor { border-color: var(--ae-q-poor); } .icon.q-common { border-color: var(--ae-q-common); } .icon.q-uncommon { border-color: var(--ae-q-uncommon); }
.icon.q-rare { border-color: var(--ae-q-rare); } .icon.q-epic { border-color: var(--ae-q-epic); } .icon.q-legendary { border-color: var(--ae-q-legendary); }
.q-poor { color: var(--ae-q-poor); } .q-uncommon { color: var(--ae-q-uncommon); } .q-rare { color: var(--ae-q-rare); } .q-epic { color: var(--ae-q-epic); } .q-legendary { color: var(--ae-q-legendary); }
.name-with-icon { display: inline-flex; align-items: center; gap: var(--ae-sp-1); }
/* ---------- cards and stats */
.card { background: var(--ae-surface); border: 1px solid var(--ae-line); border-radius: var(--ae-r-3); padding: var(--ae-sp-4); }
.card.flush { padding: 0; overflow: hidden; }
.cards { display: grid; gap: var(--ae-sp-4); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card-head { display: flex; align-items: center; gap: var(--ae-sp-2); margin-bottom: var(--ae-sp-3); }
.card-head h3 { flex: 1; min-width: 0; }
.card-head h3 a:hover { color: var(--ae-accent); }
.stat-grid { display: grid; gap: var(--ae-sp-4); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat { background: var(--ae-surface); border: 1px solid var(--ae-line); border-radius: var(--ae-r-3); padding: var(--ae-sp-3) var(--ae-sp-4); position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--c, var(--ae-line-2)); }
.stat.on { border-color: var(--ae-line-2); box-shadow: var(--ae-shadow-1); }
.stat .label { display: flex; align-items: center; gap: var(--ae-sp-2); font-size: var(--ae-fs-1); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ae-muted); font-weight: 600; }
.stat .big { font-family: var(--ae-font-display); font-size: var(--ae-fs-7); font-weight: 600; line-height: 1.1; margin: var(--ae-sp-1) 0; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat .sub { font-size: var(--ae-fs-2); color: var(--ae-muted); display: flex; flex-wrap: wrap; gap: var(--ae-sp-1) var(--ae-sp-3); }
.stat .spark { position: absolute; right: var(--ae-sp-3); bottom: var(--ae-sp-3); width: 96px; height: 28px; opacity: 0.9; }
.row-stats { display: grid; gap: var(--ae-sp-4); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.mini-big { font-family: var(--ae-font-display); font-size: var(--ae-fs-6); font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: var(--ae-sp-1) var(--ae-sp-4); font-size: var(--ae-fs-2); }
.kv dt { color: var(--ae-muted); } .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- item page: sellers and turnover, one block per market */
.depth { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ae-sp-4); }
.depth-mkt { background: var(--ae-surface); border: 1px solid var(--ae-line); border-radius: var(--ae-r-3); overflow: hidden; }
.depth-mkt > .label { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ae-sp-2); padding: var(--ae-sp-2) var(--ae-sp-4); border-bottom: 1px solid var(--ae-line); background: var(--ae-surface-2); font-size: var(--ae-fs-2); font-weight: 600; }
.depth-mkt > .label .muted { font-weight: 400; }
.depth-mkt > .label .line { flex-basis: 100%; }
.depth-mkt > .label .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); display: inline-block; }
.depth-mkt table.data { border: 0; border-radius: 0; }
@media (max-width: 900px) { .depth { grid-template-columns: 1fr; } }
/* ---------- crafting: expandable materials under each recipe */
.expander { flex: none; width: 18px; height: 18px; padding: 0; border: 1px solid var(--ae-line-2); border-radius: var(--ae-r-1); background: var(--ae-surface-2); color: var(--ae-muted); cursor: pointer; display: inline-grid; place-items: center; }
.expander::before { content: ""; width: 5px; height: 5px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 0.12s; }
.expander[aria-expanded="true"]::before { transform: rotate(45deg); }
.expander:hover, .expander:focus-visible { color: var(--ae-text); border-color: var(--ae-muted); }
table.data tr.mats > td { padding: 0 0 var(--ae-sp-3) calc(var(--ae-sp-3) + 18px + var(--ae-sp-2)); background: var(--ae-surface-2); }
table.data.mats-table { border: 0; border-radius: 0; background: transparent; font-size: var(--ae-fs-2); }
table.data.mats-table th, table.data.mats-table td { padding-top: var(--ae-sp-1); padding-bottom: var(--ae-sp-1); }
table.data.mats-table tbody.sums td { border-top: 1px solid var(--ae-line); color: var(--ae-muted); }
table.data.mats-table tbody.sums tr:first-child td { border-top: 1px solid var(--ae-line-2); }
table.data.mats-table tbody.sums b { color: var(--ae-text); font-weight: 600; }
.best-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ae-sp-4); }
@media (max-width: 900px) { .best-grid { grid-template-columns: 1fr; } }
/* ---------- branch cards (home): values plus a full chart each */
.branches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ae-sp-4); }
.branch .card-head { margin-bottom: var(--ae-sp-2); }
.branch .vals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ae-sp-3); margin-bottom: var(--ae-sp-3); }
.branch .vals .top { display: flex; align-items: baseline; gap: var(--ae-sp-2); }
.branch .vals .chg { display: flex; gap: var(--ae-sp-3); font-size: var(--ae-fs-2); white-space: nowrap; margin-top: 2px; }
.branch .vals .chg em { font-style: normal; color: var(--ae-muted); margin-right: var(--ae-sp-1); font-size: var(--ae-fs-1); text-transform: uppercase; letter-spacing: 0.06em; }
.branch .chart-wrap { height: 240px; }
.branch .chart-lines { margin-left: auto; }
@media (max-width: 900px) { .branches { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .branch .vals { grid-template-columns: minmax(0, 1fr); } }
/* ---------- index page top: stat cards stacked left, chart with its rate-of-change header right */
.index-top { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: var(--ae-sp-4); align-items: start; }
.index-top .stack { display: flex; flex-direction: column; gap: var(--ae-sp-3); }
.index-top .stack .stat { flex: none; }
.chart-card { display: flex; flex-direction: column; background: var(--ae-surface); border: 1px solid var(--ae-line); border-radius: var(--ae-r-3); overflow: hidden; }
.chart-card .chart-box { flex: 1; border: 0; border-radius: 0; }
.chart-card .chart-wrap { min-height: 320px; }
.chart-card .chart-wait { margin: 0; padding: var(--ae-sp-3) var(--ae-sp-4); border-top: 1px solid var(--ae-line); }
.chart-head { display: grid; gap: var(--ae-sp-1) var(--ae-sp-4); padding: var(--ae-sp-2) var(--ae-sp-4); border-bottom: 1px solid var(--ae-line); background: var(--ae-surface-2); font-size: var(--ae-fs-2); }
.chart-head .row { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--ae-sp-2) var(--ae-sp-4); }
.chart-head .row:not(.on) .delta { opacity: 0.75; }
.chart-head .mkt { width: 5rem; }
.chart-head .cell { white-space: nowrap; }
.chart-head .cell em { font-style: normal; color: var(--ae-muted); font-size: var(--ae-fs-1); text-transform: uppercase; letter-spacing: 0.06em; margin-right: var(--ae-sp-1); }
@media (max-width: 900px) { .index-top { grid-template-columns: 1fr; } }
/* a population page with a histogram of its components: cards, chart, histograms; the histograms drop below the
   chart on narrower screens */
.index-top.with-hist { grid-template-columns: minmax(220px, 260px) minmax(0, 1.2fr) minmax(0, 1fr); }
.index-top.with-hist .chart-tools { flex-wrap: wrap; row-gap: var(--ae-sp-2); }
.index-top .hist-stack { display: flex; flex-direction: column; gap: var(--ae-sp-3); min-width: 0; }
@media (max-width: 1200px) { .index-top.with-hist { grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); } .index-top.with-hist .hist-stack { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) { .index-top.with-hist { grid-template-columns: 1fr; } .index-top.with-hist .hist-stack { grid-template-columns: 1fr; } }
/* sub-indices compared: beside the index chart (or alone where the page has none); its legend wraps under the ranges */
.compare-head { justify-content: space-between; flex-wrap: wrap; gap: var(--ae-sp-2); }
.compare-title { font-weight: 600; color: var(--ae-text); }
.compare-head .cat { border: 1px solid var(--ae-line); }
.compare-card .chart-tools { flex-wrap: wrap; row-gap: var(--ae-sp-2); }
.compare-card .chart-lines { display: flex; flex-wrap: wrap; flex-basis: 100%; gap: var(--ae-sp-1) var(--ae-sp-3); margin-left: 0; }
.compare-card > .muted { margin: var(--ae-sp-2) var(--ae-sp-3) 0; }
.compare-solo { margin-bottom: var(--ae-sp-5); }
@media (max-width: 1200px) { .index-top.with-hist .hist-stack:has(.compare-card) { grid-template-columns: 1fr; } }
/* ---------- hero (home) and side-by-side splits */
.hero { display: grid; grid-template-columns: minmax(280px, 2fr) minmax(0, 3fr); gap: var(--ae-sp-5); align-items: stretch; }
.split { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); gap: var(--ae-sp-4); align-items: start; }
.hero .headline { display: flex; flex-direction: column; gap: var(--ae-sp-4); }
.hero .headline .stat .big { font-size: var(--ae-fs-8); }
.hero .chart-wrap { height: 100%; min-height: 300px; }

/* ---------- price / spread view of a quote table: cells carry data-view, the table carries .view-spread */
table.data [data-view="spread"] { display: none; }
table.data.view-spread [data-view="price"] { display: none; }
table.data.view-spread [data-view="spread"] { display: table-cell; }
.view-toggle a.on { color: var(--ae-accent); }
/* ---------- alignment rules for data tables: numbers and their headers right-aligned with the same inset,
   sparklines centred, a fixed-width symbol slot so icons and names line up whatever the symbol length */
.ctr { text-align: center; }
table.data th.ctr { text-align: center; }
table.data td.name { white-space: normal; min-width: 17rem; vertical-align: middle; }
table.data td.name .nm { display: flex; align-items: center; gap: var(--ae-sp-2); }
table.data td.name .ticker.sm { width: 3.6rem; flex: none; text-align: center; box-sizing: border-box; margin: 0; }
table.data td.name .ticker.sm.empty { visibility: hidden; }
table.data td.name .icon { flex: none; margin: 0; }
table.data td.name .nm > a { flex: 1 1 8rem; min-width: 6rem; line-height: 1.25; }
table.data td.name .badge, table.data td.name .small { flex: none; }
td.spark-cell, th.spark-cell { text-align: center; }
td.spark-cell .spark { display: inline-block; vertical-align: middle; }
table.data th.num, table.data td.num { padding-left: var(--ae-sp-3); }
table.data th .fmark { vertical-align: -0.1em; }
/* ---------- tables */
table.data { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--ae-surface); border: 1px solid var(--ae-line); border-radius: var(--ae-r-3); overflow: hidden; font-size: var(--ae-fs-3); }
table.data th, table.data td { padding: var(--ae-sp-2) var(--ae-sp-3); border-bottom: 1px solid var(--ae-line); text-align: left; vertical-align: middle; }
table.data th { font-size: var(--ae-fs-1); font-variant-numeric: tabular-nums; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ae-muted); font-weight: 600; background: var(--ae-surface-2); white-space: nowrap; }
table.data th.num, table.data td.num { text-align: left; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--ae-surface-2); }
table.data td.name { max-width: 34rem; }
table.data td.name a:hover { color: var(--ae-accent); }
table.data .dim td { color: var(--ae-muted); }
table.data th.group { background: var(--ae-surface); color: var(--ae-text-2); border-bottom: 1px solid var(--ae-line-2); text-align: center; }
table.data th.mk { border-left: 1px solid var(--ae-line); }
table.data td.mk { border-left: 1px solid var(--ae-line); }
table.data tr.total td { font-weight: 600; background: var(--ae-surface-2); }
table.data tr.grp td { background: var(--ae-surface-2); font-weight: 600; font-family: var(--ae-font-display); }
table.data td.name[style] { padding-left: calc(var(--ae-sp-3) + var(--d, 0) * 1.3rem); }
.wrap-cell { max-width: 40rem; overflow-wrap: anywhere; }
/* A table wider than the screen scrolls inside its own frame: the frame (border, corners) sits on the scroller and
   always fits the screen, the table moves inside it, and its first column (the name) stays put while it does. */
.table-scroll { overflow-x: auto; max-width: 100%; background: var(--ae-surface); border: 1px solid var(--ae-line); border-radius: var(--ae-r-3); overscroll-behavior-x: contain; }
.table-scroll > table.data { border: 0; border-radius: 0; overflow: visible; }
.depth-mkt .table-scroll { border: 0; border-radius: 0; }
.table-scroll > table.data > * > tr > :first-child { position: sticky; left: 0; z-index: 1; background: var(--ae-surface); box-shadow: inset -1px 0 0 var(--ae-line); }
.table-scroll > table.data > thead > tr > :first-child { background: var(--ae-surface-2); }
.table-scroll > table.data > tbody > tr:hover > :first-child, .table-scroll > table.data > tbody > tr.total > :first-child,
.table-scroll > table.data > tbody > tr.grp > :first-child, .table-scroll > table.data > tbody > tr.mats > :first-child { background: var(--ae-surface-2); }
.table-scroll > table.data > * > tr > td[colspan]:first-child { position: static; box-shadow: none; }
table.data td.name.ind { padding-left: calc(var(--ae-sp-3) + var(--d, 0) * 1.1rem); }

/* ---------- the index tree (explorer) */
.tree td.name { padding-left: calc(var(--ae-sp-3) + var(--d, 0) * 1.3rem); min-width: 20rem; }
.tree td.num, .tick td.num, .tree th.num, .tick th.num { padding-inline: var(--ae-sp-2); padding-left: var(--ae-sp-3); }
table.data th .dot { margin-right: 3px; }
.tree .caret { width: 1.1rem; height: 1.1rem; flex: none; display: inline-grid; place-items: center; margin-right: 0; border: 0; background: transparent; cursor: pointer; color: var(--ae-muted); border-radius: var(--ae-r-1); vertical-align: middle; padding: 0; }
.tree .caret:hover { color: var(--ae-text); background: var(--ae-surface-2); }
.tree .caret svg { width: 10px; height: 10px; transition: transform var(--ae-dur-1) var(--ae-ease); }
.tree tr.open > td .caret svg { transform: rotate(90deg); }
.tree .leafdot { display: inline-block; flex: none; width: 1.1rem; text-align: center; color: var(--ae-line-2); }
.tree tr[data-depth="0"] td.name { font-weight: 600; font-family: var(--ae-font-display); font-size: var(--ae-fs-4); }
.tree tr[data-depth="1"] td.name { font-weight: 600; }
.tree tr.item td { color: var(--ae-text-2); }
.tree tr.item td.name a { color: var(--ae-text-2); }
.tree tr.item td.name .ticker { color: var(--ae-muted); }
.tree-tools { display: flex; flex-wrap: wrap; gap: var(--ae-sp-2); align-items: center; margin-bottom: var(--ae-sp-3); }
.tree-tools input { flex: 1 1 14rem; max-width: 24rem; padding: var(--ae-sp-1) var(--ae-sp-3); background: var(--ae-surface); border: 1px solid var(--ae-line); border-radius: var(--ae-r-2); }
.tree-tools .count { margin-left: auto; color: var(--ae-muted); font-size: var(--ae-fs-2); }
.legend { display: inline-flex; gap: var(--ae-sp-3); align-items: center; font-size: var(--ae-fs-1); color: var(--ae-muted); text-transform: uppercase; letter-spacing: 0.08em; }

/* ---------- explorer category tabs */
.cat-tabs { margin: 0 0 var(--ae-sp-3); border-bottom: 1px solid var(--ae-line); }
.cat-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ae-sp-1); }
.cat-row.top .cat { border-radius: var(--ae-r-2) var(--ae-r-2) 0 0; padding: var(--ae-sp-2) var(--ae-sp-3); font-weight: 500; }
.cat-row.top .cat.on { background: transparent; color: var(--ae-text); box-shadow: inset 0 -2px 0 var(--ae-accent); }
.cat-row.sub { padding: var(--ae-sp-2) 0 var(--ae-sp-3); border-top: 1px solid var(--ae-line); }
.cat-label { width: 9rem; flex: none; font-size: var(--ae-fs-1); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ae-muted); font-weight: 600; }
.cat-label a:hover { color: var(--ae-accent); }
.cat { white-space: nowrap; font: inherit; font-size: var(--ae-fs-2); padding: 0.15rem 0.6rem; border: 1px solid transparent; border-radius: var(--ae-r-pill); background: transparent; color: var(--ae-text-2); cursor: pointer; }
.cat:hover { background: var(--ae-surface-2); color: var(--ae-text); }
.cat.on { background: var(--ae-accent); color: var(--ae-accent-ink); font-weight: 600; }
.tree-tools .tools-label { font-size: var(--ae-fs-1); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ae-muted); font-weight: 600; margin-left: var(--ae-sp-2); }
.tree-tools .btn.on { color: var(--ae-accent); border-color: var(--ae-line-2); background: var(--ae-surface-2); }
@media (max-width: 640px) { .cat-label { width: 100%; } }
/* ---------- sparklines */
.spark { width: 100px; height: 28px; overflow: visible; }
.spark path { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark path.a { color: var(--ae-alliance); } .spark path.h { color: var(--ae-horde); } .spark path.n { color: var(--ae-neutral); }
.spark path.up { color: var(--ae-up); } .spark path.down { color: var(--ae-down); } .spark path.flat { color: var(--ae-muted); }
td.spark-cell { width: 92px; padding: var(--ae-sp-1) var(--ae-sp-2); }
td.spark-cell .spark { width: 80px; }

/* ---------- charts and text */
.chart-wrap { position: relative; height: 320px; background: var(--ae-surface); border: 1px solid var(--ae-line); border-radius: var(--ae-r-3); padding: var(--ae-sp-3) var(--ae-sp-3) var(--ae-sp-2); }
.chart-wrap.short { height: 220px; }
.method { font-size: var(--ae-fs-2); color: var(--ae-muted); margin: var(--ae-sp-2) 0 0; max-width: var(--ae-prose); }
.method b { color: var(--ae-text-2); }
.method a { color: var(--ae-text-2); text-decoration: underline; text-decoration-color: var(--ae-line-2); }
.method a:hover { color: var(--ae-accent); }
.note { color: var(--ae-text-2); font-size: var(--ae-fs-3); max-width: var(--ae-prose); margin: 0 0 var(--ae-sp-4); }
.callout { border-left: 3px solid var(--ae-estimate); background: var(--ae-surface); padding: var(--ae-sp-3) var(--ae-sp-4); border-radius: 0 var(--ae-r-2) var(--ae-r-2) 0; font-size: var(--ae-fs-3); color: var(--ae-text-2); max-width: var(--ae-prose); margin: 0 0 var(--ae-sp-4); }
.prose { max-width: var(--ae-prose); font-size: var(--ae-fs-4); line-height: 1.65; color: var(--ae-text); }
.prose h2 { margin: var(--ae-sp-7) 0 var(--ae-sp-3); padding-top: var(--ae-sp-4); border-top: 1px solid var(--ae-line); font-size: var(--ae-fs-6); }
.prose h2:first-child { border-top: 0; margin-top: var(--ae-sp-4); padding-top: 0; }
.prose h3 { margin: var(--ae-sp-5) 0 var(--ae-sp-2); color: var(--ae-text-2); }
.prose ul { padding-left: 1.2rem; } .prose li { margin-bottom: var(--ae-sp-2); }
.prose table.data { font-size: var(--ae-fs-3); margin: var(--ae-sp-3) 0 var(--ae-sp-4); }
.doc { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--ae-sp-6); align-items: start; }
.toc { position: sticky; top: var(--ae-sp-4); font-size: var(--ae-fs-2); display: flex; flex-direction: column; gap: var(--ae-sp-1); }
.toc a { color: var(--ae-muted); padding: var(--ae-sp-1) var(--ae-sp-2); border-left: 2px solid var(--ae-line); }
.toc a:hover { color: var(--ae-text); border-color: var(--ae-accent); }
.empty { padding: var(--ae-sp-6); text-align: center; color: var(--ae-muted); border: 1px dashed var(--ae-line-2); border-radius: var(--ae-r-3); }
.filter { width: 100%; max-width: 400px; margin: var(--ae-sp-2) 0 var(--ae-sp-5); padding: var(--ae-sp-2) var(--ae-sp-3); border: 1px solid var(--ae-line); border-radius: var(--ae-r-2); background: var(--ae-surface); }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ae-sp-4); }
.two-col > div { min-width: 0; overflow-x: auto; }       /* a movers table wider than a phone scrolls inside its column */

/* ---------- footer */
.site-foot { border-top: 1px solid var(--ae-line); margin-top: var(--ae-sp-7); padding: var(--ae-sp-5) 0 var(--ae-sp-7); color: var(--ae-muted); font-size: var(--ae-fs-2); }
.site-foot .wrap { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--ae-sp-5); }
.site-foot h4 { margin: 0 0 var(--ae-sp-2); font-size: var(--ae-fs-1); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ae-text-2); }
.site-foot a { display: block; padding: 0.15rem 0; } .site-foot a:hover { color: var(--ae-text); }
.site-foot p { max-width: var(--ae-prose); }

/* ---------- responsive */
@media (max-width: 900px) {
  .hero, .split { grid-template-columns: 1fr; }
  .doc { grid-template-columns: minmax(0, 1fr); } .toc { position: static; flex-direction: row; flex-wrap: wrap; }
  .site-foot .wrap { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  body { font-size: var(--ae-fs-2); }
  h1 { font-size: var(--ae-fs-6); }
  .site-head .wrap { flex-wrap: wrap; gap: var(--ae-sp-2) var(--ae-sp-3); padding: var(--ae-sp-2) 0; }
  /* the menu scrolls sideways by swiping; no scrollbar is drawn over it (it covered the links on an iPhone) */
  .nav { order: 3; width: 100%; margin: 0; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: var(--ae-sp-1) var(--ae-sp-2); }
  .head-right { margin-left: auto; }
  .head-right { width: 100%; }
  .lookup { flex: 1; }
  .lookup input { width: 100%; }
  /* on a phone the suggestions span the whole row under the picker, search and theme switch; anchored to the search
     box's right edge at 24rem they ran off the left of the screen (owner, 2026-11-09) */
  .head-right { position: relative; }
  .lookup { position: static; }
  .lookup-list { left: 0; right: 0; width: auto; max-width: none; }
  .stat .big { font-size: var(--ae-fs-6); }
  .hero .headline .stat .big { font-size: var(--ae-fs-7); }
  .stat .spark { display: none; }
  table.data { font-size: var(--ae-fs-2); }
  table.data th, table.data td { padding: var(--ae-sp-1) var(--ae-sp-2); }
  /* the frozen name column takes about half a phone's width; names wrap, the indent per level is small */
  table.data td.name, .tree td.name { min-width: 10.5rem; max-width: 13rem; }
  .tree td.name { padding-left: calc(var(--ae-sp-2) + var(--d, 0) * 0.6rem); }
  table.data td.name.ind { padding-left: calc(var(--ae-sp-2) + var(--d, 0) * 0.6rem); }
  table.data td.name .ticker.sm { width: auto; min-width: 2.6rem; padding-inline: 0.3em; }
  table.data td.name .nm { gap: var(--ae-sp-1); }
  table.data td.name .nm > a { flex: 1 1 4rem; min-width: 4rem; }
  .tree tr[data-depth="0"] td.name { font-size: var(--ae-fs-3); }
  /* chart controls: the range buttons on one row, the faction (and Spread) checkboxes on the next, all reachable */
  .chart-tools { flex-wrap: wrap; row-gap: var(--ae-sp-2); }
  .chart-tools .chart-lines, .branch .chart-lines { flex-basis: 100%; margin-left: 0; flex-wrap: wrap; gap: var(--ae-sp-1) var(--ae-sp-3); }
  .chart-lines label.spread { margin-left: 0; padding-left: 0; border-left: 0; }
  .two-col { grid-template-columns: 1fr; }
  .site-foot .wrap { grid-template-columns: 1fr; }
  .toolbar .latest { margin-left: 0; }
}

/* ---------- public site only (web/): policy pages and the population floor */
.callout.draft { border-color: var(--ae-warn); border-left-width: 4px; }
.legal h2 { margin-top: var(--ae-sp-4); }
.legal h3 { margin: var(--ae-sp-2) 0 0; font: 600 var(--ae-fs-4)/var(--ae-lh-tight) var(--ae-font-display); }
.legal ul { margin: 0; padding-left: 1.25rem; display: grid; gap: var(--ae-sp-2); }
.legal code { font: 500 0.9em var(--ae-font-mono); background: var(--ae-surface-2); padding: 1px 5px; border-radius: var(--ae-r-1); }
.legal .table-scroll { max-width: var(--ae-prose); }
.legal table.data td { vertical-align: top; }
/* a population figure under the published floor (lib/html.ts hidden) */
.hidden-count { color: var(--ae-muted); cursor: help; }

/* ---------- public site only: ads (lib/ads.ts, lib/adslots.ts). Exactly one slot shows at any width: the rail
   where the right gutter fits it (1568px and up: 1180 content + 2 x (16 gap + 160 rail + 16 edge)), else the
   banner. Every box has its size before anything loads, so nothing moves when an ad arrives. */
.ad-slot { display: flex; flex-direction: column; gap: var(--ae-sp-1); }
.ad-label { font-size: var(--ae-fs-1); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ae-muted); line-height: 1; }
.ad-fill { display: block; overflow: hidden; border-radius: var(--ae-r-2); }
.ad-slot--rail { width: 160px; }
.ad-slot--rail .ad-fill { width: 160px; height: 600px; }
.ad-slot--rail.ad-slot--direct .ad-fill { height: 320px; }
.ad-slot--banner .ad-fill { width: 100%; height: 90px; }
.ad-slot--rail .adsbygoogle { display: inline-block; width: 160px; height: 600px; }
.ad-slot--banner .adsbygoogle { display: block; width: 100%; height: 90px; }
.ad-rail { display: none; }
.ad-banner { margin: var(--ae-sp-4) 0 var(--ae-sp-5); }       /* under the ticker, above the page's content */
@media (min-width: 1568px) {
  main:has(> .ad-rail) { position: relative; min-height: 660px; }
  .ad-rail { display: block; position: absolute; top: 0; bottom: 0; left: calc(100% + var(--ae-sp-4)); width: 160px; }
  .ad-rail > .ad-slot { position: sticky; top: var(--ae-sp-4); }
  .ad-banner { display: none; }
}
/* a direct sponsor: our own card, our own colours, the sponsor's logo and words */
.ad-sponsor { display: flex; align-items: center; gap: var(--ae-sp-3); padding: var(--ae-sp-3); background: var(--ae-surface); border: 1px solid var(--ae-line); color: var(--ae-text); }
.ad-sponsor:hover { border-color: var(--ae-line-2); }
.ad-sponsor:hover .ad-sponsor-cta { color: var(--ae-accent); }
.ad-sponsor-logo { flex: none; width: 64px; height: 64px; object-fit: contain; border-radius: var(--ae-r-1); background: var(--ae-surface-2); }
.ad-sponsor-text { flex: 1; min-width: 0; font-size: var(--ae-fs-3); line-height: 1.35; color: var(--ae-text-2); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.ad-sponsor-text b { color: var(--ae-text); }
.ad-sponsor-cta { flex: none; font-size: var(--ae-fs-2); font-weight: 600; color: var(--ae-text-2); white-space: nowrap; }
.ad-slot--rail .ad-sponsor { flex-direction: column; align-items: flex-start; justify-content: flex-start; }
.ad-slot--rail .ad-sponsor-logo { width: 128px; height: 128px; }
.ad-slot--rail .ad-sponsor-text { -webkit-line-clamp: 6; line-clamp: 6; }
@media (max-width: 640px) { .ad-sponsor-cta { display: none; } .ad-sponsor-text { -webkit-line-clamp: 2; line-clamp: 2; } }
/* the preview's placeholders (/preview/ads) */
.ad-demo { display: flex; align-items: center; justify-content: center; text-align: center; padding: var(--ae-sp-2); border: 1px dashed var(--ae-line-2); background: var(--ae-surface-2); color: var(--ae-muted); font-size: var(--ae-fs-2); }
.ad-sponsor .ad-demo { padding: 0; }
.ad-preview-note { max-width: none; display: grid; gap: var(--ae-sp-3); }
.ad-preview-note p { margin: 0; }
.ad-preview-tools { display: flex; flex-wrap: wrap; gap: var(--ae-sp-2); }
.ad-preview-tools .seg { flex-wrap: wrap; max-width: 100%; }
.ad-preview-note details table { margin-top: var(--ae-sp-2); }

/* Link-click feedback (public/nav.js): a thin bar that runs across the top until the next page arrives. */
.nav-progress { position: fixed; top: 0; left: 0; z-index: 1000; height: 3px; width: 0; background: var(--ae-accent); transition: width 8s cubic-bezier(.1, .7, .2, 1); pointer-events: none; }
.nav-progress.go { width: 90%; }
@media (prefers-reduced-motion: reduce) { .nav-progress { transition: none; } .nav-progress.go { width: 100%; opacity: .6; } }

/* Population hero: the class mix, one chart per faction side by side (Alliance left, Horde right). */
.pop-hero { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ae-sp-4); margin-bottom: var(--ae-sp-5); }
.pop-hero .chart-card { min-width: 0; }
.pop-hero .chart-head .mkt { width: auto; font-weight: 600; }
.pop-hero .chart-head .sub { color: var(--ae-muted); }
/* nine class lines do not fit beside the range buttons in a half-width card: the checkboxes get their own wrapping row */
.pop-hero .chart-tools { flex-wrap: wrap; row-gap: var(--ae-sp-2); }
.pop-hero .chart-lines { display: flex; flex-wrap: wrap; flex-basis: 100%; gap: var(--ae-sp-1) var(--ae-sp-3); margin-left: 0; }
@media (max-width: 900px) { .pop-hero { grid-template-columns: 1fr; } }
/* the population histograms (owner, 2026-11-04): server-drawn svg, one per faction; a bar links to its series */
.pop-pick { display: grid; gap: var(--ae-sp-1); }
.pop-pick .cat { border: 1px solid var(--ae-line); }
.pop-view[hidden], .pop-cap[hidden] { display: none; }
/* the level pills keep their place when hidden, so choosing Level never moves the page (owner, 2026-11-04) */
.pop-pick #pop-sub[hidden] { display: flex; visibility: hidden; }
.pop-view { margin: 0; padding: var(--ae-sp-3) var(--ae-sp-3) var(--ae-sp-2); }
.pop-hist { display: block; width: 100%; height: auto; font-family: var(--ae-font-body); }
.pop-hist .grid line { stroke: var(--ae-grid); }
.pop-hist .grid text, .pop-hist .name { fill: var(--ae-muted); font-size: 11px; }
.pop-hist .val { fill: var(--ae-text-2); font-size: 11px; }
.pop-hist .axis { stroke: var(--ae-line-2); }
.pop-hist .stub { fill: none; stroke: var(--ae-line-2); stroke-dasharray: 3 2; }
.pop-hist a:hover rect:not(.stub) { opacity: 0.8; }
.pop-hist a:focus-visible rect { outline: none; stroke: var(--ae-text); stroke-width: 1.5; }
.pop-empty { margin: var(--ae-sp-6) 0; text-align: center; }
/* the population hero's picker, to the right of the page title; drawn like the site's other controls (.seg) */
.title-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--ae-sp-2) var(--ae-sp-4); }
.title-row h1 { margin: 0; }
.pick { position: relative; display: inline-flex; align-items: center; }
.pick select { appearance: none; -webkit-appearance: none; font: inherit; font-size: var(--ae-fs-3); font-weight: 500; line-height: 1.5;
  color: var(--ae-text-2); background: var(--ae-surface); border: 1px solid var(--ae-line); border-radius: var(--ae-r-2);
  padding: var(--ae-sp-1) calc(var(--ae-sp-3) + 14px) var(--ae-sp-1) var(--ae-sp-3); cursor: pointer; }
.pick select:hover { color: var(--ae-text); background: var(--ae-surface-2); }
.pick select:focus-visible { outline: none; box-shadow: var(--ae-ring); }
.pick option { background: var(--ae-surface); color: var(--ae-text); }
.pick::after { content: ""; position: absolute; right: var(--ae-sp-3); top: 50%; width: 6px; height: 6px; margin-top: -5px; pointer-events: none;
  border-right: 1.5px solid var(--ae-muted); border-bottom: 1.5px solid var(--ae-muted); transform: rotate(45deg); }
@media (max-width: 640px) {
  /* no room beside the title on a phone: the picker sits on the right of the eyebrow line above it, adding no line */
  .page-head > div:has(.title-row) { position: relative; width: 100%; }
  .title-row .pick { position: absolute; top: -6px; right: 0; }
  .title-row .pick select { font-size: var(--ae-fs-2); padding: 2px calc(var(--ae-sp-2) + 14px) 2px var(--ae-sp-2); }
  .title-row .pick::after { right: var(--ae-sp-2); }
}
/* the population cards keep one size whatever they show: the legend takes the rows it needs, the plot fills the
   rest, so switching class / race / level never changes the card's height (and never grows it) */
.pop-hero .chart-card { min-height: 0; }
.pop-hero .chart-box { flex: 1; min-height: 0; border: 0; border-radius: 0; }
.pop-hero .chart-box .chart-wrap { flex: 1; min-height: 0; height: auto; }
/* the histograms size themselves from their own width (an svg viewBox): no fixed card height on phones */
/* home: movers, one table per faction (gains, a rule, drops); the index table follows with no dead space */
.movers-table th.fac-head { background: var(--ae-surface-2); }
.movers-table th.fac-head .mkt { font-weight: 600; }
.movers-table tbody.mv-down tr:first-child td { border-top: 2px solid var(--ae-line-2); }
/* both faction tables fit their card, so the 30-day sparkline is never cut off (owner, 2026-11-13): a narrower name
   column and tighter padding than the other quote tables; a phone still scrolls the table sideways */
table.data.movers-table td.name { min-width: 11rem; }
table.data.movers-table td.name .nm > a { min-width: 5rem; }
table.data.movers-table td, table.data.movers-table th { padding-left: 10px; padding-right: 10px; }
.home-indices { margin-top: var(--ae-sp-6); }
.nowrap { white-space: nowrap; }

/* ---------- public site only: the game / rule set picker in the header, and its "Suggest more rule sets" form */
/* the picker is a button and the site's own menu (owner, 2026-11-04: a native select opens the operating system's list) */
.pick-btn { appearance: none; font: inherit; font-size: var(--ae-fs-2); font-weight: 500; line-height: 1.5; white-space: nowrap;
  color: var(--ae-text-2); background: var(--ae-surface); border: 1px solid var(--ae-line); border-radius: var(--ae-r-2);
  padding: 0.35rem calc(var(--ae-sp-3) + 14px) 0.35rem var(--ae-sp-3); cursor: pointer; }
.pick-btn:hover, .pick-btn[aria-expanded="true"] { color: var(--ae-text); background: var(--ae-surface-2); }
.pick-btn:focus-visible { outline: none; box-shadow: var(--ae-ring); }
.pick-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 60; min-width: max(100%, 15rem); margin: 0;
  padding: var(--ae-sp-1); list-style: none; background: var(--ae-surface); border: 1px solid var(--ae-line-2);
  border-radius: var(--ae-r-2); box-shadow: var(--ae-shadow-2); }
.pick-menu [data-v] { display: flex; align-items: flex-start; gap: var(--ae-sp-2); padding: var(--ae-sp-2); border-radius: var(--ae-r-1);
  cursor: pointer; font-size: var(--ae-fs-3); color: var(--ae-text-2); white-space: nowrap; }
.pick-menu [data-v]:hover, .pick-menu [data-v]:focus { outline: none; background: var(--ae-surface-2); color: var(--ae-text); }
.pick-menu [aria-checked="true"] { color: var(--ae-text); font-weight: 600; }
.pick-check { flex: none; width: 14px; height: 1.5em; position: relative; }
.pick-menu [aria-checked="true"] .pick-check::after { content: ""; position: absolute; left: 3px; top: 0.3em; width: 5px; height: 9px;
  border-right: 2px solid var(--ae-accent); border-bottom: 2px solid var(--ae-accent); transform: rotate(45deg); }
.pick-label { display: grid; }
.pick-sub { font-size: var(--ae-fs-1); font-weight: 400; color: var(--ae-muted); }
.pick-sep { height: 1px; margin: var(--ae-sp-1) var(--ae-sp-2); background: var(--ae-line); }
/* the form's rule set choice: the site's pills, one tap each */
dialog.suggest fieldset.rs-choice { border: 0; margin: 0; padding: 0; min-width: 0; }
dialog.suggest .rs-choice legend { padding: 0; margin-bottom: var(--ae-sp-1); }
dialog.suggest .rs-chip { display: inline-flex; align-items: center; border-color: var(--ae-line); padding: 0.3rem 0.8rem; font-size: var(--ae-fs-3); font-weight: 500; }
dialog.suggest .rs-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
dialog.suggest .rs-chip:has(input:checked) { background: var(--ae-accent); color: var(--ae-accent-ink); border-color: var(--ae-accent); font-weight: 600; }
dialog.suggest .rs-chip:has(input:focus-visible) { box-shadow: var(--ae-ring); }
dialog.suggest { width: min(28rem, calc(100vw - 2 * var(--ae-sp-4))); padding: 0; border: 1px solid var(--ae-line-2); border-radius: var(--ae-r-3);
  background: var(--ae-surface); color: var(--ae-text); box-shadow: var(--ae-shadow-2); }
dialog.suggest::backdrop { background: var(--ae-bg); opacity: 0.7; }
dialog.suggest form { display: grid; gap: var(--ae-sp-3); padding: var(--ae-sp-5); }
dialog.suggest h2 { margin: 0; font-size: var(--ae-fs-5); }
dialog.suggest p { margin: 0; }
dialog.suggest .field { display: grid; gap: var(--ae-sp-1); font-size: var(--ae-fs-2); font-weight: 600; color: var(--ae-text-2); }
dialog.suggest textarea { font: inherit; font-weight: 400; font-size: var(--ae-fs-3); color: var(--ae-text); background: var(--ae-surface-2);
  border: 1px solid var(--ae-line); border-radius: var(--ae-r-2); padding: var(--ae-sp-2); width: 100%; box-sizing: border-box; }
dialog.suggest textarea { resize: vertical; min-height: 4.5rem; }
dialog.suggest textarea:focus-visible { outline: none; box-shadow: var(--ae-ring); border-color: var(--ae-line-2); }
dialog.suggest .count { justify-self: end; font-weight: 400; font-size: var(--ae-fs-1); color: var(--ae-muted); }
dialog.suggest .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
dialog.suggest .msg { min-height: 1.4em; font-size: var(--ae-fs-2); color: var(--ae-text-2); }
dialog.suggest .msg.good { color: var(--ae-up); } dialog.suggest .msg.bad { color: var(--ae-down); }
dialog.suggest .actions { display: flex; justify-content: flex-end; gap: var(--ae-sp-2); }
dialog.suggest .btn:disabled { opacity: 0.6; cursor: default; }
/* the header holds the logo, the links, the picker, search and the theme switch on one line only from 1600px (measured
   2026-11-05: eight links need 1500px, and Research adds one more); narrower, the links take their own row under the
   rest (as on a phone). A link never breaks inside itself (owner, 2026-11-05) and the page never scrolls sideways */
@media (max-width: 1600px) and (min-width: 641px) {
  .site-head .wrap { flex-wrap: wrap; row-gap: 0; padding-top: var(--ae-sp-2); }
  .site-head .nav { order: 3; width: 100%; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .site-head .nav::-webkit-scrollbar { display: none; }
  .lookup input { width: 16rem; }
}
@media (max-width: 640px) {
  .realm-pick .pick-btn { font-size: var(--ae-fs-1); padding: 0.4rem calc(var(--ae-sp-2) + 14px) 0.4rem var(--ae-sp-2); }
  .realm-pick::after { right: var(--ae-sp-2); }
}

/* Research (the analyst desk, /research): cards for notes and columns, and the note itself */
.research-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--ae-sp-3); }
.research-card { display: flex; flex-direction: column; gap: var(--ae-sp-1); padding: var(--ae-sp-4); background: var(--ae-surface); border: 1px solid var(--ae-line); border-radius: var(--ae-r-3); color: var(--ae-text); text-decoration: none; }
.research-card:hover { border-color: var(--ae-line-2); color: var(--ae-text); }
.research-card .eyebrow { margin: 0; }
.research-headline { font-size: var(--ae-fs-5); font-weight: 600; line-height: 1.3; }
.research-take { color: var(--ae-muted); font-size: var(--ae-fs-3); line-height: 1.5; }
.research-note > :not(.report-charts) { max-width: 46rem; }    /* prose stays readable; the two report charts take the width */
.research-note h1 { margin-bottom: var(--ae-sp-4); }
.research-note p { line-height: 1.65; }
.research-note .take { font-size: var(--ae-fs-5); }
.research-note h2 { margin-top: var(--ae-sp-6); }
.research-note p a, .research-note li a, .research-table a { color: var(--ae-accent); text-decoration: underline; text-underline-offset: 2px; }
.research-note .followed-up { color: var(--ae-muted); }
.research-chart { margin: var(--ae-sp-4) 0; }
.research-chart-title { font-weight: 600; }
.research-insight { padding: var(--ae-sp-2) var(--ae-sp-3) var(--ae-sp-3); margin: 0; color: var(--ae-muted); font-size: var(--ae-fs-3); }
.research-table td.num { width: 1%; white-space: nowrap; }
.chart-note { margin: var(--ae-sp-1) 0 0; font-size: var(--ae-fs-2); color: var(--ae-muted); }
.chart-note a { color: var(--ae-muted); text-decoration: underline; }
/* articles (ae/editorial.py): guides, weekly reports, stories */
.research-note .lede { font-size: var(--ae-fs-5); color: var(--ae-text-2); }
.article-updated { color: var(--ae-muted); font-size: var(--ae-fs-2); }
.research-note a.fig { color: var(--ae-accent); text-decoration: underline; text-underline-offset: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.article-tables { margin: var(--ae-sp-5) 0; }
.article-tables h3 { font-size: var(--ae-fs-4); margin: var(--ae-sp-5) 0 var(--ae-sp-2); }
.guide-table td.num, .guide-table th.num { white-space: nowrap; }
.guide-table a { color: var(--ae-accent); }
.research-note h3 { margin-top: var(--ae-sp-5); }
.research-lead .research-card { border-color: var(--ae-line-2); }
.research-lead .research-headline { font-size: var(--ae-fs-6); }
.social-draft { max-width: 46rem; border: 1px solid var(--ae-line); border-radius: var(--ae-r-2); background: var(--ae-surface); margin: 0 0 var(--ae-sp-3); }
.social-draft .social-head { display: flex; justify-content: space-between; align-items: center; padding: var(--ae-sp-2) var(--ae-sp-3); border-bottom: 1px solid var(--ae-line); }
.social-draft pre { margin: 0; padding: var(--ae-sp-3); white-space: pre-wrap; word-break: break-word; font-family: var(--ae-font-body); font-size: var(--ae-fs-3); }
.copy-btn { font: inherit; font-size: var(--ae-fs-2); padding: 2px var(--ae-sp-2); border: 1px solid var(--ae-line-2); border-radius: var(--ae-r-2); background: var(--ae-bg); color: var(--ae-text); cursor: pointer; }
/* Reports (web/lib/pages.ts, owner 2026-11-06): an index named in a report shows a card with its latest figures on
   hover or keyboard focus; the index chart and its sub-indices compared sit side by side */
.ixw { position: relative; display: inline; }
.ix-card { display: none; position: absolute; z-index: 30; left: 0; bottom: calc(100% + 6px); width: max-content; max-width: min(22rem, 86vw);
  padding: var(--ae-sp-2) var(--ae-sp-3); background: var(--ae-surface-2); border: 1px solid var(--ae-line-2); border-radius: var(--ae-r-2);
  box-shadow: var(--ae-shadow-2); color: var(--ae-text); font-size: var(--ae-fs-2); line-height: 1.4; text-align: left; white-space: nowrap; }
.ixw:hover .ix-card, .ixw:focus-within .ix-card { display: block; }
.ix-name { display: block; font-weight: 600; margin-bottom: var(--ae-sp-1); }
.ix-tk { color: var(--ae-muted); font-family: var(--ae-font-mono); font-size: var(--ae-fs-1); font-weight: 500; }
.ix-grid { display: grid; grid-template-columns: auto repeat(4, auto); gap: 2px var(--ae-sp-3); align-items: baseline; }
.ix-h { color: var(--ae-muted); font-size: var(--ae-fs-1); text-transform: uppercase; letter-spacing: 0.06em; }
.ix-mk { color: var(--ae-text-2); }
.ix-mk::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c); margin-right: 5px; }
.report-charts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--ae-sp-4); margin: var(--ae-sp-4) 0; }
.report-charts .research-chart { margin: 0; }
@media (max-width: 1000px) { .report-charts { grid-template-columns: 1fr; } }
.report-table td:first-child { white-space: nowrap; }
.report-table a.ix { color: var(--ae-accent); text-decoration: underline; text-underline-offset: 2px; }
/* on wide screens the report tables need no scrolling, so a hover card in one is not cut off by the scroll box; the
   card opens downward there, clear of the table head */
@media (min-width: 760px) { .research-note .table-scroll:has(.report-table) { overflow: visible; } .report-table .ix-card { bottom: auto; top: calc(100% + 6px); } }
.report-day { margin: var(--ae-sp-2) 0; }
.report-day summary { cursor: pointer; color: var(--ae-text-2); padding: var(--ae-sp-1) 0; }
.report-day .research-grid { margin-top: var(--ae-sp-2); }

/* Loading placeholders (web/lib/pagecache.ts): the site's frame appears at once and the page replaces them when ready */
.tape-wait { height: 36px; }
.page-wait { position: relative; padding-top: var(--ae-sp-2); }
.wait-bar { position: absolute; top: 0; left: 0; right: 0; height: 2px; overflow: hidden; background: var(--ae-line); border-radius: var(--ae-r-1); }
.wait-bar::after { content: ""; position: absolute; top: 0; bottom: 0; width: 30%; background: var(--ae-accent); animation: ae-wait-bar 1.2s ease-in-out infinite; }
@keyframes ae-wait-bar { from { left: -30%; } to { left: 100%; } }
.sk { background: var(--ae-surface-2); border-radius: var(--ae-r-2); margin-bottom: var(--ae-sp-3); animation: ae-wait-pulse 1.4s ease-in-out infinite; }
@keyframes ae-wait-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.sk-eyebrow { width: 120px; height: 12px; margin-top: var(--ae-sp-4); }
.sk-title { width: min(420px, 80%); height: 34px; }
.sk-line { width: min(640px, 100%); height: 14px; }
.sk-short { width: min(380px, 70%); }
.sk-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--ae-sp-3); margin-top: var(--ae-sp-4); }
.sk-card { height: 96px; margin: 0; }
.sk-chart { height: 280px; margin-top: var(--ae-sp-4); }
.sk-row { height: 36px; margin-bottom: var(--ae-sp-2); }
.wait-note { color: var(--ae-muted); font-size: var(--ae-fs-3); }
.wait-problem { padding: var(--ae-sp-6) 0; max-width: var(--ae-prose); }
.wait-problem p { color: var(--ae-text-2); }
.wait-slow { margin-top: var(--ae-sp-3); color: var(--ae-text-2); display: flex; flex-wrap: wrap; align-items: center; gap: var(--ae-sp-2); }
@media (prefers-reduced-motion: reduce) { .sk, .wait-bar::after { animation: none; } }

/* /facts: one question and its dated answer each (owner, 2026-11-10) */
.facts { display: grid; gap: var(--ae-sp-4); max-width: var(--ae-prose); }
.fact { border-top: 1px solid var(--ae-line); padding-top: var(--ae-sp-4); }
.fact h3 { font-size: var(--ae-fs-4); margin: 0 0 var(--ae-sp-2); }
.fact p { margin: 0; color: var(--ae-text-2); line-height: 1.6; }
.fact a { white-space: nowrap; }
