:root {
  color-scheme: light;
  --bg: #f4f3ef;
  --surface: #fcfcfb;
  --surface-2: #ecebe6;
  --border: #dcdad3;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #74736e;
  --link: #1c5cab;
  --animal: #eb6834;
  --human: #2a78d6;
  --ai: #1baf7a;
  --ink-ramp-lo: #cbc8bf;
  --ink-ramp-hi: #2b2a27;
  --danger: #d03b3b;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #262624;
    --border: #383835;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --text-3: #9a998f;
    --link: #86b6ef;
    --animal: #d95926;
    --human: #3987e5;
    --ai: #199e70;
    --ink-ramp-lo: #4d4c47;
    --ink-ramp-hi: #f0efec;
    --danger: #e66767;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--sans); }
a { color: var(--link); }
main, header, footer { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .4em; }
h2 { font-size: 1.35rem; margin-top: 2.5rem; }
.muted { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.small { font-size: .875rem; }

/* Sticky menu. The shadow + clip-path paint a full-width background behind the centered header; border-image outset draws the full-width hairline (paint only, no layout width). */
header { display: flex; align-items: center; justify-content: space-between; gap: 8px 24px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 10; background: var(--bg);
  box-shadow: 0 0 0 100vmax var(--bg); clip-path: inset(0 -100vmax); }
header { border-bottom: 1px solid var(--border); border-image: linear-gradient(var(--border) 0 0) 0 0 1 0 / 0 0 1px 0 / 0 100vmax; }
html { scroll-padding-top: 5.5rem; }
.bg-text { color: var(--bg); } /* same color as the page background */
.brand { display: inline-flex; align-items: center; font: 700 1.15rem var(--mono); color: var(--text); text-decoration: none; letter-spacing: -.02em; }
.brand img { display: block; flex: none; margin-right: 10px; }
.brand span { color: var(--animal); }
nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
nav a { padding: 6px 12px; border-radius: 999px; color: var(--text-2); text-decoration: none; font-size: .9rem; font-weight: 500; transition: background-color .15s, color .15s; }
nav a:hover, nav a[aria-current] { color: var(--text); background: var(--surface-2); }
nav a.cta { margin-left: 10px; background: var(--text); color: var(--bg); }
nav a.cta:hover { opacity: .85; }
nav a:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
@media (max-width: 640px) {
  nav { width: 100%; margin-left: -10px; }
  nav a { padding: 6px 10px; font-size: .875rem; }
  nav a[href="/"] { display: none; } /* the logo links home */
  nav a.cta { margin-left: auto; }
}

.hero { padding: 2rem 0 1rem; }
.hero .label { font: 600 .8rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); }
.hero .total { font: 700 clamp(3rem, 11vw, 6rem)/1 var(--mono); letter-spacing: -.04em; margin: .2rem 0; font-variant-numeric: tabular-nums; }
.hero p { max-width: 62ch; margin: .5rem 0; }
.tag { font-family: var(--mono); color: var(--text-2); }

.teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; margin-top: 1.5rem; }
.team { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.team h3 { display: flex; align-items: center; gap: 8px; font-size: 1rem; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }
.sw-animal { background: var(--animal); } .sw-human { background: var(--human); } .sw-ai { background: var(--ai); }
.team .count { font: 700 2.4rem/1 var(--mono); font-variant-numeric: tabular-nums; margin: .25rem 0 .75rem; }
.team ol { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.team li { display: flex; justify-content: space-between; border-top: 1px solid var(--border); padding: 4px 0; }
.team li span:last-child { font-family: var(--mono); color: var(--text-2); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; position: relative; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .85rem; color: var(--text-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-title { font-weight: 600; color: var(--text); }
.legend svg { display: block; overflow: visible; }
.legend svg text { fill: var(--text-2); font: 11px var(--mono); }
.legend svg line { stroke: var(--text-3); }
.swatch.none { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.legend .legend-top { flex-basis: 100%; }
.map > svg { display: block; width: 100%; height: auto; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--text-2); font: 11px var(--mono); }
.chart .axis path, .chart .axis line, .chart .grid line { stroke: var(--border); }
.chart .grid .domain { display: none; }
.chart .hit { fill: transparent; cursor: default; outline: none; }
.chart .hit:hover, .chart .hit:focus { fill: var(--text); fill-opacity: .05; }
.map path.country { stroke: var(--surface); stroke-width: .5; }
.map path.country.has:hover { stroke: var(--text); stroke-width: 1; }
.caption { font-size: .85rem; color: var(--text-2); margin: 8px 0 0; }

.tip { position: absolute; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: .85rem; box-shadow: 0 4px 16px rgb(0 0 0 / .15); min-width: 140px; z-index: 5; }
.tip strong { font-family: var(--mono); }
.tip .row { display: flex; align-items: center; gap: 8px; }
.tip .key { width: 12px; height: 2px; flex: none; }
.tip .row strong { margin-left: auto; padding-left: 12px; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 8px; }
.seg button { background: none; border: 0; padding: 6px 12px; font: inherit; font-size: .85rem; color: var(--text-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); font-weight: 600; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
input, select, textarea, button { font: inherit; color: var(--text); }
input, select, textarea { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.filters input[type=search] { flex: 1 1 220px; }
[hidden] { display: none !important; } /* class display rules must not un-hide */
.btn { background: var(--text); color: var(--bg); border: 0; border-radius: 8px; padding: 9px 16px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; }
.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--danger); color: #fff; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-weight: 600; color: var(--text-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
th, td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
td.date, td.num { font-family: var(--mono); white-space: nowrap; font-variant-numeric: tabular-nums; }
td.num { text-align: right; }
td .note { display: block; color: var(--text-3); font-size: .8rem; }
.actor { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

form.stack { display: grid; gap: 14px; max-width: 720px; }
form.stack label { display: grid; gap: 4px; font-weight: 600; font-size: .9rem; }
form.stack label small { font-weight: 400; color: var(--text-2); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
fieldset label { display: inline-flex !important; align-items: center; gap: 6px; margin-right: 16px; font-weight: 400 !important; }
.notice { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--ai); border-radius: 8px; padding: 12px 14px; }
.msg { font-weight: 600; } .msg.err { color: var(--danger); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.card .fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin: 10px 0; }
.card .fields label { display: grid; gap: 2px; font-size: .75rem; color: var(--text-2); }
.card .fields label.wide { grid-column: 1 / -1; }
.card .story { white-space: pre-wrap; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; font-size: .9rem; }
.card .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

footer { margin-top: 4rem; padding-top: 24px; padding-bottom: 32px; border-top: 1px solid var(--border); font-size: .85rem; color: var(--text-2); }
.prose { max-width: 70ch; }
.prose li { margin: .25rem 0; }
