.school-map-section {
  padding: var(--module-padding-block) var(--module-padding-inline);
  color: #f7fbff;
  background:
    radial-gradient(circle at 14% 12%, rgba(8, 119, 237, .2), transparent 28rem),
    radial-gradient(circle at 86% 88%, rgba(24, 185, 93, .13), transparent 27rem),
    #061b3f;
}

.school-map-heading {
  width: min(100%, var(--page-max));
  margin: 0 auto 24px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.school-map-heading > div { max-width: 850px; }
.school-map-heading h2 {
  margin: 8px 0 10px;
  font-family: var(--public-title-family, var(--font-display));
  font-size: var(--public-section-title-size, clamp(2rem, 2.5vw, 2.6rem));
  line-height: 1.04;
  letter-spacing: -.045em;
}
.school-map-heading p { margin: 0; color: #c6d7ee; }

.school-map-list-link,
.school-map-reset,
.school-map-region-zoom,
.school-map-school-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 11px;
  color: #fff;
  background: #0877ed;
  font-weight: 800;
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}
.school-map-list-link { padding: 10px 16px; white-space: nowrap; }
.school-map-list-link:hover,
.school-map-reset:hover,
.school-map-region-zoom:hover,
.school-map-school-link:hover { transform: translateY(-1px); background: #0566ce; }

.school-map-shell {
  position: relative;
  width: min(100%, var(--page-max));
  height: clamp(460px, 58vh, 620px);
  min-height: 460px;
  margin: auto;
  overflow: hidden;
  border: 1px solid rgba(153, 193, 241, .36);
  border-radius: 24px;
  background: #102b4d;
  box-shadow: 0 28px 70px rgba(0, 7, 22, .34);
}
.school-map-shell > .school-map-canvas.mapboxgl-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.school-map-canvas .mapboxgl-canvas { outline: none; }
.school-map-canvas .mapboxgl-canvas:focus-visible {
  outline: 4px solid #f5b900;
  outline-offset: -5px;
}
.school-map-canvas .mapboxgl-ctrl-group {
  overflow: hidden;
  border: 1px solid rgba(8, 26, 53, .22);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 16, 40, .18);
}

.school-map-status {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 30px;
  color: #eaf4ff;
  background: linear-gradient(145deg, #0a2449, #06162f);
  text-align: center;
}
.school-map-status p { max-width: 560px; margin: 0; }
.school-map-status a { color: #fff; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.school-map-spinner {
  width: 36px;
  height: 36px;
  border: 4px solid rgba(255, 255, 255, .2);
  border-top-color: #18b95d;
  border-radius: 50%;
  animation: school-map-spin .8s linear infinite;
}
.school-map-shell[data-map-state="ready"] .school-map-status { display: none; }
.school-map-shell[data-map-state="empty"] .school-map-spinner,
.school-map-shell[data-map-state="error"] .school-map-spinner,
.school-map-shell[data-map-state="token-missing"] .school-map-spinner { display: none; }

.school-map-reset {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 14px;
  padding: 8px 13px;
  border-color: rgba(8, 26, 53, .22);
  color: #0a2345;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 25px rgba(0, 16, 40, .2);
  font-size: .86rem;
}
.school-map-reset:hover { color: #fff; }

.school-map-panel {
  position: absolute;
  z-index: 5;
  top: 14px;
  right: 14px;
  bottom: 14px;
  width: min(390px, calc(100% - 28px));
  overflow: hidden;
  border: 1px solid rgba(173, 205, 244, .38);
  border-radius: 18px;
  color: #f7fbff;
  background: rgba(6, 27, 63, .96);
  box-shadow: 0 22px 58px rgba(0, 10, 30, .4);
  backdrop-filter: blur(16px);
}
.school-map-panel[hidden] { display: none; }
.school-map-panel > header {
  padding: 17px 18px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(173, 205, 244, .2);
}
.school-map-panel header span { color: #70b3ff; font-size: .7rem; font-weight: 900; letter-spacing: .12em; }
.school-map-panel h3 { margin: 3px 0 0; font-size: 1.25rem; line-height: 1.2; }
.school-map-panel-close {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 10px;
  color: #fff;
  background: rgba(255, 255, 255, .08);
  font-size: 1.55rem;
}
.school-map-panel-body {
  height: calc(100% - 78px);
  padding: 15px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.school-map-panel-summary { margin: 0 0 13px; color: #c6d7ee; font-size: .86rem; }
.school-map-school-list { margin: 0; padding: 0; display: grid; gap: 10px; list-style: none; }
.school-map-school-card {
  padding: 14px;
  border: 1px solid rgba(158, 195, 239, .25);
  border-radius: 14px;
  background: rgba(255, 255, 255, .07);
}
.school-map-school-card h4 { margin: 0 0 5px; color: #fff; font-size: 1rem; line-height: 1.3; }
.school-map-school-card h4 a:hover { text-decoration: underline; text-underline-offset: 3px; }
.school-map-school-card p { margin: 0 0 5px; color: #c6d7ee; font-size: .82rem; }
.school-map-school-card small { display: block; margin-bottom: 12px; color: #9eb9da; }
.school-map-school-link { width: 100%; padding: 8px 12px; font-size: .82rem; }
.school-map-region-zoom { width: 100%; margin: 13px 0 3px; padding: 9px 12px; background: #18a958; }
.school-map-region-zoom:hover { background: #148f4b; }

.school-map-legend {
  position: absolute;
  z-index: 3;
  left: 14px;
  bottom: 14px;
  width: min(280px, calc(100% - 28px));
  overflow: hidden;
  border: 1px solid rgba(8, 26, 53, .2);
  border-radius: 12px;
  color: #0a2345;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 25px rgba(0, 16, 40, .18);
}
.school-map-legend summary { padding: 10px 13px; cursor: pointer; font-size: .82rem; font-weight: 900; }
.school-map-legend > div { padding: 0 13px 12px; display: grid; gap: 7px; }
.school-map-legend span { display: flex; align-items: center; gap: 8px; font-size: .76rem; }
.school-map-legend small { color: #526b8d; line-height: 1.35; }
.school-map-dot,
.school-map-cluster { display: inline-grid; place-items: center; flex: 0 0 22px; width: 22px; height: 22px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #193b68; font-style: normal; font-size: .63rem; font-weight: 900; }
.school-map-boundary-swatch {
  display: inline-block;
  flex: 0 0 28px;
  width: 28px;
  height: 18px;
  border: 3px solid #0759ae;
  border-radius: 5px;
  background: rgba(8, 119, 237, .15);
  box-shadow: 0 0 0 2px #d9efff;
}
.school-map-dot { background: #0877ed; }
.school-map-cluster.small { color: #fff; background: #0877ed; }
.school-map-cluster.medium { color: #fff; background: #18b95d; }
.school-map-cluster.large { color: #172235; background: #f5b900; }
.school-map-cluster.very-large { color: #fff; background: #ee3946; }

.school-map-accessible-list {
  width: min(100%, var(--page-max));
  margin: 18px auto 0;
  border: 1px solid rgba(173, 205, 244, .24);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, .07);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .1);
}
.school-map-accessible-list summary { padding: 14px 17px; cursor: pointer; font-weight: 800; transition: background-color .18s; }
.school-map-accessible-list summary:hover { background: rgba(255, 255, 255, .07); }
.school-map-accessible-list summary:focus-visible { outline: 3px solid rgba(86, 170, 255, .45); outline-offset: -3px; }
.school-map-accessible-list[open] summary { border-bottom: 1px solid rgba(173, 205, 244, .2); }
.school-map-accessible-list-body { padding: 14px 16px 16px; }
.school-map-accessible-list ul { margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; list-style: none; }
.school-map-accessible-list li { min-width: 0; margin: 0; }
.school-map-accessible-list a { min-height: 100%; padding: 12px 13px; display: flex; align-items: center; gap: 9px; border: 1px solid rgba(173, 205, 244, .2); border-radius: 11px; color: #edf6ff; background: rgba(4, 24, 54, .38); font-weight: 720; line-height: 1.4; text-decoration: none; transition: border-color .18s, background-color .18s, transform .18s; }
.school-map-accessible-list a::before { content: ""; width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #2f9aff; box-shadow: 0 0 0 3px rgba(47, 154, 255, .16); }
.school-map-accessible-list a:hover { border-color: rgba(115, 158, 202, .76); background: rgba(1, 14, 34, .72); transform: translateY(-1px); }
.school-map-accessible-list a:focus-visible { outline: 3px solid rgba(86, 170, 255, .45); outline-offset: 2px; }

html[data-theme="light"] .school-map-section {
  color: #101820;
  background:
    radial-gradient(circle at 14% 12%, rgba(8, 119, 237, .1), transparent 28rem),
    radial-gradient(circle at 86% 88%, rgba(24, 185, 93, .08), transparent 27rem),
    #f7f9fc;
}
html[data-theme="light"] .school-map-heading p { color: #52657b; }
html[data-theme="light"] .school-map-accessible-list { border-color: #c9d8e8; background: #fff; box-shadow: 0 14px 34px rgba(39, 69, 105, .08); }
html[data-theme="light"] .school-map-accessible-list summary:hover { background: #f3f7fb; }
html[data-theme="light"] .school-map-accessible-list[open] summary { border-bottom-color: #d8e3ee; }
html[data-theme="light"] .school-map-accessible-list a { color: #173a60; border-color: #d5e1ed; background: #f7fafc; }
html[data-theme="light"] .school-map-accessible-list a:hover { border-color: #6f98bd; background: #e1ebf4; }
html[data-theme="dark"] .school-map-boundary-swatch {
  border-color: #168cff;
  background: rgba(44, 152, 255, .18);
  box-shadow: 0 0 0 2px rgba(168, 217, 255, .72);
}

@keyframes school-map-spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .school-map-section { padding-block: 42px; }
  .school-map-heading { align-items: start; flex-direction: column; }
  .school-map-shell { height: 560px; }
  .school-map-panel { top: auto; height: min(54%, 390px); }
  .school-map-panel-body { height: calc(100% - 76px); }
  .school-map-accessible-list ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .school-map-section { padding: 40px 14px; }
  .school-map-heading { margin-bottom: 22px; }
  .school-map-heading h2 { font-size: var(--public-section-title-size, 1.9rem); }
  .school-map-list-link { width: 100%; }
  .school-map-shell { height: 600px; min-height: 540px; border-radius: 17px; }
  .school-map-reset { top: 10px; left: 10px; max-width: calc(100% - 92px); min-height: 42px; }
  .school-map-panel { right: 8px; bottom: 8px; left: 8px; width: auto; height: 54%; border-radius: 15px; }
  .school-map-legend { right: 8px; bottom: 8px; left: 8px; width: auto; }
  .school-map-panel:not([hidden]) + .school-map-legend { display: none; }
  .school-map-accessible-list-body { padding: 12px; }
  .school-map-accessible-list ul { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .school-map-spinner { animation-duration: 1.8s; }
  .school-map-list-link,
  .school-map-reset,
  .school-map-accessible-list summary,
  .school-map-accessible-list a,
  .school-map-region-zoom,
  .school-map-school-link { transition: none; }
}
