/* Language Performance — page chrome (tech/dev-tool mood, per color-scheme.md)
   + dataviz reference palette (validated) for the chart specifically. */

:root {
  color-scheme: light;
  --primary: #1a1f2b;
  --secondary: #5b6b82;
  --cta: #f5a623;
  --surface: #faf9f7;
  --text: #1a1f2b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --success: #1f9d55;
  --warning: #d97706;
  --error: #dc2626;
  --border: rgba(11, 11, 11, 0.10);
  --gridline: #e1e0d9;

  /* dataviz categorical slots 1 (blue=latest) & 2 (orange=previous), validated */
  --series-latest: #2a78d6;
  --series-previous: #eb6834;
  --chart-surface: #fcfcfb;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --primary: #e8eaef;
    --secondary: #8b98ab;
    --surface: #12151c;
    --text: #e8eaef;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --border: rgba(255, 255, 255, 0.10);
    --gridline: #2c2c2a;
    --series-latest: #3987e5;
    --series-previous: #d95926;
    --chart-surface: #1a1a19;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #e8eaef;
  --secondary: #8b98ab;
  --surface: #12151c;
  --text: #e8eaef;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --border: rgba(255, 255, 255, 0.10);
  --gridline: #2c2c2a;
  --series-latest: #3987e5;
  --series-previous: #d95926;
  --chart-surface: #1a1a19;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--surface);
  color: var(--text);
  padding: 24px;
}

.page-header h1 {
  font-size: 1.6rem;
  margin: 0 0 8px;
}
.methodology {
  color: var(--text-secondary);
  max-width: 720px;
  font-size: 0.95rem;
}
.generated-at {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.controls select {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.btn {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 8px 18px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-start { background: var(--cta); color: #1a1f2b; font-weight: 600; }
.btn-reset { background: transparent; color: var(--text); border: 1px solid var(--border); }

.status-indicator {
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--gridline);
}
.status-indicator[data-state="running"] { background: color-mix(in srgb, var(--warning) 20%, transparent); color: var(--warning); }
.status-indicator[data-state="finished"] { background: color-mix(in srgb, var(--success) 20%, transparent); color: var(--success); }

.clock {
  font-variant-numeric: tabular-nums;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  color: var(--text-secondary);
}

.viz-root {
  background: var(--chart-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
#chart { width: 100%; height: auto; }
.bar-latest { fill: var(--series-latest); }
.bar-previous { fill: var(--series-previous); }
.chart-axis-text { fill: var(--text-muted); font-size: 11px; }
.chart-label-text { fill: var(--text); font-size: 11px; font-weight: 600; }
.chart-gridline { stroke: var(--gridline); stroke-width: 1; }

.legend { display: flex; gap: 16px; margin-top: 8px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--text-secondary); }
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.swatch-latest { background: var(--series-latest); }
.swatch-previous { background: var(--series-previous); }

.table-section { margin-top: 24px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}
th:first-child, td:first-child { text-align: left; font-family: inherit; }
thead th { background: var(--gridline); font-family: system-ui, sans-serif; }

.delta-up { color: var(--success); }
.delta-down { color: var(--error); }

.page-footer {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

@media (max-width: 480px) {
  body { padding: 12px; }
  .controls { flex-direction: column; align-items: stretch; }
}
