/* bench.regol.org — matching regol.org light/dark palette */

:root {
  color-scheme: light dark;

  --bg: #faf7f1;
  --bg-alt: #f2ece0;
  --surface: #ffffff;
  --surface-subtle: #f6f1e7;
  --border: #e3d9c8;
  --border-strong: #cfc2ac;

  --ink: #152625;
  --ink-soft: #3f5554;
  --ink-muted: #617574;

  --accent: #1a736b;
  --accent-hover: #135a54;
  --accent-soft: #e4f3ef;
  --accent-border: #9bd0c5;
  --on-accent: #ffffff;

  --ref: #b87e1b;
  --ref-soft: #fbf2de;
  --good: #16794c;
  --bad: #a82238;

  --shadow-sm: 0 1px 2px rgba(21, 38, 37, 0.06);
  --shadow-md: 0 8px 28px rgba(21, 38, 37, 0.07);
  --radius: 12px;
  --radius-sm: 8px;
  --container: 1120px;

  --font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1717;
    --bg-alt: #122020;
    --surface: #172828;
    --surface-subtle: #1c3030;
    --border: #253d3c;
    --border-strong: #355453;

    --ink: #edf4f2;
    --ink-soft: #a9bebc;
    --ink-muted: #7f9896;

    --accent: #6ed3bc;
    --accent-hover: #8be0cc;
    --accent-soft: rgba(110, 211, 188, 0.14);
    --accent-border: rgba(110, 211, 188, 0.35);
    --on-accent: #091817;

    --ref: #e4b65c;
    --ref-soft: rgba(228, 182, 92, 0.16);
    --good: #66d9a3;
    --bad: #f0768a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.32);
  }
}

:root[data-theme="dark"] {
  --bg: #0d1717;
  --bg-alt: #122020;
  --surface: #172828;
  --surface-subtle: #1c3030;
  --border: #253d3c;
  --border-strong: #355453;

  --ink: #edf4f2;
  --ink-soft: #a9bebc;
  --ink-muted: #7f9896;

  --accent: #6ed3bc;
  --accent-hover: #8be0cc;
  --accent-soft: rgba(110, 211, 188, 0.14);
  --accent-border: rgba(110, 211, 188, 0.35);
  --on-accent: #091817;

  --ref: #e4b65c;
  --ref-soft: rgba(228, 182, 92, 0.16);
  --good: #66d9a3;
  --bad: #f0768a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.32);
}

.brand-wordmark-dark { display: none; }
.brand-wordmark-light { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-wordmark-light { display: none; }
  :root:not([data-theme="light"]) .brand-wordmark-dark { display: block; }
}
:root[data-theme="dark"] .brand-wordmark-light { display: none; }
:root[data-theme="dark"] .brand-wordmark-dark { display: block; }

.theme-icon { display: none; }
:root:not([data-theme]) .theme-icon-auto { display: block; }
:root[data-theme="light"] .theme-icon-light { display: block; }
:root[data-theme="dark"] .theme-icon-dark { display: block; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-subtle));
  color: var(--ink);
  border-radius: 5px;
  padding: 0.1em 0.34em;
}
h1, h2 { font-family: var(--font-serif); font-weight: 700; letter-spacing: -0.015em; margin: 0; }
h3 { font-size: 1.05rem; margin: 0 0 12px; }
p { margin: 0 0 1rem; color: var(--ink-soft); }
p:last-child { margin-bottom: 0; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.skip-link {
  position: absolute; left: -9999px; top: 8px;
  background: var(--accent); color: var(--on-accent);
  padding: 8px 14px; border-radius: var(--radius-sm); font-weight: 600; z-index: 100;
}
.skip-link:focus { left: 16px; }

/* Header */
.site-header { position: relative; z-index: 40; background: var(--bg); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 92px; padding-top: 10px; gap: 16px;
}
.brand { display: inline-flex; align-items: center; flex-shrink: 0; }
.brand-wordmark { height: 60px; width: auto; }
.header-controls { display: flex; align-items: center; gap: 8px; }
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a {
  color: var(--ink-soft); font-size: 0.94rem; font-weight: 500;
  padding: 8px 11px; border-radius: var(--radius-sm);
}
.site-nav a:hover { color: var(--ink); background: var(--bg-alt); text-decoration: none; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-soft); cursor: pointer;
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--ink); background: var(--bg-alt); }
.nav-toggle { display: none; }
.menu-icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .menu-icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .menu-icon-close { display: block; }

/* Intro */
.intro { padding: 28px 0 44px; }
.intro h1 { font-size: clamp(2rem, 3.6vw, 2.85rem); line-height: 1.15; margin-bottom: 12px; }
.lead { max-width: 780px; font-size: 1.06rem; margin-bottom: 20px; }
.status-bar {
  display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center;
  padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  font-size: 0.9rem; color: var(--ink-soft);
}
.status-bar strong { color: var(--ink); }

/* Bands */
.band { padding: 56px 0; }
.band-alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-top {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 22px;
}
.band h2 { font-size: clamp(1.5rem, 2.4vw, 2rem); margin-bottom: 6px; }
.section-desc { font-size: 0.95rem; margin: 0; }

/* Suite tabs */
.suite-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.suite-tab {
  appearance: none; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink-soft);
  font-family: var(--font-sans); font-size: 0.9rem; font-weight: 600;
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer;
}
.suite-tab:hover { color: var(--ink); border-color: var(--accent); }
.suite-tab.is-active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* Panels & charts */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm);
}
#latest-chart-wrap { margin-bottom: 20px; }
.chart-legend {
  display: flex; flex-wrap: wrap; gap: 18px; align-items: center;
  font-size: 0.86rem; color: var(--ink-soft); margin-bottom: 14px;
}
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.swatch-regol { background: var(--accent); }
.swatch-ref { background: var(--ref); }

.bar-row {
  display: grid; grid-template-columns: minmax(150px, 230px) minmax(0, 1fr) 115px;
  gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border);
}
.bar-row:last-child { border-bottom: 0; }
.bar-label { font-size: 0.9rem; color: var(--ink); font-weight: 500; }
.bar-label small { display: block; font-size: 0.78rem; color: var(--ink-muted); font-weight: 400; }
.bar-tracks { display: flex; flex-direction: column; gap: 5px; }
.bar-track {
  position: relative; height: 14px; border-radius: 4px;
  background: var(--surface-subtle); overflow: visible;
}
.bar-fill { height: 100%; border-radius: 4px; min-width: 3px; }
.bar-fill-regol { background: var(--accent); }
.bar-fill-ref { background: var(--ref); opacity: 0.82; }
.bar-dot {
  position: absolute; top: 50%; width: 6px; height: 6px; border-radius: 50%;
  transform: translate(-50%, -50%); background: var(--ink); opacity: 0.55;
}
.bar-values { text-align: right; font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.45; }
.val-regol { color: var(--accent); font-weight: 600; display: block; }
.val-ref { color: var(--ink-muted); display: block; }
.ratio-good { color: var(--good); font-weight: 600; }
.ratio-bad { color: var(--bad); font-weight: 600; }

/* Tables */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow-sm);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 600px; }
.data-table th, .data-table td {
  text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border);
}
.data-table th {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-muted); background: var(--surface-subtle); font-weight: 700;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table td.num, .data-table th.num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }

/* History controls & uPlot */
.controls-bar {
  display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px;
}
.compare-pickers { display: flex; flex-wrap: wrap; gap: 12px; }
.control { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--ink-muted); font-weight: 600; }
.control-wide { min-width: 240px; flex: 1 1 240px; }
.control select {
  min-height: 38px; padding: 6px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font-family: var(--font-sans); font-size: 0.9rem;
}
.history-inspector {
  font-size: 0.88rem; color: var(--ink-soft); margin-bottom: 12px;
  min-height: 24px;
}
.history-inspector strong { color: var(--ink); }
.plot-host { width: 100%; min-height: 320px; }
.plot-note { margin-top: 12px; font-size: 0.84rem; color: var(--ink-muted); }

/* uPlot theme tweaks */
.uplot { font-family: var(--font-sans); color: var(--ink); }
.u-legend { font-size: 0.84rem; color: var(--ink-soft); }

/* Methodology */
.method-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 16px; }
.kv-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 0.9rem; }
.kv-list dt { color: var(--ink-muted); font-weight: 600; }
.kv-list dd { margin: 0; color: var(--ink); word-break: break-word; }
.method-list { margin: 0; padding-left: 18px; color: var(--ink-soft); font-size: 0.92rem; }
.method-list li { margin-bottom: 8px; }
.method-list li:last-child { margin-bottom: 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 40px 0 36px; background: var(--bg-alt); }
.footer-top {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border);
}
.footer-brand { display: flex; align-items: flex-start; gap: 14px; max-width: 360px; }
.footer-brand strong { display: block; font-family: var(--font-serif); font-size: 1.1rem; }
.footer-brand p { font-size: 0.88rem; color: var(--ink-muted); }
.footer-links-group { display: flex; flex-wrap: wrap; gap: 40px; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: 6px; }
.footer-links a { color: var(--ink-soft); font-size: 0.9rem; }
.footer-links a:hover { color: var(--accent); }
.footer-legal { padding-top: 18px; }
.footer-legal p { font-size: 0.82rem; color: var(--ink-muted); }

@media (max-width: 820px) {
  .method-grid { grid-template-columns: minmax(0, 1fr); }
  .bar-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .bar-values { text-align: left; display: flex; gap: 12px; }
}

@media (max-width: 720px) {
  .container { padding: 0 18px; }
  .header-inner { min-height: 76px; padding-top: 8px; }
  .brand-wordmark { height: 50px; }
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 12px 18px 16px; background: var(--bg);
    border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md);
  }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: 12px 14px; font-size: 1rem; }
  .band { padding: 40px 0; }
}
