/* Zeit Benchmarks & Validation Stylesheet */

:root {
  --bm-zeit: #2563eb;
  --bm-ref: #ea580c;
  --bm-gpu-lo: #60a5fa;
  --bm-gpu-hi: #1d4ed8;
  --bm-good: #16a34a;
  --bm-warning: #d97706;
  --bm-critical: #dc2626;
  --bm-grid: #e2e8f0;
  --bm-refline: #94a3b8;
  --bm-text: var(--md-typeset-color, #1e293b);
  --bm-muted: #64748b;
  --bm-card-bg: var(--md-code-bg-color, #f8fafc);
  --bm-border: rgba(0, 0, 0, 0.08);
}

[data-md-color-scheme="slate"] {
  --bm-text: #e6e9ee;
  --bm-zeit: #3b82f6;
  --bm-ref: #f97316;
  --bm-gpu-lo: #60a5fa;
  --bm-gpu-hi: #93c5fd;
  --bm-good: #22c55e;
  --bm-warning: #f59e0b;
  --bm-critical: #ef4444;
  --bm-grid: #334155;
  --bm-refline: #64748b;
  --bm-muted: #94a3b8;
  --bm-card-bg: var(--md-code-bg-color, #1e293b);
  --bm-border: rgba(255, 255, 255, 0.1);
}

/* KPI Tiles Grid */
.bm-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 1.5em 0;
}

.bm-kpi-card {
  background: var(--bm-card-bg);
  border: 1px solid var(--bm-border);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.bm-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.bm-kpi-label {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bm-muted);
}

.bm-kpi-value {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--bm-zeit);
  letter-spacing: -0.02em;
}

.bm-kpi-sub {
  font-size: 0.85rem;
  color: var(--bm-muted);
  line-height: 1.4;
}

/* Status Badges */
.bm-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--md-code-font-family, monospace);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bm-pill--compared {
  background: rgba(22, 163, 74, 0.15);
  color: var(--bm-good);
}

.bm-pill--partial {
  background: rgba(217, 119, 6, 0.15);
  color: var(--bm-warning);
}

.bm-pill--notcomp {
  background: rgba(220, 38, 38, 0.15);
  color: var(--bm-critical);
}

/* Chart Container & Legends */
.bm-chart-card {
  background: var(--bm-card-bg);
  border: 1px solid var(--bm-border);
  border-radius: 12px;
  padding: 20px 24px;
  margin: 1.5em 0;
}

.bm-legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--bm-muted);
  margin-bottom: 14px;
}

.bm-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.bm-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

/* Benchmark SVG Chart Styling */
.benchmark-chart {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
  font-family: var(--md-text-font-family, system-ui, sans-serif);
}

.bm-gridline {
  stroke: var(--bm-grid);
  stroke-width: 1;
}

.bm-refline {
  stroke: var(--bm-refline);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

.bm-ref-label {
  font-size: 11px;
  font-weight: 600;
  fill: var(--bm-muted);
  font-family: var(--md-code-font-family, monospace);
}

.bm-axis-tick {
  font-size: 11px;
  font-weight: 600;
  fill: var(--bm-muted);
  font-family: var(--md-code-font-family, monospace);
}

.bm-bar-label {
  font-size: 13px;
  font-weight: 600;
  fill: var(--bm-text);
}

.bm-bar-val {
  font-size: 12px;
  font-weight: 700;
  fill: var(--bm-text);
  font-family: var(--md-code-font-family, monospace);
}

.bm-bar-rect {
  cursor: pointer;
  transition: opacity 0.15s ease, filter 0.15s ease;
}

.bm-bar-group:hover .bm-bar-rect {
  filter: brightness(1.12);
}

.bm-zeit-bar {
  fill: var(--bm-zeit);
}

.bm-ref-bar {
  fill: var(--bm-ref);
}

.bm-gpu-lo {
  fill: var(--bm-gpu-lo);
}

.bm-gpu-hi {
  fill: var(--bm-gpu-hi);
}

/* Machine Comparison Callout */
.bm-machine-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  background: var(--bm-card-bg);
  border: 1px solid var(--bm-border);
  border-radius: 12px;
  padding: 20px;
  margin: 1.5em 0;
}

@media (max-width: 768px) {
  .bm-machine-box {
    grid-template-columns: 1fr;
  }
}

.bm-hw-spec {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bm-hw-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.95rem;
}

.bm-hw-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ==========================================================================
   Inline SVG charts (docs/scripts/make_benchmark_charts.py)
   ========================================================================== */
.bm-chart-card .bm-chart-title {
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--bm-text);
  margin: 0 0 2px;
}

.bm-chart-card .bm-chart-sub {
  font-size: 0.78rem;
  color: var(--bm-muted);
  margin: 0 0 14px;
  line-height: 1.5;
}

.bm-chart-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

svg.zc {
  display: block;
  width: 100%;
  min-width: 560px;
  height: auto;
  overflow: visible;
  font-family: var(--md-text-font-family, Inter, system-ui, sans-serif);
  font-variant-numeric: tabular-nums;
}

.zc-head { font-size: 13px; font-weight: 600; fill: var(--bm-muted); letter-spacing: 0.01em; }
.zc-tick { font-size: 12.5px; fill: var(--bm-muted); }
.zc-name { font-size: 15px; font-weight: 600; fill: var(--bm-text); }
.zc-sub  { font-size: 12.5px; fill: var(--bm-muted); }
.zc-val  { font-size: 13.5px; font-weight: 650; fill: var(--bm-text); }
.zc-val--soft { font-weight: 500; fill: var(--bm-muted); font-size: 12.5px; }
.zc-inbar { font-size: 12.5px; font-weight: 600; fill: var(--bm-text); }

.zc-grid { stroke: var(--bm-grid); stroke-width: 1; }
.zc-grid--minor { stroke-opacity: 0.45; }
.zc-base { stroke: var(--bm-refline); stroke-width: 1.5; }

.zc-bar--zeit  { fill: var(--bm-zeit); }
.zc-bar--zeit-lo { fill: var(--bm-gpu-lo); }
.zc-bar--ref   { fill: var(--bm-ref); }
.zc-bar--range { fill: var(--bm-zeit); fill-opacity: 0.3; }
.zc-bar--queue { fill: var(--bm-grid); }

.zc-link { stroke: var(--bm-refline); stroke-width: 2; stroke-opacity: 0.55; }
.zc-dot  { stroke: var(--md-default-bg-color, #fff); stroke-width: 2; }
.zc-dot--zeit { fill: var(--bm-zeit); }
.zc-dot--ref  { fill: var(--bm-ref); }

.zc-pill text { font-size: 12px; font-weight: 650; }
.zc-pill--same rect   { fill: var(--zeit-teal, #13868a); }
.zc-pill--same text   { fill: #fff; }
.zc-pill--float rect  { fill: var(--zeit-teal-soft, rgba(19, 134, 138, 0.12)); stroke: var(--zeit-teal, #13868a); stroke-width: 1; }
.zc-pill--float text  { fill: var(--zeit-teal, #13868a); }
.zc-pill--close rect  { fill: var(--bm-grid); }
.zc-pill--close text  { fill: var(--bm-text); }
.zc-pill--analog rect { fill: none; stroke: var(--bm-refline); stroke-width: 1; stroke-dasharray: 3 2; }
.zc-pill--analog text { fill: var(--bm-muted); }
[data-md-color-scheme="slate"] .zc-pill--same text { fill: #0e151e; }

.zc-hit { fill: transparent; }
.zc-row { cursor: default; outline: none; }
.zc-row:hover .zc-hit,
.zc-row:focus-visible .zc-hit { fill: var(--bm-zeit); fill-opacity: 0.06; }
.zc-row:focus-visible .zc-name { text-decoration: underline; }

.zc-tooltip {
  position: fixed;
  z-index: 10;
  max-width: 320px;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--md-default-bg-color, #fff);
  color: var(--md-typeset-color, #1d2939);
  border: 1px solid var(--bm-border);
  box-shadow: 0 8px 24px -6px rgba(16, 24, 40, 0.22);
  font-size: 0.72rem;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.zc-tooltip.is-on { opacity: 1; }

.bm-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 0.74rem;
  color: var(--bm-muted);
  margin: 0 0 12px;
}

.bm-chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.bm-chart-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; }
.bm-chart-legend i.dot { border-radius: 50%; }
.bm-chart-legend i.pill { width: 22px; height: 11px; border-radius: 6px; }
