/* A single scrolling body keeps school content reachable at any page zoom. */
#school-map.is-compact-map:not(.is-county-view) .map-labels .map-county-label { display: inline; }
.observatory .drilldown-screen {
  inset: auto 2vw 0;
  width: 96vw;
  height: 88dvh;
  max-height: 96dvh;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.observatory .drilldown-screen .dialog-topbar {
  display: flex; flex-wrap: wrap; gap: 8px 12px; padding: 10px 20px;
}
.observatory .school-breadcrumb { min-width: 0; overflow-wrap: anywhere; }
.observatory .school-detail {
  display: block; min-height: 0; height: 100%; margin: 0; align-self: stretch; overflow: auto;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 20px 24px;
}
.observatory .detail-hero { flex-wrap: wrap; gap: 8px 20px; margin-bottom: 16px; }
.observatory .priority-facts { margin-bottom: 20px; }
.observatory .detail-reading-layout { overflow: visible; align-items: start; }
.observatory .detail-main { overflow: visible; }
.observatory .detail-main > section:last-child { display: block; }
.observatory .detail-main h3, .observatory .detail-side h3 { font-size: 17px; }
.observatory .detail-lead, .observatory .story-points { font-size: 16px; line-height: 1.85; }
.observatory .sheet-footer { flex-wrap: wrap; gap: 8px; padding: 10px 20px; }
.observatory .sheet-footer button { margin-left: auto; }
.observatory .detail-side { min-width: 0; }
.observatory .priority-facts > div { min-width: 0; overflow-wrap: anywhere; }

/* Phones and short landscape screens need document flow and a real map height. */
@media (max-width: 1049px), (max-height: 540px) {
  html { height: auto; min-height: 100%; overflow-x: hidden; overflow-y: auto; }
  body.observatory { height: auto; min-height: 100dvh; overflow: visible; }
  .observatory .site-header {
    height: auto; min-height: 64px; flex-wrap: wrap; gap: 8px; padding: 10px 12px;
  }
  .observatory .site-header .header-actions { margin-left: auto; }
  .observatory .site-header .brand-copy { min-width: 0; flex: 1 1 12rem; }
  .observatory .site-header .brand-copy strong { white-space: normal; overflow-wrap: anywhere; }
  .observatory .site-header .quiet-button { padding: 4px; min-height: 32px; font-size: 12px; }
  .observatory .site-header > .overview-counts {
    order: 2; flex: 1 1 100%; display: grid; grid-template-columns: 1fr auto; gap: 8px;
  }
  .observatory .site-header .count-totals { grid-column: 1; grid-row: 1; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
  .observatory .site-header .exhibit-toggle { grid-column: 2; grid-row: 1; align-self: center; }
  .observatory .site-header .count-totals strong { font-size: 22px !important; }
  .observatory .site-header .count-totals span { font-size: 12px; }
  .observatory .dashboard {
    height: auto; min-height: 0; display: grid;
    grid-template-rows: auto auto; padding: 10px 12px 16px; gap: 12px;
  }
  .observatory .workspace {
    height: auto; min-height: 0; grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto; overflow: visible; gap: 12px;
  }
  .observatory .map-panel { height: clamp(480px, 78svh, 760px); min-height: 480px; }
  #school-map .school-map-svg { touch-action: pan-y pinch-zoom !important; }
  .observatory .charts-panel {
    height: auto; grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: 260px 360px; overflow: visible; gap: 12px;
  }
  .observatory .charts-panel .chart-card:first-child { grid-column: 1 / -1; }
  .observatory .charts-panel .donut-layout { flex-direction: row; gap: 16px; }
  .observatory .charts-panel .donut-svg { max-width: 52%; }
  .observatory .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px; }
  .observatory .filter-bar > .filter-field { grid-column: auto; min-width: 0; }
  .observatory .filter-bar > .search-field { grid-column: 1 / -1; }
  .observatory .reset-button { grid-area: auto / 1 / auto / -1; }
  .observatory .filter-field select, .observatory .search-control, .observatory .reset-button { height: auto; min-height: 44px; }
  .observatory .filter-field select, .observatory .reset-button { padding: .5em .65em; line-height: 1.5; }
  .observatory .search-control input { height: auto; min-height: 1.5em; line-height: 1.5; }
  .observatory .detail-switch { flex-wrap: wrap; }
  .observatory .sheet-footer { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .observatory .search-panel { position: fixed; inset: 10dvh 12px; width: auto; height: auto; }
  body.school-detail-open { overflow: hidden; }
  .observatory .drilldown-screen {
    inset: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    width: auto; height: auto; max-height: none; border-radius: 16px;
  }
  .observatory .detail-reading-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .observatory .school-detail { padding: 18px; }
  .observatory .detail-switch { display: flex; flex: 1 1 auto; gap: 8px; }
  .observatory .school-breadcrumb { flex-basis: 100%; font-size: 13px; }
  .observatory .drilldown-screen .dialog-topbar { padding: 10px 14px; }
  .observatory .detail-hero h2 { font-size: 28px; }
  #application-dialog { width: calc(100vw - 16px); height: calc(100dvh - 16px); max-height: none; }
  #application-dialog[open] { grid-template-rows: auto minmax(0, 1fr); }
  #application-dialog .dialog-topbar { flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
  #application-content { padding: 18px; }
}
@media (max-width: 480px) {
  .observatory .site-header .brand-copy strong { font-size: 17px; }
  .observatory .map-panel { height: 540px; }
  .observatory .charts-panel { grid-template-columns: minmax(0, 1fr); grid-template-rows: 250px 350px 350px; }
  .observatory .priority-facts { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .observatory .detail-side .participation-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .observatory .sheet-footer > span { display: none; }
  .observatory .sheet-footer button { width: 100%; margin: 0; }
  .observatory .map-panel-heading { left: 12px; right: 135px; }
  .observatory .map-panel-heading h2 { font-size: 17px; }
}
/* Two readable controls no longer fit at this content width. */
@media (max-width: 350px) {
  .observatory .filter-bar { grid-template-columns: minmax(0, 1fr); }
}
