.map-page [hidden] { display: none; }
.map-page .portal-page-heading :is(.breadcrumbs, .view-header) { margin-bottom: 16px; }
.pn-map-heading { margin-bottom: 24px; }
.pn-map-overview { margin-bottom: 12px; }
.pn-map-result-count, .education-map-return { font-size: 14px; line-height: 20px; }
.pn-map-result-count { margin: 0; color: var(--text); font-weight: 650; }
.pn-map-view-controls { display: none; }
.pn-map-workspace { position: relative; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px; min-width: 0; scroll-margin-top: 16px; }

@media (width >= 1024px) {
  .map-page > .container { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--pn-space-6); }
  .map-page > .container > * { grid-column: 1 / -1; }
  .map-page :is(.education-search, .education-search-row, #organization-filters, .pn-map-workspace) {
    display: grid;
    grid-template-columns: subgrid;
    column-gap: var(--pn-space-6);
  }
  .map-page .education-search-row, .map-page .education-filter-chips { grid-column: 1 / -1; }
  .map-page #organization-filters { grid-column: 1 / 10; }
  .map-page .education-query { grid-column: 1 / 5; }
  .map-page .education-toolbar-actions {
    grid-column: 5 / -1;
    display: grid;
    grid-template-columns: minmax(0, 152px) repeat(2, minmax(0, 112px));
    gap: 12px;
  }
  .map-page .education-map-return { grid-column: 10 / -1; justify-self: end; text-align: end; }

  @supports not (grid-template-columns: subgrid) {
    .map-page :is(.education-search, .education-search-row, .pn-map-workspace) {
      grid-template-columns: repeat(12, minmax(0, 1fr));
    }
    .map-page #organization-filters { grid-template-columns: repeat(9, minmax(0, 1fr)); }
  }
}
.pn-map-workspace > .pn-map-list-pane, .pn-map-workspace > .pn-map-canvas-wrap {
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  block-size: clamp(360px, calc(100dvh - var(--pn-map-offset, 340px) - 24px), 880px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.pn-map-workspace > .pn-map-list-pane { grid-column: span 4; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.pn-map-list-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.pn-map-list-header :is(h2, h3) { margin: 0; font-size: 16px; line-height: 24px; }
.pn-map-list-header span, .pn-map-meta, .pn-map-facts { margin: 0; color: var(--muted); font-size: 14px; line-height: 20px; }
.pn-organization-list { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; scroll-padding: 12px; padding: 12px; }
.pn-map-card-list, .pn-map-program-list { display: grid; gap: 12px; }
.pn-map-program-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.pn-map-program-card h4 { margin: 0; font-size: 16px; line-height: 24px; color: var(--text); overflow-wrap: anywhere; }
.pn-map-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 4px; }
.pn-map-actions :is(a, button), .pn-map-details [role="tab"], .pn-map-tools button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  color: var(--primary);
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  text-align: start;
  line-height: 20px;
  cursor: pointer;
  transition: color var(--motion-fast) var(--motion-ease-out), background-color var(--motion-fast) var(--motion-ease-out), border-color var(--motion-fast) var(--motion-ease-out);
}
.pn-map-actions :is(a, button):is(:hover, :focus-visible), .pn-map-details [role="tab"]:focus-visible { text-decoration: underline 2px; text-underline-offset: 4px; }
.pn-map-actions .icon { width: 14px; height: 14px; flex: none; }
.pn-map-more { width: 100%; margin-top: 12px; }
.pn-map-workspace > .pn-map-canvas-wrap { grid-column: span 8; display: grid; grid-template-rows: minmax(0, 1fr) auto auto; }
.pn-map-canvas, .pn-map-raster-viewport { position: relative; width: 100%; height: 100%; min-height: 0; background: var(--sage); }
.pn-map-canvas { isolation: isolate; overflow: hidden; }
.pn-map-canvas-wrap #map-status {
  position: static;
  width: auto;
  max-width: none;
  padding: 6px 12px;
  margin: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}
.pn-map-canvas-wrap #map-retry { position: static; transform: none; justify-self: start; min-height: 40px; margin: 4px 12px 12px; }
.pn-map-canvas-wrap #map-status:empty { padding: 0; border: 0; }
.pn-map-tools { position: absolute; z-index: 4; inset: 12px auto auto 12px; display: flex; flex-wrap: wrap; gap: 4px; max-width: calc(100% - 76px); pointer-events: none; }
.pn-map-tools button { pointer-events: auto; padding: 4px 10px; border: 1px solid var(--control); border-radius: 8px; background: var(--surface); color: var(--text); }
.pn-map-tools button:hover:not(:disabled) { background: var(--soft); }
.pn-map-tools button[aria-pressed="true"], .pn-map-view-controls button[aria-pressed="true"] { border-color: var(--primary); background: var(--primary); color: var(--pn-on-primary, #fff); }
.pn-map-tools button[aria-pressed="true"]:hover:not(:disabled) { background: var(--primary-hover); }
.pn-map-tools button:disabled { opacity: .7; cursor: default; }
.pn-map-native-fullscreen { position: absolute; right: 10px; top: 108px; z-index: 4; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--control); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; }
.pn-map-unavailable { display: grid; place-content: center; height: 100%; padding: 24px; }
.pn-map-marker, .pn-map-cluster { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: var(--primary); cursor: pointer; }
.pn-map-marker { align-items: end; }
.pn-map-marker svg { display: block; pointer-events: none; filter: drop-shadow(0 2px 2px #243a5b45); }
.pn-map-pin { fill: currentColor; stroke: #fff; stroke-width: 2px; }
.pn-map-marker.is-selected { color: var(--text); }
.pn-map-marker.is-selected .pn-map-pin { stroke-width: 3px; }
.pn-map-marker:focus-visible { background: var(--soft); border-radius: 8px; }
.pn-map-cluster { border: 2px solid #fff; border-radius: 50%; background: var(--primary); color: var(--pn-on-primary, #fff); font: 650 14px/20px var(--font); }
.pn-map-cluster:focus-visible { background: var(--text); }
.pn-map-canvas .maplibregl-ctrl-group { border-radius: 8px; overflow: hidden; background: var(--surface); }
.pn-map-canvas .maplibregl-ctrl-group button { width: 44px; height: 44px; }
.pn-map-canvas .maplibregl-ctrl-attrib, .pn-map-raster-viewport .ol-attribution { font-family: var(--font); font-size: 12px; line-height: 18px; }
.pn-map-raster-viewport .ol-zoom { top: 10px; left: auto; right: 10px; }
.pn-map-raster-viewport .ol-control { background: var(--surface); border: 1px solid var(--control); border-radius: 8px; padding: 0; }
.pn-map-raster-viewport .ol-control button { background: var(--surface); color: var(--text); width: 43px; height: 43px; margin: 0; cursor: pointer; }
.pn-map-canvas-wrap:is(:fullscreen, .pn-map-is-fullscreen) { width: 100vw; block-size: 100dvh; max-height: none; max-width: none; border: 0; border-radius: 0; }
.pn-map-details {
  position: absolute;
  inset: 8px 8px 8px auto;
  z-index: 6;
  box-sizing: border-box;
  width: min(384px, calc(100% - 16px));
  height: calc(100% - 16px);
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 4px 16px rgb(36 58 91 / .12);
}
.pn-map-details::backdrop { background: rgb(36 58 91 / .38); }
.pn-map-detail-layout { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; min-height: 0; }
.pn-map-detail-header { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 12px; align-items: start; padding: 16px; border-bottom: 1px solid var(--border); }
.pn-map-detail-heading h3 { margin: 4px 0 0; font-size: 20px; line-height: 28px; overflow-wrap: anywhere; }
.pn-map-detail-close { box-sizing: border-box; width: 44px; min-height: 44px; padding: 0; }
.pn-map-detail-body { min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; scroll-padding: 16px; padding: 0 16px 16px; }
.pn-map-detail-body > :is(p, dl, section, .pn-map-actions) { margin-top: 12px; }
.pn-map-detail-tabs { display: flex; flex-wrap: wrap; gap: 8px 16px; border-bottom: 1px solid var(--border); }
.pn-map-details [role="tab"] { border-bottom: 2px solid transparent; }
.pn-map-details [role="tab"][aria-selected="true"] { border-color: var(--primary); color: var(--text); }
.pn-map-detail-search { gap: 4px; margin: 12px 0 8px; }
.pn-map-program-search-control { display: flex; align-items: center; gap: 8px; min-height: 40px; padding-inline: 8px; border: 1px solid var(--control); border-radius: 8px; color: var(--muted); }
.pn-map-program-search-control .icon { width: 16px; height: 16px; flex: none; }
.pn-map-program-search-control input { min-width: 0; width: 100%; padding: 0; border: 0; outline: none; box-shadow: none; background: transparent; color: var(--text); font: inherit; }
.pn-map-program-search-control:has(input:focus-visible) { border-color: var(--text); }
.pn-map-program-status { margin: 0 0 12px; }
.pn-map-detail-facts { display: grid; gap: 4px; margin: 12px 0; }
.pn-map-detail-facts dt { font-weight: 650; }
.pn-map-detail-facts dd { margin: 0 0 8px; overflow-wrap: anywhere; }
.pn-map-location-source { margin-top: 12px; font-size: 14px; }
.pn-map-location-source summary { cursor: pointer; }
.pn-map-location-source > :not(summary) { margin-top: 4px; }
.map-page :is(.pn-map-tools, .pn-map-actions, .pn-map-details) :is(a, button):is(:focus, :focus-visible),
.map-page .pn-map-canvas .maplibregl-ctrl-group button:is(:focus, :focus-visible),
.map-page .pn-map-canvas .maplibregl-ctrl-attrib-button:is(:focus, :focus-visible),
.map-page .pn-map-raster-viewport .ol-control button:is(:focus, :focus-visible) { outline: none; box-shadow: none; }
.map-page :is(.pn-map-tools, .pn-map-details) :is(input, button):focus-visible { border-color: var(--text); }
.map-page .pn-map-tools button:focus-visible { text-decoration: underline 2px; text-underline-offset: 4px; }
.map-page :is(.pn-map-canvas .maplibregl-ctrl-group button, .pn-map-canvas .maplibregl-ctrl-attrib-button, .pn-map-raster-viewport .ol-control button, .pn-map-native-fullscreen, .pn-map-detail-close):focus-visible { background-color: var(--soft); border-color: var(--text); }
.map-page .pn-map-canvas-wrap:has(.ol-viewport:focus-visible) { border-color: var(--text); }

@media (min-width: 1200px) {
  .pn-map-workspace:has(.pn-map-details[open]) :is(.maplibregl-ctrl-top-right, .maplibregl-ctrl-bottom-right, .ol-zoom, .pn-map-native-fullscreen) { right: 392px; }
}
@media (max-width: 1199px) {
  .pn-map-details { position: fixed; inset: auto 0 0; width: min(640px, 100%); height: min(700px, 84dvh); margin-inline: auto; border-radius: 12px 12px 0 0; }
}
@media (max-width: 1023px) {
  .pn-map-view-controls { display: flex; gap: 8px; margin-bottom: 12px; }
  .pn-map-view-controls > button { flex: 1; }
  .pn-map-workspace > .pn-map-list-pane, .pn-map-workspace > .pn-map-canvas-wrap { grid-column: 1 / -1; block-size: clamp(360px, calc(100dvh - 152px), 720px); }
  .pn-map-workspace[data-view="list"] > .pn-map-canvas-wrap, .pn-map-workspace[data-view="map"] > .pn-map-list-pane { display: none; }
}
@media (max-width: 620px) {
  .pn-map-tools { inset: 8px auto auto 8px; max-width: calc(100% - 68px); }
  .pn-map-tools button { padding-inline: 8px; }
}
@media (max-height: 480px) {
  .pn-map-detail-layout { display: block; overflow-y: auto; }
  .pn-map-detail-body { overflow: visible; }
  .pn-map-detail-close { position: sticky; top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .pn-map-actions :is(a, button), .pn-map-details [role="tab"], .pn-map-tools button { transition: none; }
}
.map-page :is(.pn-map-tools, .pn-map-actions, .pn-map-details) button { user-select: none; }
[data-pn-motion="off"] .map-page :is(.pn-map-tools, .pn-map-actions, .pn-map-details) :is(a, button) { transition: none; }
