@font-face {
  font-family: Archivo;
  src: url(/fonts/archivo.woff2) format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --paper: #d1d1d3;
  --ink: #1c1c1e;
  --muted: #505055;
  --rule: #b2b2b6;
  --wash: #c1c1c5;
  --accent: #8a3f06;
  --font: Archivo, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151516;
    --ink: #e6e6e8;
    --muted: #9a9a9f;
    --rule: #303034;
    --wash: #232326;
    --accent: #f0a04b;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 var(--font);
  font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 0.2em; }
a:hover { text-decoration-color: currentColor; }
button, summary { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.page { max-width: 110rem; margin: 0 auto; padding: 0 clamp(1rem, 3vw, 3rem); }

h1 {
  margin: 0;
  padding: clamp(1.75rem, 5vw, 4rem) 0 clamp(1.5rem, 3vw, 2.75rem);
  max-width: 28em;
  font-size: clamp(1.9rem, 4.4vw, 3.5rem);
  font-weight: 560;
  font-stretch: 78%;
  line-height: 1.08;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

h2 { margin: 0; font-size: 1.05rem; font-weight: 600; }

.panels, .breakdowns {
  display: grid;
  gap: 2.75rem clamp(1.5rem, 3vw, 3.5rem);
  padding: 2rem 0 2.75rem;
  border-top: 1px solid var(--rule);
}
.panels { grid-template-columns: repeat(auto-fit, minmax(min(100%, 34rem), 1fr)); }
.breakdowns { grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr)); }
.panel, .breakdown { min-width: 0; }
.panel { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6rem 1.25rem; }
.panel[hidden] { display: none; }
.chart { display: contents; }
.empty { display: none; margin: 0; padding: 3rem 0; color: var(--muted); }
.panels[data-state=message] .panel { display: none; }
.panels[data-state=message] .empty { display: block; }
.panels[aria-busy=true] { opacity: 0.55; }

.filters {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  align-items: center;
  padding: 0.65rem 0;
  background: var(--paper);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.filters[hidden] { display: none; }
.filters:not([hidden]) + .panels { border-top: 0; }
.group { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.group-name { margin-right: 0.15rem; color: var(--muted); font-size: 0.8rem; }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: 0 0.2rem 0 0.65rem;
  background: var(--wash);
  border: 1px solid var(--rule);
  border-radius: 0.35rem;
  font-size: 0.875rem;
}
.chip-name { max-width: 20rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-remove {
  display: grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  margin-left: 0.25rem;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0.25rem;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.chip-remove:hover { background: var(--rule); color: var(--ink); }
.filters .count { margin-left: auto; color: var(--muted); font-size: 0.875rem; }

.rows { list-style: none; margin: 0.6rem 0 0; padding: 0; }
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 3rem;
  column-gap: 0.6rem;
  align-items: baseline;
  width: calc(100% + 1rem);
  margin: 0 -0.5rem;
  padding: 0.4rem 0.5rem 0.55rem;
  background: none;
  border: 0;
  text-align: left;
}
button.row { cursor: pointer; }
button.row:hover .name { text-decoration: underline; text-decoration-color: var(--rule); }
button.row[aria-pressed=true] { background: var(--wash); }
button.row[aria-pressed=true] .name { font-weight: 600; }
.rows .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .count { font-weight: 500; }
.rows .pct { text-align: right; color: var(--muted); font-size: 0.875rem; }
.rows .other .name { color: var(--muted); }
.share {
  grid-column: 1 / -1;
  height: 3px;
  margin-top: 0.35rem;
  background: linear-gradient(to right, var(--accent) var(--w), var(--wash) var(--w));
}
details > summary {
  width: max-content;
  padding: 0.2rem 0;
  color: var(--accent);
  font-size: 0.9rem;
  cursor: pointer;
}

.foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0 2.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.85rem;
}

.head:empty { display: none; }
.head { margin-left: auto; max-width: 100%; }
.controls { display: flex; flex: 0 0 100%; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-items: center; }
.seg { display: inline-flex; max-width: 100%; overflow-x: auto; }
.seg button {
  flex: none;
  white-space: nowrap;
  margin-left: -1px;
  padding: 0.2rem 0.75rem;
  background: none;
  border: 1px solid var(--rule);
  font-size: 0.875rem;
  cursor: pointer;
}
.seg button:first-child { margin-left: 0; border-radius: 0.35rem 0 0 0.35rem; }
.seg button:last-child { border-radius: 0 0.35rem 0.35rem 0; }
.seg button:only-child { border-radius: 0.35rem; }
.seg button[aria-pressed=true] { position: relative; background: var(--ink); border-color: var(--ink); color: var(--paper); }
.tools { display: flex; gap: 1rem; }
.tool { padding: 0.2rem 0; background: none; border: 0; border-bottom: 2px solid transparent; font-size: 0.875rem; cursor: pointer; }
.tool:hover { border-bottom-color: var(--rule); }
.tool[aria-pressed=true] { border-bottom-color: var(--accent); }

.plot { position: relative; flex: 0 0 100%; min-width: 0; }
.plot svg { display: block; width: 100%; touch-action: pan-y; user-select: none; cursor: crosshair; }
svg text { fill: var(--muted); font: 400 12px var(--font); }
svg .grid { stroke: var(--rule); }
svg .minor { opacity: 0.45; }
svg .line { fill: none; stroke-linejoin: round; stroke-linecap: round; }
svg .cross { stroke: var(--muted); stroke-dasharray: 2 3; }
svg .sel { fill: var(--accent); opacity: 0.18; }
svg .dot { stroke: var(--paper); stroke-width: 2; }
.tip {
  position: absolute;
  top: 0.5rem;
  padding: 0.4rem 0.65rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 0.35rem;
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: nowrap;
  pointer-events: none;
}
.tip[hidden] { display: none; }
.tip b { display: block; font-weight: 600; }
.tip i, .key i { display: inline-block; width: 0.9rem; height: 3px; margin-right: 0.45rem; vertical-align: middle; }
.key { display: flex; flex: 0 0 100%; flex-wrap: wrap; gap: 0.1rem 1rem; }
.key button { padding: 0.15rem 0; background: none; border: 0; font-size: 0.85rem; cursor: pointer; }
.key button[aria-pressed=false] { opacity: 0.45; text-decoration: line-through; }
