/**
 * The master map at /map.
 *
 * Its own stylesheet rather than an addition to styles.css, which is linked by
 * every page on the site and cached for a year — appending to it means bumping
 * the ?v= on every page that links it, which has been forgotten once already.
 * A new file cannot be stale for anyone.
 */

.map-header {
    padding: 2.5rem 0 1rem;
    text-align: center;
}

.map-header h1 {
    font-size: 2.25rem;
    margin-bottom: 0.25rem;
}

.map-lead {
    color: var(--text-light);
    font-size: 1.1rem;
}

/* ── Filters ────────────────────────────────────────────────────────────── */

.map-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem 2rem;
    padding: 1.25rem 0 0.75rem;
}

.map-filter {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

/* Hidden rather than removed: the journeys view has no windows or pin kinds,
   and collapsing the row would make the whole control block jump. */
.map-filter[hidden] {
    display: none;
}

.map-filter-label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-light);
}

.map-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.map-chip {
    font: inherit;
    font-size: 0.9rem;
    padding: 0.35rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--background);
    color: var(--text-dark);
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.map-chip:hover {
    border-color: var(--primary-color);
}

.map-chip:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.map-chip.is-selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

/* ── The map ────────────────────────────────────────────────────────────── */

.map-summary {
    font-size: 0.95rem;
    color: var(--text-light);
    padding-bottom: 0.75rem;
}

.map-summary strong {
    color: var(--text-dark);
}

.map-shell {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px var(--shadow);
}

#map {
    height: 65vh;
    min-height: 420px;
    background: var(--background-alt);
}

.map-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-light);
    /* Above Leaflet's own panes and controls, which sit at 400–1000. */
    z-index: 1100;
    /* Says what happened without taking the map away: someone reading "no
       ducks with these filters" can still pan and zoom underneath it. */
    pointer-events: none;
}

.map-overlay[hidden] {
    display: none;
}

.map-note {
    font-size: 0.85rem;
    color: var(--text-light);
    padding: 0.9rem 0 0;
    max-width: 60ch;
}

/* ── Pins ───────────────────────────────────────────────────────────────── */

/* A count bubble rather than a teardrop marker: the map's unit is "how many
   here", and at national zoom a field of identical pins says nothing. */
.map-pin {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border-radius: 50%;
    border: 2px solid #fff;
    background: var(--primary-color);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.map-pin.is-births {
    background: var(--secondary-color);
}

.map-pin.is-ducks {
    background: #f59e0b;
}

/* ── Popups ─────────────────────────────────────────────────────────────── */

.map-popup h3 {
    font-size: 1rem;
    margin: 0 0 0.15rem;
}

.map-popup .map-popup-meta {
    font-size: 0.8rem;
    color: var(--text-light);
    margin: 0 0 0.5rem;
}

.map-popup ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.map-popup li + li {
    margin-top: 0.3rem;
}

.map-popup a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.map-popup a:hover {
    text-decoration: underline;
}

/* ── Call to action ─────────────────────────────────────────────────────── */

.map-cta {
    text-align: center;
    padding: 3rem 0 4rem;
}

.map-cta h2 {
    font-size: 1.6rem;
    margin-bottom: 0.35rem;
}

.map-cta p {
    color: var(--text-light);
    margin-bottom: 1rem;
}

@media (max-width: 640px) {
    .map-header h1 {
        font-size: 1.75rem;
    }

    .map-controls {
        gap: 1rem;
    }

    .map-filter {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.35rem;
    }

    #map {
        height: 60vh;
        min-height: 340px;
    }
}
