@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@300;400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #0A0A0A;
  --surface:      #141414;
  --border:       #222222;
  --accent:       #AAFF00;
  --accent-muted: #7ABF00;
  --text:         #FFFFFF;
  --text-sec:     #888888;
  --text-muted:   #555555;
  --danger:       #FF4444;
  --warning:      #FFAA00;
  --success:      #44FF88;
  --font-mono:    'IBM Plex Mono', monospace;
  --font-sans:    'IBM Plex Sans', sans-serif;
}

html { font-size: 14px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── NAV ── */
.nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0 2rem;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav__brand {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-decoration: none;
  flex-shrink: 0;
}

.nav__links { display: flex; gap: 0.25rem; flex: 1; }

.nav__link {
  color: var(--text-sec);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.nav__link:hover,
.nav__link.active { color: var(--text); background: #1e1e1e; }
.nav__link.active { color: var(--accent); }

.nav__meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── PAGE CHROME ── */
.page { padding: 1.5rem 2rem 3rem; max-width: 1440px; margin: 0 auto; }

.page__header { margin-bottom: 1.5rem; }
.page__title  { font-size: 1.25rem; font-weight: 600; }
.page__sub    { color: var(--text-sec); font-size: 0.85rem; margin-top: 0.25rem; }

/* ── CORRIDOR SELECTOR ── */
.corridor-select {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.corridor-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-sec);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.4rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.corridor-btn:hover { border-color: var(--text-muted); color: var(--text); }
.corridor-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(170,255,0,0.06); }

/* ── STAT CARDS ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
}
.stat-card__label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}
.stat-card__value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}
.stat-card__delta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  margin-top: 0.35rem;
}
.delta-up   { color: var(--success); }
.delta-down { color: var(--danger); }
.delta-flat { color: var(--text-muted); }

/* ── CHART CARDS ── */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 900px) { .chart-grid { grid-template-columns: 1fr; } }

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
}
.chart-card--full { grid-column: 1 / -1; }

.chart-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.chart-card__title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.chart-card__actions { display: flex; gap: 0.5rem; }

.type-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}
.type-toggle.active,
.type-toggle:hover { border-color: var(--accent); color: var(--accent); }

.chart-wrap { position: relative; height: 220px; }

/* ── MAP CARD ── */
.map-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 1rem;
  overflow: hidden;
}
.map-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.map-card__title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
#map { height: 380px; }

/* Override Leaflet dark tiles */
.leaflet-container { background: #0f0f0f; }
.leaflet-popup-content-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}
.leaflet-popup-tip { background: var(--surface); }
.leaflet-popup-content { font-family: var(--font-sans); font-size: 0.8rem; }

/* ── TABLE ── */
.data-table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.data-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.data-table th:hover { color: var(--text-sec); }
.data-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #1a1a1a;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  white-space: nowrap;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.025); }

/* ── STATUS BADGES ── */
.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge--live       { background: rgba(68,255,136,0.15); color: var(--success); }
.badge--partial    { background: rgba(255,170,0,0.15);  color: var(--warning); }
.badge--pending    { background: rgba(85,85,85,0.3);    color: var(--text-muted); }
.badge--launched   { background: rgba(170,255,0,0.12);  color: var(--accent); }
.badge--announced  { background: rgba(255,170,0,0.12);  color: var(--warning); }
.badge--construction { background: rgba(68,255,136,0.1); color: var(--success); }

/* ── DEMAND SCORE BAR ── */
.demand-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.demand-bar__track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.demand-bar__fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}
.demand-bar__label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-sec);
  width: 2.5rem;
  text-align: right;
  flex-shrink: 0;
}

/* ── SKELETON LOADING ── */
.skeleton {
  background: linear-gradient(90deg, #1a1a1a 25%, #222 50%, #1a1a1a 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton--text  { height: 1em; margin-bottom: 0.4em; }
.skeleton--value { height: 2em; width: 60%; }
.skeleton--chart { height: 220px; }
.skeleton--map   { height: 380px; }

/* ── EMPTY STATE ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  gap: 0.5rem;
}
.empty-state__icon { font-size: 2rem; opacity: 0.4; }

/* ── FILTER BAR ── */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}
.filter-select, .filter-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.15s;
}
.filter-select:focus,
.filter-input:focus { border-color: var(--text-muted); }
.filter-select option { background: var(--surface); }

/* ── METHODOLOGY PAGE ── */
.method-section { margin-bottom: 2rem; }
.method-section h2 { font-size: 0.95rem; font-weight: 600; margin-bottom: 1rem; color: var(--accent); }
.method-note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-muted);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  font-size: 0.82rem;
  color: var(--text-sec);
  line-height: 1.6;
  margin-bottom: 1rem;
}
.formula-block {
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  line-height: 1.8;
  overflow-x: auto;
  white-space: pre;
}

/* ── DISTRICT DETAIL ── */
.district-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.district-header h1 { font-size: 1.4rem; font-weight: 600; }
.district-header__state { font-size: 0.82rem; color: var(--text-muted); font-family: var(--font-mono); }

.score-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.score-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.9rem 1rem;
}
.score-item__label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.4rem; }
.score-item__value { font-family: var(--font-mono); font-size: 1.1rem; font-weight: 600; }

/* ── PIPELINE CALENDAR ── */
.calendar-strip {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}
.cal-month {
  min-width: 120px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.6rem 0.75rem;
}
.cal-month__label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.5rem; }
.cal-month__items { display: flex; flex-direction: column; gap: 0.25rem; }
.cal-item { font-size: 0.72rem; color: var(--text-sec); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-item::before { content: '·'; color: var(--accent); margin-right: 0.35rem; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .page { padding: 1rem; }
  .nav  { padding: 0 1rem; gap: 1rem; }
  .nav__links { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ── UTILS ── */
.mono { font-family: var(--font-mono); }
.text-accent { color: var(--accent); }
.text-sec   { color: var(--text-sec); }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warn  { color: var(--warning); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.caveat { font-size: 0.72rem; color: var(--text-muted); font-style: italic; margin-top: 0.5rem; }
