/* MVZ Roth — Map section (loaded only on templates that render the consent-gated map).
   Part of the MVZ Roth theme. Cascade layer: pages (order declared in style.css). */
@layer pages {
    /* =========================================================================
       MAP
       ========================================================================= */
    .map-section { padding: 0; }

    /*
     * The map is a letterbox on a wide screen: at a fixed 480px it was 1440px
     * or more across, and fitting three practices that lie 13km apart
     * north-to-south into that strip forced the zoom so far out that half of
     * the region was on screen. Height now scales with the viewport, which
     * buys back roughly a zoom level on a desktop display.
     */
    /*
     * Contained rather than edge-to-edge.
     *
     * Full-bleed looked generous but behaved badly: a 1440px-wide, 480px-tall
     * strip is a letterbox, and Leaflet has to zoom out until the practices'
     * 13km north-south spread fits the SHORT side. The result was half of the
     * region on screen with three dots lost in it. At content width the box is
     * roughly 3:2 instead of 3:1, the same bounds fit a zoom level closer, and
     * the map sits in the page like the other cards.
     */
    .map-container {
        width: min(100% - (2 * var(--gutter)), var(--container));
        margin-inline: auto;
        /*
         * A proportioned box, not a strip. Leaflet fits the bounds to whichever
         * side is tighter, and the practices are spread 13km north-to-south
         * against 5km east-to-west — so the HEIGHT decides the zoom. At 2:1 the
         * box is tall enough for the next zoom level up, which is the
         * difference between three dots lost in the region and three dots in a
         * recognisable neighbourhood.
         */
        aspect-ratio: 2 / 1;
        min-height: 420px;
        max-height: 660px;
        border-radius: var(--r-lg, 22px);
        overflow: hidden;
        box-shadow: var(--shadow-sm, 0 2px 4px rgb(26 36 38 / 0.04));
    }
    .map-section:has(.map-container:not([hidden])) { padding-block: var(--space-10, 2.5rem); }

    /*
     * `hidden` is only `display: none` in the browser's own stylesheet, and
     * any author `display` beats it. The consent panel therefore stayed on
     * screen after the visitor accepted, with the map stacked underneath it —
     * the section rendered twice its intended height and the panel never went
     * away. Same guard on the container, so it cannot be revealed by accident.
     */
    .map-consent[hidden],
    .map-container[hidden] { display: none !important; }

    .map-consent {
        width: 100%; min-height: 480px;
        background: var(--paper-warm);
        background-image:
            radial-gradient(circle at 30% 20%, var(--teal-pale) 0%, transparent 40%),
            radial-gradient(circle at 70% 80%, var(--clay-pale) 0%, transparent 40%);
        display: flex; align-items: center; justify-content: center;
        text-align: center; padding: var(--space-12) var(--space-6);
    }
    .map-consent > div { max-width: 480px; }
    .map-consent :is(h2, h3) {
        font-family: var(--font-display); font-size: var(--text-2xl);
        color: var(--ink-deep); margin-bottom: var(--space-4);
        letter-spacing: -0.02em;
    }
    .map-consent p {
        color: var(--ink-soft); margin-bottom: var(--space-6);
        font-size: var(--text-base);
    }
}

/* =========================================================================
   LEAFLET-FACING RULES — DELIBERATELY OUTSIDE @layer pages
   -------------------------------------------------------------------------
   leaflet.css ships unlayered, and unlayered styles beat every declared
   layer no matter how specific the layered selector is. Marker and popup
   rules therefore cannot live in `@layer pages`: inside it, Leaflet's own
   `.leaflet-marker-icon { display: block }` silently won and the dot was
   never centred on its anchor. Same reasoning as assets/css/overrides.css.
   ========================================================================= */
/* =========================================================================
   MARKERS
   -------------------------------------------------------------------------
   The pin is a Leaflet `divIcon`: the theme hands Leaflet
   `<span class="mvz-marker-dot">` and Leaflet sizes the wrapper. Nothing
   ever styled that span, so all three practices were plotted correctly and
   drawn as nothing at all — the map looked like it had lost its locations.
   ========================================================================= */
/*
 * Leaflet's own `.leaflet-marker-icon { display: block }` loads after this
 * file, so the wrapper needs the extra class to win and actually centre
 * the dot on its anchor.
 */
.leaflet-marker-icon.mvz-marker { display: grid; place-items: center; }

.mvz-marker-dot {
    /*
     * `display: block` is the whole trick. The dot is a <span>, and width
     * and height are ignored on a non-replaced inline element — so the
     * span collapsed to nothing and all that rendered was its 3px white
     * border, curved into a thin white ellipse. Three of those on a map of
     * the region read as "the locations are missing".
     */
    display: block;
    inline-size: 18px;
    block-size: 18px;
    border-radius: 50%;
    background: var(--teal, #0d4a5c);
    border: 3px solid var(--pure-white, #fff);
    box-shadow: 0 2px 6px rgb(6 42 54 / 0.45);
    transition: transform var(--t-fast, 200ms) var(--ease, ease);
}

.leaflet-marker-icon:hover .mvz-marker-dot { transform: scale(1.25); }

/* Markers are keyboard-reachable (`keyboard: true`), so the focus ring has
   to be visible against both the map and the tiles behind it. */
.leaflet-marker-icon:focus-visible {
    outline: 3px solid var(--teal-deep, #062a36);
    outline-offset: 3px;
    border-radius: 50%;
}
.leaflet-marker-icon:focus-visible .mvz-marker-dot { transform: scale(1.25); }

@media (prefers-reduced-motion: reduce) {
    .mvz-marker-dot { transition: none; }
}

/* Popup: match the theme rather than Leaflet's default chrome. */
.leaflet-popup-content-wrapper {
    border-radius: var(--r, 14px);
    box-shadow: 0 6px 24px rgb(6 42 54 / 0.18);
}

/*
 * Leaflet sizes a popup from its content. The theme's global
 * `overflow-wrap: anywhere` — the safety net for long German compounds —
 * applied inside it too and let the browser break "Praxis Ostfildern"
 * mid-word, so the popup collapsed to a few characters wide. Inside a
 * popup the text is short and known, so normal wrapping is right.
 */
.leaflet-popup-content {
    margin: 0.85rem 1.1rem;
    line-height: 1.5;
    min-inline-size: 11rem;
    overflow-wrap: normal;
    word-break: normal;
}
.mvz-popup-name { display: inline-block; margin-block-end: 0.2rem; }
.mvz-popup-name {
    font-family: var(--font-display, serif);
    font-size: 1.05rem;
    color: var(--ink-deep, #0a1518);
}
.mvz-popup-address { color: var(--ink-soft, #4a5760); font-size: 0.9rem; }
