/* ── Variables ────────────────────────────────────────────────── */
:root {
  --brand:        #1b4332;
  --brand-mid:    #2d6a4f;
  --brand-light:  #52b788;
  --accent:       #b5890a;
  --accent-light: #e9c46a;
  --bg:           #f7f5f0;
  --surface:      #ffffff;
  --surface-alt:  #f0ede6;
  --border:       #ddd9d0;
  --text:         #1c1c1a;
  --text-mid:     #4a4845;
  --text-muted:   #7a776f;
  --radius:       6px;
  --shadow:       0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
  --shadow-sm:    0 1px 3px rgba(0,0,0,.07);
  --max-w:        1160px;
  --section-pad:  2rem 1rem;  /* mobile-first */
}

@media (min-width: 700px) {
  :root { --section-pad: 4rem 1.5rem; }
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }

a { color: var(--brand-mid); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--brand); }

ul { list-style: none; }

/* ── Typography ───────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  line-height: 1.25;
  font-weight: 600;
  color: var(--text);
}

h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: .5rem; }
h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: .25rem; color: var(--text); }
h4 { font-size: .9rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: .6rem; }

/* ── Header ───────────────────────────────────────────────────── */
.site-header {
  background: var(--brand);
  color: #fff;
  padding: 0;
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 1.5rem;
}

.header-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0;
}

.wordmark h1 {
  font-family: 'Lora', Georgia, serif;
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  font-weight: 600;
  color: #fff;
  letter-spacing: -.01em;
  line-height: 1;
}

.wordmark-sub {
  font-size: .82rem;
  color: rgba(255,255,255,.65);
  margin-top: .35rem;
  letter-spacing: .02em;
}

.header-label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.5);
  flex-shrink: 0;
  padding-bottom: .2rem;
}

/* ── Stat Strip (wrapper below nav) ──────────────────────────── */
.stat-strip {
  background: var(--brand);
}

.stat-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}

/* ── Stat Bar ─────────────────────────────────────────────────── */
.stat-bar {
  display: flex;
  gap: 0;
  border-top: 1px solid rgba(255,255,255,.12);
  overflow-x: auto;
  scrollbar-width: none;
}
.stat-bar::-webkit-scrollbar { display: none; }

.stat-item {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.5rem 1.1rem;
  border-right: 1px solid rgba(255,255,255,.1);
  flex: 1 0 auto;
  min-width: 120px;
}
.stat-item:last-child { border-right: none; }

.stat-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: rgba(255,255,255,.55);
  margin-bottom: .3rem;
}

.stat-value {
  font-size: 1.45rem;
  font-family: 'Lora', Georgia, serif;
  font-weight: 600;
  color: #fff;
  line-height: 1.1;
}

/* ── Section Nav ──────────────────────────────────────────────── */
.section-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--brand);
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0;
}

/* Desktop: hamburger hidden, links visible inline */
.nav-hamburger { display: none; }

.nav-links {
  display: flex;
  gap: 0;
}

.nav-link {
  display: block;
  padding: .75rem 1.25rem;
  font-size: .82rem;
  font-weight: 500;
  letter-spacing: .03em;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.nav-link:hover,
.nav-link.active {
  color: #fff;
  border-bottom-color: var(--accent-light);
}

/* ── Data Sections ────────────────────────────────────────────── */
.data-section {
  padding: var(--section-pad);
  background: var(--bg);
}
.data-section.alt-bg {
  background: var(--surface);
}

.section-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}

.section-header {
  margin-bottom: 2.5rem;
  max-width: 680px;
}

.section-lede {
  font-size: 1rem;
  color: var(--text-mid);
  line-height: 1.7;
  margin-top: .6rem;
}

/* ── Charts Grid ──────────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

@media (max-width: 700px) {
  .charts-grid { grid-template-columns: 1fr; }
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.alt-bg .chart-card {
  background: var(--bg);
}

.chart-card h3 {
  color: var(--text);
  font-size: .95rem;
  margin-bottom: .15rem;
}

.chart-note {
  font-size: .75rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

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

@media (min-width: 600px) {
  .chart-wrap { height: 260px; }
}

.chart-wrap--donut {
  height: 180px;
}

@media (min-width: 600px) {
  .chart-wrap--donut { height: 200px; }
}

/* ── Inline Stats ─────────────────────────────────────────────── */
.inline-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.alt-bg .inline-stats {
  background: var(--bg);
}

.inline-stat {
  flex: 1 0 160px;
  padding: 1.25rem 1.5rem;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.inline-stat:last-child { border-right: none; }

.is-value {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--brand);
  line-height: 1.1;
}

.is-label {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .25rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Chart Legend ─────────────────────────────────────────────── */
.chart-legend {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.chart-legend li {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
  color: var(--text-mid);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-pct {
  margin-left: auto;
  font-weight: 600;
  color: var(--text);
  font-size: .82rem;
}

/* ── Schools ──────────────────────────────────────────────────── */
.schools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.school-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.school-card-header {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: 1rem;
}

.school-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  flex-shrink: 0;
  margin-top: .1rem;
}

.school-name {
  font-family: 'Lora', Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.school-grades {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: .2rem;
}

.school-stats {
  display: flex;
  gap: 1.5rem;
}

.school-stat {
  display: flex;
  flex-direction: column;
}

.school-stat-val {
  font-size: 1.25rem;
  font-family: 'Lora', Georgia, serif;
  font-weight: 600;
  color: var(--brand);
}

.school-stat-lbl {
  font-size: .72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.loading-msg {
  font-size: .9rem;
  color: var(--text-muted);
  padding: 2rem 0;
}

.error-msg {
  font-size: .9rem;
  color: #8b1a1a;
  padding: 2rem 0;
}

/* ── School cards — extra detail rows ────────────────────────── */
.school-detail-row {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .5rem;
  line-height: 1.5;
}

.school-nces-link {
  color: var(--brand-mid);
  text-decoration: none;
  font-size: .8rem;
}
.school-nces-link:hover { text-decoration: underline; }

/* ── Full-width chart grid variant ───────────────────────────── */
.charts-grid--full {
  grid-template-columns: 1fr;
  margin-top: 1.25rem;
}

/* ── School detail page (schools.php) ────────────────────────── */
.sdc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.sdc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.sdc-card-header {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.sdc-icon {
  width: 44px;
  height: 44px;
  font-size: .75rem;
  flex-shrink: 0;
}

.sdc-card-title .school-name { font-size: 1.05rem; }

.sdc-level-badge {
  display: inline-block;
  margin-top: .3rem;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--brand-mid);
}

.sdc-stat-row {
  display: flex;
  gap: 2rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.sdc-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}

.sdc-info-table tr + tr td,
.sdc-info-table tr + tr th {
  padding-top: .4rem;
}

.sdc-info-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 400;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
  padding-right: 1rem;
  vertical-align: top;
  padding-top: .1rem;
}

.sdc-info-table td {
  color: var(--text);
  vertical-align: top;
}

.sdc-ext-link {
  color: var(--brand-mid);
  text-decoration: none;
}
.sdc-ext-link:hover { text-decoration: underline; }

.sdc-back-link {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.sdc-back-link a {
  color: var(--brand-mid);
  font-size: .9rem;
}

/* ── Community Grid ───────────────────────────────────────────── */
.community-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 700px) {
  .community-grid { grid-template-columns: 1fr; }
}

.community-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.community-card h3 {
  font-size: 1rem;
  color: var(--brand);
  margin-bottom: .6rem;
}

.community-card p {
  font-size: .9rem;
  color: var(--text-mid);
  line-height: 1.7;
}

/* ── Data Note ────────────────────────────────────────────────── */
.data-note {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 1.25rem;
  line-height: 1.6;
  max-width: 700px;
}

/* ── Footer ───────────────────────────────────────────────────── */
.site-footer {
  background: var(--brand);
  color: rgba(255,255,255,.75);
  padding: 3rem 1.5rem 0;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

@media (max-width: 700px) {
  .footer-inner { grid-template-columns: 1fr; gap: 1.5rem; }
}

.footer-col h4 {
  color: rgba(255,255,255,.45);
  margin-bottom: .75rem;
}

.footer-col p {
  font-size: .85rem;
  line-height: 1.65;
}

.footer-links li { margin-bottom: .4rem; }
.footer-links a { color: rgba(255,255,255,.7); font-size: .85rem; }
.footer-links a:hover { color: #fff; }

.footer-bottom {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.25rem 0;
  font-size: .78rem;
  color: rgba(255,255,255,.35);
}

/* ── Responsive misc ──────────────────────────────────────────── */

/* Mobile hamburger nav */
@media (max-width: 640px) {
  .nav-inner {
    justify-content: flex-end;
  }

  .nav-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: .65rem;
    background: none;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
  }

  .nav-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: rgba(255,255,255,.85);
    border-radius: 1px;
    transition: transform .2s ease, opacity .15s ease;
  }

  .nav-hamburger[aria-expanded="true"] .nav-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .nav-hamburger[aria-expanded="true"] .nav-bar:nth-child(2) {
    opacity: 0;
  }
  .nav-hamburger[aria-expanded="true"] .nav-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--brand);
    border-top: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 6px 20px rgba(0,0,0,.25);
    z-index: 200;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-link {
    padding: .9rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.07);
    border-left: none;
    font-size: .9rem;
    white-space: normal;
  }

  /* Stat bar: 2-column wrap on mobile */
  .stat-bar {
    flex-wrap: wrap;
    overflow-x: visible;
  }
  .stat-item {
    flex: 1 0 calc(50% - .5px);
    min-width: 0;
  }
  .stat-item:nth-child(even) {
    border-right: none;
  }
}

@media (max-width: 500px) {
  .header-top { flex-direction: column; align-items: flex-start; }
  .header-label { display: none; }
  .inline-stat { flex: 1 0 140px; }
}

/* ── Overview card grid (index.php landing page) ──────────────── */
.overview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (min-width: 560px) {
  .overview-grid { grid-template-columns: 1fr 1fr; gap: 1.25rem; }
}

@media (min-width: 900px) {
  .overview-grid { grid-template-columns: 1fr 1fr 1fr; }
}

.overview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.overview-card-eyebrow {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--brand-light);
  margin-bottom: .3rem;
}

.overview-card-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .85rem;
  line-height: 1.25;
}

.overview-card-stats {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.ov-stat {
  display: flex;
  flex-direction: column;
}

.ov-stat-val {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--brand);
  line-height: 1.1;
}

.ov-stat-lbl {
  font-size: .68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: .2rem;
}

.overview-card-desc {
  font-size: .875rem;
  color: var(--text-mid);
  line-height: 1.65;
  flex: 1;
  margin-bottom: 1.1rem;
}

.overview-card-link {
  font-size: .82rem;
  font-weight: 600;
  color: var(--brand-mid);
  text-decoration: none;
  letter-spacing: .02em;
  margin-top: auto;
}
.overview-card-link:hover { text-decoration: underline; }
