/* Map containers (loaded only on pages with a map). */
.map {
    width: 100%;
    min-height: 280px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--color-map-bg);
}
.map--picker { aspect-ratio: 4 / 3; max-height: 420px; }
.maplibregl-ctrl-attrib { font-size: var(--text-xs); }
.maplibregl-ctrl-group button { width: 36px; height: 36px; }

/* Address search results under the input */
.address-search { position: relative; }
.address-results {
    position: absolute;
    inset: 100% 0 auto;
    z-index: 10;
    margin: var(--space-1) 0 0;
    padding: var(--space-1);
    list-style: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
}
.address-results li {
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.address-results li:hover,
.address-results li:focus { background: var(--color-surface-muted); outline: none; }

/* ---------- Driveway map page ---------- */
.map-page {
    height: calc(100dvh - var(--header-height) - var(--safe-top));
}
.map-layout {
    position: relative;
    display: grid;
    grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
    height: 100%;
}
.map-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-right: 1px solid var(--color-border);
    background: var(--color-surface);
}
.map-panel__head {
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.map-list {
    flex: 1;
    margin: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.map-list__item {
    width: 100%;
    grid-template-columns: 72px minmax(0, 1fr);
    border: 0;
    border-bottom: 1px solid var(--color-border);
    background: none;
    text-align: left;
    font: inherit;
    cursor: pointer;
}
.map-list__item .list-item__title,
.map-list__item .list-item__meta { display: block; }
.map-list__item .tags { margin-top: var(--space-1); }
.map-list__thumb {
    width: 72px;
    height: 72px;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: var(--color-surface-sunken);
}
.map-list__thumb img { width: 100%; height: 100%; object-fit: cover; }
.map-canvas { min-height: 0; background: var(--color-map-bg); }
.map-toggle { display: none; }

.tag--sm { padding: 2px var(--space-2); font-size: var(--text-xs); }
.text-xs { font-size: var(--text-xs); }

/* Popup */
.maplibregl-popup-content {
    padding: 0;
    overflow: hidden;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    font-family: var(--font-body);
}
.map-popup__photo { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.map-popup__body {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4) var(--space-4);
}
.map-popup__body h3 { font-size: var(--size-16); }

/* Visitors: blurred example card; the content is a placeholder, not real data */
.map-popup--locked { position: relative; width: min(260px, 70vw); min-height: 220px; }
.map-popup__sample { filter: blur(6px); }
.map-popup__sample-photo { aspect-ratio: 16 / 9; background: var(--color-decor); }
.map-popup__sample-line {
    height: 0.9rem;
    margin: var(--space-3) var(--space-4) 0;
    border-radius: var(--radius-sm);
    background: var(--color-border-strong);
}
.map-popup__sample-line--short { width: 50%; margin-bottom: var(--space-4); }
.map-popup__lock {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    justify-content: center;
    padding: var(--space-4);
    background: var(--color-veil);
    color: var(--color-text-strong);
    text-align: center;
}
.map-popup__lock .cluster { justify-content: center; }
.maplibregl-popup-close-button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-surface);
    font-size: 20px;
}

@media (max-width: 720px) {
    .map-page {
        height: calc(100dvh - var(--header-height) - var(--safe-top) - var(--bottom-nav-height) - var(--safe-bottom));
    }
    .layout-map.has-bottom-nav { padding-bottom: 0; }
    .layout-map:not(.has-bottom-nav) .map-page { height: calc(100dvh - var(--header-height) - var(--safe-top)); }
    .map-layout { grid-template-columns: 1fr; }
    .map-panel { display: none; border-right: 0; }
    .map-layout.show-list .map-panel { display: flex; }
    .map-layout.show-list .map-canvas { display: none; }
    .map-toggle {
        position: absolute;
        bottom: var(--space-4);
        left: 50%;
        z-index: 5;
        display: inline-flex;
        transform: translateX(-50%);
        box-shadow: var(--shadow-md);
    }
}

/* Homepage: "Find a driveway" with a compact map (same script, no list) */
.home-map {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: var(--space-12);
    align-items: center;
}
.home-map__title { font-size: var(--heading-1); }
.home-map__frame {
    height: 540px;
    overflow: hidden;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}
.home-map__frame .map-canvas { width: 100%; height: 100%; }
@media (max-width: 900px) {
    .home-map { grid-template-columns: minmax(0, 1fr); gap: var(--space-8); }
    .home-map__frame { height: 420px; }
}
