/* Overview presentation: let the map use the available viewport. */
body { --sidebar-w: 360px; }
#mobileDataViewBtn { display: none; }
.header, .tab-bar, .tab-layers, .tab-sub-filters, .corridor-bar, .mmap-bar { flex-shrink: 0; }
.header { grid-template-rows: auto; grid-template-areas: 'title meta'; align-items: center; gap: 12px 24px; padding: 12px 20px; z-index: 1300; }
.header h1 { font: 600 21px/1.3 var(--font-display); letter-spacing: -.025em; padding-right: 0; }
.header-meta { flex-direction: row; align-items: center; gap: 16px; }
.header .lang-toggle { position: static; transform: none; align-self: center; height: 36px; border-radius: 4px; flex-shrink: 0; }
.header .lang-btn { min-width: 36px; line-height: 34px; font: 600 11px var(--font-body); }
.header .map-orient-restore { width: auto; min-height: 36px; padding: 0 10px; gap: 8px; border: 1px solid var(--line-3); border-radius: 4px; color: var(--fg-2); font: 500 13px/1.3 var(--font-body); white-space: nowrap; background: var(--bg-2); }
.header .map-orient-restore[aria-expanded='true'] { border-color: var(--clean); color: var(--fg-1); }
.header .map-orient { position: absolute; top: calc(100% + 8px); right: 20px; left: auto; width: min(620px, calc(100vw - 40px)); max-height: calc(100dvh - 110px); overflow-y: auto; padding: 24px; display: grid; gap: 20px; background: var(--bg-2); border: 1px solid var(--line-3); border-radius: 6px; box-shadow: var(--shadow-lg); }
.header .map-orient[hidden] { display: none; }
.map-orient-main { display: flex; gap: 10px; }
.header .map-orient .subtitle { grid-area: auto; max-width: none; margin: 0 0 8px; padding: 0 0 16px; border-bottom: 1px solid var(--line-2); font: 400 14px/1.6 var(--font-body); color: var(--fg-2); }
.map-orient-what { font: 400 15px/1.6 var(--font-body); }
.map-orient-how { font: 400 14px/1.6 var(--font-body); }
.map-orient-actions { justify-content: space-between; }
.map-orient-tour, .map-orient-x { min-height: 44px; }
.map-orient-x { min-width: 44px; }
.header .coord-readout-row { display: flex; flex-wrap: wrap; gap: 4px; }
.coord-readout { border: 1px solid var(--line-2); padding: 6px 8px; font: 400 10px/1.4 var(--font-mono); }
.tab-bar { padding: 0 20px; }
.tab-btn { padding: 10px 14px; font: 600 13px/1.4 var(--font-body); letter-spacing: 0; text-transform: none; }
.tab-bar__right { padding: 4px 0; gap: 6px; }
.icon-btn, .data-notes-btn, .data-view-btn { min-height: 32px; height: 32px; padding: 0 9px; font: 500 11px/1.3 var(--font-body); letter-spacing: 0; text-transform: none; }
.tab-layers { padding: 6px 20px; gap: 6px 0; }
.ctrl-group { gap: 5px; }
.ctrl-group-label { letter-spacing: .08em; }
.layer-btn { min-height: 32px; height: 32px; padding: 0 10px; font: 500 12px/1.3 var(--font-body); letter-spacing: 0; text-transform: none; white-space: nowrap; }
.tab-sub-filters { padding: 6px 20px; }
.corridor-bar { padding: 5px 20px; gap: 6px; }
.corridor-bar__right { display: none; }
.corridor-btn { min-height: 30px; font-family: var(--font-body); font-size: 11px; letter-spacing: .02em; text-transform: none; }
.app-layout { flex: 1 1 0; min-height: 0; height: auto; flex-direction: row; }
#map-wrap { min-height: 0; }
#map { min-height: 0; height: 100%; }
#sidebar { width: var(--sidebar-w); min-width: var(--sidebar-w); max-width: var(--sidebar-w); max-height: none; border-left: 1px solid var(--line-2); border-top: 0; }
.leaflet-control-zoom { border-color: var(--line-3) !important; box-shadow: var(--shadow-sm) !important; }
.leaflet-control-zoom a { background: var(--bg-2); color: var(--fg-1); border-color: var(--line-3); }
.leaflet-control-zoom a:hover, .leaflet-control-zoom a:focus { background: var(--bg-3); color: var(--fg-1); }
.legend-compact { max-height: calc(var(--overview-map-height, 600px) - 40px); overflow-y: auto; scrollbar-width: thin; }
.data-view-overlay, .data-notes-overlay { max-height: calc(100% - 24px); }
@media (min-width: 768px) and (max-width: 1250px) {
  body { --sidebar-w: 320px; }
  .header h1 { font-size: 19px; }
  .header-meta { gap: 8px; }
  .tab-bar, .tab-layers, .tab-sub-filters, .corridor-bar { padding-inline: 14px; }
  .tab-bar { flex-wrap: wrap; }
  .tab-bar__right { flex-wrap: wrap; }
  .ctrl-group { flex-wrap: wrap; }
}
@media (max-width: 767px) {
  .header { padding: 12px 16px 8px; grid-template-columns: minmax(0,1fr); grid-template-areas: 'title' 'meta'; gap: 8px; }
  .header h1 { font-size: 18px; line-height: 1.3; }
  .header-meta { width: 100%; justify-content: space-between; flex-direction: row; gap: 8px; }
  .header .lang-toggle { height: 44px; }
  .header .lang-btn { min-width: 44px; }
  .header .map-orient-restore { min-height: 44px; }
  .header .map-orient { right: 12px; width: calc(100vw - 24px); padding: 20px; max-height: calc(100dvh - 170px); }
  .header .map-orient-how { display: none; }
  .mmap-bar { padding: 8px 16px 12px; gap: 8px; }
  .mmap-field { flex-basis: 140px; }
  .mmap-bar { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .mmap-bar select { min-width: 0; width: 100%; min-height: 44px; }
  #mobileDataViewBtn, #mmapOpenState { display: inline-flex; min-height: 44px; height: 44px; align-self: end; justify-content: center; }
  #mobileDataViewBtn { padding-inline: 8px; flex-shrink: 0; }
  #mmapOpenState:disabled { opacity: .5; cursor: default; }
  .mmap-state-controls { display: flex; align-items: end; gap: 8px; grid-column: 1 / -1; }
  .data-view-overlay { overflow: auto; overscroll-behavior: contain; }
  .mmap-lbl { font-size: 11px; letter-spacing: .06em; }
  /* The compact picker already supplies these play controls. Keeping their
     desktop panels over the canvas blocks taps on the northern states. */
  #rca-selector, #rel-selector, #denue-selector, #archetype-selector, #isn-selector { display: none !important; }
  #sidebar { width: auto; min-width: 0; max-width: none; max-height: min(56dvh, calc(var(--overview-map-height, 600px) * .68)); border-left: 0; border-top: 1px solid var(--line-3); }
}
.arch-history-note { max-width: 260px; font-size: 12px; line-height: 1.5; color: var(--fg-2); }
.dv-compare { padding: 14px; margin: 16px 0; border: 1px solid var(--line-3); border-radius: 5px; color: var(--fg-1); background: var(--bg-2); }
.dv-compare summary { font-size: 15px; font-weight: 600; cursor: pointer; min-height: 32px; }
.dv-compare p { font-size: 13px; line-height: 1.5; margin: 8px 0 12px; }
.dv-compare-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.dv-compare-controls label { display: grid; gap: 5px; font-size: 12px; line-height: 1.4; }
.dv-compare-controls select { width: 100%; min-width: 0; min-height: 44px; padding: 8px; font: inherit; background: var(--bg-3); color: var(--fg-1); border: 1px solid var(--line-3); border-radius: 4px; }
.dv-compare-scroll { overflow-x: auto; margin: 12px 0; }
.dv-compare-scroll table { min-width: 660px; }
.dv-compare-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.dv-compare-actions button, .dv-compare-actions a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 12px; font: 500 13px/1.4 var(--font-body); color: var(--fg-1); background: var(--bg-3); border: 1px solid var(--line-3); border-radius: 4px; }
.dv-compare :is(select, button, a, summary, [tabindex]):focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

.dv-compare .dv-note, #compare-release-mismatch { overflow-wrap: anywhere; }
