/* Responsive map workspace. Loaded after the active theme stylesheet. */
.map-page {
    --map-panel-width: 280px;
    width: 100%;
    max-width: 1800px;
    margin-inline: auto;
}

.map-page [hidden] {
    display: none !important;
}

.map-page .text-light {
    color: var(--text) !important;
}

.map-page-header {
    min-height: 3.5rem;
}

.map-result-summary {
    color: var(--text);
    background: var(--surface);
    border: 1px solid rgba(212, 175, 55, 0.45);
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    font-size: 0.88rem;
    white-space: nowrap;
}

.map-mobile-result-summary {
    display: none;
}

.map-workspace {
    display: grid;
    grid-template-columns: var(--map-panel-width) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.map-main {
    min-width: 0;
}

#legend.map-filter-panel {
    position: sticky;
    inset: auto;
    top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    height: auto;
    min-height: 0;
    max-height: calc(100dvh - 7.5rem);
    padding: 0;
    overflow: hidden;
    color: var(--text);
    background: var(--surface);
    border: 1px solid rgba(212, 175, 55, 0.45);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
    transform: none;
    visibility: visible;
    opacity: 1;
    z-index: 10;
}

.map-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding-bottom: 0.9rem;
}

.map-filter-resize-handle {
    display: none;
}

.map-filter-close {
    display: none;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    font-size: 1.45rem;
    line-height: 1;
}

.map-filter-section {
    padding: 1rem 0;
    border-top: 1px solid rgba(212, 175, 55, 0.25);
}

.map-filter-title {
    display: flex;
    gap: 0.45rem;
    align-items: center;
    margin: 0 0 0.7rem;
    color: var(--gold);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.map-filter-panel .form-switch {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.25rem;
}

.map-filter-panel .map-region-toggle {
    flex-wrap: wrap;
    padding-block: 0.2rem;
}

.map-region-toggle .form-check-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.map-region-swatch {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
    background: linear-gradient(135deg, #8b5a2b 0 20%, #4c7a6a 20% 40%, #b8860b 40% 60%, #587f9b 60% 80%, #7e5a9b 80%);
    border: 1px solid rgba(255, 255, 255, 0.48);
    border-radius: 3px;
}

.map-filter-hint {
    flex-basis: 100%;
    margin: -0.25rem 0 0 3.05rem;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.25;
}

.map-filter-panel .form-check-input {
    flex: 0 0 auto;
    margin: 0;
}

.map-filter-menu-btn {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    text-align: left;
}

.map-filter-menu-btn .map-filter-chevron {
    margin-left: auto;
    transition: transform 0.18s ease;
}

.map-filter-menu-btn[aria-expanded="true"] .map-filter-chevron {
    transform: rotate(180deg);
}

.map-filter-count {
    display: inline-grid;
    place-items: center;
    min-width: 1.45rem;
    height: 1.45rem;
    padding: 0 0.32rem;
    color: #17110a;
    font-size: 0.74rem;
    font-weight: 800;
    line-height: 1;
    border-radius: 999px;
    background: var(--gold);
}

.map-filter-panel .filter-dropdown {
    position: static !important;
    inset: auto !important;
    width: 100%;
    max-width: none;
    max-height: 17rem;
    margin-top: 0.35rem;
    overflow-y: auto;
    transform: none !important;
}

.map-status-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

.map-page .status-filter-item {
    display: flex;
    min-width: 0;
    min-height: 5.25rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 0.25rem;
    color: var(--text);
    background: rgba(128, 128, 128, 0.08);
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
}

.map-page .status-filter-item:hover,
.map-page .status-filter-item:focus-visible {
    transform: none;
    border-color: rgba(212, 175, 55, 0.55);
    outline: none;
}

.map-page .status-filter-item.active {
    border-color: var(--gold);
}

.map-page .status-label {
    display: block;
    color: var(--text);
    font-size: 0.7rem;
    line-height: 1.15;
    text-shadow: none;
}

.map-toolbar {
    display: grid;
    grid-template-columns: minmax(250px, 1fr) auto minmax(145px, auto);
    gap: 0.65rem;
    align-items: end;
    margin-bottom: 0.65rem;
    padding: 0.65rem;
    background: var(--surface);
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.map-toolbar-toggle,
.map-toolbar-close {
    display: none;
}

.map-search-wrap {
    position: relative;
    min-width: 0;
}

.map-search-wrap > .visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.map-search-wrap .form-control {
    width: 100%;
    min-height: 44px;
    padding-left: 2.7rem;
    padding-right: 2.8rem;
    color: var(--text);
    background: var(--bg-darker, var(--bg));
    border-color: rgba(212, 175, 55, 0.38);
}

.map-search-wrap .form-control:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 0.2rem rgba(212, 175, 55, 0.15);
}

.map-search-icon {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 0.85rem;
    width: 1.15rem;
    height: 1.15rem;
    color: var(--gold);
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    transform: translateY(-50%);
    pointer-events: none;
}

.map-search-clear {
    position: absolute;
    z-index: 2;
    top: 50%;
    right: 0.35rem;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    color: var(--muted);
    font-size: 1.35rem;
    line-height: 1;
    border: 0;
    border-radius: 50%;
    background: transparent;
    transform: translateY(-50%);
}

.map-search-clear:hover,
.map-search-clear:focus-visible {
    color: var(--text);
    background: rgba(212, 175, 55, 0.12);
    outline: none;
}

.map-button-icon,
.map-popup-icon {
    width: 1.15rem;
    height: 1.15rem;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.map-action-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.map-search-results {
    position: absolute;
    z-index: 1200;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    max-height: min(22rem, 55vh);
    overflow-y: auto;
    border: 1px solid rgba(212, 175, 55, 0.55);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.map-search-results .list-group-item {
    min-height: 48px;
    padding: 0.65rem 0.8rem;
}

.map-search-results .list-group-item[role="option"] {
    cursor: pointer;
}

.map-search-results .list-group-item[role="option"].active,
.map-search-results .list-group-item[role="option"]:hover {
    color: var(--text);
    border-color: rgba(212, 175, 55, 0.4);
    background: rgba(212, 175, 55, 0.16);
}

.map-search-empty {
    color: var(--muted);
    cursor: default;
}

.map-toolbar-actions {
    display: flex;
    gap: 0.4rem;
}

.map-toolbar-actions .btn {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    white-space: nowrap;
    border-color: rgba(212, 175, 55, 0.55);
}

#toggle-legend-btn {
    display: none;
}

.map-provider-control {
    min-width: 145px;
}

.map-provider-control .form-label {
    display: block;
    color: var(--text);
    font-size: 0.72rem;
}

.map-location-status {
    margin: 0 0 0.65rem;
    padding: 0.55rem 0.75rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 8px;
    font-size: 0.86rem;
    line-height: 1.35;
}

.map-location-status.is-error {
    border-color: var(--danger, #dc3545);
}

#myLocationBtn[aria-busy="true"] {
    cursor: wait;
}

.map-provider-control .form-select {
    min-height: 44px;
    color: var(--text);
    background-color: var(--bg-darker, var(--bg));
    border-color: rgba(212, 175, 55, 0.38);
}

.map-page #map {
    position: relative;
    width: 100%;
    height: calc(100dvh - 10.5rem);
    min-height: 610px;
    overflow: hidden;
    border-width: 2px;
    border-radius: 14px;
}

/*
 * OpenLayers indsætter viewporten med height: 100%. Når kortets højde kommer
 * fra min-height i det responsive layout, kan procenthøjden ende som 0 px.
 * Absolutte kanter bruger containerens faktiske renderede højde og virker
 * derfor ens i normal- og fullscreenvisning.
 */
.map-page #map > .ol-viewport {
    position: absolute !important;
    inset: 0;
    width: auto !important;
    height: auto !important;
}

.map-state-overlay {
    position: absolute;
    z-index: 900;
    top: 0.75rem;
    left: 50%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: calc(100% - 2rem);
    padding: 0.6rem 0.85rem;
    color: var(--text);
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    border: 1px solid rgba(212, 175, 55, 0.55);
    border-radius: 999px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    transform: translateX(-50%);
    white-space: nowrap;
}

/* map-state-overlay har sin egen display-regel og indlæses efter temaet. */
.map-state-overlay.wk-hidden {
    display: none !important;
}

.map-state-warning {
    top: 3.8rem;
    color: var(--text);
    border-color: var(--warning, #ffc107);
}

.map-page #map:fullscreen {
    height: 100dvh;
    min-height: 0;
    border: 0;
    border-radius: 0;
}

body.map-pseudo-fullscreen-open {
    overflow: hidden;
    overscroll-behavior: none;
}

.map-page #map.map-pseudo-fullscreen {
    position: fixed !important;
    z-index: 2000;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    min-height: 0;
    max-height: none;
    border: 0;
    border-radius: 0;
}

.map-exit-fullscreen {
    position: absolute;
    z-index: 1100;
    top: max(0.75rem, env(safe-area-inset-top, 0px));
    right: max(0.75rem, env(safe-area-inset-right, 0px));
    display: none;
    min-width: 44px;
    height: 44px;
    padding: 0 0.8rem;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    color: #111;
    background: var(--gold-strong, #d4af37);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    border: 2px solid #111;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.map-exit-fullscreen span:first-child {
    font-size: inherit;
    font-weight: inherit;
}

.map-page #map:fullscreen .map-exit-fullscreen,
.map-page #map.map-pseudo-fullscreen .map-exit-fullscreen,
.map-page #map.map-fullscreen-active .map-exit-fullscreen {
    display: inline-flex;
}

.map-page .ol-control button {
    width: 2.35rem;
    height: 2.35rem;
    font-size: 1.25rem;
}

.map-page .ol-zoom {
    top: 0.75rem;
    left: 0.75rem;
}

.map-page .popup-container {
    width: min(340px, 80vw);
    max-height: min(520px, 70dvh);
    padding: 1.05rem 2.7rem 1.05rem 1.05rem;
    overflow-y: auto;
    border: 1px solid rgba(212, 175, 55, 0.65);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
}

.map-page .popup-container p {
    margin-bottom: 0.5rem;
    color: var(--text);
    line-height: 1.4;
}

.map-page .map-popup-title {
    margin: 0 0 0.8rem;
    padding-bottom: 0.65rem;
    color: var(--gold);
    font-size: 1.05rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.25);
}

.map-page .map-popup-actions,
.map-page .map-popup-admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.85rem;
}

.map-page .map-popup-actions .btn,
.map-page .map-popup-admin-actions .btn {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.map-page .map-popup-admin-actions {
    padding-top: 0.7rem;
    border-top: 1px dashed rgba(212, 175, 55, 0.3);
}

.map-page .popup-opening-hours {
    font-family: Consolas, "Courier New", monospace;
    white-space: pre-wrap;
}

.map-page .map-popup-release {
    margin: 0.65rem 0;
    padding: 0.6rem;
    color: #17110a;
    border-radius: 0.5rem;
    background: var(--gold-strong, #d4af37);
}

.map-page .map-popup-release strong {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.map-page .map-popup-release a {
    color: #17110a;
    font-weight: 700;
    text-decoration: underline;
}

.map-page .popup-close-btn {
    top: 0.65rem;
    right: 0.65rem;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    color: var(--text);
    background: rgba(128, 128, 128, 0.12);
    border: 1px solid rgba(212, 175, 55, 0.35);
}

.map-page .popup-close-btn:hover,
.map-page .popup-close-btn:focus-visible {
    color: #17110a;
    background: var(--gold);
    outline: none;
}

.map-filter-backdrop {
    display: none;
}

.map-page .nearby-panel {
    position: fixed;
    z-index: 1300;
    right: 0;
    bottom: 0;
    left: 0;
    display: none;
    max-height: min(72dvh, 620px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    overflow-y: auto;
    color: var(--text);
    background: var(--surface);
    border-top: 2px solid var(--gold);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -12px 35px rgba(0, 0, 0, 0.42);
    transform: translateY(100%);
    transition: transform 0.25s ease;
}

.map-page .nearby-panel.show {
    transform: translateY(0);
}

.map-page .nearby-panel[hidden] {
    display: none !important;
}

.nearby-list {
    width: min(760px, 100%);
    margin-inline: auto;
    padding: 1rem;
}

.nearby-header,
.nearby-result,
.nearby-result-main {
    display: flex;
    align-items: center;
}

.nearby-header {
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.nearby-close {
    flex: 0 0 auto;
}

.nearby-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.nearby-tabs .btn {
    min-height: 42px;
}

.nearby-tabs .btn[aria-selected="true"] {
    color: #17110a;
    background: var(--gold);
    border-color: var(--gold);
}

.nearby-result {
    gap: 0.65rem;
    padding: 0;
    background: var(--bg-darker, var(--bg));
    border-color: rgba(212, 175, 55, 0.3);
}

.nearby-result-main {
    min-width: 0;
    min-height: 64px;
    flex: 1 1 auto;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem;
    color: var(--text);
    text-align: left;
    background: transparent;
    border: 0;
}

.nearby-result-main:hover,
.nearby-result-main:focus-visible {
    background: rgba(212, 175, 55, 0.12);
    outline: 2px solid var(--gold);
    outline-offset: -2px;
}

.nearby-result-copy {
    display: grid;
    min-width: 0;
    gap: 0.15rem;
}

.nearby-result-name,
.nearby-result-meta,
.nearby-result-address {
    overflow-wrap: anywhere;
}

.nearby-result-name {
    color: var(--gold);
}

.nearby-result-meta,
.nearby-result-address {
    color: var(--muted);
    font-size: 0.8rem;
}

.nearby-result-distance {
    flex: 0 0 auto;
    color: var(--gold);
    white-space: nowrap;
}

.nearby-route-button {
    min-height: 42px;
    flex: 0 0 auto;
    margin-right: 0.65rem;
}

body.map-filters-open {
    overflow: hidden;
}

@media (min-width: 992px) {
    .map-page {
        display: flex;
        height: max(760px, calc(100dvh - 4rem));
        flex-direction: column;
    }

    .map-page-header {
        flex: 0 0 auto;
    }

    .map-workspace {
        min-height: 0;
        flex: 1 1 auto;
        align-items: stretch;
    }

    .map-main {
        display: flex;
        min-height: 0;
        flex-direction: column;
    }

    #legend.map-filter-panel {
        height: auto;
        min-height: 0;
        align-self: start;
    }

    .map-toolbar {
        flex: 0 0 auto;
    }

    .map-page #map {
        height: auto;
        flex: 1 1 auto;
    }
}

@media (max-width: 1199.98px) {
    .map-button-label {
        display: none;
    }

    .map-toolbar {
        grid-template-columns: minmax(220px, 1fr) auto 145px;
    }
}

@media (max-width: 991.98px) {
    .map-page {
        display: flex;
        height: max(620px, calc(100dvh - 4rem));
        flex: 0 0 auto;
        flex-direction: column;
        padding-top: 0.75rem !important;
    }

    .map-page-header p {
        font-size: 0.9rem;
    }

    .map-workspace {
        display: flex;
        min-height: 0;
        flex: 1 1 auto;
        align-items: stretch;
    }

    .map-main {
        display: flex;
        width: 100%;
        min-height: 0;
        flex: 1 1 auto;
        flex-direction: column;
    }

    #legend.map-filter-panel {
        --map-filter-sheet-height: min(54dvh, 460px);
        position: fixed;
        z-index: 1210;
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: var(--map-filter-sheet-height);
        min-height: min(280px, 54dvh);
        max-height: min(88dvh, 760px);
        padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
        border-width: 1px 0 0;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -12px 35px rgba(0, 0, 0, 0.45);
        transform: translateY(105%);
        visibility: hidden;
        opacity: 0;
        transition: transform 0.25s ease, opacity 0.2s ease, visibility 0.25s;
    }

    #legend.map-filter-panel.is-expanded {
        --map-filter-sheet-height: min(88dvh, 760px);
    }

    #legend.map-filter-panel.is-dragging {
        transition: none;
        user-select: none;
    }

    #legend.map-filter-panel.show {
        transform: translateY(0);
        visibility: visible;
        opacity: 1;
    }

    .map-filter-header {
        position: sticky;
        z-index: 3;
        top: -1rem;
        flex-wrap: wrap;
        margin: -1rem -1rem 0;
        padding: 0.35rem 1rem 0.75rem;
        background: color-mix(in srgb, var(--surface) 96%, transparent);
        border-bottom: 1px solid rgba(212, 175, 55, 0.2);
        backdrop-filter: blur(14px);
    }

    .map-filter-resize-handle {
        display: grid;
        width: 100%;
        height: 28px;
        flex: 0 0 100%;
        padding: 0;
        place-items: center;
        border: 0;
        background: transparent;
        cursor: ns-resize;
        touch-action: none;
    }

    .map-filter-resize-handle > span {
        width: 46px;
        height: 5px;
        border-radius: 999px;
        background: color-mix(in srgb, var(--muted) 72%, transparent);
        transition: width 0.18s ease, background 0.18s ease;
    }

    .map-filter-resize-handle:hover > span,
    .map-filter-resize-handle:focus-visible > span {
        width: 58px;
        background: var(--gold);
    }

    .map-filter-resize-handle:focus-visible {
        border-radius: 999px;
        outline: 2px solid var(--gold);
        outline-offset: -3px;
    }

    .map-filter-close,
    #toggle-legend-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .map-filter-backdrop {
        position: fixed;
        z-index: 1200;
        inset: 0;
        display: block;
        width: 100%;
        height: 100%;
        padding: 0;
        background: rgba(0, 0, 0, 0.32);
        border: 0;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, visibility 0.2s;
    }

    .map-filter-backdrop.show {
        opacity: 1;
        visibility: visible;
    }

    .map-toolbar {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: stretch;
        padding: 0.55rem;
    }

    .map-search-wrap {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .map-toolbar-actions {
        grid-column: 1;
        grid-row: 2;
    }

    .map-provider-control {
        grid-column: 2;
        grid-row: 2;
    }

    .map-provider-control .form-label {
        display: none;
    }

    .map-page #map {
        height: auto;
        min-height: 360px;
        max-height: none;
        flex: 1 1 auto;
    }
}

@media (max-width: 767.98px) {
    .map-page {
        padding-top: 0.35rem !important;
    }

    .map-page-header {
        display: none !important;
    }

    .map-mobile-result-summary {
        position: absolute;
        z-index: 1065;
        top: 0.75rem;
        left: 0.75rem;
        display: block;
        max-width: calc(100% - 5.25rem);
        overflow: hidden;
        padding: 0.42rem 0.68rem;
        color: var(--text);
        border: 1px solid rgba(212, 175, 55, 0.42);
        border-radius: 999px;
        background: color-mix(in srgb, var(--surface) 90%, transparent);
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
        backdrop-filter: blur(9px);
        font-size: 0.72rem;
        font-weight: 700;
        line-height: 1.2;
        text-overflow: ellipsis;
        white-space: nowrap;
        pointer-events: none;
    }
}

@media (max-width: 575.98px) {
    .map-page .btn {
        width: auto;
    }

    #legend.map-filter-panel {
        padding-inline: 0.85rem;
    }

    #legend .map-filter-header {
        margin-inline: -0.85rem;
        padding-inline: 0.85rem;
    }

    #legend .map-filter-section {
        padding-block: 0.72rem;
    }

    #legend .status-filter-item {
        min-height: 4.35rem;
    }

    .map-page-header {
        margin-bottom: 0.65rem !important;
    }

    .map-page-header h1 {
        font-size: 1.35rem;
    }

    .map-page-header p {
        display: none;
    }

    .map-result-summary {
        max-width: 100%;
        padding: 0.3rem 0.65rem;
        overflow: hidden;
        font-size: 0.78rem;
        text-overflow: ellipsis;
    }

    .map-toolbar {
        gap: 0.45rem;
        margin-bottom: 0.45rem;
        border-radius: 10px;
    }

    .map-toolbar-actions {
        gap: 0.3rem;
    }

    .map-toolbar-actions .btn {
        min-width: 44px;
        padding-inline: 0.65rem;
    }

    .map-provider-control {
        min-width: 122px;
    }

    .map-provider-control .form-select {
        width: 122px;
        font-size: 0.75rem;
    }

    .map-page #map {
        border-width: 1px;
        border-radius: 10px;
    }

    .map-page .popup-container {
        width: min(88vw, 340px);
        max-height: 55dvh;
    }

    .map-page .popup-container .btn {
        flex: 1 1 auto;
        min-height: 42px;
    }

    .map-state-overlay {
        top: 0.55rem;
        font-size: 0.8rem;
    }

    .nearby-list {
        padding: 0.85rem;
    }

    .nearby-result {
        align-items: stretch;
    }

    .nearby-result-main {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.35rem;
    }

    .nearby-route-button {
        align-self: center;
        margin-right: 0.5rem;
    }
}

@media (max-height: 700px) and (max-width: 991.98px) {
    .map-page {
        height: max(560px, calc(100dvh - 4rem));
    }
}

@media (prefers-reduced-motion: reduce) {
    #legend.map-filter-panel,
    .map-filter-backdrop,
    .map-toolbar,
    .map-page .nearby-panel {
        transition: none;
    }
}

.map-production-toggle .map-filter-hint {
    display: block;
    margin-top: 0.2rem;
}

.map-production-swatch {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    margin-right: 0.45rem;
    border: 1px solid #fff4d7;
    vertical-align: middle;
}

.map-production-swatch-water { background: #49b9e8; border-radius: 50%; }
.map-production-swatch-peat { background: #bc8766; }
.map-production-swatch-maltings { background: #edc45c; clip-path: polygon(50% 0, 100% 100%, 0 100%); }

.production-location-note { font-size: 0.85rem; color: #d8cbb8; }
.production-sources ul { padding-left: 1.2rem; }
.production-sources a { overflow-wrap: anywhere; }

/* Enhanced map exploration layout */
.map-stage,
.map-canvas-column,
.map-surface {
    min-width: 0;
    min-height: 0;
}

.map-stage {
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
    overflow: hidden;
}

.map-stage.map-detail-open {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 350px);
}

.map-canvas-column {
    display: flex;
    flex-direction: column;
}

.map-surface {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    overflow: hidden;
    border-radius: 14px;
}

.map-toolbar {
    grid-template-columns: minmax(250px, 1fr) auto;
}

.map-active-filters {
    display: flex;
    grid-column: 1 / -1;
    gap: 0.4rem;
    overflow-x: auto;
    padding-top: 0.1rem;
    scrollbar-width: thin;
}

.map-active-filters[hidden] {
    display: none !important;
}

.map-filter-chip {
    display: inline-flex;
    min-height: 30px;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.55rem;
    color: var(--text);
    border: 1px solid rgba(212, 175, 55, 0.42);
    border-radius: 999px;
    background: color-mix(in srgb, var(--gold) 10%, var(--bg-darker));
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.map-filter-chip:hover,
.map-filter-chip:focus-visible {
    color: #17110a;
    background: var(--gold);
    outline: none;
}

.map-filter-chip svg {
    width: 0.75rem;
    height: 0.75rem;
    stroke: currentColor;
}

.map-provider-control {
    width: 100%;
    min-width: 0;
}

.map-provider-control .form-select {
    width: 100%;
}

.map-page #map {
    height: auto;
    min-height: 520px;
    flex: 1 1 auto;
}

.map-results-panel,
.map-detail-panel {
    color: var(--text);
    background: color-mix(in srgb, var(--surface) 97%, transparent);
    border: 1px solid rgba(212, 175, 55, 0.48);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
}

.map-results-panel[hidden],
.map-detail-panel[hidden] {
    display: none !important;
}

.map-results-panel {
    position: absolute;
    z-index: 1060;
    top: 0.75rem;
    bottom: 0.75rem;
    left: 0.75rem;
    width: min(310px, calc(100% - 1.5rem));
    overflow: hidden;
    border-radius: 13px;
}

.map-results-panel.show {
    display: flex;
    flex-direction: column;
}

.map-panel-heading {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 0.9rem 0.65rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.24);
}

.map-panel-heading small {
    display: block;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.map-panel-heading h2 {
    margin: 0.1rem 0 0;
    color: var(--gold);
    font-size: 1.05rem;
}

.map-panel-close {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    padding: 0;
    color: var(--text);
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 50%;
    background: rgba(128, 128, 128, 0.1);
    place-items: center;
}

.map-panel-close:hover,
.map-panel-close:focus-visible {
    color: #17110a;
    background: var(--gold);
    outline: none;
}

.map-panel-summary {
    margin: 0;
    padding: 0.55rem 0.9rem;
    color: var(--muted);
    font-size: 0.78rem;
}

.map-result-list-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-right: 0.65rem;
}

.map-result-list-tools .form-select {
    width: auto;
    min-width: 92px;
    color: var(--text);
    background-color: var(--bg-darker, var(--bg));
    border-color: rgba(212, 175, 55, 0.3);
    font-size: 0.72rem;
}

.map-results-list {
    display: grid;
    gap: 0.4rem;
    margin: 0;
    padding: 0 0.65rem 0.75rem;
    overflow-y: auto;
    list-style: none;
}

.map-result-item-button {
    display: grid;
    width: 100%;
    min-height: 58px;
    padding: 0.6rem 0.65rem;
    color: var(--text);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 9px;
    background: var(--bg-darker, var(--bg));
    text-align: left;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.55rem;
}

.map-result-item-button:hover,
.map-result-item-button:focus-visible,
.map-result-item-button.is-selected {
    border-color: var(--gold);
    background: color-mix(in srgb, var(--gold) 12%, var(--bg-darker));
    outline: none;
}

.map-result-type-mark {
    display: grid;
    width: 2rem;
    height: 2rem;
    color: #17110a;
    border-radius: 50%;
    background: var(--gold);
    font-size: 0.72rem;
    font-weight: 900;
    place-items: center;
}

.map-result-item-copy {
    display: grid;
    min-width: 0;
    gap: 0.15rem;
}

.map-result-item-copy strong,
.map-result-item-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-result-item-copy small {
    color: var(--muted);
    font-size: 0.72rem;
}

.map-results-empty {
    padding: 1rem;
    color: var(--muted);
    text-align: center;
}

.map-detail-panel {
    position: relative;
    display: none;
    min-height: 0;
    overflow-y: auto;
    border-radius: 14px;
}

.map-detail-panel.show {
    display: block;
}

.map-detail-panel .popup-container {
    width: 100%;
    max-width: none;
    max-height: none;
    padding: 1rem;
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.map-popup-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
    padding-right: 2.4rem;
}

.map-popup-heading-copy {
    min-width: 0;
}

.map-place-type,
.map-place-status {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    padding: 0.18rem 0.48rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.map-place-type {
    color: #17110a;
    background: var(--gold);
}

.map-place-status {
    color: var(--text);
    border: 1px solid rgba(212, 175, 55, 0.4);
    background: rgba(128, 128, 128, 0.12);
}

.map-page .map-popup-title {
    margin: 0.45rem 0 0;
    padding: 0;
    border: 0;
    font-family: var(--font-heading, Georgia, serif);
    font-size: 1.35rem;
    line-height: 1.15;
}

.map-popup-image {
    width: 100%;
    margin: 0 0 0.85rem;
    overflow: hidden;
    border: 1px solid rgba(212, 175, 55, 0.28);
    border-radius: 10px;
    background: #100d09;
}

.map-popup-image-media {
    position: relative;
    aspect-ratio: 2.5 / 1;
    overflow: hidden;
}

.map-popup-image-backdrop,
.map-popup-image-foreground {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.map-popup-image-backdrop {
    object-fit: cover;
    filter: blur(12px) brightness(0.46) saturate(0.78);
    transform: scale(1.1);
}

.map-popup-image-foreground {
    z-index: 1;
    object-fit: contain;
}

.map-popup-image.is-ai-fallback .map-popup-image-foreground {
    object-fit: cover;
}

.map-popup-image figcaption {
    padding: 0.5rem 0.65rem;
    color: #f8f3e8;
    border-top: 1px solid rgba(248, 243, 232, 0.3);
    background: rgba(12, 9, 6, 0.78);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.025em;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.map-popup-image .map-popup-image-credit {
    text-align: left;
}
.map-popup-image-credit a { color: #fff; text-decoration: underline; text-underline-offset: 2px; }

.map-popup-facts {
    display: grid;
    gap: 0;
    margin: 0;
}

.map-popup-facts p {
    display: grid;
    margin: 0 !important;
    padding: 0.55rem 0;
    border-top: 1px solid rgba(212, 175, 55, 0.16);
    grid-template-columns: minmax(90px, 0.42fr) minmax(0, 1fr);
    gap: 0.7rem;
}

.map-popup-facts p strong {
    color: var(--muted);
    font-size: 0.75rem;
}

.map-page .map-popup-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.map-page .map-popup-actions .btn {
    min-height: 42px;
}

.map-popup-more {
    margin-top: 0.55rem;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(212, 175, 55, 0.2);
}

.map-popup-more summary {
    color: var(--gold);
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
}

.map-page .popup-close-btn {
    position: absolute;
}

.map-marker-key {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    margin-top: 0.65rem;
}

.map-marker-key span {
    display: grid;
    min-width: 0;
    gap: 0.2rem;
    color: var(--muted);
    font-size: 0.65rem;
    text-align: center;
    place-items: center;
}

.map-marker-key img {
    width: 1.75rem;
    height: 1.75rem;
    object-fit: contain;
}

@media (min-width: 992px) {
    .map-main,
    .map-canvas-column,
    .map-stage,
    .map-surface {
        min-height: 0;
    }

    .map-canvas-column,
    .map-stage {
        flex: 1 1 auto;
    }

    .map-page #map {
        min-height: 0;
    }
}

@media (max-width: 991.98px) {
    .map-page {
        height: max(620px, calc(100dvh - 3.5rem));
        padding-bottom: 0.5rem !important;
    }

    .map-main,
    .map-stage,
    .map-canvas-column,
    .map-surface {
        min-height: 0;
        flex: 1 1 auto;
    }

    .map-stage,
    .map-stage.map-detail-open {
        display: flex;
    }

    .map-canvas-column {
        position: relative;
        width: 100%;
    }

    .map-toolbar {
        position: absolute;
        z-index: 1070;
        top: 0.55rem;
        right: 0.55rem;
        left: 0.55rem;
        margin: 0;
        padding: 0.48rem;
        background: color-mix(in srgb, var(--surface) 92%, transparent);
        backdrop-filter: blur(10px);
        grid-template-columns: minmax(0, 1fr) 44px;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-10px) scale(0.985);
        transform-origin: top right;
        transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    }

    .map-toolbar.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0) scale(1);
    }

    .map-toolbar-toggle {
        position: absolute;
        z-index: 1065;
        top: 0.75rem;
        right: 0.75rem;
        display: inline-grid;
        width: 48px;
        height: 48px;
        padding: 0;
        color: #17110a;
        border: 2px solid rgba(23, 17, 10, 0.28);
        border-radius: 50%;
        background: var(--gold);
        box-shadow: 0 7px 22px rgba(0, 0, 0, 0.35);
        place-items: center;
    }

    .map-toolbar-toggle:hover,
    .map-toolbar-toggle:focus-visible {
        color: #17110a;
        filter: brightness(1.08);
        outline: 3px solid color-mix(in srgb, var(--gold) 42%, transparent);
        outline-offset: 2px;
    }

    .map-toolbar-toggle[aria-expanded="true"] {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    .map-search-wrap {
        grid-column: 1;
        grid-row: 1;
    }

    .map-toolbar-close {
        display: grid;
        width: 44px;
        height: 44px;
        padding: 0;
        align-self: center;
        color: var(--text);
        border: 1px solid rgba(212, 175, 55, 0.38);
        border-radius: 10px;
        background: rgba(128, 128, 128, 0.1);
        place-items: center;
        grid-column: 2;
        grid-row: 1;
    }

    .map-toolbar-close:hover,
    .map-toolbar-close:focus-visible {
        color: #17110a;
        background: var(--gold);
        outline: none;
    }

    .map-toolbar-actions {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: space-between;
    }

    .map-toolbar-actions .btn {
        min-width: 44px;
        flex: 1 1 0;
        padding-inline: 0.55rem;
    }

    .map-active-filters {
        grid-row: 3;
    }

    .map-surface,
    .map-page #map {
        width: 100%;
        height: 100%;
        min-height: 380px;
    }

    .map-page .ol-zoom {
        top: auto;
        bottom: 0.75rem;
    }

    .map-state-overlay {
        top: auto;
        bottom: 1rem;
    }

    .map-state-warning {
        top: auto;
        bottom: 4.5rem;
    }

    .map-results-panel,
    .map-detail-panel {
        position: fixed;
        z-index: 1190;
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: min(70dvh, 680px);
        border-width: 1px 0 0;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -14px 38px rgba(0, 0, 0, 0.48);
    }

    .map-results-panel.show,
    .map-detail-panel.show {
        display: flex;
        flex-direction: column;
    }

    .map-detail-panel {
        overflow-y: auto;
    }

    .map-detail-panel .popup-container {
        padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
    }

    .map-popup-heading::before,
    .map-panel-heading::before {
        position: absolute;
        top: 0.38rem;
        left: 50%;
        width: 38px;
        height: 4px;
        border-radius: 999px;
        background: rgba(212, 175, 55, 0.42);
        content: "";
        transform: translateX(-50%);
    }

    .map-panel-heading {
        position: relative;
        padding-top: 1.05rem;
    }

    .map-page .popup-container > .map-popup-actions {
        position: sticky;
        bottom: 0;
        padding: 0.65rem 0;
        background: var(--surface);
    }
}

@media (max-width: 575.98px) {
    .map-page-header {
        align-items: center !important;
    }

    .map-page-header h1 {
        font-size: 1.15rem;
    }

    .map-result-summary {
        font-size: 0.7rem;
    }

    .map-button-label {
        display: none;
    }

    .map-toolbar-actions .btn {
        padding-inline: 0.4rem;
    }

    .map-popup-facts p {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }

    .map-page .map-popup-actions {
        grid-template-columns: 1fr 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .map-toolbar {
        transition: none;
    }
}

@media (max-width: 767.98px) {
    .map-page .ol-zoom,
    .map-page .ol-attribution {
        bottom: calc(var(--wk-mobile-nav-clearance, calc(80px + env(safe-area-inset-bottom, 0px))) + 0.75rem);
    }

    .map-page #map:fullscreen .ol-zoom,
    .map-page #map:fullscreen .ol-attribution,
    .map-page #map.map-pseudo-fullscreen .ol-zoom,
    .map-page #map.map-pseudo-fullscreen .ol-attribution,
    .map-page #map.map-fullscreen-active .ol-zoom,
    .map-page #map.map-fullscreen-active .ol-attribution {
        bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
    }
}

.map-production-swatch-cooperages { background: #cf8ae8; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.map-production-swatch-warehouses { background: #8dc59d; clip-path: polygon(50% 0, 100% 38%, 81% 100%, 19% 100%, 0 38%); }
.map-production-toggle:has(#toggle-production-warehouses) { grid-column: 1 / -1; }
.production-distilleries ul { padding-left: 1.2rem; }

/* Compact filter groups keep headers and reset accessible while content scrolls. */
#toggle-legend-btn { display: inline-flex; }
#legend .map-filter-header {
    flex: 0 0 auto;
    gap: 0.5rem;
    padding: 0.85rem 0.85rem 0.65rem;
    margin: 0;
}
#legend .map-filter-header h2 { font-size: 1rem; }
#legend .map-filter-header small { color: var(--muted) !important; font-size: 0.73rem; }
#legend .map-filter-close { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; }
.map-filter-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 0.75rem 0.75rem; scrollbar-width: thin; }
.map-filter-group { margin-top: 0.45rem; border: 1px solid color-mix(in srgb, var(--muted) 24%, transparent); border-radius: 10px; }
.map-filter-group:first-child { margin-top: 0; }
.map-filter-group > summary { display: flex; min-height: 54px; align-items: center; gap: 0.5rem; padding: 0.55rem 0.65rem; list-style: none; cursor: pointer; border-radius: 10px; }
.map-filter-group > summary::-webkit-details-marker { display: none; }
.map-filter-group > summary:hover { background: color-mix(in srgb, var(--gold) 7%, transparent); }
.map-filter-group > summary:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.map-group-copy { min-width: 0; flex: 1; }
.map-group-title { display: block; color: var(--text); font-size: 0.86rem; font-weight: 650; }
.map-group-preview { display: block; color: var(--muted); font-size: 0.7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-filter-group[open] > summary .map-group-preview { display: none; }
.map-group-chevron { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: var(--muted); stroke-width: 2; }
.map-filter-group[open] > summary .map-group-chevron { transform: rotate(180deg); }
.map-filter-group.has-active-filters { border-color: color-mix(in srgb, var(--gold) 55%, transparent); }
.map-filter-group.has-active-filters > summary .map-group-title { color: var(--gold); }
.map-place-choices, .map-production-choices { display: grid; gap: 0.4rem; margin: 0 0.6rem 0.65rem; }
.map-place-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.map-production-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.map-layer-choice { position: relative; min-width: 0; }
.map-layer-choice > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.map-layer-choice > label { position: relative; display: flex; min-height: 54px; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem; padding: 0.5rem 0.2rem; color: var(--muted); background: color-mix(in srgb, var(--muted) 7%, transparent); border: 1px solid color-mix(in srgb, var(--muted) 28%, transparent); border-radius: 8px; cursor: pointer; font-size: 0.7rem; }
.map-layer-choice > label img { width: 21px; height: 21px; object-fit: contain; }
.map-layer-choice > input:checked + label { color: var(--text); border-color: color-mix(in srgb, var(--gold) 65%, transparent); background: color-mix(in srgb, var(--gold) 12%, transparent); }
.map-layer-choice > input:checked + label::after { content: '✓'; position: absolute; right: 4px; top: 1px; color: var(--gold); font-size: 0.65rem; font-weight: 800; }
.map-layer-choice > input:focus-visible + label { outline: 2px solid var(--gold); outline-offset: 2px; }
.map-layer-choice > input:disabled + label { opacity: 0.45; cursor: default; }
.map-production-choices .map-layer-choice > label { min-height: 44px; flex-direction: row; gap: 0.45rem; font-size: 0.77rem; }
#legend .map-production-toggle .map-filter-hint { margin: 0.25rem 0.15rem 0; font-size: 0.67rem; }
.map-production-toggle > input:not(:checked) ~ .map-filter-hint { display: none; }
.map-filter-menus { display: grid; gap: 0.4rem; margin: 0 0.6rem; }
#legend .map-filter-menu-btn { min-height: 38px; padding: 0.35rem 0.65rem; font-size: 0.82rem; border-color: color-mix(in srgb, var(--muted) 38%, transparent); }
.map-status-heading { display: flex; align-items: center; gap: 0.4rem; margin: 0.7rem 0.6rem 0.35rem; }
.map-status-heading .map-filter-title { margin: 0; font-size: 0.65rem; letter-spacing: 0.025em; color: var(--muted); }
#legend .map-status-filters { gap: 0.3rem; margin: 0 0.6rem 0.65rem; }
#legend .status-filter-item { min-height: 44px; flex-direction: row; padding: 0.3rem; gap: 0.25rem; border: 1px solid color-mix(in srgb, var(--muted) 26%, transparent); border-radius: 7px; }
#legend .status-filter-item img { width: 15px; height: 15px; object-fit: contain; }
#legend .status-filter-item.active { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); }
#legend .status-label { font-size: 0.64rem; }
.map-group-note { display: block; margin: 0.4rem 0.65rem; font-size: 0.7rem; line-height: 1.4; color: var(--muted); }
#legend #fit-production-layers-btn { width: calc(100% - 1.2rem) !important; margin: 0.1rem 0.6rem 0.65rem; font-size: 0.75rem; }
#legend .map-provider-control { margin: 0 0.6rem 0.5rem; }
#legend .map-provider-control .map-group-note { margin-inline: 0; }
#legend .map-region-toggle { margin: 0.35rem 0.65rem !important; padding: 0.35rem 0; font-size: 0.76rem; }
#legend .map-region-toggle .map-filter-hint { margin-left: 0; font-size: 0.68rem; }
#legend .map-marker-key { margin: 0.5rem 0.65rem 0.65rem; }
.map-filter-footer { display: flex; flex: 0 0 auto; align-items: center; gap: 0.6rem; padding: 0.65rem 0.85rem; border-top: 1px solid color-mix(in srgb, var(--muted) 22%, transparent); background: var(--surface); }
.map-filter-footer .map-action-button { flex: 1; min-height: 38px; font-size: 0.8rem; }
#legend .filter-dropdown { max-height: min(250px, 35dvh); padding: 0.5rem !important; }
.map-filter-list-search { position: sticky; top: 0; z-index: 1; margin-bottom: 0.45rem; background: var(--surface) !important; color: var(--text) !important; }
#legend .filter-dropdown .form-check { display: flex; gap: 0.5rem; align-items: center; min-height: 32px; padding: 0.1rem 0.2rem; }
#legend .filter-dropdown .form-check-label { flex: 1; font-size: 0.8rem; cursor: pointer; }
@media (min-width: 992px) {
    .map-workspace.filters-collapsed { grid-template-columns: minmax(0, 1fr); }
    .map-workspace.filters-collapsed #legend { display: none !important; }
}
@media (max-width: 991.98px) {
    #legend.map-filter-panel { padding: 0; }
    #legend.map-filter-panel .map-filter-header { position: static; top: auto; margin: 0; padding: 0.2rem 0.85rem 0.65rem; }
    .map-filter-footer { padding-bottom: calc(0.65rem + env(safe-area-inset-bottom, 0px)); }
    .map-layer-choice > label { min-height: 58px; font-size: 0.78rem; }
    #legend .status-filter-item { min-height: 44px; }
    #legend .filter-dropdown .form-check { min-height: 40px; }
}

/* Use the space below navigation, including on short laptop and landscape screens. */
.map-page { height: var(--map-page-height, calc(100dvh - 5rem)); min-height: 0; }
.map-workspace { min-height: 0; }
#legend.map-filter-panel { max-height: 100%; }
.map-canvas-column { container: map-canvas / inline-size; }
.map-toolbar { grid-template-columns: minmax(0, 1fr) auto; }

@media (min-width: 992px) {
    @container map-canvas (max-width: 980px) {
        .map-button-label { display: none; }
    }
    @container map-canvas (max-width: 580px) {
        .map-toolbar { grid-template-columns: minmax(0, 1fr); }
        .map-toolbar-actions { grid-column: 1; grid-row: 2; justify-content: space-between; }
        .map-toolbar-actions .btn { flex: 1 1 0; }
        .map-active-filters { grid-row: 3; }
    }
}
@media (max-width: 991.98px) {
    #legend.map-filter-panel { max-height: min(88dvh, 760px); }
    .map-toolbar { grid-template-columns: minmax(0, 1fr) 44px; }
    .map-surface, .map-page #map { min-height: 0; }
    .map-page .ol-zoom, .map-page .ol-attribution { bottom: 0.75rem; }
}
@media (max-width: 991.98px) and (max-height: 500px) {
    #legend.map-filter-panel { --map-filter-sheet-height: min(88dvh, 460px); }
}
.map-popup-heading-copy .map-popup-title { overflow-wrap: anywhere; }
