/* ============================================================
   Metro Atlanta Transit Equity & Access Tracker
   Design system — tokens, typography, layout primitives
   ============================================================ */

/* Google Fonts */
@import url("https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,500;0,8..60,600;0,8..60,700;1,8..60,400;1,8..60,600&family=Source+Sans+3:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Source+Code+Pro:wght@400;500&display=swap");

/* ===== Color tokens ===== */
:root {
  /* Accent — deep teal, single accent, no gradients */
  --accent:         oklch(38% 0.06 210);
  --accent-12:      oklch(38% 0.06 210 / 0.10);
  --accent-strong:  oklch(28% 0.07 210);

  /* Page surface */
  --page-bg:    oklch(98.5% 0.005 80);
  --panel-bg:   oklch(99.5% 0.003 80);

  /* Ink scale — graphite, not pure black */
  --ink:     oklch(20% 0.01 250);
  --ink-80:  oklch(30% 0.01 250);
  --ink-65:  oklch(45% 0.01 250);
  --ink-50:  oklch(60% 0.008 250);
  --ink-30:  oklch(78% 0.005 250);
  --ink-15:  oklch(90% 0.004 250);
  --ink-08:  oklch(94% 0.004 250);
  --ink-04:  oklch(97% 0.003 250);

  /* Hairline rules */
  --rule:        oklch(86% 0.005 250);
  --rule-strong: oklch(70% 0.008 250);

  /* Data viz — 4-color categorical, WCAG-AA safe */
  --cat-1: oklch(38% 0.06 210);   /* teal   — MARTA        */
  --cat-2: oklch(55% 0.10 60);    /* ochre  — CobbLinc     */
  --cat-3: oklch(45% 0.10 30);    /* terracotta — Gwinnett */
  --cat-4: oklch(40% 0.06 290);   /* aubergine  — Xpress   */

  /* Semantic status */
  --ok:   oklch(48% 0.10 150);
  --warn: oklch(58% 0.13 60);
  --bad:  oklch(50% 0.16 25);

  /* Map surface */
  --map-bg:            oklch(98% 0.004 80);
  --map-county-fill:   oklch(96% 0.004 80);
  --map-county-stroke: oklch(82% 0.005 80);
  --map-river:         oklch(70% 0.04 220);

  /* Type stacks */
  --serif: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  --sans:  "Source Sans 3", "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:  "Source Code Pro", ui-monospace, "SF Mono", monospace;

  /* Density tokens — comfortable default */
  --row-pad-y:     14px;
  --section-pad-y: 48px;
  --card-pad:      28px;
}

/* Dark mode */
[data-theme="dark"] {
  --page-bg:    oklch(18% 0.01 250);
  --panel-bg:   oklch(22% 0.01 250);
  --ink:        oklch(94% 0.005 80);
  --ink-80:     oklch(86% 0.006 80);
  --ink-65:     oklch(72% 0.008 80);
  --ink-50:     oklch(58% 0.008 80);
  --ink-30:     oklch(38% 0.008 80);
  --ink-15:     oklch(28% 0.008 80);
  --ink-08:     oklch(24% 0.008 80);
  --ink-04:     oklch(22% 0.008 80);
  --rule:        oklch(34% 0.008 80);
  --rule-strong: oklch(50% 0.008 80);
  --map-bg:            oklch(22% 0.01 250);
  --map-county-fill:   oklch(26% 0.01 250);
  --map-county-stroke: oklch(34% 0.008 80);
  --map-river:         oklch(50% 0.04 220);
  --accent:        oklch(70% 0.08 210);
  --accent-12:     oklch(70% 0.08 210 / 0.16);
  --accent-strong: oklch(80% 0.08 210);
}

/* Compact density */
[data-density="compact"] {
  --row-pad-y:     8px;
  --section-pad-y: 28px;
  --card-pad:      18px;
}

/* ===== Base reset ===== */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 400;
  color: var(--ink);
  background: var(--page-bg);
  line-height: 1.55;
  font-feature-settings: "ss01", "ss02", "kern", "liga";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
}

/* ===== Masthead ===== */
.masthead {
  max-width: 1280px;
  margin: 0 auto;
  padding: 36px 0 28px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 36px;
}
.masthead__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}
.masthead__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.masthead__rule {
  display: inline-block;
  width: 32px;
  height: 2px;
  background: var(--accent);
}
.masthead__kicker {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-65);
  font-weight: 600;
}
.masthead__kicker-link {
  color: var(--ink-65);
  text-decoration: none;
  border-bottom: 1px solid var(--ink-30);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.masthead__kicker-link:hover {
  color: var(--ink);
  border-bottom-color: var(--ink-50);
}
.masthead__kicker-dot { color: var(--ink-30); margin: 0 4px; }

.masthead__title {
  font-family: var(--serif);
  font-size: 52px;
  line-height: 1.08;
  font-weight: 500;
  letter-spacing: -0.022em;
  color: var(--ink);
  max-width: 28ch;
  text-wrap: balance;
  margin: 0 0 14px 0;
}
.masthead__amp {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}
.masthead__sub {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.5;
  color: var(--ink-65);
  max-width: 70ch;
  margin: 0 0 22px 0;
  font-weight: 400;
  text-wrap: pretty;
}
.masthead__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-65);
}
.masthead__meta strong { color: var(--ink); font-weight: 600; }
.masthead__byline a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--ink-30); }
.masthead__dot { color: var(--ink-30); }

/* ===== Status row ===== */
.status-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-bottom: var(--section-pad-y);
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
}
.status-card {
  padding: var(--card-pad);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.status-card:last-child { border-right: none; }
.status-card__eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.status-card__num {
  font-family: var(--serif);
  font-size: 64px;
  font-weight: 500;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1;
}
.status-card__lede {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink);
  margin: 0;
  text-wrap: pretty;
  font-weight: 400;
}
.status-card__detail {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-65);
  margin: 0;
}
.status-card__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px dashed var(--rule);
  font-size: 12px;
}
.status-card__rule {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 6px 0;
}
.status-card__num--sm {
  font-size: 48px;
}
[data-density="compact"] .status-card__num--sm { font-size: 40px; }

/* ===== Map legend row ===== */
.map-legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: var(--ink-65);
  margin: 10px 0 24px 0;
}
.map-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.map-legend-line {
  display: inline-block;
  width: 24px;
  height: 2px;
}
.map-legend-line--fg {
  height: 3px;
  background: #2a5e5f;
}

/* ===== Chart callout ===== */
.chart-callout {
  margin: 16px 0 0 0;
  padding: 14px 18px;
  border-left: 3px solid var(--warn, #d4a017);
  background: var(--panel-bg);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-65);
  max-width: 760px;
}
.chart-callout__flag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--warn, #d4a017);
  border: 1px solid currentColor;
  border-radius: 2px;
  padding: 1px 5px;
  margin-right: 8px;
  vertical-align: middle;
}

/* Trend indicators */
.trend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.trend--up   { color: var(--ok); }
.trend--down { color: var(--warn); }
.trend--flat { color: var(--ink-50); }

/* Link button */
.link {
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  border: none;
}
.link:hover { color: var(--accent-strong); }

/* ===== Section headers ===== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.section-header > div:first-child { min-width: 0; flex: 1; }
.section-header h3 {
  font-size: 26px;
  margin: 0 0 6px 0;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.section-header p {
  font-size: 14px;
  color: var(--ink-65);
  margin: 0;
  max-width: 70ch;
  line-height: 1.55;
  text-wrap: pretty;
}

/* ===== Segmented control ===== */
.seg {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  align-self: flex-start;
}
.seg__btn {
  background: var(--panel-bg);
  border: none;
  border-right: 1px solid var(--rule);
  padding: 8px 14px;
  font-size: 12px;
  color: var(--ink-65);
  letter-spacing: 0.02em;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  font-family: var(--sans);
}
.seg__btn:last-child { border-right: none; }
.seg__btn:hover { color: var(--ink); background: var(--ink-04); }
.seg__btn.is-active {
  background: var(--ink);
  color: var(--page-bg);
  font-weight: 600;
}

/* ===== Placeholder notice ===== */
.placeholder-notice {
  max-width: 1280px;
  margin: 48px auto;
  padding: 24px 28px;
  border: 1px dashed var(--rule-strong);
  background: var(--panel-bg);
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-65);
  font-size: 15px;
}
.placeholder-notice strong {
  font-style: normal;
  color: var(--ink);
}

/* ===== Density overrides ===== */
[data-density="compact"] .masthead__title { font-size: 40px; max-width: 32ch; }
[data-density="compact"] .masthead__sub   { font-size: 17px; margin-bottom: 14px; }
[data-density="compact"] .status-card__num { font-size: 48px; }
[data-density="compact"] .status-card__lede { font-size: 16px; }
[data-density="compact"] .section-header h3 { font-size: 22px; }

/* ===== Status-row column count variants ===== */
.status-row--4col { grid-template-columns: repeat(4, 1fr); }
.status-row--2col { grid-template-columns: repeat(2, 1fr); max-width: 860px; }

/* ===== Operator comparison table ===== */
.comparison-table {
  width: 100%;
  max-width: 1280px;
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 6px;
}
.comparison-table caption {
  text-align: left;
  font-size: 12px;
  color: var(--ink-50);
  margin-bottom: 8px;
  caption-side: bottom;
  padding-top: 8px;
}
.comparison-table th {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-65);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--rule-strong);
  white-space: nowrap;
}
.comparison-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  color: var(--ink);
  line-height: 1.35;
}
.comparison-table tr:last-child td { border-bottom: none; }
.comparison-table .col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.comparison-table .col-name { font-weight: 600; }
.comparison-table .col-type {
  color: var(--ink-65);
  font-size: 12px;
  margin-top: 2px;
}

/* ===== Coverage gaps callout grid ===== */
.callout-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  max-width: 1280px;
  margin-top: var(--section-pad-y);
}
.callout-cell {
  background: var(--panel-bg);
  padding: var(--card-pad);
}
.callout-cell__eyebrow {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 10px 0;
}
.callout-cell__body {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0;
  text-wrap: pretty;
}

/* ===== Observable Framework overrides ===== */
/* Keep Framework's nav/sidebar; override its body font and color tokens to match our system */
:root {
  --theme-foreground: var(--ink);
  --theme-background: var(--page-bg);
}
