/* PulseBoard — premium dark data-dashboard theme (cyan / lime accents) */

:root {
  --bg: #0a0e13;
  --bg-alt: #0d1219;
  --panel: #11161d;
  --panel-border: #1d2530;
  --text: #e7edf3;
  --text-dim: #9aa7b4;
  --text-faint: #6b7686;
  --accent: #00e0c7;
  --accent-dim: #0a8f80;
  --lime: #c6f135;
  --warn: #ff7a59;
  --radius: 14px;
  --radius-sm: 8px;
  --max-width: 1180px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color-scheme: dark;
}

body {
  margin: 0;
  background: radial-gradient(ellipse 1200px 600px at 50% -10%, #0f2620 0%, var(--bg) 55%);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #00211d;
  padding: 8px 14px;
  border-radius: 0 0 8px 0;
  font-weight: 600;
  z-index: 100;
}
.skip-link:focus {
  left: 0;
}

code {
  font-family: var(--font-mono);
  background: #0f1620;
  border: 1px solid var(--panel-border);
  padding: 0.1em 0.4em;
  border-radius: 5px;
  font-size: 0.92em;
  color: var(--lime);
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover, a:focus-visible {
  text-decoration: underline;
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 14, 19, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--panel-border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
}
.brand-name {
  background: linear-gradient(90deg, var(--accent), var(--lime));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.header-nav {
  display: flex;
  gap: 24px;
}
.header-nav a {
  color: var(--text-dim);
  font-size: 0.92rem;
  font-weight: 500;
}
.header-nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ---------- hero ---------- */
.hero {
  padding: 72px 0 48px;
}
.eyebrow {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 14px;
}
.hero h1 {
  font-size: clamp(1.9rem, 4vw, 3.1rem);
  line-height: 1.12;
  margin: 0 0 18px;
  max-width: 18ch;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.hero-sub {
  color: var(--text-dim);
  font-size: 1.08rem;
  max-width: 62ch;
  margin: 0 0 36px;
}
.hero-sub strong {
  color: var(--text);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.stat-card {
  background: linear-gradient(160deg, var(--panel) 0%, #0d1117 100%);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  font-weight: 600;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--accent);
}
.stat-sub {
  font-size: 0.78rem;
  color: var(--text-faint);
}
.hero-note {
  font-size: 0.85rem;
  color: var(--text-faint);
  margin: 0;
}

/* ---------- filters ---------- */
.filters-bar {
  position: sticky;
  top: 64px;
  z-index: 40;
  background: rgba(13, 18, 25, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--panel-border);
  border-top: 1px solid var(--panel-border);
  padding: 16px 0;
}
.filters-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  font-weight: 600;
  white-space: nowrap;
}
.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.chip[aria-pressed="true"] {
  color: #00211d;
  border-color: transparent;
  font-weight: 700;
}
.chip:hover {
  border-color: var(--accent-dim);
}
.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.year-group {
  flex: 1;
  min-width: 280px;
}
.year-controls {
  position: relative;
  height: 24px;
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
}
.year-controls input[type="range"] {
  position: absolute;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  margin: 0;
}
.year-controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #00211d;
  cursor: pointer;
  margin-top: 0;
}
.year-controls input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #00211d;
  cursor: pointer;
}
.year-controls input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--panel-border);
  border-radius: 2px;
}
.year-controls input[type="range"]::-moz-range-track {
  height: 4px;
  background: var(--panel-border);
  border-radius: 2px;
}
.year-readout {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  margin-top: 4px;
  min-width: 110px;
}

.reset-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.reset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- panels ---------- */
.panel {
  padding: 64px 0;
}
.panel.alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--panel-border);
  border-bottom: 1px solid var(--panel-border);
}
.panel-head h2 {
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  margin: 0 0 8px;
  font-weight: 700;
}
.panel-sub {
  color: var(--text-dim);
  margin: 0 0 28px;
  max-width: 68ch;
}

.chart-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 20px clamp(8px, 2vw, 24px) 24px;
}
.chart-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  padding: 0 8px 12px;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
svg#scatter-chart, svg#bar-chart {
  width: 100%;
  height: auto;
  display: block;
}
.readout-row {
  margin-top: 14px;
  padding: 12px 14px;
  background: #0c1117;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.readout-row strong, .readout-row span {
  color: var(--accent);
}

/* ---------- methodology / limitations text ---------- */
.text-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px 40px;
}
.text-grid article h3 {
  font-size: 1.02rem;
  color: var(--lime);
  margin: 0 0 10px;
}
.text-grid article p {
  color: var(--text-dim);
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.limitations-list {
  display: grid;
  gap: 14px;
  padding: 0;
  margin: 0;
  list-style: none;
  max-width: 80ch;
}
.limitations-list li {
  position: relative;
  padding-left: 22px;
  color: var(--text-dim);
  font-size: 0.95rem;
}
.limitations-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--warn);
}
.limitations-list strong {
  color: var(--text);
}

/* ---------- footer ---------- */
.site-footer {
  padding: 32px 0 48px;
  border-top: 1px solid var(--panel-border);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-faint);
  font-size: 0.85rem;
}
.footer-inner p {
  margin: 0;
}

/* ---------- axes / svg text (used by app.js-generated elements) ---------- */
.axis-label {
  fill: var(--text-faint);
  font-size: 12px;
  font-family: var(--font-mono);
}
.axis-title {
  fill: var(--text-dim);
  font-size: 13px;
  font-family: var(--font-sans);
  font-weight: 600;
}
.grid-line {
  stroke: var(--panel-border);
  stroke-width: 1;
}
.reg-line {
  stroke: var(--lime);
  stroke-width: 2.5;
}
.ci-band {
  fill: var(--lime);
  opacity: 0.12;
}

/* ---------- responsive ---------- */
@media (max-width: 880px) {
  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .text-grid {
    grid-template-columns: 1fr;
  }
  .header-nav {
    display: none;
  }
  .filters-inner {
    gap: 18px;
  }
  .reset-btn {
    margin-left: 0;
  }
}

@media (max-width: 540px) {
  .hero-stats {
    grid-template-columns: 1fr 1fr;
  }
  .hero h1 {
    font-size: 1.7rem;
  }
}

/* ---------- reduced motion / accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
