/* Single light theme. Colour appears only inside charts, and only where it
   distinguishes one series from another; the three series colours are
   validated all-pairs for colour-vision deficiency against a white surface.

   Field labels are lowercase monospace, not tracked-out caps. Configuration
   identifiers are fixed-width columns rather than middle-dot meta strings --
   this page is a capture listing, and it should read like one. */

:root {
  color-scheme: light;

  --paper:  #ffffff;
  --panel:  #f4f5f6;
  --rule:   #dcdfe2;
  --ink:    #0f1113;
  --ink-2:  #474c51;
  --ink-3:  #6f757b;   /* 4.6:1 on white */

  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;

  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --shell: 1040px;
  --gut: 24px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

.shell { max-width: var(--shell); margin: 0 auto; padding-inline: var(--gut); }

:where(a):focus-visible,
:where(button):focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---- identity bar ---- */

.idbar { border-bottom: 1px solid var(--ink); }
.idbar .shell { display: flex; align-items: baseline; gap: 12px; padding-block: 14px; }
.me b { font-weight: 600; letter-spacing: -0.01em; }
.me .role { color: var(--ink-3); font-size: 0.85rem; margin-left: 10px; }

/* ---- hero ---- */

.hero { padding-block: 44px 8px; }

h1 {
  font-size: clamp(1.45rem, 3.6vw, 2.35rem);
  line-height: 1.22;
  letter-spacing: -0.026em;
  font-weight: 500;
  margin: 0 0 34px;
  max-width: 30ch;
  text-wrap: balance;
}
.figures {
  display: grid;
  grid-template-columns: max-content minmax(0, max-content);
  gap: 24px 48px;
  align-items: start;
  border-top: 1px solid var(--ink);
  padding-top: 22px;
}

.fig-big .fv {
  display: block;
  font-family: var(--mono);
  font-size: clamp(3.4rem, 11vw, 5.6rem);
  font-weight: 600;
  line-height: 0.92;
  letter-spacing: -0.045em;
}
.fig-big .fk { display: block; color: var(--ink-2); font-size: 0.86rem; margin-top: 8px; max-width: 18ch; }

.fig-pair { display: grid; grid-template-columns: repeat(2, minmax(0, max-content)); gap: 20px 56px; margin: 0; align-content: start; }
.fig-pair dt { font-family: var(--mono); font-size: 0.76rem; color: var(--ink-3); margin-bottom: 4px; }
.fig-pair dd { margin: 0; font-family: var(--mono); font-size: 1.55rem; font-weight: 500; letter-spacing: -0.02em; }
.fig-pair dd span { font-size: 0.72rem; color: var(--ink-3); font-weight: 400; margin-left: 6px; }
.fig-pair dd.sub {
  font-size: 0.68rem; color: var(--ink-3); font-weight: 400; letter-spacing: 0;
  margin-top: 7px; white-space: pre; overflow-x: auto;
}

/* Two figure columns need room for their monospace configuration strings; below
   this they would be scroll boxes rather than something you can read. */
@media (max-width: 900px) {
  .fig-pair { grid-template-columns: 1fr; gap: 16px; }
}

.reading { max-width: 74ch; color: var(--ink-2); margin: 26px 0 0; font-size: 0.95rem; }
.reading em { font-style: normal; color: var(--ink); font-weight: 500; }

/* ---- hero chart ---- */

.hero-chart { margin: 34px 0 0; }
.chartkey { display: flex; gap: 22px; font-family: var(--mono); font-size: 0.76rem; color: var(--ink-2); margin-bottom: 12px; }
.chartkey span { display: flex; align-items: center; gap: 8px; }
.chartkey span::before { content: ""; width: 12px; height: 12px; border-radius: 50%; flex: none; }
.k-med::before { border: 2.5px solid var(--ink); }
.k-tail::before { background: var(--series-2); }

svg { display: block; width: 100%; height: auto; overflow: visible; }
.dumbbell { min-width: 0; }
.dline { stroke: var(--rule); stroke-width: 3; }
.dtail { fill: var(--series-2); }
.dmed { fill: none; stroke: var(--ink); stroke-width: 2.5; }
.dlbl { font-family: var(--mono); font-size: 12px; fill: var(--ink-2); }
.dval { font-family: var(--mono); font-size: 12px; fill: var(--ink); font-weight: 500; }
.dax  { font-family: var(--mono); font-size: 11px; fill: var(--ink-3); }
.dgrid { stroke: var(--rule); stroke-width: 1; }

.undercap { font-size: 0.8rem; color: var(--ink-3); margin: 14px 0 0; max-width: 76ch; }


/* ---- bands ---- */

.band { padding-block: 42px; border-top: 1px solid var(--rule); margin-top: 42px; }
.hero + .band { margin-top: 20px; }

h2 { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.012em; margin: 0 0 10px; }
h3 { font-size: 0.98rem; font-weight: 600; letter-spacing: -0.008em; margin: 38px 0 6px; }

.lede { max-width: 74ch; color: var(--ink-2); margin: 0 0 26px; }
.note { margin: 0 0 16px; color: var(--ink-2); font-size: 0.88rem; max-width: 76ch; }
.opnote { margin: 12px 0 14px; color: var(--ink-3); font-size: 0.8rem; max-width: 76ch; }
.opbar { margin: 4px 0 14px; }
.opbar .opnote { margin: 0; }
code { font-family: var(--mono); font-size: 0.88em; background: var(--panel); padding: 1px 5px; }

/* ---- method: a spec sheet, labels in the margin ---- */

.method { border-top: 1px solid var(--rule); }
.mrow { display: grid; grid-template-columns: 132px 1fr; gap: 28px; padding: 15px 0; border-bottom: 1px solid var(--rule); }
.mk { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-3); }
.mv { font-size: 0.9rem; color: var(--ink-2); max-width: 74ch; }

/* ---- limitations ---- */

.limits { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.limits li { padding: 16px 0 16px 20px; border-bottom: 1px solid var(--rule); font-size: 0.9rem; color: var(--ink-2); max-width: 82ch; position: relative; }
.limits li::before { content: ""; position: absolute; left: 0; top: 24px; width: 9px; height: 1px; background: var(--ink-3); }
.limits b { color: var(--ink); font-weight: 600; }

/* ---- controls ---- */

.ctlbar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin-bottom: 20px; }
.ctl { display: flex; align-items: center; gap: 8px; }
.ctl-label { font-family: var(--mono); font-size: 0.76rem; color: var(--ink-3); }

.seg { display: inline-flex; border: 1px solid var(--rule); }
.seg button {
  border: 0; border-left: 1px solid var(--rule);
  background: var(--paper); color: var(--ink-2);
  padding: 6px 12px; cursor: pointer;
  font: inherit; font-family: var(--mono); font-size: 0.78rem;
}
.seg button:first-child { border-left: 0; }
@media (hover: hover) { .seg button:hover { background: var(--panel); } }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.reset {
  margin-left: auto; border: 1px solid var(--rule); background: var(--paper);
  color: var(--ink-2); font: inherit; font-family: var(--mono); font-size: 0.78rem;
  padding: 6px 12px; cursor: pointer;
}
@media (hover: hover) { .reset:hover { border-color: var(--ink); color: var(--ink); } }

/* ---- charts ---- */

/* ---- factor impact: one ranked row per factor ---- */

.impact { border-top: 1px solid var(--rule); }
.i-row {
  display: grid;
  grid-template-columns: 186px minmax(0, 1fr) 68px 54px;
  gap: 18px; align-items: center;
}
.impact .i-row { padding: 13px 0; border-bottom: 1px solid var(--rule); }

.i-f { min-width: 0; }
.i-name { display: block; font-size: 0.9rem; }
/* esp_intr_alloc has no break opportunity; without this its min-content width
   becomes the floor for the whole row and the grid stops shrinking. */
.i-lv { display: block; font-family: var(--mono); font-size: 0.7rem; color: var(--ink-3);
        margin-top: 3px; overflow-wrap: anywhere; }

.i-t { position: relative; height: 16px; }
.i-t::before { content: ""; position: absolute; inset: 7px 0 auto; height: 1px; background: var(--rule); }
.i-bar { position: absolute; top: 6.5px; height: 3px; background: var(--rule); }
.i-dot {
  position: absolute; top: 2px; width: 12px; height: 12px; margin-left: -6px;
  border-radius: 50%; border: 2.5px solid var(--ink); background: var(--paper);
}
.i-dot.is-hi { background: var(--series-2); border-color: var(--series-2); }

/* Coincident settings: concentric rings sharing one centre, largest first in
   the DOM so each later (smaller) ring draws on top and stays visible. */
.i-dot-wrap { position: absolute; top: 50%; width: 28px; height: 28px; transform: translate(-50%, -50%); }
.i-dot-wrap .i-dot { position: absolute; inset: 0; top: auto; margin: auto; }

.i-v { font-family: var(--mono); font-size: 0.82rem; font-weight: 500; text-align: right; }
.i-r { font-family: var(--mono); font-size: 0.82rem; color: var(--ink-2); text-align: right; }

.i-axis { padding-top: 9px; }
.i-axis .i-t { height: 14px; }
.i-axis .i-t::before { display: none; }
.i-tick { position: absolute; top: 0; transform: translateX(-50%); font-family: var(--mono); font-size: 0.68rem; color: var(--ink-3); }
.i-axis .i-v, .i-axis .i-r { font-family: var(--mono); font-size: 0.68rem; font-weight: 400; color: var(--ink-3); }

.ax { font-family: var(--mono); font-size: 11px; fill: var(--ink-3); }
.lbl { font-family: var(--mono); font-size: 11px; fill: var(--ink-2); }
.gl { stroke: var(--rule); stroke-width: 1; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 14px; font-family: var(--mono); font-size: 0.76rem; }
.legend .item { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.legend .sw { width: 11px; height: 11px; flex: none; }

/* ---- tables ---- */

.tablewrap { overflow-x: auto; }
.tablewrap.scroll { max-height: 400px; overflow-y: auto; border-bottom: 1px solid var(--rule); }
.tablewrap.scroll thead th { position: sticky; top: 0; z-index: 1; background: var(--paper); box-shadow: inset 0 -1px 0 var(--ink); }

table { border-collapse: collapse; width: 100%; font-size: 0.8rem; }
th, td { text-align: right; padding: 7px 10px; white-space: nowrap; border-bottom: 1px solid var(--rule); }
thead th { color: var(--ink-3); font-weight: 400; font-family: var(--mono); font-size: 0.74rem; border-bottom: 1px solid var(--ink); cursor: pointer; user-select: none; }
@media (hover: hover) { thead th:hover { color: var(--ink); } }
tbody td { font-family: var(--mono); color: var(--ink-2); }
.cfgcol { text-align: left; padding-left: 0; font-weight: 400; }
.cfg { font-family: var(--mono); font-size: 0.78rem; color: var(--ink); white-space: pre; }
tbody tr { cursor: pointer; }
#table .tick {
  display: inline-block; width: 11px; height: 11px; margin-right: 10px;
  border: 1px solid var(--ink-3); vertical-align: -1px; flex: none;
}
#table tr.sel .tick { background: var(--pin, var(--ink)); border-color: var(--pin, var(--ink)); }
/* A tap has no hover to release: without this guard, the row you last tapped
   on a phone stays shaded until you tap another one, reading as stuck. */
@media (hover: hover) { tbody tr:hover td, tbody tr:hover .cfgcol { background: var(--panel); } }
tbody tr.sel td, tbody tr.sel .cfgcol { background: var(--panel); color: var(--ink); }
tbody tr.sel .cfgcol { box-shadow: inset 3px 0 0 var(--pin, var(--ink)); padding-left: 9px; }

/* ---- tooltip ---- */

.tip { position: fixed; z-index: 10; pointer-events: none; background: var(--ink); color: var(--paper); padding: 9px 12px; font-family: var(--mono); font-size: 0.75rem; line-height: 1.5; max-width: 300px; }
.tip b { font-weight: 600; }

/* ---- narrow: the tables become records, not a sideways scroll ---- */

@media (max-width: 680px) {
  :root { --gut: 16px; }
  body { font-size: 15px; }

  .figures { grid-template-columns: 1fr; gap: 22px; }
  .fig-pair { grid-template-columns: 1fr; gap: 16px; }
  .fig-pair dd.sub { font-size: 0.64rem; }
  .mrow { grid-template-columns: 1fr; gap: 4px; padding: 13px 0; }

  /* Records, not a sideways scroll -- but 288 of them stacked is 60,000px of
     page, so the picker keeps its own scroll box here too. */
  .tablewrap { overflow: visible; }
  .tablewrap.scroll { overflow-x: visible; overflow-y: auto; max-height: 68vh; }
  #table thead, #dtable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  #table tr, #dtable tr { display: block; border: 1px solid var(--rule); border-bottom: 0; padding: 12px 14px; }
  #table tbody tr:last-child, #dtable tbody tr:last-child { border-bottom: 1px solid var(--rule); }
  #table td, #dtable td { display: flex; justify-content: space-between; gap: 16px; border: 0; padding: 3px 0; white-space: normal; }
  #table td::before, #dtable td::before { content: attr(data-l); font-family: var(--mono); color: var(--ink-3); font-size: 0.74rem; }
  #table .cfgcol, #dtable .cfgcol { display: block; padding: 0 0 9px; border: 0; }
  #table .cfg, #dtable .cfg { white-space: normal; font-size: 0.74rem; line-height: 1.5; }
  tbody tr.sel .cfgcol { box-shadow: none; padding-left: 0; }
  tbody tr.sel { background: var(--panel); box-shadow: inset 3px 0 0 var(--pin, var(--ink)); }

  .i-row { grid-template-columns: minmax(0, 1fr) 58px 48px; gap: 6px 12px; }
  .i-f { grid-column: 1 / -1; }
  .i-t { grid-column: 1; }

  /* A segmented group cannot break inside itself, so on a narrow screen the
     shared border becomes individual chips that can wrap. */
  .ctl { flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
  .seg { flex-wrap: wrap; gap: 6px; border: 0; }
  .seg button, .seg button:first-child { border: 1px solid var(--rule); }
  .seg button[aria-pressed="true"] { border-color: var(--ink); }

  .ctlbar { gap: 10px 14px; }
  .reset { margin-left: 0; }
}

/* ---- narrow-screen twin of the hero chart ---- */

.dbc, .dbc-ax { display: none; }

@media (max-width: 680px) {
  .dumbbell { display: none; }
  .dbc { display: block; list-style: none; margin: 0; padding: 0; }
  .dbc-ax { display: block; }
  .dbc li { display: grid; grid-template-columns: 82px 1fr 52px; align-items: center; gap: 10px; padding: 9px 0; }
  .dbc-l { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-2); text-align: right; }
  .dbc-t { position: relative; height: 14px; }
  .dbc-t::before { content: ""; position: absolute; inset: 6px 0 auto; height: 1px; background: var(--rule); }
  .dbc-bar { position: absolute; top: 5.5px; height: 3px; background: var(--rule); }
  .dbc-tail, .dbc-med { position: absolute; top: 1px; width: 12px; height: 12px; border-radius: 50%; margin-left: -6px; }
  .dbc-tail { background: var(--series-2); }
  .dbc-med { border: 2.5px solid var(--ink); }
  .dbc-v { font-family: var(--mono); font-size: 0.78rem; font-weight: 500; text-align: right; }
  .dbc-ax { font-family: var(--mono); font-size: 0.68rem; color: var(--ink-3); margin: 8px 0 0; }
}
