:root {
  --paper: #f9fbf8;
  --green: #15594d;
  --ink: #193e36;
  --muted: #546960;
  --line: #dbe5dd;
  --shadow: 0 12px 28px #183e351f;
}
body { background: #e8eee8; }
.top { display: grid; grid-template-columns: auto minmax(0, 460px) auto; gap: 20px; padding-inline: 20px; }
.top .header-links { grid-column: 3; grid-row: 1; justify-self: end; }
.map-toolbar { grid-column: 2; grid-row: 1; min-width: 0; }
#toggle-filters { display: none; }
.top h1 { letter-spacing: .04em; }
.contact-link {
  padding: 8px 12px; border-radius: 7px; text-decoration: none; white-space: nowrap;
  color: white; background: var(--green); font-size: 14px; font-weight: 750;
}
.directory { position: relative; padding-bottom: 8px; }
.map-switches {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  position: sticky; top: 0; z-index: 3; padding: 10px 14px;
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.map-switches h2 { margin: 0; font-size: 16px; }
.directory .layer-list { overflow: visible; padding-top: 8px; }
.building-layer-choice {
  display: flex; align-items: center; justify-content: space-between; gap: 9px;
  width: 100%; min-height: 44px; border: 1px solid #b3c6ba; border-radius: 9px;
  padding: 7px 10px; margin: 0 0 6px; background: #fff; color: var(--ink);
  cursor: pointer; font: inherit; font-size: 15px; font-weight: 750; text-align: left;
}
.building-layer-choice[aria-pressed="true"] { border-color: #70a08e; background: #e4f0e8; color: var(--green); }
.building-layer-state { padding: 2px 7px; border-radius: 999px; background: #edf1ed; color: var(--muted); font-size: .8rem; }
.building-layer-choice[aria-pressed="true"] .building-layer-state { background: #d3e9dc; color: #20584a; }
.building-layer-choice:focus-visible, .building-options > summary:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.building-options > summary { padding: 6px 9px 9px; color: var(--green); font-size: .875rem; font-weight: 750; cursor: pointer; }
#building-options .filters { padding: 10px 4px 14px; }
#building-options .filters h2 { font-size: 17px; }
#building-options .list-area { padding: 12px 0; }
.map-toolbar .search-box { height: 43px; border-radius: 8px; padding: 0 6px 0 9px; gap: 6px; background: #fff; }
.map-toolbar .map-search-submit { border-radius: 6px; }
.map-toolbar .search-results { top: calc(100% + 4px); border-radius: 9px; }
.map-toolbar .search-result { text-align: left; }
.map-area .detail-card { top: 14px; right: 15px; padding: 15px; z-index: 5; max-height: min(70dvh, 690px); overflow: auto; }
.map-area .detail { z-index: 5; }
#detail .close { position: sticky; top: 0; float: right; right: 0; border-radius: 8px; background: var(--paper); z-index: 3; }
#detail .transactions { clear: both; }
.map-area .school-legend { z-index: 2; left: 12px; bottom: 35px; max-width: min(285px, calc(100% - 80px)); }
#building-options .map-guide { position: static; width: auto; margin-block: 8px; }
.map-area .bus-track-banner { z-index: 2; left: 12px; top: 10px; bottom: auto; }
#map .life-overlay {
  position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none;
  background: transparent; transform-origin: center center;
}
#map .life-overlay.is-popup-open { z-index: 3; }
#map .life-overlay .leaflet-pane > canvas { pointer-events: none; }
#map .life-overlay .leaflet-popup { pointer-events: auto; }
#map .life-overlay .leaflet-control-container { display: none; }
#map .map-pin { z-index: 2; }
#map .maplibregl-ctrl-top-left, #map .maplibregl-ctrl-top-right,
#map .maplibregl-ctrl-bottom-left, #map .maplibregl-ctrl-bottom-right { z-index: 4; }
#map .maplibregl-ctrl-attrib { max-width: calc(100vw - 75px); }
@media (max-width: 740px) {
  .top { height: auto; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 52px auto; gap: 0 8px; padding: 0 8px 7px; z-index: 12; }
  .top .header-links { grid-column: 2; }
  .layout { grid-template-rows: minmax(0, 1fr); }
  .map-area { grid-row: 1; }
  .map-toolbar { grid-column: 1 / -1; grid-row: 2; display: flex; align-items: center; gap: 6px; }
  .map-toolbar .search-wrap { flex: 1; min-width: 0; }
  .map-toolbar .search-box { height: 44px; }
  .map-toolbar input { font-size: 16px; }
  .map-toolbar .map-search-submit { padding-inline: 8px; }
  .map-toolbar .search-box > span { display: none; }
  #toggle-filters { display: inline-flex; align-items: center; min-height: 44px; flex: none; white-space: nowrap; font-size: 14px; }
  .contact-link { font-size: 12px; }
  .directory { position: absolute; z-index: 10; inset: 6px 8px 8px; }
  .map-area .detail-card { top: auto; bottom: 61px; right: 8px; }
  .map-area .school-legend { left: 8px; top: 8px; bottom: auto; max-width: min(258px, calc(100% - 56px)); }
  .map-area .bus-track-banner { left: 8px; top: 8px; }
  .map-area:has(.bus-track-banner:not([hidden])) .school-legend { top: 98px; }
  .map-area:has(.detail:not([hidden]), .detail-card:not([hidden])) .school-legend { visibility: hidden; }
}

.sale-legend .legend-building {
  display: inline-block;
  width: 14px;
  height: 10px;
  border: 1.4px solid #255ebc;
  border-radius: 2px;
  background: #dce8f7;
}
.footprint-legend-note { margin: 5px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.5; }
.footprint-legend-note a { color: var(--green); }
