/* REVIEW_NOTES_36 / 37 — simplified layout (loaded after notes23/25/27) */
.has-o36 .guided-bar,
.has-o36 #guided-select-wrap,
.has-o36 .guided-select-wrap,
.has-o36 #guided-select {
  display: none !important;
}

/* NOTES_37-1: grid tracks follow sidebar state so the map widens */
.has-o36 .layout {
  grid-template-columns: var(--o36-left, minmax(240px, 300px)) minmax(0, 1fr) var(--o36-right, minmax(220px, 300px));
  width: 100%;
  max-width: 100vw;
}
body.o36-sl-open { --o36-left: minmax(240px, 300px); }
body.o36-sl-rail { --o36-left: 32px; }
body.o36-sl-gone { --o36-left: 0px; }
body.o36-sr-open { --o36-right: minmax(220px, 300px); }
body.o36-sr-rail { --o36-right: 32px; }
body.o36-sr-gone { --o36-right: 0px; }
.has-o36 #map {
  width: 100%;
  min-width: 0;
}
/* Stay in the grid (no display:none) so 0-width tracks still leave 1fr for #map */
.panel.o36-gone {
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  visibility: hidden;
  pointer-events: none;
}
/* Legacy scenario / capacity-growth radios kept in DOM for app.js wiring, not visible */
.has-o36 #scenario-panel .group:has(input[name="scenario"]),
.has-o36 #scenario-panel > h3:first-of-type,
.has-o36 #scenario-panel > .group:has(input[name="growth"]),
.has-o36 #scenario-panel > h3:nth-of-type(2),
.has-o36 #scenario-panel > .hint#growth-affects-note,
.has-o36 #scenario-panel input[name="scenario"],
.has-o36 #scenario-panel input[name="growth"],
.has-o36 #scenario-panel label:has(input[name="scenario"]),
.has-o36 #scenario-panel label:has(input[name="growth"]),
.has-o36 #density-radios,
.has-o36 #capacity-envelope-wrap {
  display: none !important;
}
.has-o36 .layer-group.o36-legacy-hidden,
.has-o36 #layers-panel > .note,
.has-o36 #layers-panel > h3,
.has-o36 #layers-panel > .sources,
.has-o36 #layers-panel > .method-note,
.has-o36 #layers-panel > .methods-brand,
.has-o36 #layers-panel > details.legend-box {
  display: none !important;
}
.has-o36 #layers-panel details[data-group="background"] {
  display: none !important;
}
.has-o36 #qt-tools {
  display: none !important;
}
.has-o36 #qt-reach {
  display: none !important;
}
.has-o36 #qt-station:not([hidden]) {
  z-index: 5;
  /* NOTES_42-7: keep clear of the in-map scenario bar at 1280/1366 */
  top: calc(var(--o36-bar-h, 5.75rem) + 0.45rem);
  max-height: calc(100% - var(--o36-bar-h, 5.75rem) - 1.2rem);
}
.has-o36 .o36-bar {
  --o36-bar-h: 5.75rem;
}
.has-o36 #o36-terrain.on {
  background: #1d4e89;
  color: #fff;
}

/* scenario cards */
.o36-cards-wrap {
  border-bottom: 1px solid #c4b9a8;
  background: #f7f3ec;
  padding: 0.35rem 0.5rem;
}
.o36-cards-wrap.collapsed .o36-cards {
  display: none;
}
.o36-cards-wrap.collapsed .o36-cards-collapsed-label {
  display: block;
}
.o36-cards-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}
.o36-cards-collapsed-label {
  display: none;
  flex: 1;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: left;
  padding: 0.25rem 0;
}
.o36-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.35rem 0 0.5rem;
}
.o36-card {
  flex: 1 1 10rem;
  min-width: 9rem;
  max-width: 14rem;
  text-align: left;
  padding: 0.5rem 0.65rem;
  border: 1px solid #c4b9a8;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font: inherit;
}
.o36-card:hover {
  border-color: #0b6e4f;
}
.o36-card[aria-pressed="true"] {
  border-color: #0b6e4f;
  box-shadow: 0 0 0 2px rgba(11, 110, 79, 0.25);
  background: #f0faf6;
}
.o36-card-title {
  font-weight: 600;
  font-size: 0.85rem;
  display: block;
}
.o36-card-reach {
  font-size: 1.35rem;
  font-weight: 600;
  color: #0b6e4f;
}
.o36-card-meta {
  font-size: 0.72rem;
  color: #5c4d3c;
  margin-top: 0.2rem;
  line-height: 1.25;
  display: block;
}

/* scenario bar on map */
.o36-bar {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  top: 0.5rem;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
  padding: 0.4rem 0.55rem;
  background: rgba(247, 243, 236, 0.94);
  border: 1px solid #c4b9a8;
  border-radius: 8px;
  font-size: 0.82rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  max-width: calc(100% - 1rem);
}
.o36-bar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
  width: 100%;
}
.o36-bar select,
.o36-bar input[type="range"] {
  font: inherit;
}
.o36-bar-year {
  flex: 1 1 8rem;
  min-width: 7rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.o36-bar-year input {
  flex: 1;
}
.o36-bar-year-val {
  font-weight: 600;
  min-width: 2.5rem;
}
.o36-bar-reach {
  font-weight: 700;
  font-size: 1rem;
  color: #0b6e4f;
  white-space: nowrap;
}
.o36-bar-reach .o36-infill-range {
  font-weight: 400;
  font-size: 0.75rem;
  color: #5c4d3c;
}
.o36-bar-kb {
  display: none;
  align-items: center;
  gap: 0.25rem;
}
.o36-bar-kb.on {
  display: inline-flex;
}
.o36-bar-anim {
  padding: 0.2rem 0.45rem;
}

/* map controls — NOTES_37-5: below the year bar so the slider stays clear */
.o36-map-ctl {
  position: absolute;
  right: 0.55rem;
  top: auto;
  bottom: 2.75rem;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.o36-map-ctl .maplibregl-ctrl-top-right {
  position: static !important;
}
#o36-fullmap,
#o36-basemap {
  position: static;
  top: auto;
}
.o36-map-btn {
  font: inherit;
  font-size: 0.75rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid #c4b9a8;
  border-radius: 6px;
  background: #f7f3ec;
  cursor: pointer;
}
/* sidebars collapse */
.panel.o36-collapsed {
  width: 32px !important;
  min-width: 32px !important;
  padding: 0 !important;
  overflow: hidden;
}
.panel.o36-collapsed > *:not(.o36-rail):not(.o36-collapse-btn) {
  display: none !important;
}
.o36-rail {
  display: none;
  height: 100%;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: #5c4d3c;
  padding: 0.5rem 0;
}
.panel.o36-collapsed .o36-rail {
  display: flex;
}
.o36-collapse-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  width: 22px;
  height: 48px;
  padding: 0;
  border: 1px solid #c4b9a8;
  background: #f7f3ec;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
}
#o36-collapse-layers {
  right: -11px;
  border-radius: 0 6px 6px 0;
}
#o36-collapse-results {
  left: -11px;
  border-radius: 6px 0 0 6px;
}
#layers-panel {
  position: relative;
}
#scenario-panel {
  position: relative;
}

/* layer groups */
.o36-layer-groups details.o36-group {
  border-bottom: 1px solid #e8e2d8;
  margin: 0;
}
.o36-layer-groups summary {
  font-weight: 600;
  padding: 0.45rem 0;
  cursor: pointer;
}
.o36-group-body {
  padding: 0 0 0.5rem;
}
.o36-group-body label {
  display: block;
  margin: 0.25rem 0;
  font-size: 0.85rem;
}
details.o36-more {
  margin-top: 0.35rem;
}
details.o36-more > summary {
  font-weight: 500;
  font-size: 0.8rem;
  color: #0b6e4f;
}
.o36-dp-switch {
  display: flex;
  gap: 0.5rem;
  font-size: 0.78rem;
  margin: 0.25rem 0 0.35rem;
}
.o36-capacity-growth {
  margin: 0.35rem 0;
  font-size: 0.82rem;
}

/* right panel tabs */
.o36-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #c4b9a8;
  margin: 0 0 0.5rem;
}
.o36-tab {
  flex: 1;
  padding: 0.45rem 0.35rem;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.o36-tab[aria-selected="true"] {
  font-weight: 600;
  border-bottom-color: #0b6e4f;
  color: #0b6e4f;
}
.o36-tab-panel {
  display: none;
  max-height: calc(100vh - 11rem);
  overflow-y: auto;
}
.o36-tab-panel.on {
  display: block;
}
.o36-outside-reach {
  margin: 0.75rem 0;
  padding: 0.5rem;
  background: #fff;
  border: 1px solid #e8e2d8;
  border-radius: 6px;
}
.o36-advanced details {
  margin-top: 0.5rem;
}

/* NOTES_37-2 / 38-1: mobile — no blank band, no grey map-ui under bar, bar wraps, cards scroll clean */
body.has-o36 {
  /* banner · cards · layout · footer (guided-bar is display:none and out of flow) */
  grid-template-rows: auto auto 1fr auto;
}
.has-o36 .guided-bar {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  position: absolute !important;
  pointer-events: none !important;
}

@media (max-width: 900px) {
  html,
  body.has-o36 {
    overflow-x: hidden;
    max-width: 100vw;
    width: 100%;
  }
  .has-o36 .layout {
    grid-template-columns: 1fr !important;
    min-height: 0;
    height: 100%;
  }
  .has-o36 #map {
    min-height: 50vh;
    height: 100%;
  }
  /* 38-1a: ID-level position:relative was beating .panel.drawer{fixed}, stacking
     the sidebars above the map and leaving a ~100px blank band. Keep drawers off-flow. */
  .has-o36 #layers-panel,
  .has-o36 #scenario-panel {
    position: fixed !important;
  }
  /* 38-1b: old Layers / Scenario / Flat 2D under the scenario bar */
  .has-o36 .map-ui {
    display: none !important;
  }
  .o36-cards-wrap {
    max-width: 100vw;
    width: 100%;
    box-sizing: border-box;
    padding: 0.25rem 0.5rem 0.45rem;
  }
  /* 38-1a: collapse the cards-head chrome that left a ~95px empty band */
  .o36-cards-head {
    display: none;
  }
  .o36-cards-wrap.collapsed .o36-cards-head {
    display: flex;
  }
  .o36-cards {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    max-width: 100vw;
    width: 100%;
    gap: 0.4rem;
    padding: 0.2rem 0 0.55rem; /* 38-1d: room under cards so scroll thumb doesn't cover them */
    scrollbar-width: none; /* Firefox */
  }
  .o36-cards::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
    height: 0;
  }
  .o36-card {
    flex: 0 0 160px;
    width: 160px;
    min-width: 160px;
    max-width: 160px;
  }
  /* 38-1c: two-row scenario bar — network/growth, then ▶ year REACH */
  .o36-bar {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    overflow-x: visible;
    font-size: 0.75rem;
    max-width: calc(100% - 1rem);
    row-gap: 0.35rem;
  }
  .o36-bar-row-year .o36-bar-year {
    flex: 1 1 auto;
    min-width: 0;
  }
  .o36-bar-reach {
    white-space: nowrap;
  }
  .o36-rail,
  .o36-collapse-btn {
    display: none !important;
  }
  .panel.o36-collapsed,
  .panel.o36-gone {
    width: auto !important;
    min-width: 0 !important;
    display: block !important;
  }
  .o36-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #f7f3ec;
    z-index: 8;
    margin: 0;
    padding: 0.25rem;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
  }
  .has-o36 #scenario-panel.drawer.open {
    padding-bottom: 3rem;
  }
}

@media (max-width: 600px) {
  .o36-cards {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100vw;
    padding-bottom: 0.55rem;
    scrollbar-width: none;
  }
  .o36-cards::-webkit-scrollbar {
    display: none;
    height: 0;
  }
  .o36-card {
    flex: 0 0 160px;
    min-width: 160px;
  }
}

/* ---- NOTES_38-4 public presentation mode ---- */
html.public-mode #glossary-modal dt.public-hide,
html.public-mode #glossary-modal dd.public-hide,
html.public-mode #bc-system-panel,
html.public-mode .o36-merge-bc-patronage,
html.public-mode label:has(#o36-merge-bc-patronage) {
  display: none !important;
}