@import url("/static/css/explorer-controls.css");

:root {
  color-scheme: light;
  --bg: #ffffff; --text: #080808; --muted: #5f5f5f; --border: #e0e0e0; --surface: #f5f5f5; --missing: #f2f2ef;
  --state-accent: var(--s4);
  --unalloc: #d5d3cc;
  --on-unalloc: #080808;
}
/* The site header's toggle sets data-theme; without it, follow the system. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #020202; --text: #f4f4f0; --muted: #bdbdbd; --border: #2a2a2a; --surface: #1a1a1a; --missing: #141414;
    --unalloc: #383733;
    --on-unalloc: #f4f4f0;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #020202; --text: #f4f4f0; --muted: #bdbdbd; --border: #2a2a2a; --surface: #1a1a1a; --missing: #141414;
  --unalloc: #383733;
  --on-unalloc: #f4f4f0;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 13px/1.5 'JetBrains Mono', ui-monospace, monospace;
}
main { max-width: calc(1400px + 3rem); padding: 1.5rem 1.5rem 4rem; margin: 0 auto; }
h1 { font-size: 1.25rem; line-height: 1.3; margin: 0 0 0.25rem; font-weight: 600; }
h2 { font-size: 1rem; margin: 0 0 0.35rem; font-weight: 600; }
h3 { font-size: 0.9rem; margin: 1.5rem 0 0.25rem; font-weight: 600; }
p { margin: 0.25rem 0; max-width: 95ch; }
a { color: inherit; }
code { font-family: inherit; background: var(--surface); padding: 0.1rem 0.3rem; border-radius: 3px; font-size: 0.92em; }
.sub { color: var(--muted); font-size: 12px; margin: 0.25rem 0 0.65rem; max-width: 95ch; }
ul.sub { padding-left: 1.25rem; }
ul.sub li { margin: 0.25rem 0; }
.src { color: var(--muted); font-size: 11.5px; margin-top: 0.75rem; max-width: 95ch; }
@media (min-width: 601px) { main { padding-right: 48px; max-width: calc(1400px + 1.5rem + 48px); } }
section { margin: 2rem 0 0; padding: 1.5rem 0 0; border-top: 1px solid var(--border); scroll-margin-top: 1.5rem; }
section:first-of-type { margin-top: 1.25rem; padding-top: 0; border-top: 0; }
.controls { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-items: center; margin: 0.75rem 0; }
.controls label { max-width: 100%; min-width: 0; display: inline-flex; align-items: center; gap: 0.4rem; color: var(--muted); font-size: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; align-items: center; font-size: 12px; color: var(--muted); margin: 0.5rem 0; }
.legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; flex: none; }
.tiles {
  display: flex; flex-wrap: wrap; gap: 0.6rem 1.75rem; margin: 0.65rem 0; padding: 0.55rem 0.9rem;
  border: 1px solid var(--border); border-radius: 4px; width: fit-content; max-width: 100%;
}
.tiles .tile { min-width: 110px; }
.tiles .k { font-size: 11px; color: var(--muted); }
.tiles .v { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
table.data { border-collapse: collapse; margin-top: 0.5rem; font-size: 12px; width: 100%; max-width: 1000px; }
table.data th, table.data td { text-align: left; padding: 0.25rem 0.75rem 0.25rem 0; border-bottom: 1px solid var(--border); }
table.data th { color: var(--muted); font-weight: 400; font-size: 11.5px; }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tbody tr:hover { background: var(--surface); }
.two > * { min-width: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 860px) { .two { grid-template-columns: 1fr; } }
footer { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
@media (max-width: 600px) {
  main { padding: 1rem 1rem 3rem; }
}
/* The map and ranked bars use the GDP explorer's sequential and comparison scales. */
#map { display: block; width: 100%; }
#map-states path { cursor: pointer; stroke: var(--bg); stroke-width: 1; stroke-linejoin: round; }
#leaders { position: relative; max-height: 22rem; overflow-y: auto; scrollbar-gutter: stable; }
.rank:is(:hover, :focus-visible, .preview) .fill {
  outline: 1.5px solid var(--text); outline-offset: -1.5px;
}
.map-selection { fill: none; pointer-events: none; }
.map-selection path { vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.map-halo { stroke: var(--bg); stroke-width: 5px; }
.map-outline { stroke: var(--state-accent); stroke-width: 3px; }
#state-summary { border-inline-start: 3px solid var(--state-accent); padding-inline-start: .65em; }
.rank[aria-current="true"] span:first-child, .compare-state[aria-current="true"], #state-treemap .crumbs > :first-child {
  color: var(--state-accent); font-weight: 600;
}
.rank[aria-current="true"] .fill { background: var(--state-accent); }
.rank {
  display: grid; grid-template-columns: minmax(9em, 1fr) 48% 4.8em; align-items: center;
  gap: 0.5rem; width: 100%; padding: 0.2rem 0; border: 0; background: none;
  color: var(--text); font: inherit; font-size: 11.5px; text-align: left; cursor: pointer;
}
td button:hover { background: var(--surface); }
.rank b { color: var(--muted); font-size: 11px; font-weight: 400; font-variant-numeric: tabular-nums; text-align: right; }
.track { display: block; position: relative; height: 9px; background: var(--surface); }
.fill, .sample { display: block; height: 100%; background: var(--pos); }
.key { gap: 0.35rem; }
.key .sample { width: 16px; height: 8px; }
.tick, .benchmark { width: 2px; height: 13px; background: var(--neg); }
.tick { margin-left: 0.7rem; }
.benchmark { position: absolute; top: -2px; }
.scroll { overflow-x: auto; }
.visual { width: 24%; }
td button { border: 0; padding: 0; color: inherit; background: none; font: inherit; text-align: left; cursor: pointer; }
td button::before { content: "▸"; display: inline-block; width: 1em; color: var(--muted); }
td button[aria-expanded=true]::before { content: "▾"; }
table.data td:first-child:not(:has(button)) { padding-left: 1em; }
table.data tr.detail td:first-child { padding-left: 2em; }
.detail { background: var(--surface); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 600px) {
  .visual, .key { display: none; }
  .rank { grid-template-columns: minmax(0, 1fr) 35% 4.6em; }
}
.industry-table { margin-top: 0.9rem; font-size: 12px; }
.industry-table summary { cursor: pointer; color: var(--muted); }
.history-scroll { max-width: 980px; overflow-x: auto; }
.history-scroll svg { display: block; width: 100%; min-width: 480px; cursor: crosshair; }
.history-scroll text { fill: var(--muted); font: 11px 'JetBrains Mono', monospace; }
.history-marker { stroke: var(--text); stroke-width: 1.8px; stroke-dasharray: 4 3; pointer-events: none; }
#history .legend { max-width: 980px; }
#changes { max-width: 900px; }
.change-row { display: grid; grid-template-columns: minmax(12em, 1fr) 45% 7em; align-items: center; gap: .6rem; font-size: 11.5px; padding: .16rem 0; }
.change-row > :last-child { text-align: right; font-variant-numeric: tabular-nums; }
.change-bar { position: relative; height: 13px; border-bottom: 1px solid var(--surface); }
.change-bar::after { content: ''; position: absolute; left: 50%; height: 100%; border-left: 1px solid var(--muted); }
.change-bar i { position: absolute; top: 2px; height: 9px; }
.change-bar .gain { left: 50%; background: var(--pos); }
.change-bar .loss { right: 50%; background: var(--neg); }
@media (max-width: 600px) { .change-row { grid-template-columns: minmax(0,1fr) 26% 6.5em; } }

#state-treemap .scroll-x { overflow-x:auto; }
#state-treemap .tm { max-width:100%; overflow:hidden; }
