/* Unified chrome for NYC Schools — Atlas of the System.
   Injected at the top of every page. The map page is dark below the header;
   explainer pages are light. The header itself is dark on every page.

   This file is intentionally opinionated. It overrides satellite styles
   so every page reads as one site: same typography, same color tokens,
   same paragraph rhythm, same component treatments. */

/* ----------- Tokens ----------- */
:root {
  --site-ink:        #0c0f14;
  --site-ink-2:      #161a22;
  --site-line:       #2a2f3c;
  --site-text:       #e8ecf3;
  --site-muted:      #9099ab;

  /* Paper (explainer) palette */
  --site-paper:      #faf7f1;
  --site-paper-2:    #f1eadb;
  --site-paper-ink:  #050507;
  --site-paper-soft: #2a2a2a;
  --site-paper-muted:#5d5f66;
  --site-paper-line: #e3dccc;
  --site-paper-line-soft: #ede5d2;

  /* Single shared accent palette (replaces vc-*, etc.) */
  --site-accent:     #ff7c53;  /* orange */
  --site-blue:       #217ebe;  /* cerulean */
  --site-green:      #57aa4a;  /* good green */
  --site-pink:       #e7466d;  /* magenta */
  --site-chartreuse: #b8c12a;  /* darker than #dde44c for readability on light bg */
  --site-purple:     #6a4ec9;
  --site-red:        #d2232a;

  --section-accent:  var(--site-accent);
}

/* ----------- Header / nav ----------- */
.site-header {
  background: var(--site-ink);
  color: var(--site-text);
  border-bottom: 1px solid var(--site-line);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  position: relative;
  z-index: 100;
}
.site-header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  max-width: 1400px;
  margin: 0 auto;
}
.site-brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  flex: none;
  min-width: 0;
}
.site-brand .mark {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.015em;
  line-height: 1.05;
  color: var(--site-text);
}
.site-brand .mark em {
  font-style: normal;
  font-weight: 400;
  color: var(--site-accent);
}
.site-brand .tag {
  color: var(--site-muted);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 3px;
}
.site-nav {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  color: var(--site-muted);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
  transition: color .15s, background .15s;
  border-bottom: 0 !important;
}
.site-nav a:hover { color: var(--site-text); background: var(--site-ink-2); }
.site-nav a.active {
  color: var(--site-ink);
  background: var(--site-text);
  font-weight: 500;
}
.site-section-bar {
  height: 3px;
  background: var(--section-accent, var(--site-accent));
}

/* ----------- Footer ----------- */
.site-footer {
  background: var(--site-ink);
  color: var(--site-muted);
  border-top: 1px solid var(--site-line);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  padding: 24px;
  text-align: center;
  line-height: 1.6;
}
.site-footer a {
  color: var(--site-text);
  text-decoration: none;
  border-bottom: 1px solid var(--site-line);
}
.site-footer a:hover { color: var(--site-accent); border-color: var(--site-accent); }
.site-footer .footer-line + .footer-line { margin-top: 4px; }

/* ============================================================
   EXPLAINER BASE — applies to every non-map page via data-section.
   These rules use high specificity ([data-section]) so satellite
   styles inherit consistent typography and color without per-page
   edits.
   ============================================================ */

body[data-section]:not([data-section="map"]) {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  background: var(--site-paper) !important;
  color: var(--site-paper-ink) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body[data-section]:not([data-section="map"]) h1,
body[data-section]:not([data-section="map"]) h2,
body[data-section]:not([data-section="map"]) h3,
body[data-section]:not([data-section="map"]) h4 {
  font-family: 'Fraunces', Georgia, serif !important;
  letter-spacing: -0.012em !important;
  line-height: 1.15 !important;
  color: var(--site-paper-ink) !important;
  font-weight: 700 !important;
}
body[data-section]:not([data-section="map"]) h1 {
  font-size: clamp(30px, 4.4vw, 44px) !important;
  font-weight: 700 !important;
  margin: 0 0 10px !important;
}
body[data-section]:not([data-section="map"]) h2 {
  font-size: clamp(22px, 2.6vw, 28px) !important;
  font-weight: 600 !important;
  margin: 2em 0 0.5em !important;
}
body[data-section]:not([data-section="map"]) h3 {
  font-size: 18px !important;
  font-weight: 600 !important;
  margin: 1.4em 0 0.5em !important;
}
body[data-section]:not([data-section="map"]) h4 {
  font-size: 15px !important;
  font-weight: 600 !important;
  margin: 1em 0 0.4em !important;
}

body[data-section]:not([data-section="map"]) p {
  margin: 0.9em 0 !important;
  max-width: 72ch;
}
body[data-section]:not([data-section="map"]) main a,
body[data-section]:not([data-section="map"]) .container a,
body[data-section]:not([data-section="map"]) .callout a,
body[data-section]:not([data-section="map"]) .source-block a,
body[data-section]:not([data-section="map"]) p a,
body[data-section]:not([data-section="map"]) li a,
body[data-section]:not([data-section="map"]) td a {
  color: var(--site-paper-ink);
  text-decoration: none;
  border-bottom: 1px solid var(--site-paper-line);
  transition: color .15s, border-color .15s;
}
body[data-section]:not([data-section="map"]) main a:hover,
body[data-section]:not([data-section="map"]) .container a:hover,
body[data-section]:not([data-section="map"]) p a:hover,
body[data-section]:not([data-section="map"]) li a:hover {
  color: var(--site-accent);
  border-color: var(--site-accent);
}
body[data-section] .site-header .site-nav a,
body[data-section] .site-header .site-brand,
body[data-section] .site-footer a {
  border-bottom: 0 !important;
}
body[data-section]:not([data-section="map"]) hr {
  border: 0;
  border-top: 1px solid var(--site-paper-line);
  margin: 2.4em 0;
}
body[data-section]:not([data-section="map"]) ul,
body[data-section]:not([data-section="map"]) ol {
  padding-left: 22px;
  margin: 0.9em 0;
}
body[data-section]:not([data-section="map"]) li {
  margin: 0.3em 0;
  line-height: 1.55;
}
body[data-section]:not([data-section="map"]) code {
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 0.92em;
  background: var(--site-paper-2);
  padding: 1px 6px;
  border-radius: 3px;
}

/* The container most satellite pages already use */
body[data-section]:not([data-section="map"]) .container {
  max-width: 880px !important;
  margin: 0 auto !important;
  padding: 48px 28px 80px !important;
}
body[data-section]:not([data-section="map"]) .container.wide {
  max-width: 1180px !important;
}

/* Article header conventions */
body[data-section]:not([data-section="map"]) .kicker,
body[data-section]:not([data-section="map"]) header .kicker {
  font-family: 'Inter', system-ui, sans-serif !important;
  font-size: 11.5px !important;
  letter-spacing: 0.14em !important;
  text-transform: uppercase !important;
  color: var(--section-accent, var(--site-accent)) !important;
  font-weight: 600 !important;
  margin: 0 0 12px !important;
}
body[data-section]:not([data-section="map"]) .subtitle,
body[data-section]:not([data-section="map"]) .dek,
body[data-section]:not([data-section="map"]) header .subtitle,
body[data-section]:not([data-section="map"]) header .dek {
  font-family: 'Fraunces', Georgia, serif !important;
  font-style: normal !important;
  font-size: 20px !important;
  font-weight: 400 !important;
  color: var(--site-paper-muted) !important;
  line-height: 1.4 !important;
  margin: 6px 0 28px !important;
  max-width: 720px;
}
body[data-section]:not([data-section="map"]) header {
  padding: 0 0 24px !important;
  margin: 0 0 32px !important;
  border-bottom: 1px solid var(--site-paper-line) !important;
}

/* Metric cards */
body[data-section]:not([data-section="map"]) .metrics {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
  gap: 12px !important;
  margin: 28px 0 !important;
}
body[data-section]:not([data-section="map"]) .metric {
  background: #fff !important;
  border: 1px solid var(--site-paper-line) !important;
  border-left: 3px solid var(--section-accent, var(--site-accent)) !important;
  padding: 18px 20px !important;
  border-radius: 0 !important;
}
body[data-section]:not([data-section="map"]) .metric .value {
  font-family: 'Fraunces', Georgia, serif !important;
  font-size: 30px !important;
  font-weight: 700 !important;
  line-height: 1.05 !important;
  color: var(--site-paper-ink) !important;
  letter-spacing: -0.015em !important;
}
body[data-section]:not([data-section="map"]) .metric .label {
  font-family: 'Inter', sans-serif !important;
  font-size: 12px !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  color: var(--site-paper-muted) !important;
  margin-top: 8px !important;
  line-height: 1.4 !important;
  font-weight: 500 !important;
}

/* Chart cards */
body[data-section]:not([data-section="map"]) .chart-box,
body[data-section]:not([data-section="map"]) .chart-card {
  background: #fff !important;
  border: 1px solid var(--site-paper-line) !important;
  border-radius: 0 !important;
  padding: 22px 22px 18px !important;
  margin: 16px 0 !important;
}
body[data-section]:not([data-section="map"]) .chart-title {
  font-family: 'Fraunces', Georgia, serif !important;
  font-size: 17px !important;
  font-weight: 600 !important;
  margin: 0 0 4px !important;
  color: var(--site-paper-ink) !important;
}
body[data-section]:not([data-section="map"]) .chart-note {
  font-family: 'Inter', sans-serif !important;
  font-size: 13px !important;
  color: var(--site-paper-muted) !important;
  margin: 0 0 16px !important;
  line-height: 1.5 !important;
  max-width: none !important;
}

/* Callouts */
body[data-section]:not([data-section="map"]) .callout {
  background: var(--site-paper-2) !important;
  border-left: 3px solid var(--section-accent, var(--site-accent)) !important;
  padding: 16px 20px !important;
  margin: 18px 0 !important;
  font-size: 14.5px !important;
  line-height: 1.55 !important;
  font-family: 'Inter', sans-serif !important;
  color: var(--site-paper-soft) !important;
  border-radius: 0 !important;
}
body[data-section]:not([data-section="map"]) .callout strong { font-weight: 600 !important; color: var(--site-paper-ink) !important; }

/* Tables */
body[data-section]:not([data-section="map"]) table {
  width: 100% !important;
  border-collapse: collapse !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 14px !important;
  margin: 12px 0 !important;
}
body[data-section]:not([data-section="map"]) th,
body[data-section]:not([data-section="map"]) td {
  text-align: left;
  padding: 10px 12px !important;
  border-bottom: 1px solid var(--site-paper-line) !important;
  font-weight: 400;
}
body[data-section]:not([data-section="map"]) th {
  font-size: 11px !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  color: var(--site-paper-muted) !important;
  font-weight: 600 !important;
  background: var(--site-paper-line-soft) !important;
}
body[data-section]:not([data-section="map"]) td.num,
body[data-section]:not([data-section="map"]) .num {
  font-variant-numeric: tabular-nums;
}

/* Footer-within-explainer (some satellites have their own page footer) */
body[data-section]:not([data-section="map"]) .container > footer {
  margin-top: 60px !important;
  padding: 20px 0 !important;
  border-top: 1px solid var(--site-paper-line) !important;
  font-size: 12.5px !important;
  color: var(--site-paper-muted) !important;
  background: none !important;
}

/* The site footer (dark, full-width) overrides the above when at body level */
.site-footer { font-family: 'Inter', sans-serif !important; }

/* Recharts inherit fonts via SVG text */
body[data-section]:not([data-section="map"]) .recharts-wrapper text {
  font-family: 'Inter', system-ui, sans-serif !important;
  font-size: 12px;
}

/* Section accent colors per page */
body[data-section="enrollment"]  { --section-accent: var(--site-blue); }
body[data-section="spending"]    { --section-accent: var(--site-green); }
body[data-section="special-ed"]  { --section-accent: var(--site-pink); }
body[data-section="school-day"]  { --section-accent: var(--site-chartreuse); }
body[data-section="curriculum"]  { --section-accent: var(--site-purple); }
body[data-section="about"]       { --section-accent: var(--site-accent); }

/* Optional: kill any orange-bar decorations satellites added that
   conflict with the new section bar */
body[data-section]:not([data-section="map"]) .decorative-bar { display: none !important; }

/* Mobile */
@media (max-width: 720px) {
  .site-brand .tag { display: none; }
  .site-header-inner { padding: 12px 16px; gap: 12px; }
  body[data-section]:not([data-section="map"]) .container { padding: 28px 18px 60px !important; }
  body[data-section]:not([data-section="map"]) .metrics { grid-template-columns: 1fr 1fr !important; }
}
