/* ============================================
   SCHOOL BUDGET CLARITY
   Nassau County School District Finance Portal

   Fonts load via <link> tags in each page <head>
   (non-render-blocking) rather than CSS @import.
   ============================================ */

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

:root {
  --navy: #1A4480;
  --blue: #005EA2;
  --blue-light: #E8F0F8;
  --blue-hover: #F0F5FB;
  --gold: #E5A000;
  --gold-light: #FFF8E6;
  --gold-text: #9A6A00; /* AA-contrast gold for small text (e.g. K-6 label) */
  --success: #2E8540;
  --alert: #B50909;
  --dark: #1B1B1B;
  --text: #1B1B1B;
  --text-muted: #565C65;
  --text-hint: #6B7178;
  --border: #DFE1E2;
  --border-light: #E8EAEB;
  --bg: #FFFFFF;
  --bg-warm: #FAFAF8;
  --bg-section: #F6F8FA;
  --font-ui: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Source Serif 4", Georgia, serif;
  --font-mono: "IBM Plex Mono", "Consolas", monospace;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --max-width: 880px;
}

html {
  font-size: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a {
  color: var(--blue);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* --- Accessibility --- */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 2px;
}
.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;
}
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--navy);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
}
.skip-link:focus {
  left: 8px;
  top: 8px;
  text-decoration: none;
}

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum", "lnum";
}

/* --- Layout --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* --- Header --- */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 17px;
  color: var(--dark);
  letter-spacing: -0.3px;
  text-decoration: none;
}
.logo:hover { text-decoration: none; }
.logo .logo-accent { color: var(--navy); }
.site-nav {
  display: flex;
  gap: 1.25rem;
}
.site-nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 2px 0;
}
.site-nav a:hover { color: var(--dark); }
.site-nav a.active {
  color: var(--navy);
  border-bottom: 2px solid var(--navy);
}

/* --- Hero --- */
.hero {
  padding: 2.5rem 0 2rem;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}
.hero-eyebrow .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--navy);
  opacity: 0.4;
}
.hero h1 {
  font-family: var(--font-ui);
  font-size: 30px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  max-width: 580px;
}
.hero-deck {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 560px;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}
.hero-deck strong {
  color: var(--text);
  font-weight: 600;
}

/* --- Primary CTA --- */
.cta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--navy);
  color: #fff;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 15px;
  padding: 11px 20px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.15s;
}
.btn-primary:hover {
  background: #143268;
  text-decoration: none;
  color: #fff;
}
.btn-primary .arrow {
  font-size: 18px;
  line-height: 1;
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--blue);
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  padding: 11px 4px;
}
.btn-secondary:hover {
  text-decoration: underline;
}

/* --- Search --- */
.search-wrap {
  max-width: 440px;
  position: relative;
  margin-bottom: 0.5rem;
}
.search-input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--blue); }
.search-input::placeholder { color: var(--text-hint); }
.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-hint);
  pointer-events: none;
}

/* --- Trust Strip --- */
.trust-strip {
  background: var(--bg-section);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  padding: 0.875rem 0;
  margin-bottom: 2rem;
}
.trust-strip .container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.trust-item {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}
.trust-item .num {
  color: var(--dark);
  font-weight: 600;
  font-size: 14px;
}
.trust-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-hint);
}

/* --- Section Headers --- */
.section-header {
  margin-bottom: 0.875rem;
}
.section-header h2 {
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 600;
  color: var(--dark);
}
.section-header p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- District Structure Explainer --- */
.structure-note {
  background: var(--bg-section);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 1.25rem;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}
.coverage-note {
  background: var(--blue-light);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 1.25rem;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}
.coverage-note strong { color: var(--navy); }
.structure-note strong {
  color: var(--text);
  font-weight: 600;
}

/* --- District Grid --- */
.district-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 2.5rem;
  align-items: start;
}
.district-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.district-card.hidden { display: none; }
.district-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--dark);
}
.district-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.district-meta .dtype {
  display: inline-block;
  font-weight: 500;
  color: var(--text);
}
.district-meta .dtype-chsd {
  color: var(--navy);
}
.district-meta .dtype-elem {
  color: var(--gold-text);
}
.district-meta .grade-range {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-hint);
  font-size: 10px;
  margin-left: 4px;
}
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  color: var(--text-hint);
  font-size: 14px;
  display: none;
}

/* --- Dashboard Page --- */
.page-header {
  padding: 1.5rem 0 0;
}
.breadcrumb {
  font-size: 13px;
  color: var(--text-hint);
  margin-bottom: 0.75rem;
}
.breadcrumb a {
  color: var(--text-muted);
}
.page-header h1 {
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 4px;
}
.page-deck {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 620px;
}
.page-meta {
  font-size: 12px;
  color: var(--text-hint);
  margin-top: 0.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-meta a {
  color: var(--blue);
}

/* --- Meta Strip (replaces old KPI strip) --- */
.meta-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  background: var(--bg-section);
  border-radius: var(--radius-sm);
  margin: 1.25rem 0;
  font-size: 13px;
  color: var(--text-muted);
}
.meta-strip-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.meta-strip-item strong {
  color: var(--text);
  font-weight: 600;
}
.meta-strip-item a {
  color: var(--blue);
}

/* --- Orientation Block --- */
.orientation {
  background: var(--blue-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 1.25rem;
  font-size: 13px;
  color: var(--navy);
  line-height: 1.5;
}
.orientation strong {
  font-weight: 600;
}
.orientation ul {
  margin: 6px 0 0 0;
  padding-left: 1.25rem;
}
.orientation li {
  margin: 2px 0;
}

/* --- Data Explainer (dashboard) --- */
.data-explainer {
  margin-top: 2rem;
  margin-bottom: 2rem;
}
.data-explainer-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 0.75rem;
}
.data-explainer-item {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}
.data-explainer-item strong {
  color: var(--text);
  display: block;
  margin-bottom: 2px;
}

/* --- Dashboard Embed --- */
.dashboard-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 500px;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.dashboard-frame iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* --- Click-to-load embed facade (district pages) --- */
.dashboard-facade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 24px;
  text-align: center;
  background: var(--bg-section);
  border: 0;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: background 0.15s;
}
.dashboard-facade:hover { background: var(--blue-hover); }
.facade-icon { width: 38px; height: 38px; color: var(--navy); margin-bottom: 6px; }
.facade-title { font-size: 16px; font-weight: 600; color: var(--dark); }
.facade-hint { font-size: 13px; color: var(--text-muted); max-width: 400px; line-height: 1.5; }
.facade-btn {
  margin-top: 14px;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
}
.dashboard-facade:hover .facade-btn { background: var(--blue); }

/* Loading state shown behind the dashboard embed until the iframe paints */
.embed-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-hint);
}

/* --- Post-Embed Actions --- */
.post-embed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}
.post-embed-source {
  font-size: 12px;
  color: var(--text-hint);
}
.post-embed-source a { color: var(--blue); }
.post-embed-actions {
  display: flex;
  gap: 1rem;
}
.post-embed-actions a {
  font-size: 12px;
  font-weight: 500;
  color: var(--blue);
}

/* --- Content / About Page --- */
.content-page {
  padding: 2.5rem 0 3rem;
  max-width: 640px;
}
.content-page h1 {
  font-family: var(--font-ui);
  font-size: 24px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 0.5rem;
}
.content-page .page-deck {
  font-family: var(--font-ui);
  margin-bottom: 2rem;
}
.content-page h2 {
  font-family: var(--font-ui);
  font-size: 17px;
  font-weight: 600;
  color: var(--dark);
  margin: 2rem 0 0.5rem;
}
.content-page p {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 1rem;
}
.content-page p a {
  color: var(--blue);
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-top: 2rem;
}
.footer-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.footer-brand {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 15px;
  color: var(--dark);
}
.footer-brand .logo-accent { color: var(--navy); }
.footer-links {
  display: flex;
  gap: 1rem;
}
.footer-links a {
  font-size: 13px;
  color: var(--text-muted);
}
.footer-trust {
  font-size: 12px;
  color: var(--text-hint);
  line-height: 1.6;
}
.footer-trust a { color: var(--blue); }
.footer-updated { font-size: 12px; color: var(--text-hint); margin-top: 10px; }

/* --- Mobile --- */
@media (max-width: 640px) {
  .container { padding-left: 1.5rem; padding-right: 1.5rem; }
  .hero h1 { font-size: 24px; }
  .district-grid { grid-template-columns: 1fr; }
  .data-explainer-grid { grid-template-columns: 1fr; }
  .meta-strip { flex-direction: column; align-items: flex-start; }
  .trust-strip .container { gap: 0.75rem; }
  .site-nav { gap: 0.75rem; }
  .site-nav a { font-size: 13px; }
  .footer-top { flex-direction: column; }
  .post-embed { flex-direction: column; align-items: flex-start; }
}

/* --- Data cards (homepage) + quick facts (district pages) --- */
.district-card {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  text-decoration: none;
  color: inherit;
}
.district-card:hover {
  border-color: var(--blue);
  box-shadow: 0 1px 6px rgba(0,94,162,0.08);
  text-decoration: none;
}
.card-head { margin-bottom: 10px; }
.card-primary { display: flex; align-items: baseline; gap: 5px; }
.card-pp { font-size: 19px; font-weight: 600; color: var(--navy); }
.card-pp-label { font-size: 12px; color: var(--text-muted); }
.card-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.card-rank { font-size: 11px; color: var(--text-hint); margin-top: 3px; }
.card-budget {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}
.card-budget-line { font-size: 11.5px; color: var(--text-muted); line-height: 1.7; }
.card-budget-line .num { color: var(--text); font-weight: 600; }

.quick-facts { margin: 0.5rem 0; }
.qf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--border-light);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.qf-item { background: var(--bg); padding: 14px 16px; }
.qf-num { font-size: 20px; font-weight: 700; color: var(--navy); display: block; }
.qf-label { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.qf-note { font-size: 12px; color: var(--text-hint); margin-top: 8px; font-style: italic; }
.qf-rank { font-size: 13px; color: var(--text-muted); margin-top: 10px; font-weight: 500; }

@media (max-width: 640px) {
  .qf-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- Reduced motion: honor the OS "reduce motion" preference --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

/* --- Print: drop interactive chrome; keep the data + sourcing readable --- */
@media print {
  .site-nav, .search-wrap, .skip-link, .cta-row,
  .dashboard-facade, .dashboard-frame, .embed-loading { display: none; }
  .site-header, .site-footer { border: 0; }
  a { color: #000; text-decoration: underline; }
  body { color: #000; }
}
