/* Parallax Explorer. Colours are the dataviz reference palette's roles; input size
   is the only categorical encoding (640 = slot 1 blue, 1280 = slot 2 orange) and
   box outcome uses the status palette, always with a line style and a label. */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface-1: #fcfcfb;
  --surface-2: #f0efec;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --s640: #2a78d6;
  --s1280: #eb6834;
  --good: #0ca30c;
  --critical: #d03b3b;
  --warning: #fab219;
  --neutral: #898781;
  --accent: #2a78d6;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface-1: #1a1a19;
    --surface-2: #232321;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --s640: #3987e5;
    --s1280: #d95926;
    --accent: #3987e5;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface-1: #1a1a19;
  --surface-2: #232321;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --s640: #3987e5;
  --s1280: #d95926;
  --accent: #3987e5;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--text-primary); font: 14px/1.45 var(--font); }
a { color: var(--accent); }
h1 { font-size: 18px; margin: 0; font-weight: 650; }
h2 { font-size: 16px; margin: 0 0 4px; font-weight: 650; }
h3 { font-size: 14px; margin: 0 0 6px; font-weight: 650; }
p { margin: 0 0 8px; }
.muted { color: var(--text-secondary); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }

header { display: flex; align-items: center; gap: 24px; padding: 12px 20px; background: var(--surface-1); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
header .title p { margin: 0; color: var(--text-secondary); font-size: 12px; }
nav { display: flex; gap: 4px; }
nav button, .seg button { font: inherit; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); padding: 6px 12px; border-radius: 6px; cursor: pointer; }
nav button[aria-selected="true"] { background: var(--text-primary); color: var(--surface-1); border-color: var(--text-primary); }
.spacer { flex: 1; }
#theme { font: inherit; background: none; border: 1px solid var(--border); color: var(--text-secondary); border-radius: 6px; padding: 5px 10px; cursor: pointer; }

main { padding: 16px 20px 40px; }
.view[hidden] { display: none !important; }
.lede { max-width: 860px; margin-bottom: 14px; color: var(--text-secondary); }

.controls { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-bottom: 12px; }
.control { display: flex; align-items: center; gap: 8px; }
.control > .label { font-size: 12px; color: var(--text-secondary); }
.seg { display: inline-flex; }
.seg button { border-radius: 0; margin-left: -1px; padding: 5px 10px; }
.seg button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.seg button:last-child { border-radius: 0 6px 6px 0; }
.seg button[aria-pressed="true"] { background: var(--text-primary); color: var(--surface-1); border-color: var(--text-primary); position: relative; }
.seg button.size-640[aria-pressed="true"] { background: var(--s640); border-color: var(--s640); color: #fff; }
.seg button.size-1280[aria-pressed="true"] { background: var(--s1280); border-color: var(--s1280); color: #fff; }
input[type="range"] { width: 160px; accent-color: var(--text-primary); }
select { font: inherit; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); }
label.check { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer; }
button.link { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }

.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }

/* Inspector */
.inspector { display: grid; grid-template-columns: 250px 1fr; gap: 16px; align-items: start; }
.imagelist { max-height: calc(100vh - 150px); overflow: auto; padding: 0; position: sticky; top: 70px; }
.imagelist .head { padding: 10px 12px; border-bottom: 1px solid var(--border); display: grid; gap: 6px; }
.imagelist ol { list-style: none; margin: 0; padding: 0; }
.imagelist li button { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 7px 12px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 12px; }
.imagelist li button:hover { background: var(--surface-2); }
.imagelist li button[aria-current="true"] { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--text-primary); }
.imagelist .env { font-weight: 600; text-transform: capitalize; }
.imagelist .miss { color: var(--text-secondary); text-align: right; }
.stage { position: relative; background: #000; border-radius: 8px; overflow: hidden; }
.stage canvas { display: block; width: 100%; height: auto; }
.stage .badge { position: absolute; left: 10px; top: 10px; background: rgba(0, 0, 0, 0.72); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 4px; pointer-events: none; }
.summary { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; margin: 10px 0 4px; }
.summary .big { font-size: 15px; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-secondary); align-items: center; }
.legend svg { vertical-align: middle; margin-right: 4px; }
.attribution { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.keys { font-size: 12px; color: var(--muted); margin-top: 8px; }
kbd { font: 11px var(--font); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: var(--surface-1); }

/* Tooltip */
.tooltip { position: fixed; pointer-events: none; z-index: 20; background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16); padding: 8px 10px; font-size: 12px; max-width: 280px; }
.tooltip .tt-title { font-weight: 600; margin-bottom: 4px; }
.tooltip .row { display: flex; align-items: center; gap: 6px; }
.tooltip .row strong { font-variant-numeric: tabular-nums; }
.tooltip .key { display: inline-block; width: 12px; height: 2px; }

/* Charts */
.chart text { fill: var(--muted); font: 11px var(--font); }
.chart .axis line, .chart .axis path { stroke: var(--axis); }
.chart .grid line { stroke: var(--grid); }
.chart .label-strong { fill: var(--text-primary); font-weight: 600; }
.chart .label-secondary { fill: var(--text-secondary); paint-order: stroke; stroke: var(--surface-1); stroke-width: 4px; stroke-linejoin: round; }
.multiples { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .multiples { grid-template-columns: 1fr; } }
.multiples .card { padding: 10px 12px 6px; }
.chartlegend { display: flex; gap: 16px; font-size: 12px; color: var(--text-secondary); align-items: center; margin-bottom: 10px; }
.note { font-size: 12px; color: var(--text-secondary); border-left: 3px solid var(--axis); padding: 4px 10px; margin: 10px 0; max-width: 860px; }
table.data { border-collapse: collapse; font-size: 12px; margin-top: 10px; }
table.data th, table.data td { padding: 4px 10px; border-bottom: 1px solid var(--border); text-align: right; font-variant-numeric: tabular-nums; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { color: var(--text-secondary); font-weight: 600; }

/* Eye-chart strip */
.strip { display: grid; grid-template-columns: 90px repeat(8, 1fr); gap: 6px; align-items: center; margin-top: 8px; }
.strip img { width: 100%; image-rendering: pixelated; border-radius: 4px; display: block; }
.strip .rowlabel { font-size: 12px; color: var(--text-secondary); }
.strip .collabel { font-size: 12px; text-align: center; color: var(--text-secondary); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(520px, 1fr)); gap: 16px; }
.fcard .hero { font-size: 26px; font-weight: 650; line-height: 1.1; margin: 8px 0 2px; }
.fcard .checks { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 4px; font-size: 13px; }
.fcard .checks li::before { content: "✓"; color: var(--good); font-weight: 700; margin-right: 6px; }
.fcard .checks li.partial::before { content: "◐"; color: var(--text-secondary); }
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.gallery button { all: unset; cursor: pointer; display: block; }
.gallery .thumb { position: relative; }
.gallery .thumb img { width: 100%; display: block; border-radius: 6px; image-rendering: pixelated; }
.gallery .thumb .box { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6); border-radius: 2px; }
.gallery button:focus-visible .thumb img, .gallery button:hover .thumb img { outline: 2px solid var(--text-primary); outline-offset: 1px; }
.chips { display: grid; grid-template-columns: 30px repeat(5, 1fr); gap: 2px; margin-top: 4px; font-size: 10px; color: var(--text-secondary); align-items: center; }
.chip { height: 14px; border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: 9px; color: #fff; font-weight: 700; }
.chip.m { background: var(--good); }
.chip.u { background: var(--critical); }
.chip.x { background: var(--surface-2); color: var(--text-secondary); }
details summary { cursor: pointer; font-size: 13px; color: var(--text-secondary); margin-top: 8px; }

footer { padding: 14px 20px 24px; border-top: 1px solid var(--border); color: var(--text-secondary); font-size: 12px; }
footer .brand { font-weight: 700; color: var(--text-primary); }

@media (max-width: 900px) {
  .inspector { grid-template-columns: 1fr; }
  .imagelist { position: static; max-height: 240px; }
  .cards { grid-template-columns: 1fr; }
}
