/* Special education federal data explorer */

:root {
  --sed-navy: #182743;
  --sed-navy-soft: #2a3f5f;
  --sed-teal: #0d9488;
  --sed-teal-light: #ccfbf1;
  --sed-yellow: #ffef4b;
  --sed-white: #ffffff;
  --sed-beige: #faf8f4;
  --sed-gray-50: #f7f8fa;
  --sed-gray-100: #eef0f3;
  --sed-gray-200: #e2e5ea;
  --sed-gray-500: #6b7280;
  --sed-gray-700: #374151;
  --sed-max: 1080px;
  --sed-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

body.sed-page {
  margin: 0;
  background: var(--sed-white);
  color: var(--sed-navy);
  font-family: var(--sed-font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.sed-wrap {
  width: 100%;
  max-width: var(--sed-max);
  margin: 0 auto;
  padding: 0 24px;
}

.sed-main :where(h1, h2, h3, p, ul, ol) {
  margin: 0;
}

.sed-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Hero */
.sed-hero {
  background: var(--sed-beige);
  padding: 56px 0 48px;
  border-bottom: 1px solid var(--sed-gray-200);
}

.sed-eyebrow {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sed-gray-500);
  margin-bottom: 12px;
}

.sed-hero h1 {
  font-size: clamp(1.75rem, 4.5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.12;
  max-width: 20ch;
}

.sed-lede {
  margin-top: 16px;
  max-width: 42rem;
  color: var(--sed-gray-700);
  font-size: 1.0625rem;
  line-height: 1.6;
}

/* National stats */
.sed-stats {
  padding: 40px 0;
}

.sed-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.sed-stat-card {
  background: var(--sed-white);
  border: 1px solid var(--sed-gray-200);
  border-radius: 12px;
  padding: 20px 22px;
}

.sed-stat-card--loading {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--sed-gray-500);
}

.sed-stat-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--sed-gray-500);
  margin-bottom: 6px;
}

.sed-stat-value {
  font-size: clamp(1.5rem, 3vw, 1.875rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.sed-stat-sub {
  margin-top: 6px;
  font-size: 0.875rem;
  color: var(--sed-gray-700);
}

/* Map section */
.sed-map-section {
  padding: 48px 0 56px;
  background: var(--sed-gray-50);
}

.sed-map-stage {
  width: 100%;
  padding: 0 24px;
  margin-top: 24px;
}

.sed-map-stage .sed-map-footnote {
  margin-top: 16px;
  padding-left: 0;
  padding-right: 0;
}

.sed-map-intro h2 {
  font-size: clamp(1.375rem, 3vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sed-map-intro p {
  margin-top: 10px;
  max-width: 40rem;
  color: var(--sed-gray-700);
}

.sed-map-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 24px;
  margin-top: 28px;
}

.sed-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: min(100%, 280px);
}

.sed-control-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--sed-gray-700);
}

.sed-select {
  appearance: none;
  min-height: 44px;
  padding: 0 36px 0 14px;
  border: 1px solid var(--sed-gray-200);
  border-radius: 8px;
  background: var(--sed-white)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 12px center;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--sed-navy);
  cursor: pointer;
}

.sed-select:focus-visible {
  outline: 2px solid var(--sed-teal);
  outline-offset: 2px;
}

.sed-metric-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sed-metric-toggle {
  display: inline-flex;
  padding: 3px;
  background: var(--sed-white);
  border: 1px solid var(--sed-gray-200);
  border-radius: 8px;
}

.sed-metric-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: 6px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sed-gray-700);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}

.sed-metric-btn.is-active {
  background: var(--sed-navy);
  color: var(--sed-white);
}

.sed-metric-btn.is-locked {
  opacity: 0.55;
  cursor: not-allowed;
  color: var(--sed-gray-500);
}

.sed-metric-btn.is-locked.is-active {
  background: transparent;
  color: var(--sed-gray-500);
}

.sed-metric-btn-icons {
  position: relative;
  display: inline-flex;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-left: 3px;
}

.sed-metric-btn-icon {
  position: absolute;
  inset: 0;
  font-size: 14px !important;
  line-height: 1;
  transition:
    opacity 0.2s ease,
    transform 0.28s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.sed-metric-btn-icon--lock {
  opacity: 0;
  transform: scale(0.5) rotate(12deg);
}

.sed-metric-btn-icon--unlock {
  opacity: 1;
  transform: scale(1);
  color: var(--sed-teal);
}

.sed-metric-btn.is-locked .sed-metric-btn-icon--lock {
  opacity: 1;
  transform: scale(1);
  color: var(--sed-gray-500);
}

.sed-metric-btn.is-locked .sed-metric-btn-icon--unlock {
  opacity: 0;
  transform: scale(0.5) rotate(-12deg);
  color: var(--sed-gray-500);
}

.sed-metric-btn.is-active .sed-metric-btn-icon--unlock {
  color: var(--sed-white);
}

.sed-metric-btn.is-unlocking .sed-metric-btn-icon--unlock {
  animation: sed-lock-open 0.38s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.sed-metric-btn.is-locking .sed-metric-btn-icon--lock {
  animation: sed-lock-close 0.32s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes sed-lock-open {
  0% {
    opacity: 0;
    transform: scale(0.4) rotate(-20deg);
  }

  55% {
    opacity: 1;
    transform: scale(1.2) rotate(6deg);
  }

  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@keyframes sed-lock-close {
  0% {
    opacity: 0;
    transform: scale(0.4) rotate(20deg);
  }

  55% {
    opacity: 1;
    transform: scale(1.15) rotate(-4deg);
  }

  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

.sed-metric-btn:disabled {
  pointer-events: none;
}

.sed-metric-btn:focus-visible {
  outline: 2px solid var(--sed-teal);
  outline-offset: 2px;
}

.sed-state-search-wrap {
  position: relative;
}

.sed-state-search {
  position: relative;
}

.sed-state-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--sed-gray-500);
  pointer-events: none;
}

.sed-state-search-input {
  width: 100%;
  min-width: 220px;
  min-height: 44px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--sed-gray-200);
  border-radius: 8px;
  background: var(--sed-white);
  font: inherit;
  font-size: 0.9375rem;
  color: var(--sed-navy);
}

.sed-state-search-input:focus-visible {
  outline: 2px solid var(--sed-teal);
  outline-offset: 2px;
}

.sed-state-search-input::-webkit-search-cancel-button {
  cursor: pointer;
}

.sed-state-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 10;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--sed-white);
  border: 1px solid var(--sed-gray-200);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgb(17 17 17 / 0.1);
  max-height: 240px;
  overflow: auto;
}

.sed-state-suggestion {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  color: var(--sed-navy);
  cursor: pointer;
}

.sed-state-suggestion:hover,
.sed-state-suggestion.is-active {
  background: var(--sed-gray-50);
}

.sed-state-suggestion-abbr {
  font-weight: 600;
}

.sed-state-suggestion span {
  color: var(--sed-gray-500);
  font-size: 0.8125rem;
}

.sed-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 520px);
  gap: 20px;
  align-items: stretch;
  width: 100%;
}

.sed-map-canvas-wrap {
  position: relative;
  min-height: max(480px, calc(100vh - 300px));
  background: var(--sed-white);
  border: 1px solid var(--sed-gray-200);
  border-radius: 12px;
  overflow: hidden;
}

.sed-map-canvas {
  width: 100%;
  height: 100%;
  min-height: max(480px, calc(100vh - 300px));
}

.sed-map-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  padding: 24px;
  color: var(--sed-gray-500);
  text-align: center;
}

.sed-map-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  min-width: 140px;
  padding: 10px 12px;
  background: rgb(255 255 255 / 0.94);
  border: 1px solid var(--sed-gray-200);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgb(17 17 17 / 0.06);
  pointer-events: none;
}

.sed-map-legend-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--sed-gray-700);
  margin-bottom: 8px;
}

.sed-map-legend-bar {
  height: 10px;
  border-radius: 4px;
}

.sed-map-legend-bar--count {
  background: linear-gradient(90deg, #ccfbf1, #0d9488, #182743);
}

.sed-map-legend-bar--share {
  background: linear-gradient(90deg, #e8eaee, #5eead4, #0f766e);
}

.sed-map-legend-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 0.6875rem;
  color: var(--sed-gray-500);
}

/* Detail panel */
.sed-map-detail {
  background: var(--sed-white);
  border: 1px solid var(--sed-gray-200);
  border-radius: 12px;
  padding: 22px 24px;
  overflow: auto;
  max-height: max(480px, calc(100vh - 300px));
}

.sed-map-detail-head {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--sed-gray-100);
}

.sed-map-detail-topline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.sed-map-detail-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  min-width: 0;
}

.sed-map-detail-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--sed-navy);
  white-space: nowrap;
  flex-shrink: 0;
}

.sed-map-detail-count .material-symbols-outlined.sed-map-detail-icon {
  font-size: 20px !important;
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24 !important;
  color: var(--sed-teal);
  line-height: 1;
}

.sed-map-detail-sub {
  margin-top: 4px;
  font-size: 0.8125rem;
  color: var(--sed-gray-700);
  line-height: 1.45;
}

.sed-map-detail-note {
  margin: 0 0 12px;
  font-size: 0.8125rem;
  color: var(--sed-gray-500);
}

.sed-compare {
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
}

.sed-compare--above {
  color: #0f766e;
}

.sed-compare--below {
  color: #b45309;
}

.sed-compare--average {
  color: var(--sed-gray-500);
}

body.sed-page--personnel .sed-compare--good,
body.sed-page--exiting .sed-compare--good {
  color: #0f766e;
}

body.sed-page--personnel .sed-compare--bad,
body.sed-page--exiting .sed-compare--bad,
body.sed-page--child-count .sed-compare--bad {
  color: #b45309;
}

body.sed-page--personnel .sed-compare--neutral,
body.sed-page--exiting .sed-compare--neutral,
body.sed-page--child-count .sed-compare--neutral {
  color: var(--sed-gray-500);
}

body.sed-page--personnel .sed-bar-row,
body.sed-page--exiting .sed-bar-row,
body.sed-page--child-count .sed-bar-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

body.sed-page--personnel .sed-bar-value,
body.sed-page--exiting .sed-bar-value,
body.sed-page--child-count .sed-bar-value {
  white-space: nowrap;
}

.sed-map-detail-actions {
  margin-top: 8px;
}

.sed-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sed-teal);
  text-decoration: none;
}

.sed-link-btn:hover {
  text-decoration: underline;
}

.sed-bar-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sed-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 42%);
  gap: 6px 16px;
  align-items: baseline;
}

.sed-bar-value {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--sed-navy);
  text-align: right;
  line-height: 1.45;
}

.sed-bar-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--sed-gray-700);
  line-height: 1.35;
}

.sed-bar-label.is-selected {
  color: var(--sed-navy);
  font-weight: 600;
}

.sed-bar-track {
  grid-column: 1 / -1;
  height: 6px;
  background: var(--sed-gray-100);
  border-radius: 3px;
  overflow: hidden;
}

.sed-bar-fill {
  height: 100%;
  background: var(--sed-teal);
  border-radius: 3px;
  transition: width 0.25s ease;
}

.sed-bar-fill.is-selected {
  background: var(--sed-navy);
}

.sed-bar-row.is-muted .sed-bar-label,
.sed-bar-row.is-muted .sed-bar-value {
  color: var(--sed-gray-500);
}

.sed-map-detail-empty-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 280px;
  padding: 24px 12px;
}

.sed-map-detail-empty-icon {
  font-size: 36px;
  color: var(--sed-gray-200);
  margin-bottom: 12px;
}

.sed-map-detail-empty {
  font-size: 0.9375rem;
  color: var(--sed-gray-500);
  max-width: 16rem;
}

.sed-map-footnote {
  margin-top: 16px;
  font-size: 0.8125rem;
  color: var(--sed-gray-500);
  line-height: 1.5;
}

/* National breakdown */
.sed-breakdown {
  padding: 56px 0;
}

.sed-breakdown h2 {
  font-size: clamp(1.375rem, 3vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sed-breakdown-lede {
  margin-top: 10px;
  color: var(--sed-gray-700);
  max-width: 36rem;
}

.sed-breakdown-chart {
  margin-top: 28px;
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr) 168px;
  gap: 12px 16px;
  align-items: center;
}

.sed-breakdown-row {
  display: contents;
}

.sed-breakdown-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sed-gray-700);
}

.sed-breakdown-label a {
  color: inherit;
  text-decoration: none;
}

.sed-breakdown-label a:hover {
  color: var(--sed-teal);
  text-decoration: underline;
}

.sed-breakdown-track {
  height: 24px;
  width: 100%;
  min-width: 0;
  background: var(--sed-gray-100);
  border-radius: 4px;
  overflow: hidden;
}

.sed-breakdown-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sed-teal-light), var(--sed-teal));
  border-radius: 4px;
}

.sed-breakdown-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--sed-navy);
  text-align: right;
  white-space: nowrap;
}

.sed-breakdown-pct {
  font-weight: 400;
  color: var(--sed-gray-500);
}

/* Notes */
.sed-notes {
  padding: 48px 0 72px;
  background: var(--sed-beige);
  border-top: 1px solid var(--sed-gray-200);
}

.sed-notes-inner {
  max-width: 42rem;
}

.sed-notes h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.sed-notes-list {
  margin-top: 16px;
  padding-left: 1.25rem;
  color: var(--sed-gray-700);
  font-size: 0.9375rem;
}

.sed-notes-list li + li {
  margin-top: 8px;
}

.sed-source {
  margin-top: 0;
  font-size: 0.8125rem;
  color: var(--sed-gray-500);
  line-height: 1.6;
}

.sed-related {
  margin-top: 20px;
  font-size: 0.9375rem;
  color: var(--sed-gray-700);
}

.sed-related a {
  color: var(--sed-teal);
  font-weight: 500;
}

.sed-related a:hover {
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  .sed-metric-btn-icon {
    transition: opacity 0.01ms;
  }

  .sed-metric-btn.is-unlocking .sed-metric-btn-icon--unlock,
  .sed-metric-btn.is-locking .sed-metric-btn-icon--lock {
    animation: none;
  }
}

@media (max-width: 900px) {
  .sed-stat-grid {
    grid-template-columns: 1fr;
  }

  .sed-map-stage {
    padding: 0 16px;
  }

  .sed-map-layout {
    grid-template-columns: 1fr;
  }

  .sed-map-canvas-wrap,
  .sed-map-canvas {
    min-height: 360px;
  }

  .sed-map-detail {
    max-height: none;
  }

  .sed-breakdown-chart {
    display: block;
  }

  .sed-breakdown-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 6px 12px;
    align-items: baseline;
    width: 100%;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--sed-gray-100);
  }

  .sed-breakdown-row:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
  }

  .sed-breakdown-label {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    text-align: left;
  }

  .sed-breakdown-value {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }

  .sed-breakdown-track {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }
}

@media (max-width: 560px) {
  .sed-hero {
    padding: 40px 0 36px;
  }

  .sed-map-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .sed-metric-toggle {
    width: 100%;
  }

  .sed-metric-btn {
    flex: 1;
    text-align: center;
  }
}
