/*
 * Statistics page — snapshot injects between SNAPSHOT_* markers.
 * :root must stay aligned with configs/caddy/apex/style.css
 */
:root {
  --bg: #0d1117;
  --fg: #e6edf3;
  --fg-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --accent-muted: #388bfd;
  --ok: #3fb950;
  --warn: #d29922;
  --crit: #f85149;
  --border: #30363d;
  --surface: #161b22;
  --surface-inset: #21262d;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  --radius-panel: 12px;
  --radius-inner: 8px;
}

* {
  box-sizing: border-box;
}

body {
  background-color: var(--bg);
  color: var(--fg);
  margin: 0;
  padding: 1.5rem clamp(1rem, 4vw, 2rem) 3rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
}

.subsection {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin: 0 0 0.65rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.subsection-note {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--accent-muted);
  font-family: var(--font-mono);
  font-size: 0.65rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: 1.25rem;
  align-items: stretch;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  padding: 1.35rem 1.4rem;
  display: flex;
  flex-direction: column;
}

.section-title {
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.6875rem;
  font-weight: 600;
  margin: 0 0 1.15rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.section-badge {
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.bar-container {
  margin-bottom: 1rem;
}

.bar-container:last-child {
  margin-bottom: 0;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  gap: 0.5rem;
  font-size: 0.8125rem;
}

.bar-label {
  color: var(--fg);
  font-weight: 500;
}

.bar-val {
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
}

.bar-bg {
  background: var(--surface-inset);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.bar-fill {
  height: 100%;
  min-width: 0;
  border-radius: 3px;
  width: calc(var(--bar-pct, 0) * 1%);
  background-color: var(--bar-fill-color, var(--accent));
  transition: width 0.35s cubic-bezier(0.33, 1, 0.68, 1);
}

.stat-spacer {
  flex-shrink: 0;
  min-height: 0.5rem;
}

.stat-block {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.stat-block .stat-row + .subsection {
  margin-top: 1rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.8125rem;
  margin-bottom: 0.45rem;
}

.stat-row:last-child {
  margin-bottom: 0;
}

.stat-label {
  color: var(--fg-muted);
}

.stat-val {
  color: var(--fg);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.hero-io {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.hero-io-card {
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-inner);
  padding: 0.85rem 0.9rem;
  text-align: center;
}

.hero-io-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--fg-muted);
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.hero-io-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.5rem;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.hero-io-unit {
  display: block;
  font-size: 0.6875rem;
  color: var(--fg-muted);
  margin-top: 0.2rem;
}

.accent {
  color: var(--accent);
}

.warn {
  color: var(--warn);
}

.crit {
  color: var(--crit);
}

.dim {
  color: var(--fg-muted);
}

.site-footer {
  grid-column: 1 / -1;
  margin-top: 1rem;
  padding-top: 1.25rem;
  text-align: center;
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  color: var(--fg-muted);
  border-top: 1px solid var(--border);
}

.footer-meta {
  color: var(--fg);
  font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
  .bar-fill {
    transition: none;
  }
}

@media (max-width: 640px) {
  .hero-io {
    grid-template-columns: 1fr;
  }
}
