/* Palette matches scripts/figures/style.py (Okabe-Ito), so the site and the figures read as
   one piece of work. Tokens are named the way the shared CoSE kit expects, so cose-map.css
   can retint them for light and dark without this file knowing about it. */
:root {
  --bg: #ffffff;
  --bg-2: #f5f6f8;
  --panel: #ffffff;
  --ink: #1a1d21;
  --ink-soft: #4a5058;
  --ink-faint: #8a8f98;
  --line: #dfe2e6;
  --edge: #c8ccd2;
  --accent: #0072b2;
  --vermilion: #d55e00;
  --orange: #e69f00;
  --green: #009e73;
  --sky: #56b4e9;
  --purple: #cc79a7;
  --radius: 10px;
  --maxw: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a; --bg-2: #1b1f23; --panel: #1b1f23;
    --ink: #e8eaed; --ink-soft: #b6bcc4; --ink-faint: #868d96;
    --line: #2c3238; --edge: #3a424a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 1.25rem 4rem;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hero, .panel, nav.tabs, footer { max-width: var(--maxw); margin: 0 auto; }

.hero { padding: 3rem 0 1.5rem; }
.eyebrow {
  text-transform: uppercase; letter-spacing: .09em; font-size: .7rem;
  color: var(--ink-faint); margin: 0 0 .6rem;
}
h1 { font-size: clamp(1.5rem, 3.4vw, 2.2rem); line-height: 1.2; margin: 0 0 1rem; }
h2 { font-size: 1.35rem; margin: 0 0 .5rem; }
h3 { font-size: 1.02rem; margin: 1.8rem 0 .4rem; }
.lede { color: var(--ink-soft); max-width: 62ch; margin: 0 0 .9rem; }
.note { color: var(--ink-soft); font-size: .88rem; max-width: 68ch; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }

.btns { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1.4rem; }
.btn {
  display: inline-block; padding: .5rem .95rem; border-radius: 999px;
  border: 1px solid var(--edge); color: var(--ink); text-decoration: none; font-size: .87rem;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); color: #fff; }

nav.tabs {
  display: flex; gap: .3rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); margin: 1.6rem auto .4rem; padding-bottom: .1rem;
}
nav.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: .55rem .8rem; font: inherit; font-size: .9rem;
  color: var(--ink-soft); cursor: pointer;
}
nav.tabs button:hover { color: var(--ink); }
nav.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.panel { display: none; padding: 1.6rem 0 0; }
.panel.on { display: block; }

.preset-row { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; margin: 1rem 0; }
.preset-label { font-size: .78rem; color: var(--ink-faint); text-transform: uppercase;
                letter-spacing: .06em; }
.chip {
  border: 1px solid var(--edge); background: var(--panel); color: var(--ink);
  border-radius: 999px; padding: .32rem .75rem; font: inherit; font-size: .82rem;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

select, input[type=search] {
  border: 1px solid var(--edge); background: var(--panel); color: var(--ink);
  border-radius: 7px; padding: .34rem .55rem; font: inherit; font-size: .85rem;
}

.split { display: grid; grid-template-columns: minmax(230px, 300px) 1fr; gap: 1.8rem; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }

.controls label { display: block; margin: 0 0 .85rem; font-size: .82rem; }
.controls .row { display: flex; justify-content: space-between; align-items: baseline; }
.controls .name { color: var(--ink-soft); }
.controls .val { font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
                 font-size: .82rem; color: var(--ink); }
.controls input[type=range] { width: 100%; margin-top: .25rem; accent-color: var(--accent); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: .6rem; }
.cards.wide { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 1.2rem; }
.card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .6rem .7rem;
}
.card .k { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em;
           color: var(--ink-faint); }
.card .v { font-size: 1.22rem; font-weight: 650;
           font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.card .u { font-size: .7rem; color: var(--ink-faint); }

figure { margin: 1.4rem 0; }
figcaption { font-size: .8rem; color: var(--ink-soft); margin-top: .5rem; max-width: 64ch; }
svg { width: 100%; height: auto; overflow: visible; }

.callout {
  margin: 2rem 0 0; padding: 1.1rem 1.2rem;
  background: var(--bg-2); border: 1px solid var(--line);
  border-left: 3px solid var(--vermilion); border-radius: var(--radius);
}
.callout h3 { margin-top: 0; }

.tablewrap { overflow-x: auto; margin: .8rem 0 1.4rem; }
table { border-collapse: collapse; width: 100%; font-size: .82rem; }
th, td { text-align: left; padding: .38rem .6rem; border-bottom: 1px solid var(--line);
         vertical-align: top; }
th { color: var(--ink-faint); font-weight: 600; font-size: .72rem;
     text-transform: uppercase; letter-spacing: .04em; cursor: pointer; white-space: nowrap; }
th:hover { color: var(--accent); }
td.num { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-align: right;
         white-space: nowrap; }
tr.excluded td { color: var(--ink-faint); }
.tag { display: inline-block; padding: .05rem .4rem; border-radius: 4px; font-size: .72rem;
       font-weight: 600; }
.tag.sig { background: rgba(213,94,0,.14); color: var(--vermilion); }
.tag.no  { background: rgba(138,143,152,.16); color: var(--ink-faint); }

footer {
  margin-top: 3.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line);
  font-size: .82rem; color: var(--ink-soft);
}
footer a { color: var(--accent); }
.warn { color: var(--vermilion); }

/* Shared tooltip for the heatmap and Sankey. Positioned in page coordinates so it is not
   clipped by the SVG viewBox. */
.tooltip {
  position: absolute; display: none; z-index: 50; pointer-events: none;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--edge); border-radius: 7px;
  padding: .4rem .55rem; font-size: .76rem; line-height: 1.45;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .18); max-width: 280px;
}

/* A heatmap row is a control, so it has to look like one. */
.hm-row:hover rect { stroke: var(--accent); stroke-width: 1.2; }
.hm-row:hover text { fill: var(--accent); font-weight: 600; }

#sankey path { transition: fill-opacity .12s ease; }

/* The Sankey's broad-map toggle sits in the same row as its pathway-count select. */
.inline-check { display: inline-flex; align-items: center; gap: .35rem;
                font-size: .82rem; color: var(--ink-soft); cursor: pointer; }
.inline-check input { accent-color: var(--accent); margin: 0; }

/* The heatmap and Sankey carry dense row labels. Letting `svg { width: 100% }` shrink them
   to a phone width renders that text at about 4.6 px, so below the layout's own breakpoint
   they keep a legible size and scroll sideways inside the figure instead. The page itself
   must never scroll horizontally. */
.chartscroll { overflow-x: auto; overflow-y: hidden; }
.chartscroll svg { min-width: 560px; }

/* The ladder's contrast chips are injected into a span, which must not collapse the row. */
#ladderpick { display: contents; }
