:root {
  --bg: #0B0F14;
  --panel: #141A20;
  --cream: #F7F4EE;
  --muted: #9AA3AD;
  --sage: #3D6B5A;
  --sage2: #8FBFA9;
  --line: #1e262e;
  --radius: 12px;
  --gold: #E6D5A3;
  --low: #1a3d32;
  --mid: #3D6B5A;
  --high: #8FBFA9;
  --vt-maroon: #861F41;
  --vt-orange: #E87722;
  --accent: var(--sage);
  --accent2: var(--sage2);
  --team-primary: var(--sage);
  --team-secondary: var(--sage2);
}
body.vt-active {
  --accent: var(--vt-maroon);
  --accent2: var(--vt-orange);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body {
  margin: 0; min-height: 100%;
  background: var(--bg); color: var(--cream);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
}
html.embed, html.embed body { height: 100%; overflow: hidden; }
a { color: var(--sage2); text-decoration: none; }
a:hover { color: var(--cream); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

header.app-bar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px;
  background: rgba(11,15,20,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
body.vt-active header.app-bar {
  border-bottom-color: rgba(134,31,65,.55);
  box-shadow: 0 1px 0 rgba(232,119,34,.25);
}
header.app-bar img.wordmark { height: 32px; width: auto; display: block; }
header.app-bar .sub {
  color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
}
.vt-badge {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase;
  color: var(--vt-orange);
  background: rgba(134,31,65,.28);
  border: 1px solid rgba(232,119,34,.45);
  padding: 4px 9px; border-radius: 999px;
}
header.app-bar nav { margin-left: auto; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
header.app-bar nav a { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
header.app-bar nav a:hover { color: var(--cream); }

.open-full { display: none; }
html.embed .open-full {
  display: inline-flex; align-items: center; gap: .35rem;
  position: fixed; top: 8px; right: 8px; z-index: 4000;
  background: var(--sage); color: var(--cream); text-decoration: none;
  font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  padding: .55rem .85rem; border-radius: 999px;
  border: 1px solid rgba(143,191,169,.35);
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
}
html.embed header.app-bar { padding-right: 9.5rem; }
html.embed header.app-bar img.wordmark { height: 22px; }
html.embed header.app-bar .sub { display: none; }
html.embed .hero, html.embed .cue, html.embed .cards, html.embed .filter-strip, html.embed .page-foot { display: none; }
html.embed .workspace { height: calc(100vh - 52px); margin: 0; border: 0; border-radius: 0; }

.hero {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px;
  padding: 22px 22px 8px;
}
.hero-copy { max-width: 48rem; }
.hero h1 {
  margin: 0 0 6px;
  font-family: Syne, "IBM Plex Sans", sans-serif;
  font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em;
}
.hero p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.hero p strong { color: var(--cream); font-weight: 600; }
body.vt-active .hero p strong { color: var(--vt-orange); }
.hero-meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  font-size: 11.5px; color: var(--muted); text-align: right; white-space: nowrap;
}
.hero-meta .kicker {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--sage2);
}
body.vt-active .hero-meta .kicker { color: var(--vt-orange); }

.cue {
  margin: 0 22px 4px;
  padding: 10px 14px;
  background: rgba(61,107,90,.12);
  border: 1px solid rgba(143,191,169,.22);
  border-radius: 10px;
  color: var(--cream); font-size: 13px; line-height: 1.45;
}
body.vt-active .cue {
  background: rgba(134,31,65,.14);
  border-color: rgba(232,119,34,.28);
}
.cue.dim { opacity: .55; }

.cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 22px 10px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px 12px;
  min-height: 110px;
  overflow: visible;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0;
}
body.vt-active .card[data-card="program"] {
  border-color: rgba(232,119,34,.4);
  background: linear-gradient(160deg, rgba(134,31,65,.22), var(--panel) 70%);
}
.card .lbl {
  display: block;
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.card .val {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.25rem; font-weight: 500; letter-spacing: -.03em;
  color: var(--cream); line-height: 1.15;
}
.card .sub {
  display: block;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(247, 244, 238, 0.28);
  font-size: 13.5px;
  font-weight: 600;
  color: #F7F4EE;
  line-height: 1.4;
  letter-spacing: 0.01em;
  opacity: 1;
  visibility: visible;
  max-height: none;
  overflow: visible;
  white-space: normal;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}
body.vt-active .card[data-card="program"] .val { color: var(--vt-orange); }

.filter-strip {
  margin: 0 22px 14px;
  padding: 10px 14px 12px;
  /* Lighter school tint for ANY selected program (JS sets --team-primary / --team-secondary) */
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--team-primary, var(--sage)) 10%, var(--panel)),
    var(--panel) 75%
  );
  border: 1px solid color-mix(in srgb, var(--team-secondary, var(--sage2)) 26%, var(--line));
  border-left: 3px solid color-mix(in srgb, var(--team-primary, var(--sage)) 50%, transparent);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--team-secondary, var(--sage2)) 10%, transparent);
}
.filter-strip[hidden] { display: none !important; }
.filter-strip-label {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: color-mix(in srgb, var(--team-secondary, var(--sage2)) 72%, var(--muted));
  font-weight: 600; margin-bottom: 10px;
}
.filter-strip-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 16px;
}
.filter-stat .fl {
  display: block;
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 4px;
}
.filter-stat .fv {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.1rem; font-weight: 500; letter-spacing: -.02em;
  color: var(--cream); line-height: 1.2;
}
.filter-stat .fs {
  display: block;
  margin-top: 4px;
  font-size: 12.5px; font-weight: 500;
  color: #E8E4DC; line-height: 1.35;
}
@media (max-width: 980px) {
  .filter-strip { margin: 0 12px 12px; }
  .filter-strip-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .filter-strip-stats { grid-template-columns: 1fr; }
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 0;
  margin: 0 22px 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  min-height: 640px;
  background: var(--panel);
}
.rail {
  background: #10161c;
  border-right: 1px solid var(--line);
  padding: 14px 14px 20px;
  overflow-y: auto;
  max-height: 78vh;
}
.rail-sec { margin-bottom: 18px; }
.rail-lbl {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.rail-hint { font-family: "IBM Plex Mono", monospace; letter-spacing: 0; text-transform: none; font-size: 10px; color: var(--sage2); }
.field-hint { margin: 8px 0 0; font-size: 11px; color: var(--muted); line-height: 1.4; }

input[type="search"], select, .field input {
  width: 100%;
  background: #0B0F14;
  border: 1px solid var(--line);
  color: var(--cream);
  border-radius: 8px;
  padding: 9px 11px;
  font: inherit; font-size: 13px;
}
input[type="search"]:focus, select:focus {
  outline: none;
  border-color: var(--accent2);
  box-shadow: 0 0 0 2px rgba(143,191,169,.18);
}
body.vt-active input[type="search"]:focus,
body.vt-active select:focus {
  border-color: var(--vt-orange);
  box-shadow: 0 0 0 2px rgba(134,31,65,.28);
}
#team-select { margin-top: 8px; }
.team-pinned { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.team-chip {
  display: inline-flex; align-items: center;
  font-size: 11px; padding: 5px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: #0B0F14; color: var(--muted);
  cursor: pointer;
}
.team-chip:hover { color: var(--cream); border-color: var(--sage2); }
.team-chip.active {
  color: var(--cream);
  border-color: var(--accent2);
  background: rgba(61,107,90,.2);
}
.team-chip.vt {
  border-color: rgba(232,119,34,.55);
  color: var(--vt-orange);
}
.team-chip.vt.active {
  background: rgba(134,31,65,.35);
  color: var(--cream);
  border-color: var(--vt-orange);
}

.seg {
  display: flex; flex-wrap: wrap; gap: 4px;
  background: #0B0F14; border: 1px solid var(--line); border-radius: 10px; padding: 4px;
}
.seg button {
  flex: 1 1 auto;
  min-width: 44px;
  background: transparent; border: 0; color: var(--muted);
  font: inherit; font-size: 12px; font-weight: 500;
  padding: 7px 8px; border-radius: 7px; cursor: pointer;
}
.seg button:hover { color: var(--cream); }
.seg button[aria-current="true"] {
  background: var(--sage); color: var(--cream);
}
body.vt-active .seg button[aria-current="true"] {
  background: var(--vt-maroon); color: var(--cream);
}

.compare-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }

.search-results {
  list-style: none; margin: 6px 0 0; padding: 0;
  background: #0B0F14; border: 1px solid var(--line); border-radius: 8px;
  max-height: 220px; overflow-y: auto;
}
.search-results li button {
  display: block; width: 100%; text-align: left;
  background: transparent; border: 0; color: var(--cream);
  font: inherit; font-size: 12.5px; padding: 8px 10px; cursor: pointer;
}
.search-results li button:hover,
.search-results li button.active { background: rgba(61,107,90,.22); }
.search-results li button .meta { color: var(--muted); font-size: 11px; margin-left: 6px; }

.top-list {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 4px;
}
.top-list li button {
  display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center;
  width: 100%; text-align: left;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  color: var(--cream); font: inherit; font-size: 12.5px; padding: 7px 8px; cursor: pointer;
}
.top-list li button:hover { background: rgba(255,255,255,.04); border-color: var(--line); }
.top-list .rank {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--muted);
}
.top-list .n {
  font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--accent2);
}

.map-wrap {
  position: relative; min-height: 640px; background: #0d1218;
}
#map { position: absolute; inset: 0; }
.legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 500;
  background: rgba(20,26,32,.92); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; min-width: 160px;
  font-size: 11px; color: var(--muted);
  backdrop-filter: blur(6px);
}
.legend .legend-title {
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--cream); margin-bottom: 8px;
}
.legend .swatches { display: flex; height: 10px; border-radius: 4px; overflow: hidden; margin-bottom: 6px; }
.legend .swatches span { flex: 1; }
.legend .legend-scale { display: flex; justify-content: space-between; font-family: "IBM Plex Mono", monospace; font-size: 10px; }

.hover-card {
  position: absolute; z-index: 600; pointer-events: none;
  background: rgba(20,26,32,.95); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; min-width: 140px;
  font-size: 12px; color: var(--cream);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.hover-card .hc-name { font-weight: 600; margin-bottom: 2px; }
.hover-card .hc-meta { color: var(--muted); font-size: 11px; }
.hover-card .hc-n { font-family: "IBM Plex Mono", monospace; color: var(--accent2); margin-top: 4px; }

.detail-panel {
  position: absolute; top: 12px; right: 12px; z-index: 700;
  width: min(360px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  overflow: auto;
  background: rgba(20,26,32,.96);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 14px 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
  backdrop-filter: blur(8px);
}
body.vt-active .detail-panel { border-color: rgba(232,119,34,.35); }
.detail-sheet-handle { display: none; }
.detail-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  margin-bottom: 8px;
}
.detail-head h3 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.detail-geoid {
  display: block; margin-top: 2px;
  font-family: "IBM Plex Mono", monospace; font-size: 10px; color: var(--muted);
}
.detail-close {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  width: 32px; height: 32px; border-radius: 8px; font-size: 18px; cursor: pointer;
}
.detail-close:hover { color: var(--cream); border-color: var(--muted); }
.detail-means {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.35rem; color: var(--accent2); margin-bottom: 4px;
}
.detail-cue { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.detail-rows { display: flex; flex-direction: column; gap: 6px; }
.player-row {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 10px;
  padding: 8px 10px; border-radius: 8px;
  background: #0B0F14; border: 1px solid var(--line);
}
.player-row .pname { font-size: 13px; font-weight: 500; }
.player-row .pmeta { font-size: 11px; color: var(--muted); grid-column: 1 / -1; }
.player-row .pyear {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--accent2);
}

.page-foot {
  padding: 8px 22px 36px;
  color: var(--muted); font-size: 12px; line-height: 1.55;
  display: flex; flex-direction: column; gap: 10px;
}
.page-foot b { color: var(--cream); font-weight: 600; }
.page-foot code {
  font-family: "IBM Plex Mono", monospace; font-size: 11px;
  background: rgba(255,255,255,.04); padding: 1px 5px; border-radius: 4px;
}

.page-foot ul.sources {
  margin: 6px 0 0;
  padding-left: 1.15rem;
  list-style: disc;
}
.page-foot ul.sources li {
  margin: 0.35rem 0;
}
.page-foot ul.sources a {
  color: var(--sage2);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.page-foot ul.sources a:hover { color: var(--cream); }


/* Color swatches (pinned chips, search, compare A/B, legend) */
.chip-swatch {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle; flex-shrink: 0;
}
.compare-lbl {
  display: inline-flex; align-items: center; gap: 0;
}
.compare-swatch {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle;
  border: 1px solid rgba(247,244,238,.25);
}
.legend-ab {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 11px; color: var(--cream);
}
.legend-ab-item {
  display: inline-flex; align-items: center;
  color: var(--muted);
}
.search-results li button .chip-swatch { flex-shrink: 0; }




/* Layers box + satellite chip (Henrico / CU atlas pattern) */
.satellite-chip {
  position: absolute; z-index: 520; left: 12px; top: 12px;
  appearance: none;
  border: 1px solid rgba(143,191,169,.55);
  border-radius: 999px;
  background: rgba(11,15,20,.9);
  color: var(--cream);
  cursor: pointer;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  padding: 7px 11px;
  box-shadow: 0 4px 14px rgba(0,0,0,.24);
}
.satellite-chip span { color: var(--sage2); margin-right: 4px; }
.satellite-chip:hover,
.satellite-chip.is-active {
  background: var(--sage);
  border-color: var(--sage2);
}
body.vt-active .satellite-chip.is-active,
body.vt-active .satellite-chip:hover {
  background: var(--vt-maroon);
  border-color: rgba(232,119,34,.55);
}
.satellite-chip:focus-visible {
  outline: 2px solid var(--sage2);
  outline-offset: 2px;
}

.layers-box {
  position: absolute; z-index: 520; left: 12px; top: 48px;
  pointer-events: auto;
  background: rgba(11,15,20,.9);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 176px; max-width: 220px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
}
.layers-toggle {
  appearance: none; border: 0; width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: transparent; color: var(--cream); cursor: pointer;
  font-family: "IBM Plex Sans", sans-serif;
  padding: 8px 11px 7px;
}
.layers-toggle-lbl {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 500;
}
.layers-toggle-chev {
  font-size: 10px; color: var(--muted); transition: transform .18s ease;
}
.layers-box.is-collapsed .layers-toggle-chev { transform: rotate(-90deg); }
.layers-box.is-collapsed .layers-body { display: none; }
.layers-body {
  padding: 0 10px 9px;
  border-top: 1px solid rgba(30,38,46,.85);
}
.layers-sec { margin-top: 8px; }
.layers-sec:first-child { margin-top: 7px; }
.layers-sec-lbl {
  font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--sage2); margin-bottom: 4px; font-weight: 500;
}
.layers-opt {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--cream);
  margin: 3px 0; cursor: pointer; line-height: 1.25;
  user-select: none;
}
.layers-opt input {
  accent-color: var(--team-secondary, var(--sage2));
  width: 13px; height: 13px; margin: 0; flex-shrink: 0;
  cursor: pointer;
}
.map-wrap.basemap-imagery #map { background: #1a1a1a; }
.map-wrap.basemap-topo #map { background: #c8d0c0; }
.map-wrap.basemap-dark #map { background: #0d1218; }
.map-wrap.basemap-light #map { background: #e6e6e6; }

@media (max-width: 980px) {
  .layers-box { top: auto; bottom: 56px; left: 12px; max-width: 200px; }
  .satellite-chip { top: auto; bottom: 12px; left: 12px; }
}

/* Leaflet tweaks */
.leaflet-container { background: #0d1218; font: inherit; }
.leaflet-control-zoom a {
  background: var(--panel) !important; color: var(--cream) !important;
  border-color: var(--line) !important;
}
.leaflet-control-attribution {
  background: rgba(11,15,20,.75) !important; color: var(--muted) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--sage2) !important; }

@media (max-width: 980px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace { grid-template-columns: 1fr; min-height: auto; margin: 0 12px 20px; }
  .rail { max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .map-wrap { min-height: 520px; height: 60vh; }
  .hero { flex-direction: column; align-items: flex-start; padding: 16px 14px 6px; }
  .hero-meta { align-items: flex-start; text-align: left; }
  .cue { margin: 0 14px 4px; }
  .cards { padding: 12px 14px; }
  .page-foot { padding: 8px 14px 28px; }
  .detail-panel {
    top: auto; right: 0; left: 0; bottom: 0;
    width: 100%; max-height: 48%;
    border-radius: 14px 14px 0 0;
  }
  .detail-sheet-handle {
    display: flex; justify-content: center; width: 100%;
    background: transparent; border: 0; padding: 6px 0 10px; cursor: pointer;
  }
  .detail-sheet-grip {
    width: 42px; height: 4px; border-radius: 999px; background: var(--line);
  }
}
@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr 1fr; }
  header.app-bar nav a:nth-child(n+3) { display: none; }
}


/* Per-school accents (JS sets --accent / --accent2). VT keeps featured vt-active extras. */
body.team-active header.app-bar {
  border-bottom-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
body.team-active .hero-meta .kicker { color: var(--accent2); }
body.team-active .cue {
  border-left-color: var(--accent);
}
body.team-active .card[data-card="program"] {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}
body.team-active .card[data-card="program"] .val { color: var(--accent2); }
body.team-active input[type="search"]:focus,
body.team-active select:focus {
  border-color: var(--accent2);
}
body.team-active .seg button[aria-current="true"] {
  background: var(--accent);
  color: var(--cream);
}
body.team-active .detail-panel {
  border-color: color-mix(in srgb, var(--accent2) 40%, transparent);
}
body.team-active .top-list button:hover,
body.team-active .top-list button:focus-visible {
  border-color: var(--accent2);
}
/* Featured Hokies still win when vt-active */
body.vt-active .card[data-card="program"] .val { color: var(--vt-orange); }
