/* maps.html — "Explore the map": sidebar + map on tablet/desktop, map + bottom sheet on phones. */

body.page-maps {
    --header-height: 72px;
    --ex-panel-w: 340px;
    --ex-bg: #f5f3ee;
    --ex-surface: #ffffff;
    --ex-border: #e2ded4;
    --ex-text: var(--color-text);
    --ex-muted: var(--color-gray-16);
    --ex-green: #2f5a3c;
    --ex-green-tint: #e3ebdd;
    --ex-dark: #262b25;
    --ex-red: var(--color-1);
    --ex-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 14px rgba(0, 0, 0, 0.08);
}

@media (min-width: 1100px) {
    body.page-maps {
        --ex-panel-w: 404px;
    }
}

/* Site header is taller on narrow screens (styles.css). */
@media (max-width: 900px) {
    body.page-maps {
        --header-height: 80px;
    }
}

/* ---------- page frame + header ---------- */

body.page-maps #page.s-pagewrap {
    height: 100dvh;
    padding-top: var(--header-height);
    box-sizing: border-box;
    overflow: hidden;
}

body.page-maps .s-header {
    top: 0;
}

body.page-maps .s-header,
body.page-maps .s-header__inner,
body.page-maps .s-header__block,
body.page-maps .s-header__nav,
body.page-maps .s-header.sticky,
body.page-maps .s-header.sticky .s-header__inner {
    background-color: var(--color-2);
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

body.page-maps .s-header__logo a {
    color: #ffffff;
}

body.page-maps .s-header__menu-links a {
    color: rgba(255, 255, 255, 0.82);
}

body.page-maps .s-header__menu-links a:hover,
body.page-maps .s-header__menu-links a:focus-visible,
body.page-maps .s-header__menu-links .current a {
    color: #ffffff;
}

/* ---------- resets inside the explore UI (site styles target bare elements) ----------
 * :where() keeps these at class-level specificity so component rules below win. */

.explore {
    font-family: var(--font-1);
    color: var(--ex-text);
    font-size: 16px;
    line-height: 1.45;
}

.explore :where(h1, h2, h3, p, ul, dl, dd) {
    margin: 0;
    padding: 0;
    font-family: var(--font-1);
    letter-spacing: normal;
}

.explore :where(ul) {
    list-style: none;
}

.explore :where(li) {
    margin: 0;
}

.explore button {
    height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    line-height: inherit;
    letter-spacing: normal;
    text-transform: none;
    cursor: pointer;
}

.explore [hidden] {
    display: none !important;
}

.explore :focus-visible {
    outline: 2px solid var(--ex-green);
    outline-offset: 2px;
}

/* ---------- layout: tablet / desktop ---------- */

.explore {
    /* Own stacking context: map chrome (z 500–700) stays below the site header + its mobile menu. */
    isolation: isolate;
    display: grid;
    grid-template-columns: var(--ex-panel-w) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    height: calc(100dvh - var(--header-height));
}

.explore-map {
    position: relative;
    grid-column: 2;
    grid-row: 1 / span 2;
    min-height: 0;
}

#map {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: #f2efe9;
}

.explore-filters {
    grid-column: 1;
    grid-row: 1;
    padding: 24px 24px 18px;
    background: var(--ex-bg);
    border-right: 1px solid var(--ex-border);
}

.explore-sheet {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--ex-bg);
    border-right: 1px solid var(--ex-border);
}

.explore[data-view="detail"] .explore-filters {
    display: none;
}

.explore[data-view="detail"] .explore-sheet {
    grid-row: 1 / span 2;
}

.explore[data-view="list"] .explore-detail,
.explore[data-view="detail"] .explore-list {
    display: none;
}

/* ---------- filters ---------- */

.explore-filters__title {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
}

.explore-filters__intro {
    margin-top: 6px;
    color: var(--ex-muted);
    font-size: 15px;
}

.explore-search {
    position: relative;
    display: block;
    margin: 18px 0 14px;
}

.explore-search__icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ex-muted);
    pointer-events: none;
}

.explore .explore-search__input {
    display: block;
    width: 100%;
    height: 46px;
    margin: 0;
    padding: 0 16px 0 44px;
    border: 1px solid var(--ex-border);
    border-radius: 8px;
    background: var(--ex-surface);
    color: var(--ex-text);
    font: 15px/1 var(--font-1);
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.explore .explore-search__input::placeholder {
    color: var(--ex-muted);
}

.explore .explore-search__input:focus {
    border-color: var(--ex-green);
    outline: none;
    box-shadow: 0 0 0 3px rgba(47, 90, 60, 0.15);
}

.explore-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.explore .explore-chip {
    padding: 7px 14px;
    border: 1px solid #d6d1c5;
    border-radius: 999px;
    background: var(--ex-surface);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.explore .explore-chip:hover {
    border-color: var(--ex-dark);
}

.explore .explore-chip[aria-pressed="true"] {
    background: var(--ex-dark);
    border-color: var(--ex-dark);
    color: #ffffff;
}

/* ---------- place list ---------- */

.explore-sheet__grip {
    display: none;
}

.explore-list {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
    border-top: 1px solid var(--ex-border);
}

.explore-list__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 18px 24px 6px;
}

.explore-list__count {
    color: var(--ex-muted);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.explore-list__drag-hint {
    display: none;
}

.explore-list__items {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 12px;
}

.explore .explore-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 12px 24px;
    text-align: left;
    transition: background 0.15s ease;
}

.explore .explore-item:hover {
    background: rgba(0, 0, 0, 0.035);
}

.explore-item__thumb {
    flex: 0 0 74px;
    width: 74px;
    height: 74px;
    border-radius: 6px;
    overflow: hidden;
    background: #e6e1d6;
}

.explore-item__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.explore-item__thumb.is-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8b8677;
}

.explore-item__text {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.explore-item__name {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
}

.explore-item__town {
    color: var(--ex-muted);
    font-size: 14px;
}

.explore-item__tags {
    color: var(--ex-green);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.explore-item__chevron {
    flex: 0 0 auto;
    color: var(--ex-muted);
}

.explore-list__empty {
    padding: 16px 24px;
    color: var(--ex-muted);
    font-size: 15px;
}

/* ---------- detail ---------- */

.explore-detail {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.explore-detail__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 22px 12px 18px;
    border-bottom: 1px solid var(--ex-border);
}

.explore .explore-detail__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 6px;
    font-size: 15px;
    font-weight: 600;
}

.explore-detail__toolbar-actions {
    display: flex;
    gap: 8px;
}

.explore .explore-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border: 1px solid #d6d1c5;
    border-radius: 999px;
    background: var(--ex-surface);
    color: var(--ex-text);
    transition: border-color 0.15s ease;
}

.explore .explore-icon-btn:hover {
    border-color: var(--ex-dark);
}

.explore .explore-icon-btn[aria-pressed="true"] svg path {
    fill: currentColor;
}

.explore .explore-icon-btn.is-done {
    border-color: var(--ex-green);
    color: var(--ex-green);
}

.explore-detail__body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 20px 24px 32px;
}

.explore-detail__body > * {
    flex-shrink: 0;
}

.explore .explore-detail__photo {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10.3;
    border-radius: 12px;
    overflow: hidden;
    background: #e6e1d6;
}

.explore-detail__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.explore-detail__photo-count {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 6px;
    background: rgba(20, 22, 20, 0.72);
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
}

.explore-detail__heading {
    position: relative;
    margin-bottom: -6px;
}

.explore-detail__crumbs {
    margin-bottom: 4px;
    color: var(--ex-muted);
    font-size: 13px;
}

.explore-detail__title {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.15;
}

.explore-detail__town {
    margin-top: 2px;
    color: var(--ex-muted);
    font-size: 15px;
}

.explore .explore-detail__close {
    display: none;
}

.explore-detail__actions {
    display: flex;
    gap: 10px;
}

.explore .explore-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1 1 0;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 8px;
    font-family: var(--font-1);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    box-sizing: border-box;
    transition: background 0.15s ease, color 0.15s ease;
}

.explore .explore-btn--primary {
    background: var(--ex-red);
    color: #ffffff;
}

.explore .explore-btn--primary:hover {
    background: var(--color-1-light);
    color: #ffffff;
}

.explore .explore-detail__inline-action {
    display: none;
}

.explore-detail__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: 1px solid var(--ex-border);
    border-radius: 8px;
    background: var(--ex-surface);
}

.explore-detail__stats > div {
    padding: 12px 8px;
    text-align: center;
}

.explore-detail__stats > div + div {
    border-left: 1px solid var(--ex-border);
}

.explore-detail__stats dt {
    color: var(--ex-muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.explore-detail__stats dd {
    font-size: 17px;
    font-weight: 600;
}

.explore-detail__section h3 {
    margin-bottom: 6px;
    font-size: 17px;
    font-weight: 700;
}

.explore-detail__section p {
    font-size: 16px;
    line-height: 1.6;
}

.explore-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.explore-tags li {
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--ex-green-tint);
    color: var(--ex-green);
    font-size: 14px;
    font-weight: 500;
}

/* ---------- map chrome ---------- */

.explore-map__hint {
    position: absolute;
    z-index: 500;
    top: 20px;
    left: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 999px;
    background: var(--ex-surface);
    box-shadow: var(--ex-shadow);
    font-size: 15px;
    font-weight: 500;
}

.explore-map__hint svg {
    color: var(--ex-green);
}

.explore[data-view="detail"] .explore-map__hint {
    display: none;
}

.explore .explore-map__back {
    display: none;
}

.explore-map__controls {
    position: absolute;
    z-index: 500;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.explore-map__zoom {
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    background: var(--ex-surface);
    box-shadow: var(--ex-shadow);
    overflow: hidden;
}

.explore .explore-map__ctrl {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: var(--ex-surface);
    color: var(--ex-text);
}

.explore .explore-map__ctrl:hover {
    background: #f1efe9;
}

.explore-map__zoom .explore-map__ctrl + .explore-map__ctrl {
    border-top: 1px solid var(--ex-border);
}

.explore .explore-map__locate {
    border-radius: 8px;
    box-shadow: var(--ex-shadow);
}

.explore .explore-map__locate.is-busy svg {
    animation: explore-pulse 1s ease-in-out infinite;
}

@keyframes explore-pulse {
    50% {
        opacity: 0.35;
    }
}

.explore-map__credit {
    position: absolute;
    z-index: 500;
    right: 0;
    bottom: 0;
    padding: 3px 8px;
    border-top-left-radius: 4px;
    background: rgba(255, 255, 255, 0.85);
    font-size: 11px;
    line-height: 1.3;
}

.explore-map__credit a {
    color: var(--color-link);
    text-decoration: underline;
}

body.page-maps .leaflet-control-attribution {
    display: none;
}

/* Pins + name labels */
.leaflet-marker-icon.explore-pin {
    background: none;
    border: 0;
}

.explore-pin svg {
    display: block;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

.leaflet-tooltip.explore-pin-label {
    padding: 6px 11px;
    border: 0;
    border-radius: 6px;
    background: #1f231e;
    color: #ffffff;
    font: 600 14px/1.2 var(--font-1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.leaflet-tooltip-top.explore-pin-label::before {
    border-top-color: #1f231e;
}

/* ---------- phones: full map + draggable bottom sheet ---------- */

@media (max-width: 767px) {
    .explore {
        position: relative;
        display: block;
        --sheet-h: 40%;
    }

    .explore-map {
        position: absolute;
        inset: 0;
    }

    .explore-filters {
        position: absolute;
        z-index: 600;
        top: 22px;
        left: 0;
        right: 0;
        padding: 0;
        background: none;
        border: 0;
        pointer-events: none;
    }

    .explore-filters > * {
        pointer-events: auto;
    }

    .explore-filters__title,
    .explore-filters__intro {
        display: none;
    }

    .explore-search {
        margin: 0 16px 10px;
    }

    .explore .explore-search__input {
        height: 52px;
        border: 0;
        border-radius: 12px;
        box-shadow: var(--ex-shadow);
        font-size: 16px;
    }

    .explore-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 2px 16px 8px;
        scrollbar-width: none;
    }

    .explore-chips::-webkit-scrollbar {
        display: none;
    }

    .explore .explore-chip {
        padding: 9px 16px;
        border-color: transparent;
        box-shadow: var(--ex-shadow);
        font-size: 15px;
    }

    .explore-sheet {
        position: absolute;
        z-index: 700;
        left: 0;
        right: 0;
        bottom: 0;
        height: var(--sheet-h);
        border: 0;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
        transition: height 0.28s ease;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    /* Content only scrolls once the sheet is full height; before that a swipe moves the sheet (maps.js). */
    .explore:not([data-sheet="full"]) .explore-detail__body,
    .explore:not([data-sheet="full"]) .explore-list__items {
        overflow-y: hidden;
    }

    .explore-detail__body,
    .explore-list__items {
        overscroll-behavior: contain;
    }

    .explore-sheet.is-dragging {
        transition: none;
    }

    .explore-sheet__grip,
    .explore-list__head,
    .explore-detail__heading {
        touch-action: none;
    }

    .explore-sheet__grip {
        display: flex;
        justify-content: center;
        flex: 0 0 auto;
        padding: 10px 0 4px;
        cursor: grab;
    }

    .explore-sheet__grip span {
        width: 40px;
        height: 5px;
        border-radius: 999px;
        background: #cfcabe;
    }

    .explore-list {
        border-top: 0;
    }

    .explore-list__head {
        padding: 8px 20px 8px;
    }

    .explore-list__count {
        color: var(--ex-text);
        font-size: 20px;
        font-weight: 700;
        letter-spacing: normal;
        text-transform: none;
    }

    .explore-list__drag-hint {
        display: inline;
        color: var(--ex-muted);
        font-size: 14px;
    }

    .explore .explore-item {
        padding: 10px 20px;
    }

    .explore-item__thumb {
        flex-basis: 60px;
        width: 60px;
        height: 60px;
    }

    .explore-detail__toolbar {
        display: none;
    }

    .explore-detail__body {
        gap: 16px;
        padding: 4px 20px 28px;
    }

    /* Phone order: title → actions → photo → stats → about → tags */
    .explore-detail__heading {
        order: 1;
        padding-right: 56px;
        margin-bottom: -4px;
    }

    .explore-detail__actions {
        order: 2;
    }

    .explore .explore-detail__photo {
        order: 3;
    }

    .explore-detail__stats {
        order: 4;
    }

    .explore-detail__section {
        order: 5;
    }

    .explore-detail__crumbs {
        display: none;
    }

    .explore-detail__title {
        font-size: 26px;
    }

    .explore .explore-detail__close {
        position: absolute;
        top: 0;
        right: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: 999px;
        background: #e9e5db;
    }

    .explore .explore-detail__inline-action {
        display: inline-flex;
        width: 52px;
        height: 48px;
        border-radius: 8px;
    }

    .explore-map__hint {
        display: none;
    }

    .explore[data-view="detail"] .explore-map__back {
        position: absolute;
        z-index: 600;
        top: 16px;
        left: 16px;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 10px 18px 10px 12px;
        border-radius: 999px;
        background: var(--ex-surface);
        box-shadow: var(--ex-shadow);
        font-size: 16px;
        font-weight: 600;
    }

    .explore-map__controls {
        top: auto;
        bottom: calc(var(--sheet-h) + 16px);
        right: 16px;
        transition: bottom 0.28s ease;
    }

    .explore-map__zoom {
        display: none;
    }

    .explore .explore-map__locate {
        width: 48px;
        height: 48px;
        border-radius: 999px;
    }

    .explore[data-view="detail"] .explore-map__controls,
    .explore[data-sheet="full"] .explore-map__controls {
        display: none;
    }

    .explore-map__credit {
        top: 0;
        bottom: auto;
        border-radius: 0 0 0 4px;
        font-size: 10px;
    }
}
