/* Container Manifest Database — chart chrome and palette roles.
   Palette: validated reference instance (see dataviz palette.md). */

.viz-root {
  color-scheme: light;
  --page:           #f9f9f7;
  --surface-1:      #fcfcfb;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --grid:           #e1e0d9;
  --baseline:       #c3c2b7;
  --border:         rgba(11, 11, 11, 0.10);
  --series-1:       #2a78d6;  /* blue   */
  --series-2:       #eb6834;  /* orange */
  --series-3:       #1baf7a;  /* aqua   */
  --ghost:          rgba(11, 11, 11, 0.045);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .viz-root {
    color-scheme: dark;
    --page:           #0d0d0d;
    --surface-1:      #1a1a19;
    --text-primary:   #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --grid:           #2c2c2a;
    --baseline:       #383835;
    --border:         rgba(255, 255, 255, 0.10);
    --series-1:       #3987e5;
    --series-2:       #d95926;
    --series-3:       #199e70;
    --ghost:          rgba(255, 255, 255, 0.06);
  }
}
:root[data-theme="dark"] .viz-root {
  color-scheme: dark;
  --page:           #0d0d0d;
  --surface-1:      #1a1a19;
  --text-primary:   #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted:     #898781;
  --grid:           #2c2c2a;
  --baseline:       #383835;
  --border:         rgba(255, 255, 255, 0.10);
  --series-1:       #3987e5;
  --series-2:       #d95926;
  --series-3:       #199e70;
  --ghost:          rgba(255, 255, 255, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: #f9f9f7; }
:root[data-theme="dark"] body { background: #0d0d0d; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body { background: #0d0d0d; }
}

.viz-root {
  min-height: 100vh;
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  padding: 24px clamp(16px, 4vw, 48px) 48px;
}

a { color: var(--series-1); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--ghost);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ---------- header ---------- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
.site-header h1 { font-size: 22px; font-weight: 650; margin: 0 0 4px; }
.subtitle { margin: 0; max-width: 72ch; color: var(--text-secondary); }
.subtitle #generated { color: var(--text-muted); }
.header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.gh-link, #theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
.gh-link:hover, #theme-toggle:hover { background: var(--ghost); text-decoration: none; }

.loading { color: var(--text-muted); padding: 48px 0; }

/* ---------- coverage ---------- */
.coverage-card { margin-bottom: 16px; padding: 14px 16px; }
.coverage-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.coverage-head h2 { font-size: 15px; font-weight: 600; margin: 0; }
.seg-bar {
  display: flex;
  height: 28px;
  border-radius: 0; /* blocks carry their own corners */
}
.seg-block {
  position: relative;
  height: 100%;
  border-radius: 4px;
  min-width: 2px;
}
.seg-block + .seg-block { margin-left: 2px; } /* surface gap */
.seg-label {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- filter row ---------- */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}
.filter-row input[type="search"], .filter-row select, .filter-row button {
  font: inherit;
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
}
.filter-row input[type="search"] { min-width: 240px; flex: 0 1 300px; }
.filter-row button { cursor: pointer; }
.filter-row button:hover { background: var(--ghost); }
.filter-count { color: var(--text-muted); margin-left: 4px; }

/* ---------- stat tiles ---------- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-label { color: var(--text-secondary); font-size: 13px; }
.stat-value { font-size: 28px; font-weight: 600; letter-spacing: -0.01em; }
.stat-delta { color: var(--text-muted); font-size: 12px; }

/* ---------- chart cards ---------- */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  min-width: 0;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.card-head h2 { font-size: 15px; font-weight: 600; margin: 0; }
.card-head .sub { color: var(--text-muted); font-size: 12px; }
.view-toggle {
  font: inherit;
  font-size: 12px;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  cursor: pointer;
  flex-shrink: 0;
}
.view-toggle:hover { background: var(--ghost); }
.muted { color: var(--text-muted); }

svg { display: block; }
svg text { font-family: inherit; }
.bar-hit { fill: transparent; cursor: default; }
.bar { transition: filter 80ms ease; }
.bar.hover { filter: brightness(1.12); }
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.legend .swatch {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -1px;
}

/* chart table-view twin */
.chart-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.chart-table th, .chart-table td {
  text-align: left;
  padding: 4px 8px;
  border-bottom: 1px solid var(--grid);
}
.chart-table td.num, .chart-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.chart-table th { color: var(--text-secondary); font-weight: 500; }

/* ---------- tooltip ---------- */
.tooltip {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  background: var(--surface-1);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  padding: 8px 10px;
  font-size: 12.5px;
  max-width: 320px;
}
.tooltip .tt-value { font-weight: 650; font-size: 14px; }
.tooltip .tt-label { color: var(--text-secondary); }
.tooltip .tt-key {
  display: inline-block;
  width: 12px; height: 3px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: 3px;
}

/* ---------- image table ---------- */
.table-card { margin-bottom: 16px; }
.table-wrap { overflow-x: auto; }
#image-table { width: 100%; border-collapse: collapse; font-size: 13px; }
#image-table th, #image-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--grid);
  white-space: nowrap;
}
#image-table th { color: var(--text-secondary); font-weight: 500; position: sticky; top: 0; background: var(--surface-1); }
#image-table th.num, #image-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
#image-table td.apps { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
#image-table tbody tr:hover { background: var(--ghost); }
.chip {
  display: inline-block;
  font-size: 11.5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 8px;
  color: var(--text-secondary);
}
.chip.gpu-cuda  { color: var(--series-1); border-color: var(--series-1); }
.chip.gpu-rocm  { color: var(--series-2); border-color: var(--series-2); }
.chip.gpu-mixed { color: var(--series-3); border-color: var(--series-3); }
.pager {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  padding-top: 10px;
}
.pager button {
  font: inherit;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
}
.pager button:disabled { opacity: 0.4; cursor: default; }
.pager button:not(:disabled):hover { background: var(--ghost); }

.site-footer { color: var(--text-muted); font-size: 12.5px; margin-top: 8px; }
