/* KAI Heterogeneity Lab — workbench styles. Tokens follow the KAI site (assets/site.css).
   Layout: a decision workbench. Map and site answer side by side, then the section between two
   points, the blind-test scorecard and "run on your logs". Everything stacks on a phone. */
.hl {
  --page: #f3f7f7; --surface: #ffffff; --surface-2: #eaf2f2; --ink: #0b1f2a; --ink-2: #3b5260; --muted: #64788a;
  --line: rgba(11, 31, 42, 0.12); --brand: #0e7c86; --brand-strong: #0a5e66; --brand-ink: #ffffff;
  --ochre: #c2873a; --ok: #15803d; --watch: #b45309; --warn: #b91c1c;
  --shadow: 0 1px 2px rgba(11, 31, 42, 0.04), 0 10px 30px -14px rgba(11, 31, 42, 0.18);
  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.55;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hl {
    --page: #07141b; --surface: #0e1f28; --surface-2: #142a35; --ink: #e6eef2; --ink-2: #b6c6cf; --muted: #8aa0ad;
    --line: rgba(230, 238, 242, 0.12); --brand: #2dd4bf; --brand-strong: #5eead4; --brand-ink: #042f2e;
    --ok: #4ade80; --watch: #fbbf24; --warn: #f87171;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -16px rgba(0, 0, 0, 0.7);
  }
}
:root[data-theme="dark"] .hl {
  --page: #07141b; --surface: #0e1f28; --surface-2: #142a35; --ink: #e6eef2; --ink-2: #b6c6cf; --muted: #8aa0ad;
  --line: rgba(230, 238, 242, 0.12); --brand: #2dd4bf; --brand-strong: #5eead4; --brand-ink: #042f2e;
  --ok: #4ade80; --watch: #fbbf24; --warn: #f87171;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -16px rgba(0, 0, 0, 0.7);
}
.hl *, .hl *::before, .hl *::after { box-sizing: border-box; }
.hl h1, .hl h2, .hl h3 { font-family: var(--f-display); letter-spacing: -0.015em; line-height: 1.12; margin: 0; text-wrap: balance; }
.hl h1 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); font-weight: 700; }
.hl h2 { font-size: clamp(1.25rem, 2.2vw, 1.6rem); font-weight: 700; }
.hl h3 { font-size: 1.02rem; font-weight: 700; }
.hl p { margin: 0; }
.hl a { color: var(--brand); text-underline-offset: 3px; }
.hl button, .hl input, .hl select { font: inherit; color: inherit; }
.hl :focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.hl .eyebrow { font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--brand); }
.hl .muted { color: var(--muted); }
.hl .mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.hl .num { font-variant-numeric: tabular-nums; }

.hl-head { display: grid; gap: 10px; padding-block: 18px 14px; }
.hl-head .lede { color: var(--ink-2); max-width: 70ch; }
.hl-case { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.82rem; color: var(--muted); }
.hl-case b { color: var(--ink-2); font-weight: 600; }

.hl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 10px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.hl-ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hl-ctl > label, .hl-ctl > span.lab { font-family: var(--f-mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.hl-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--surface); }
.hl-seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 999px; cursor: pointer; font-size: 0.86rem; color: var(--ink-2); }
.hl-seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
.hl select { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 5px 8px; font-size: 0.88rem; max-width: 100%; }
.hl input[type="range"] { accent-color: var(--brand); width: 130px; }

.hl-main { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .hl-main { grid-template-columns: minmax(0, 1fr); } }

.hl-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 14px; min-width: 0; }
.hl-mapwrap { position: relative; }
.hl-map { width: 100%; display: block; border-radius: 10px; cursor: crosshair; touch-action: manipulation; background: var(--surface-2); }
.hl-maptools { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; margin-top: 10px; }
.hl-legend { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--muted); flex-wrap: wrap; }
.hl-legend canvas { height: 10px; width: 160px; border-radius: 3px; }
.hl-chips { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 0.78rem; color: var(--ink-2); }
.hl-chip { display: inline-flex; align-items: center; gap: 6px; }
.hl-chip i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.hl-hint { font-size: 0.8rem; color: var(--muted); }
.hl-btn { border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 0.86rem; }
.hl-btn:hover { border-color: var(--brand); }
.hl-btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.hl-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* site answer */
.hl-site { display: grid; gap: 12px; }
.hl-site .where { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 0.82rem; color: var(--muted); }
.hl-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.74rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; border: 1px solid currentColor; }
.hl-pill.good { color: var(--ok); } .hl-pill.fair { color: var(--watch); } .hl-pill.thin { color: var(--warn); }
.hl-verdicts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.hl-verdict { border-radius: 12px; padding: 10px 12px; background: var(--surface-2); display: grid; gap: 2px; }
.hl-verdict .big { font-family: var(--f-display); font-size: 2.1rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.hl-verdict .what { font-size: 0.8rem; color: var(--ink-2); }
.hl-verdict .word { font-size: 0.82rem; font-weight: 600; }
.hl-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 0.88rem; }
.hl-facts dt { color: var(--muted); }
.hl-facts dd { margin: 0; font-weight: 500; }
.hl-colwrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.hl-col { width: 100%; display: block; }
.hl-note { font-size: 0.8rem; color: var(--muted); }
.hl-warnbox { border-left: 3px solid var(--watch); padding: 6px 10px; background: var(--surface-2); border-radius: 6px; font-size: 0.85rem; }

.hl-section { margin-top: 18px; }
.hl-sechead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.hl-xs { width: 100%; display: block; }

/* blind test */
.hl-score { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.hl-score .k { font-family: var(--f-display); font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.hl-bars { display: grid; gap: 5px; font-size: 0.82rem; }
.hl-bars .row { display: grid; grid-template-columns: 9.5em minmax(0, 1fr) 3.4em; align-items: center; gap: 8px; }
.hl-bars .track { height: 10px; background: var(--surface-2); border-radius: 5px; position: relative; overflow: hidden; }
.hl-bars .fill { position: absolute; top: 0; bottom: 0; left: 0; background: var(--muted); border-radius: 5px; }
.hl-bars .row.me .fill { background: var(--brand); }
.hl-bars .row.me { font-weight: 600; }
.hl-tablewrap { overflow-x: auto; }
.hl table { border-collapse: collapse; font-size: 0.84rem; width: 100%; }
.hl th, .hl td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.hl th { font-family: var(--f-mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.hl td.n { text-align: right; font-variant-numeric: tabular-nums; }

/* upload */
.hl-drop { border: 1.5px dashed var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 8px; justify-items: start; background: var(--surface-2); }
.hl-drop.over { border-color: var(--brand); }
.hl-checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 0.88rem; }
.hl-checks li::before { content: "○ "; color: var(--muted); }
.hl-checks li.ok::before { content: "● "; color: var(--ok); }
.hl-checks li.bad::before { content: "● "; color: var(--warn); }
.hl pre.tpl { font-family: var(--f-mono); font-size: 0.76rem; background: var(--surface-2); padding: 10px; border-radius: 8px; overflow-x: auto; margin: 0; }
.hl-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.hl-foot { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 0.78rem; color: var(--muted); display: grid; gap: 4px; }
@media (prefers-reduced-motion: no-preference) { .hl-verdict { transition: background 0.2s; } }
