/* Filter/list layout overrides only the map page. The place-page design is untouched. */
.map-page [hidden] {
    display: none !important;
}
.map-page .places-sidebar {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}
.map-page .hmp-map-tools {
    flex: 0 0 auto;
    min-width: 0;
    background: var(--bg, #f1eadf);
}
.map-page .hmp-map-tools h1 {
    margin: 0.8rem 0;
}
.map-page .hmp-map-tools .search-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
    margin: 0.6rem 0;
    width: 100%;
}
.map-page .hmp-map-tools .search-box input {
    min-width: 0;
    width: 100%;
    min-height: 44px;
    padding: 0.65rem 0.85rem;
}
.map-page .hmp-map-tools .search-box button {
    width: auto;
    min-height: 44px;
    white-space: nowrap;
    padding-inline: 1.1rem;
}
.map-page .hmp-filter-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.85rem;
}
.map-page .hmp-filter-button {
    border: 1px solid var(--line, #c8c0b4);
    background: var(--soft, #fffdf8);
    color: var(--ink, #24211c);
    border-radius: 999px;
    padding: 0.5rem 1rem;
    min-height: 44px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.map-page .hmp-filter-button [data-hmp-filter-number] {
    display: inline-block;
    min-width: 1.5em;
    margin-left: 0.2rem;
    font-size: 0.8em;
}
.map-page .hmp-filter-reset {
    background: transparent;
    border: 0;
    color: var(--ink, #24211c);
    text-decoration: underline;
    text-underline-offset: 0.2em;
    padding: 0.5rem 0.2rem;
    min-height: 44px;
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
}
.map-page .hmp-results-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding-top: 0.7rem;
}
.map-page .hmp-results-scroll .result-list {
    overflow: visible;
    height: auto;
    min-height: 0;
    display: grid;
    gap: 0.7rem;
    padding: 0;
}
.map-page .result-card .result-card-header {
    display: block;
}
.map-page .result-card .result-card-header h2 {
    width: 100%;
    margin: 0 0 0.45rem;
    overflow-wrap: anywhere;
}
.map-page .result-card .result-farm {
    display: block;
    max-width: none;
    margin: 0.3rem 0 0.6rem;
    text-align: left;
}
.map-page .result-card .hmp-farm-info {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.85em;
    font-weight: 400;
}
.map-page .result-card {
    min-width: 0;
}
.map-page .hmp-more-results {
    padding: 0.8rem 0 1.4rem;
    text-align: center;
}
.map-page .hmp-more-results p {
    font-size: 0.88rem;
    margin-block: 0.5rem;
}
.map-page .hmp-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding-top: 0.5rem;
    max-height: 88px;
    overflow-y: auto;
}
.map-page .hmp-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #fffdf8;
    color: #302f29;
    border: 1px solid #c8c0b4;
    border-radius: 20px;
    padding: 0.3rem 0.7rem;
    min-height: 36px;
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
    text-align: left;
}
.map-page .map-result-count {
    margin: 0.6rem 0 0.15rem;
    font-size: 0.94rem;
}
.map-page .hmp-unmapped-count {
    margin: 0.15rem 0;
    font-size: 0.8rem;
}
.map-page .hmp-selection-statistics {
    margin: 0.2rem 0 0.6rem;
    font-size: 0.84rem;
}
.map-page .hmp-selection-statistics summary {
    cursor: pointer;
    padding-block: 0.35rem;
}
.map-page .hmp-selection-statistics dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin: 0.5rem 0;
}
.map-page .hmp-selection-statistics dl > div {
    border-left: 2px solid var(--line, #c8c0b4);
    padding-left: 0.5rem;
}
.map-page .hmp-selection-statistics dt {
    font-size: 0.78rem;
}
.map-page .hmp-selection-statistics dd {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}
.map-page .hmp-filter-panel {
    margin-top: 0.5rem;
    border-block: 1px solid var(--line, #c8c0b4);
    background: var(--soft, #fffdf8);
    color: var(--ink, #24211c);
    padding: 0.7rem;
}
.map-page .hmp-filter-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.map-page .hmp-filter-heading h2 {
    font-size: 1.1rem;
    margin: 0;
}
.map-page .hmp-filter-heading > button {
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.8rem;
}
.map-page .hmp-filter-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
    overflow: auto;
    max-height: min(36dvh, 350px);
    padding: 0.6rem 0.2rem 0.6rem 0;
    overscroll-behavior: contain;
}
.map-page .hmp-filter-fields > label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    min-width: 0;
}
.map-page .hmp-filter-fields select,
.map-page .hmp-filter-fields input {
    display: block;
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line, #c8c0b4);
    background: #fff;
    color: #302f29;
    border-radius: 0.25rem;
    font: inherit;
    font-size: 0.94rem;
    padding: 0.45rem;
    margin-top: 0.25rem;
}
.map-page .hmp-filter-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--line, #c8c0b4);
}
.map-page .hmp-period-range {
    grid-column: 1 / -1;
    border: 1px solid var(--line, #c8c0b4);
    padding: 0.6rem;
    margin: 0;
}
.map-page .hmp-period-range > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
}
.map-page .hmp-period-range p {
    font-size: 0.78rem;
    margin: 0.6rem 0 0;
    line-height: 1.5;
}
.map-page .hmp-mobile-map-tools {
    display: none;
}
.map-page .hmp-filter-dialog {
    color: var(--ink, #24211c);
    background: var(--soft, #fffdf8);
    border: 1px solid var(--line, #c8c0b4);
    padding: 0;
}
.map-page .hmp-filter-dialog:not([open]) {
    display: none;
}
.map-page .hmp-filter-dialog::backdrop {
    background: rgb(0 0 0 / 0.4);
}
.map-page .hmp-filter-error {
    border-left: 3px solid #8a402b;
    padding: 0.7rem;
}
.map-page .hmp-detail-credit {
    font-size: 0.8rem;
    line-height: 1.5;
    margin-block: 0.5rem 1rem;
}
.map-page .hmp-no-map {
    padding: 1rem;
    background: var(--soft, #fffdf8);
}
.map-page .hmp-filter-button:focus-visible,
.map-page .hmp-filter-reset:focus-visible,
.map-page .hmp-filter-chip:focus-visible {
    outline: 3px solid #8a402b;
    outline-offset: 3px;
}
.map-page .hmp-results-scroll[aria-busy="true"] {
    opacity: 0.65;
}
@media (max-width: 920px) {
    .map-page .hmp-mobile-map-tools {
        display: flex;
        position: fixed;
        top: calc(var(--header-height, 78px) + var(--admin-bar, 0px) + 10px);
        left: 10px;
        z-index: 800;
        align-items: center;
        flex-wrap: wrap;
        gap: 0.5rem;
        max-width: calc(100% - 72px);
    }
    .map-page .hmp-mobile-map-tools .sidebar-open-button {
        display: inline-flex;
        position: static;
        margin: 0;
        min-height: 44px;
        width: auto;
        padding: 0.6rem 0.9rem;
    }
    .map-page .hmp-mobile-count {
        flex-basis: 100%;
        width: fit-content;
        max-width: max-content;
        background: #fffdf8ed;
        padding: 0.15rem 0.55rem;
        border-radius: 12px;
        font-size: 0.75rem;
        pointer-events: none;
    }
    .map-page .places-sidebar {
        padding: 12px 16px;
    }
    .map-page .hmp-map-tools h1 {
        margin-top: 0.5rem;
        padding-right: 38px;
        font-size: 1.6rem;
    }
    .map-page .hmp-map-tools .search-box {
        grid-template-columns: minmax(0, 1fr) auto;
    }
    .map-page .hmp-filter-dialog[open] {
        position: fixed;
        inset: auto 0 0;
        width: 100%;
        max-width: 100%;
        max-height: 88dvh;
        margin: 0;
        border-radius: 18px 18px 0 0;
        overflow: hidden;
    }
    .map-page .hmp-filter-dialog .hmp-filter-panel {
        margin: 0;
        border: 0;
        padding: 1rem 1rem max(1rem, env(safe-area-inset-bottom));
    }
    .map-page .hmp-filter-dialog .hmp-filter-fields {
        max-height: calc(88dvh - 170px - env(safe-area-inset-bottom));
        padding-bottom: 1rem;
    }
    .map-page .hmp-active-filters {
        max-height: 74px;
    }
}
@media (max-height: 620px) {
    .map-page .hmp-map-tools h1 {
        font-size: 1.35rem;
        margin-block: 0.3rem;
    }
    .map-page .hmp-filter-fields {
        max-height: 26dvh;
    }
    .map-page .hmp-selection-statistics {
        margin-bottom: 0.2rem;
    }
}
@media (prefers-reduced-motion: reduce) {
    .map-page .hmp-filter-dialog,
    .map-page .hmp-results-scroll {
        scroll-behavior: auto;
        transition: none;
    }
}

/* The legacy sidebar reserved the header twice. Keep tools immediately below it. */
@media (min-width: 921px) {
    .map-page .places-sidebar {
        padding-top: 85px;
    }
}
.map-page .hmp-detail-qr {
    display: block;
    margin: 20px 0;
    width: 120px;
    height: 120px;
}
.map-page .hmp-mobile-map-tools {
    top: calc(var(--husmann-map-header-height, 80px) + 100px);
}
/* Keep closing controls in the visible panel, independent of old theme offsets. */
.map-page .offcanvas-close {
    position: static;
    margin-left: auto;
}
.map-page .offcanvas-header > div {
    min-width: 0;
}
.map-page .offcanvas-title {
    overflow-wrap: anywhere;
}
.map-page .sidebar-close-button {
    top: 12px;
    right: 12px;
}

/* Keep map controls readable even before Blocksy's palette variables are loaded. */
body.map-page {
    --accent: var(--theme-palette-color-1, #532817);
}
.map-page .button:focus-visible,
.map-page .sidebar-open-button:focus-visible {
    outline: 3px solid #8a402b;
    outline-offset: 3px;
}
/* The legacy header-offset block is commented out in the supplied map stylesheet. */
body.map-page .husmann-map-layout {
    inset: var(--husmann-map-header-height, 80px) 0 0;
    height: calc(100dvh - var(--husmann-map-header-height, 80px));
}
body.map-page .husmann-map-layout > .map-wrap {
    height: 100%;
}
@media (min-width: 921px) {
    body.map-page .husmann-map-layout > .places-sidebar {
        height: 100%;
    }
    .map-page .leaflet-top.leaflet-right {
        top: 0;
        right: 0;
    }
    .map-page .leaflet-bottom {
        bottom: 0;
        right: 0;
    }
}
.map-page .hmp-mobile-map-tools .sidebar-open-button {
    background: var(
        --theme-button-background-initial-color,
        var(--theme-palette-color-1, #532817)
    );
    color: #fff;
}
.map-page a.result-card {
    color: var(--ink, #24211c);
    text-decoration: none;
}
.map-page a.result-card h2 {
    color: inherit;
}
