/* Bodenrichtwert-Karte: OSM-Basiskarte + amtliches WMS-Overlay */
.bi-brw-map-wrap {
    margin: 1.5rem 0;
}

.bi-brw-map {
    position: relative;
    width: 100%;
    border: 1px solid var(--c-border, #e2e6ea);
    border-radius: var(--r-md, 10px);
    overflow: hidden;
    background: var(--c-grey-light, #f0f2f4);
    z-index: 0;
}

.bi-brw-map__consent {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem;
    text-align: center;
    background: var(--c-grey-light, #f0f2f4);
    z-index: 2;
}

.bi-brw-map__consent-text {
    max-width: 46ch;
    margin: 0;
    font-size: .875rem;
    line-height: 1.6;
    color: var(--c-grey, #637e9c);
}

.bi-brw-map__consent-btn {
    padding: .625rem 1.25rem;
    border: none;
    border-radius: var(--r-sm, 6px);
    background: var(--c-teal, #00a1a3);
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
}

.bi-brw-map__consent-btn:hover { filter: brightness(1.08); }

.bi-brw-map__caption {
    margin: .625rem 0 0;
    font-size: .8125rem;
    line-height: 1.6;
    color: var(--c-grey, #637e9c);
}

.bi-brw-map__source {
    display: block;
    margin-top: .25rem;
    font-size: .75rem;
    opacity: .85;
}

/* Leaflet-Bedienelemente an die Seitentypografie angleichen */
.bi-brw-map .leaflet-control-layers-list {
    font-size: .8125rem;
    color: var(--c-navy, #002147);
}

.bi-brw-map .leaflet-container {
    font-family: inherit;
}


/* ── Legende ──────────────────────────────────────────────────────
   Eingeklappt, damit sie auf schmalen Bildschirmen nicht die halbe
   Karte verdeckt. */
.bi-brw-legende {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 5px rgba(0,0,0,.4);
    font-size: .8125rem;
    line-height: 1.4;
    max-width: min(15rem, 60vw);
}
.bi-brw-legende__schalter {
    display: flex;
    align-items: center;
    gap: .375rem;
    width: 100%;
    padding: .4rem .6rem;
    background: none;
    border: 0;
    font: inherit;
    color: #1f2937;
    cursor: pointer;
}
.bi-brw-legende__schalter:hover { background: #f3f4f6; border-radius: 6px; }
.bi-brw-legende__inhalt { padding: 0 .6rem .6rem; }
.bi-brw-legende__inhalt img { display: block; max-width: 100%; height: auto; }
.bi-brw-legende__hinweis {
    margin: .5rem 0 0;
    font-size: .75rem;
    color: #4b5563;
}


/* ── Verweis auf die amtliche Quelle ──────────────────────────────
   Tritt an die Stelle des frueheren Zonen-Overlays. */
.bi-brw-quelle {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 5px rgba(0,0,0,.4);
    padding: .55rem .7rem;
    max-width: min(17rem, 68vw);
    font-size: .8125rem;
    line-height: 1.45;
}
.bi-brw-quelle strong { display: block; color: #1f2937; margin-bottom: .2rem; }
.bi-brw-quelle p { margin: 0 0 .4rem; color: #4b5563; font-size: .75rem; }
.bi-brw-quelle a { color: var(--c-teal, #0f766e); font-weight: 500; text-decoration: none; }
.bi-brw-quelle a:hover { text-decoration: underline; }

/* ── Fenster der Landkreisflaechen ────────────────────────────── */
/* Die Regeln tragen durchgehend .bi-kreis-popup davor: Das Fenster liegt
   in .post-content, wo p und h4 eigene Groessen gesetzt bekommen. */
.bi-kreis-popup .leaflet-popup-content-wrapper {
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(15,23,42,.18);
}
.bi-kreis-popup .leaflet-popup-content { margin: .8rem .9rem .85rem; }
.bi-kreis-popup .bi-kreis svg {
    flex: 0 0 auto;
    width: 1em; height: 1em;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.bi-kreis-popup .bi-kreis__titel {
    display: flex; align-items: center; gap: .4rem;
    margin: 0 0 .5rem;
    font-size: 1.0625rem; font-weight: 600; line-height: 1.3;
    color: #0f172a;
}
.bi-kreis-popup .bi-kreis__titel svg { color: #0f766e; width: 1.05em; height: 1.05em; }

.bi-kreis-popup .bi-kreis__spanne {
    display: flex; align-items: flex-start; gap: .4rem;
    margin: 0 0 .4rem;
    font-size: 1rem; font-weight: 600; line-height: 1.3;
    color: #0f766e;
}
.bi-kreis-popup .bi-kreis__spanne svg { margin-top: .15em; }
.bi-kreis-popup .bi-kreis__spanne em {
    display: block;
    margin-top: .12rem;
    font-size: .8125rem; font-weight: 500; font-style: normal; line-height: 1.35;
    color: #475569;
}

.bi-kreis-popup .bi-kreis__fuss {
    margin: 0 0 .45rem;
    font-size: .6875rem; line-height: 1.4;
    color: #64748b;
}
.bi-kreis-popup .bi-kreis__hinweis {
    margin: 0 0 .45rem;
    font-size: .75rem; line-height: 1.5;
    color: #475569;
}

.bi-kreis-popup .bi-kreis__amt {
    display: flex; align-items: flex-start; gap: .4rem;
    margin: 0 0 .5rem;
    padding-top: .45rem;
    border-top: 1px solid #e2e8f0;
    font-size: .6875rem; line-height: 1.4;
    color: #64748b;
}
.bi-kreis-popup .bi-kreis__amt svg { margin-top: .15em; }

.bi-kreis-popup .bi-kreis__link {
    display: flex; align-items: center; gap: .35rem;
    margin-top: .2rem;
    font-size: .8125rem; font-weight: 500; line-height: 1.4;
    color: #0f766e; text-decoration: none;
}
.bi-kreis-popup .bi-kreis__link:hover { color: #115e59; text-decoration: underline; }
.bi-kreis-popup .bi-kreis__link svg { transition: transform .15s ease; }
.bi-kreis-popup .bi-kreis__link:hover svg { transform: translateX(2px); }

/* ── Legende der Landkreisflaechen ────────────────────────────── */
.bi-brw-legende2 {
    background: rgba(255,255,255,.94);
    border-radius: 6px;
    box-shadow: 0 1px 5px rgba(0,0,0,.35);
    padding: .5rem .65rem;
    font-size: .75rem;
    line-height: 1.5;
    max-width: min(14rem, 58vw);
}
.bi-brw-legende2 strong { display: block; margin-bottom: .3rem; color: #1f2937; font-size: .8125rem; }
.bi-brw-legende2__zeile { display: flex; align-items: center; gap: .4rem; color: #374151; }
.bi-brw-legende2__feld { flex: 0 0 auto; width: 15px; height: 11px; border-radius: 2px; }
.bi-brw-legende2__feld--werte { background: rgba(20,184,166,.38); border: 2px solid #0f766e; }
.bi-brw-legende2__feld--ohne  { background: rgba(100,116,139,.32); border: 2px dashed #475569; }
.bi-brw-legende2__hinweis { display: block; margin-top: .35rem; color: #6b7280; font-size: .6875rem; }

/* ── Zeichen in der Kreisflaeche ──────────────────────────────── */
.bi-kreis-zeichen { background: none; border: 0; }
.bi-kreis-zeichen__feld {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1px;
    width: 34px; padding: 3px 2px 2px;
    background: rgba(255,255,255,.95);
    border: 1.5px solid #0f766e;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(15,23,42,.32);
    color: #0f766e;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
}
.bi-kreis-zeichen__feld--ohne { border-color: #475569; color: #475569; }
.bi-kreis-zeichen__feld--nurkz { padding: 3px 2px; }

.bi-kreis-zeichen__bild { display: block; line-height: 0; }
.bi-kreis-zeichen__bild svg {
    width: 19px; height: 19px;
    fill: none; stroke: currentColor;
    stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
}

.bi-kreis-zeichen__kz {
    display: block;
    font-size: 9.5px; font-weight: 700; letter-spacing: .3px; line-height: 1.1;
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
}
.bi-kreis-zeichen__kz--allein { font-size: 12px; letter-spacing: .4px; }

.bi-kreis-zeichen:hover .bi-kreis-zeichen__feld,
.bi-kreis-zeichen:focus .bi-kreis-zeichen__feld {
    transform: scale(1.12);
    box-shadow: 0 2px 9px rgba(15,23,42,.42);
}

/* ── Teilmaerkte im Kartenfenster ─────────────────────────────── */
.bi-kreis-popup .bi-gem__lage {
    margin: 0 0 .4rem;
    font-size: .875rem; font-weight: 500; line-height: 1.4;
    color: #0f766e;
}

/* ── Verkehrsachsen ───────────────────────────────────────────── */
.bi-achsen__strich {
    flex: 0 0 auto;
    width: 15px; height: 3px;
    border-radius: 2px;
}
.bi-achsen__band {
    flex: 0 0 auto;
    width: 15px; height: 11px;
    border-radius: 2px;
    background: rgba(4,120,87,.16);
    border: 1px solid rgba(4,120,87,.35);
}
.bi-achsen-legende { margin-bottom: .4rem; }
.bi-halt-schild {
    padding: .15rem .4rem;
    font-size: .6875rem;
    font-weight: 500;
    background: rgba(255,255,255,.95);
    border: none;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
    color: #1f2937;
}
.bi-halt-schild::before { display: none; }

/* ── Legende der Karte ────────────────────────────────────────── */
.bi-legende {
    background: rgba(255,255,255,.95);
    border-radius: 6px;
    box-shadow: 0 1px 5px rgba(0,0,0,.3);
    font-size: .75rem;
    line-height: 1.45;
    color: #374151;
    max-width: min(15rem, 62vw);
    overflow: hidden;
}
.bi-legende__griff {
    display: none;
    width: 100%;
    padding: .4rem .6rem;
    background: none;
    border: 0;
    font: inherit;
    font-weight: 600;
    color: #1f2937;
    text-align: left;
    cursor: pointer;
}
.bi-legende__griff::after { content: ' ▾'; color: #6b7280; }
.bi-legende__inhalt { padding: .5rem .6rem; }
.bi-legende__titel {
    display: block;
    font-weight: 600;
    font-size: .75rem;
    color: #1f2937;
}
.bi-legende__titel--zweit { margin-top: .55rem; }
.bi-legende__skala { display: flex; gap: 2px; margin-top: .3rem; }
.bi-legende__skala i {
    flex: 1 1 0;
    height: 9px;
    border-radius: 1px;
    border: 1px solid rgba(15,118,110,.35);
}
.bi-legende__marken {
    display: flex;
    justify-content: space-between;
    margin-top: .1rem;
    font-size: .625rem;
    color: #6b7280;
}
.bi-legende__marken span:first-child { margin-left: 22%; }
.bi-legende__zeile {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-top: .22rem;
}
.bi-legende__strich { flex: 0 0 auto; width: 15px; height: 3px; border-radius: 2px; }
.bi-legende__band {
    flex: 0 0 auto;
    width: 15px; height: 10px;
    border-radius: 2px;
    background: rgba(4,120,87,.16);
    border: 1px solid rgba(4,120,87,.35);
}

/* Auf schmalen Schirmen zugeklappt: Die Karte ist dort das Knappere. */
@media (max-width: 640px) {
    .bi-legende__griff { display: block; }
    .bi-legende__inhalt { display: none; }
    .bi-legende--offen .bi-legende__inhalt { display: block; padding-top: 0; }
    .bi-legende--offen .bi-legende__griff::after { content: ' ▴'; }
}

/* Das Band in der Legende einfarbig: Der Verlauf las sich als eigene
   Abstufung, die die Legende nicht erklaert. */
.bi-legende__band {
    background: rgba(4,120,87,.18) !important;
    border: 1px solid rgba(4,120,87,.35) !important;
}

/* Zeichen fuer die Teilmarktgrenze in der Legende */
.bi-legende__grenze {
    flex: 0 0 auto;
    width: 15px; height: 0;
    border-top: 2.4px dashed #134e4a;
    opacity: .85;
}

/* ── Gemeindenamen in der Flaeche ─────────────────────────────── */
.bi-gem-schild {
    pointer-events: none;
    white-space: nowrap;
}
.bi-gem-schild span {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: .6875rem;
    font-weight: 600;
    line-height: 1.1;
    color: #0f3b38;
    text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 5px #fff;
    letter-spacing: .01em;
}
@media (max-width: 700px) {
    .bi-gem-schild span { font-size: .625rem; }
}

.bi-halt-schild em {
    display: block;
    margin-top: .1rem;
    font-style: normal;
    font-size: .6875rem;
    font-weight: 600;
    color: #334155;
}


/* ── Kacheln vom Bildabstand des Themes ausnehmen ─────────────── */
/* .post-content img traegt margin: 1.5rem 0. Das gilt auch fuer die
   Kachelbilder der Karte und schiebt sie gegen das SVG-Overlay, das
   kein Bild ist. Die Folge waeren 24 Bildpunkte Versatz — bei kleinem
   Massstab mehrere Kilometer. */
.leaflet-container img,
.post-content .leaflet-container img,
.bi-brw-map img {
    margin: 0;
    padding: 0;
    border: 0;
    max-width: none;
    height: auto;
}
.leaflet-container .leaflet-marker-pane img,
.leaflet-container .leaflet-shadow-pane img {
    height: revert-layer;
}

/* ── Schilder an Flaechen und Halten ──────────────────────────── */
.bi-schild {
    max-width: 15rem;
    padding: .4rem .6rem;
    white-space: normal;
    line-height: 1.3;
}
.bi-schild b {
    display: block;
    font-size: .8125rem;
    font-weight: 600;
}
.bi-schild em {
    display: block;
    margin-top: .12rem;
    font-style: normal;
    font-size: .6875rem;
    font-weight: 500;
    color: #334155;
}
.bi-schild__fahrt { color: #475569 !important; }


/* Legendenzeichen fuer die Eisenbahn: weisse Schwellen auf der Linie,
   wie auf der Karte. Die Autobahn traegt ihre Strichelung. */
.bi-legende__strich--zug {
    background-image: repeating-linear-gradient(90deg,
        rgba(255,255,255,.9) 0 2px, transparent 2px 5px) !important;
}
.bi-legende__strich--auto {
    background-image: repeating-linear-gradient(90deg,
        transparent 0 2px, rgba(255,255,255,.9) 2px 4px) !important;
}
