/* ==================================================================
   Neukölln Navigator – Frontend
   4K-first: die Basisschriftgröße skaliert mit der Viewport-Breite,
   alle Maße in rem skalieren mit.
   ================================================================== */

:root {
    --rot: #df1c2d;
    --rot-dunkel: #8b1515;
    --schwarz: #1a1a1a;
    --grau: #6e6e6a;
    --grau-hell: #f4f4f2;
    --weiss: #ffffff;
    --radius: 4px;
    --schatten: 0 10px 40px rgba(0, 0, 0, 0.22);
    --font: 'IBM Plex Sans', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html {
    /* skaliert von Smartphone bis 4K */
    font-size: clamp(15px, 0.55vw + 9px, 32px);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--schwarz);
    background: var(--weiss);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

button {
    font-family: inherit;
    cursor: pointer;
}

a { color: inherit; }

/* Touch-Ziele */
button, .btn, a.btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    min-height: 3rem;
    padding: 0.7em 1.6em;
    background: var(--weiss);
    color: var(--schwarz);
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover, .btn:focus-visible { transform: translateY(-1px); box-shadow: 0 4px 18px rgba(0,0,0,0.25); }
.btn-rot { background: var(--rot); color: var(--weiss); }

:focus-visible { outline: 3px solid var(--rot); outline-offset: 3px; }
.screen-intro :focus-visible, .screen-grid :focus-visible,
.screen-fragen :focus-visible, .screen-tags :focus-visible { outline-color: var(--weiss); }

/* ==================================================================
   Home: Screen-Wechsel (Intro → Grid → Fragen → Tagcloud)
   ================================================================== */

body.home { overflow: hidden; height: 100dvh; }

.screen {
    position: fixed;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.7s ease, visibility 0s linear 0.7s;
    z-index: 1;
}
.screen.aktiv {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.7s ease;
    z-index: 2;
}

/* ---------- Screen 1: Intro ---------- */

.screen-intro {
    background: var(--rot);
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Fullscreen-Foto, sichtbar nur innerhalb des Neukölln-Umrisses */
.intro-maske {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: grayscale(1) contrast(1.05);
    -webkit-mask-image: url('/assets/images/neukoelln_umriss.svg');
    mask-image: url('/assets/images/neukoelln_umriss.svg');
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: auto 86%;
    mask-size: auto 86%;
    pointer-events: none;
}
.screen-intro.aktiv .intro-maske {
    animation: maskeEin 1.4s ease both;
}
@keyframes maskeEin {
    from { opacity: 0; transform: scale(1.03); }
    to   { opacity: 1; transform: scale(1); }
}
.intro-logo {
    position: relative;
    width: clamp(280px, 32vw, 1100px);
    height: auto;
}
.screen-intro.aktiv .intro-logo {
    animation: introZoom 1.1s ease both;
}
@keyframes introZoom {
    from { opacity: 0; transform: scale(1.15); }
    to   { opacity: 1; transform: scale(1); }
}

/* ---------- Screen 2: Memory-Grid ---------- */

.screen-grid { background: var(--rot); }

.grid-wrap {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: var(--rot);
}
.grid-inner {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 2px;
    background: rgba(255, 255, 255, 0.16);
}
.base-cell { background: var(--rot); }
.base-cell.center-cell { background: var(--rot); }

.tile {
    position: absolute;
    z-index: 10;
    overflow: hidden;
    border-radius: 1px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0.8rem 1rem;
    opacity: 0;
    will-change: opacity;
    background: var(--rot-dunkel);
}
.tile::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.55) 0%, transparent 60%);
    pointer-events: none;
}
.tile-label {
    position: relative;
    z-index: 1;
    color: var(--weiss);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-size: 0.85rem;
}
.tile-desc {
    position: relative;
    z-index: 1;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.7rem;
    margin-top: 0.15rem;
    line-height: 1.35;
}

.center-block {
    position: absolute;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.1rem;
    background: var(--rot);
    text-align: center;
    padding: 1rem;
}
.center-block .pin { width: clamp(64px, 6vw, 200px); height: auto; }
.center-block .wortmarke { width: clamp(160px, 13vw, 460px); height: auto; }
.center-block .subline {
    color: var(--weiss);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-top: -0.6rem;
}

/* ---------- Screen 3: Fragen ---------- */

.screen-fragen, .screen-tags {
    background: var(--rot);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    padding: 4vmin;
}

.screen-titel {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin: 0;
}

.fragen {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: clamp(1.5rem, 4vw, 5rem);
}
.frage-btn {
    background: none;
    border: none;
    color: var(--weiss);
    font-size: clamp(3rem, 7vw, 9rem);
    font-weight: 800;
    letter-spacing: -0.01em;
    padding: 0.2em 0.35em;
    border-radius: var(--radius);
    transition: transform 0.2s ease, background 0.2s ease;
}
.frage-btn:hover, .frage-btn:focus-visible {
    transform: scale(1.06);
    background: rgba(255, 255, 255, 0.08);
}

/* ---------- Screen 4: Tagcloud ---------- */

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 0.4em clamp(1.2rem, 3vw, 3.5rem);
    max-width: 72vw;
}
.tag-wort {
    background: none;
    border: none;
    color: var(--weiss);
    font-weight: 800;
    line-height: 1.2;
    padding: 0.1em 0.25em;
    border-radius: var(--radius);
    transition: transform 0.18s ease, opacity 0.18s ease;
    opacity: 0.96;
}
.tag-wort small {
    font-size: 0.45em;
    font-weight: 600;
    opacity: 0.65;
    vertical-align: super;
    margin-left: 0.25em;
}
.tag-wort:hover, .tag-wort:focus-visible {
    transform: scale(1.07);
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}
.tag-cloud .leer {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
}

.zurueck-btn {
    position: absolute;
    top: 2.2rem;
    left: 2.2rem;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: var(--weiss);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.8em 1.4em;
    border-radius: var(--radius);
    min-height: 3rem;
    transition: background 0.2s ease;
}
.zurueck-btn:hover, .zurueck-btn:focus-visible { background: rgba(255, 255, 255, 0.24); }

.home-footer {
    position: absolute;
    bottom: 1.6rem;
    right: 2rem;
    z-index: 30;
    display: flex;
    gap: 1.6rem;
}
.home-footer a, .home-footer button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-decoration: none;
    padding: 0.6em 0.4em;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}
.home-footer a:hover, .home-footer button:hover { color: var(--weiss); }

/* ==================================================================
   Kartenansicht
   ================================================================== */

body.karte-seite { overflow: hidden; height: 100dvh; }

.karte-layout {
    display: flex;
    height: 100dvh;
}
#map {
    flex: 1;
    min-width: 0;
    height: 100%;
    background: #f7f7f5;
}

.karte-sidebar {
    width: clamp(320px, 24vw, 760px);
    height: 100%;
    background: var(--weiss);
    box-shadow: -6px 0 30px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 5;
}
.sidebar-kopf {
    display: flex;
    gap: 1rem;
    padding: 1.4rem;
    align-items: flex-start;
}
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}
.sidebar-nav .nav-btn {
    width: 3.2rem;
    height: 3.2rem;
    border: 1px solid #e2e2de;
    border-radius: var(--radius);
    background: var(--weiss);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    text-decoration: none;
    transition: background 0.15s ease;
}
.sidebar-nav .nav-btn:hover { background: var(--grau-hell); }
.sidebar-nav .nav-btn.logo { background: var(--rot); border-color: var(--rot); }
.sidebar-nav .nav-btn.logo img { width: 55%; }

.sidebar-intro h1 {
    font-size: 1.25rem;
    margin: 0 0 0.5rem;
    font-weight: 800;
}
.sidebar-intro p {
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--grau);
    margin: 0;
}

.filter-akkordeons {
    flex: 1;
    overflow-y: auto;
    padding: 0 1.4rem 1.4rem;
}
.akkordeon {
    border-top: 1px solid #e8e8e4;
}
.akkordeon summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 3.4rem;
    font-weight: 700;
    font-size: 0.98rem;
    cursor: pointer;
    position: relative;
    padding-left: 0.9rem;
}
.akkordeon summary::-webkit-details-marker { display: none; }
.akkordeon summary::before {
    content: "";
    position: absolute;
    left: 0;
    top: 18%;
    bottom: 18%;
    width: 3px;
    border-radius: 2px;
    background: var(--rot);
}
.akkordeon.dim-wann summary::before { background: #e8a13c; }
.akkordeon.dim-wo summary::before { background: #3c7fe8; }
.akkordeon summary .anzahl { color: var(--grau); font-weight: 500; margin-left: 0.4em; }
.akkordeon summary .pfeil { transition: transform 0.2s ease; color: var(--grau); }
.akkordeon[open] summary .pfeil { transform: rotate(180deg); }

.akkordeon .tags-liste {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.2rem 0 1.2rem;
}
.filter-tag {
    border: 1px solid #ddddd8;
    background: var(--weiss);
    border-radius: 100px;
    font-size: 0.82rem;
    padding: 0.5em 1em;
    min-height: 2.6rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    transition: all 0.15s ease;
}
.filter-tag .anzahl { color: var(--grau); font-size: 0.85em; }
.filter-tag:hover { border-color: var(--schwarz); }
.filter-tag.aktiv {
    background: var(--rot);
    border-color: var(--rot);
    color: var(--weiss);
}
.filter-tag.aktiv .anzahl { color: rgba(255, 255, 255, 0.8); }

.sidebar-fuss {
    padding: 1.1rem 1.4rem;
    border-top: 1px solid #e8e8e4;
    font-size: 0.72rem;
    color: var(--grau);
    line-height: 1.5;
}
.sidebar-fuss .links {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    margin-top: 0.7rem;
}
.sidebar-fuss a, .sidebar-fuss button {
    background: none;
    border: none;
    padding: 0.4em 0;
    color: var(--schwarz);
    font-weight: 600;
    font-size: 0.78rem;
    text-decoration: none;
}
.sidebar-fuss a:hover, .sidebar-fuss button:hover { color: var(--rot); }

.karte-logo-ecke {
    position: absolute;
    bottom: 1.4rem;
    left: 1.4rem;
    z-index: 4;
    width: clamp(90px, 7vw, 220px);
    background: var(--weiss);
    border: 1px solid #e0e0dc;
    padding: 0.4rem;
}

/* Map-Marker */
.nav-marker {
    width: 2.4rem;
    height: 2.4rem;
    cursor: pointer;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
    transition: transform 0.15s ease;
    transform-origin: bottom center;
}
.nav-marker:hover { transform: scale(1.15); }
.nav-marker img { width: 100%; height: 100%; }

.marker-titel {
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    background: var(--weiss);
    color: var(--schwarz);
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    padding: 0.25em 0.7em;
    border-radius: 100px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    margin-top: 0.3rem;
    pointer-events: none;
}

/* ---------- Verschiebbare Content-Popups ---------- */

.content-popup {
    position: fixed;
    z-index: 100;
    width: clamp(320px, 26vw, 700px);
    background: var(--weiss);
    border-radius: 8px;
    box-shadow: var(--schatten);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: min(72vh, 60rem);
    touch-action: none;
}
.content-popup .popup-griff {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--rot);
    color: var(--weiss);
    padding: 0.7rem 0.7rem 0.7rem 1.2rem;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}
.content-popup .popup-griff:active { cursor: grabbing; }
.content-popup .griff-punkte {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 0;
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.03em;
}
.content-popup .griff-punkte .titel {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.content-popup .griff-punkte::before {
    content: "⠿";
    font-size: 1.2rem;
    opacity: 0.7;
}
.popup-schliessen {
    flex: none;
    width: 2.8rem;
    height: 2.8rem;
    border: none;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.15);
    color: var(--weiss);
    font-size: 1.3rem;
    line-height: 1;
}
.popup-schliessen:hover { background: rgba(255, 255, 255, 0.3); }

.content-popup .popup-inhalt {
    overflow-y: auto;
    padding: 1.2rem;
    touch-action: pan-y;
}
.content-popup .popup-bild {
    margin: -1.2rem -1.2rem 1rem;
}
.content-popup .popup-bild img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}
.content-popup h2 {
    margin: 0 0 0.3rem;
    font-size: 1.15rem;
    font-weight: 800;
}
.content-popup .untertitel {
    color: var(--grau);
    font-size: 0.85rem;
    margin: 0 0 0.8rem;
}
.content-popup p { font-size: 0.88rem; line-height: 1.6; margin: 0 0 1rem; }
.content-popup .popup-aktionen { display: flex; gap: 0.8rem; }

/* ==================================================================
   Artikelseite
   ================================================================== */

body.ort-seite { background: var(--weiss); }

.ort-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--rot);
    padding: 0.7rem 1.4rem;
}
.ort-topbar .wortmarke { height: 2.2rem; width: auto; }
.ort-topbar .aktionen { display: flex; gap: 0.8rem; }
.ort-topbar .btn { min-height: 2.6rem; font-size: 0.8rem; padding: 0.5em 1.2em; }

.ort-hero {
    position: relative;
    background: var(--schwarz);
    color: var(--weiss);
    overflow: hidden;
}
.ort-hero img {
    width: 100%;
    height: clamp(300px, 46vh, 900px);
    object-fit: cover;
    opacity: 0.85;
}
.ort-hero .hero-text {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: clamp(1.5rem, 4vw, 4rem);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
}
.ort-hero.ohne-bild { background: var(--rot); }
.ort-hero.ohne-bild .hero-text { position: static; background: none; }
.ort-hero h1 {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 4.2rem);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.ort-hero .untertitel {
    font-size: clamp(0.95rem, 1.4vw, 1.5rem);
    opacity: 0.9;
    margin-top: 0.4rem;
}

.ort-inhalt {
    max-width: min(46rem, 92vw);
    margin: 0 auto;
    padding: clamp(2rem, 5vh, 5rem) 1.2rem 4rem;
}
.ort-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 2.2rem;
}
.ort-meta .autor { color: var(--grau); font-size: 0.9rem; margin-right: auto; }
.ort-tag {
    display: inline-flex;
    align-items: center;
    border-radius: 100px;
    background: var(--grau-hell);
    color: var(--schwarz);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.45em 1em;
    text-decoration: none;
}
.ort-tag:hover { background: var(--rot); color: var(--weiss); }

.block-paragraph { font-size: 1.02rem; line-height: 1.75; margin: 0 0 1.4rem; }
.block-heading { font-size: 1.35rem; font-weight: 800; margin: 2.4rem 0 1rem; }
h3.block-heading { font-size: 1.2rem; }
h4.block-heading { font-size: 1.05rem; }

.block-quote {
    border-left: 4px solid var(--rot);
    margin: 2rem 0;
    padding: 0.4rem 0 0.4rem 1.4rem;
}
.block-quote p { font-size: 1.08rem; font-style: italic; line-height: 1.65; margin: 0 0 0.5rem; }
.block-quote cite { font-style: normal; font-size: 0.85rem; color: var(--grau); }

.block-image { margin: 2.2rem 0; }
.block-image img { width: 100%; border-radius: var(--radius); }
.block-image figcaption {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-top: 0.6rem;
    font-size: 0.82rem;
    color: var(--grau);
    line-height: 1.5;
}
.block-image figcaption .credit { font-size: 0.74rem; opacity: 0.8; }

.block-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: 1.2rem;
    margin: 2.2rem 0;
}
.block-gallery .block-image { margin: 0; }

.ort-felder {
    margin-top: 3rem;
    border-top: 1px solid #e8e8e4;
    padding-top: 1.6rem;
}
.ort-felder dt { font-weight: 700; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 1.1rem; }
.ort-felder dd { margin: 0.3rem 0 0; font-size: 0.95rem; line-height: 1.6; color: var(--grau); }

.ort-fuss {
    border-top: 1px solid #e8e8e4;
    margin-top: 3rem;
    padding-top: 1.4rem;
    font-size: 0.85rem;
    color: var(--grau);
}

/* ==================================================================
   Statische Seiten + Info-Popup
   ================================================================== */

.seite-wrap {
    max-width: min(44rem, 92vw);
    margin: 0 auto;
    padding: 3rem 1.2rem 4rem;
}
.seite-wrap h1 { font-size: 2rem; font-weight: 800; }

.info-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(20, 20, 20, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4vmin;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}
.info-overlay.offen {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}
.info-modal {
    display: flex;
    width: min(64rem, 94vw);
    max-height: 86vh;
    background: var(--weiss);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--schatten);
}
.info-modal .info-marke {
    flex: 0 0 32%;
    background: var(--rot);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    padding: 2rem;
}
.info-modal .info-marke img.pin { width: clamp(70px, 7vw, 180px); }
.info-modal .info-marke img.wortmarke { width: clamp(140px, 11vw, 300px); }
.info-modal .info-text {
    flex: 1;
    overflow-y: auto;
    padding: clamp(1.6rem, 3vw, 3.5rem);
    position: relative;
}
.info-text h1 { margin-top: 0; font-size: clamp(1.6rem, 2.6vw, 3rem); }
.info-text .info-schliessen {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.8rem;
    height: 2.8rem;
    border: none;
    border-radius: var(--radius);
    background: var(--grau-hell);
    font-size: 1.2rem;
}
.info-text .projekt-zeile {
    margin-top: 2rem;
    padding-top: 1.2rem;
    border-top: 1px solid #e8e8e4;
    font-size: 0.85rem;
    color: var(--grau);
}

/* ==================================================================
   404
   ================================================================== */
.fehler-wrap {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.6rem;
    background: var(--rot);
    color: var(--weiss);
    text-align: center;
    padding: 2rem;
}
.fehler-wrap h1 { font-size: 3rem; margin: 0; }

/* ==================================================================
   Responsive: kleine Geräte
   ================================================================== */

@media (max-width: 900px) {
    .karte-layout { flex-direction: column; }
    .karte-sidebar {
        width: 100%;
        height: auto;
        max-height: 46dvh;
        order: 2;
        box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.1);
    }
    #map { order: 1; min-height: 0; }
    .sidebar-kopf { padding: 1rem; gap: 0.8rem; }
    .sidebar-nav { flex-direction: row; }
    .karte-logo-ecke { display: none; }
    .content-popup {
        width: min(92vw, 480px);
        max-height: 60vh;
    }
    .info-modal { flex-direction: column; }
    .info-modal .info-marke { flex: none; padding: 1.4rem; }
    .grid-inner {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(7, 1fr);
    }
}

/* ==================================================================
   Kartenansicht: Karte im Neukölln-Umriss auf roter Fläche,
   Inhaltspanel links, Navigation rechts
   ================================================================== */

body.karte {
    overflow: hidden;
    height: 100dvh;
    background: var(--rot);
    /* Spalten: Inhaltspanel links, Logo-/Button-Spalte rechts */
    --karte-panel-breite: clamp(320px, 29vw, 42rem);
    --karte-rechts-breite: clamp(150px, 11vw, 16rem);
}

/* Karte als Screen innerhalb der App-Seite */
.screen-karte { background: var(--rot); }

.karte-layout {
    position: relative;
    width: 100%;
    height: 100dvh;
}
/* Karte beginnt rechts vom Panel und läuft bis zum rechten Rand –
   die rechte Spalte (Logo-Block + Buttons) schwebt darüber */
.karte-layout #map {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--karte-panel-breite);
    right: 0;
    background: var(--rot);
}

/* ---------- Marker ---------- */

.karte-marker {
    width: 2.1rem;
    height: 2.8rem;
    cursor: pointer;
    /* Wichtig: keine transform-Transition auf dem Marker-Element selbst –
       MapLibre positioniert es per transform, eine Transition würde die
       Pins der Kartenbewegung verzögert hinterherziehen. */
    transition: opacity 0.25s ease;
}
.karte-marker svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.3));
    transition: transform 0.25s ease;
    transform-origin: bottom center;
}
.karte-marker.inaktiv { opacity: 0.4; }
.karte-marker.aktiv { z-index: 5; }
.karte-marker.aktiv svg { transform: scale(1.35); }
.karte-marker:focus-visible { outline: 3px solid var(--weiss); outline-offset: 2px; border-radius: 50%; }

/* ---------- Inhaltspanel links ---------- */

.karte-panel {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--karte-panel-breite);
    display: flex;
    flex-direction: column;
    color: var(--weiss);
    background: var(--rot);
    z-index: 5;
    padding: 1.6rem 0 1rem 1.8rem;
}
/* Weicher Inhaltswechsel: nur der Inhalt in der Mitte blendet –
   "Zurück" oben und die Fußleiste (Vorlesen, Pfeile) bleiben stehen */
.karte-panel-scroll {
    transition: opacity 0.2s ease;
}
.karte-panel.wechselt .karte-panel-scroll {
    opacity: 0;
}
@media (prefers-reduced-motion: reduce) {
    .karte-panel-scroll { transition: none; }
}

/* "Zurück" oben im Panel (Tag-Ansicht und Einzelinhalt) */
.karte-panel-kopf {
    padding: 0 1.4rem 0.9rem 0;
}
.karte-panel-kopf[hidden] { display: none; }
.karte-panel-zurueck {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 0;
    padding: 0.2rem 0;
    color: var(--weiss);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}
.karte-panel-zurueck svg { width: 1.05em; height: 1.05em; }
.karte-panel-zurueck:hover,
.karte-panel-zurueck:focus-visible { text-decoration: underline; }

.karte-panel-scroll {
    flex: 1;
    overflow: hidden; /* Inhalt wird geblättert, nicht gescrollt */
    padding-right: 1.4rem;
}
/* Nur die Übersicht darf scrollen (lange Listen) */
.karte-panel.modus-uebersicht .karte-panel-scroll { overflow-y: auto; }
.karte-panel-scroll::-webkit-scrollbar { width: 6px; }
.karte-panel-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.35); border-radius: 3px; }

.karte-titel {
    font-size: 1.85rem;
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 1.2rem;
}
.karte-lead {
    font-size: 1.25rem;
    font-weight: 300;
    line-height: 1.4;
    margin: 0 0 1.1rem;
}
.karte-laden { font-weight: 300; opacity: 0.7; }

.karte-bloecke { font-weight: 300; font-size: 0.92rem; line-height: 1.5; }
.karte-bloecke .block-paragraph { line-height: 1.5; margin: 0 0 1rem; }
.karte-bloecke .block-heading { font-weight: 600; font-size: 1.1rem; line-height: 1.3; margin: 1.6rem 0 0.7rem; }
.karte-bloecke .block-image { margin: 1.3rem 0; }
/* Das ganze Bild ist klickbar (Button), die Lupe nur Indikator */
.karte-bloecke .karte-bild-wrap {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    cursor: pointer;
    text-align: inherit;
}
.karte-bloecke .karte-bild-wrap:hover .karte-lupe,
.karte-bloecke .karte-bild-wrap:focus-visible .karte-lupe {
    transform: scale(1.1);
}
.karte-bloecke .block-image img {
    width: 100%;
    height: auto;
    /* Hochformate maximal im Verhältnis 3:4 zeigen – Rest beschneiden */
    max-height: calc((var(--karte-panel-breite) - 3.2rem) * 1.3333);
    object-fit: cover;
    border-radius: 3px;
    display: block;
}

/* Lupe: öffnet das Bild in der Lightbox */
.karte-lupe {
    position: absolute;
    right: 0.55rem;
    bottom: 0.55rem;
    width: 2.1rem;
    height: 2.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    color: var(--schwarz);
    border: 0;
    border-radius: 5px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    transition: transform 0.15s ease;
}
.karte-lupe svg { width: 1.15rem; height: 1.15rem; }

/* Lightbox: Bild im Vollbild */
.karte-lightbox {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(12, 6, 6, 0.93);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    cursor: pointer;
    /* weiches Ein-/Ausblenden */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.32s ease, visibility 0s linear 0.32s;
}
.karte-lightbox.offen {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.32s ease;
}
.karte-lightbox figure {
    margin: 0;
    max-width: 92vw;
    max-height: 88dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    transform: scale(0.96);
    transition: transform 0.32s ease;
}
.karte-lightbox.offen figure { transform: none; }
@media (prefers-reduced-motion: reduce) {
    .karte-lightbox, .karte-lightbox figure { transition: none; }
}
.karte-lightbox img {
    max-width: 92vw;
    max-height: 78dvh;
    width: auto;
    height: auto;
    border-radius: 3px;
}
.karte-lightbox figcaption {
    color: var(--weiss);
    font-size: 0.78rem;
    line-height: 1.45;
    text-align: center;
    opacity: 0.9;
    white-space: pre-line;
}
.karte-lightbox-zu {
    position: absolute;
    top: 1.4rem;
    right: 1.6rem;
    background: none;
    border: 0;
    color: var(--weiss);
    font-size: 1.6rem;
    line-height: 1;
    padding: 0.6rem;
}
.karte-bloecke .block-image figcaption {
    font-size: 0.62rem;
    line-height: 1.4;
    color: var(--weiss);
    opacity: 0.9;
    margin-top: 0.4rem;
    display: flex;
    flex-direction: column;
}
.karte-bloecke .block-image figcaption .caption,
.karte-bloecke .block-image figcaption .credit { color: var(--weiss); }
/* Credit nicht größer als die Bildunterschrift (Artikel-Style überschreibt sonst) */
.karte-bloecke .block-image figcaption .credit { font-size: inherit; opacity: 0.75; }
.karte-bloecke .block-quote {
    margin: 1.4rem 0;
    padding-left: 1rem;
    border-left: 3px solid rgba(255,255,255,0.6);
    font-style: italic;
}
.karte-bloecke .block-quote p { margin: 0 0 0.4rem; font-size: 1.05rem; line-height: 1.45; }
.karte-bloecke .block-quote cite { font-style: normal; font-size: 0.75rem; color: var(--weiss); opacity: 0.8; }
.karte-bloecke .block-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin: 1.3rem 0; }
.karte-bloecke .block-gallery .block-image { margin: 0; }

/* Panel-Fuß: Zurück / Vorlesen / Weiter */

.karte-panel-fuss {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.9rem 1.4rem 1.1rem 0;
}
.karte-blaettern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 0;
    color: var(--weiss);
    padding: 0.6rem;
    transition: opacity 0.2s ease, transform 0.15s ease;
}
.karte-blaettern svg { width: 1.7rem; height: 1.7rem; }
.karte-blaettern:hover:not(:disabled), .karte-blaettern:focus-visible:not(:disabled) { transform: scale(1.12); }
.karte-blaettern:disabled { opacity: 0.35; cursor: default; }

/* Zurück / Vorlesen / Weiter auf einer Mittellinie –
   die Seitenzahl hängt absolut darunter und verschiebt nichts */
.karte-fuss-mitte {
    position: relative;
    display: flex;
    align-items: center;
}
.karte-seitenzahl {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0.25rem;
    font-size: 0.68rem;
    opacity: 0.85;
    white-space: nowrap;
}
.karte-vorlesen.laedt { opacity: 0.7; }
.karte-vorlesen {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    background: var(--schwarz);
    color: var(--weiss);
    border: 0;
    border-radius: 7px;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.85rem 1.4rem;
}
.karte-vorlesen svg { width: 1.25rem; height: 1.25rem; }
.karte-vorlesen[aria-pressed="true"] { background: var(--weiss); color: var(--schwarz); }

/* ---------- Rechte Spalte: Logo-Block + Navigation ---------- */

.karte-rechts {
    position: absolute;
    top: 0;
    right: 0;
    width: var(--karte-rechts-breite);
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.1rem;
    pointer-events: none;
}
.karte-rechts .karte-nav-btn { pointer-events: auto; }

/* Roter Block hinter dem Logo – liegt bewusst über der Karte */
.karte-marke {
    width: 100%;
    background: var(--rot);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
    padding: 1.5rem 1.2rem 1.4rem;
}
.karte-marke .zeichen { width: 38%; }
.karte-marke .wortmarke { width: 72%; }

.karte-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
}
.karte-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    width: clamp(86px, 6.5vw, 9rem);
    aspect-ratio: 1 / 0.87;
    background: var(--weiss);
    color: var(--schwarz);
    border: 0;
    border-radius: 6px;
    box-shadow: 0 1.5px 4.5px rgba(0,0,0,0.2);
    font-size: 0.72rem;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.karte-nav-btn:hover, .karte-nav-btn:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(0,0,0,0.3);
}
.karte-nav-btn svg { width: 1.4rem; height: 1.4rem; }

/* Zoom-Buttons unten rechts – gleiche Optik wie die Navigation */
.karte-zoom {
    position: absolute;
    right: 0;
    bottom: 1.4rem;
    width: var(--karte-rechts-breite);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    z-index: 5;
    pointer-events: none;
}
.karte-zoom-btn {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(86px, 6.5vw, 9rem);
    aspect-ratio: 1 / 0.62;
    background: var(--weiss);
    color: var(--schwarz);
    border: 0;
    border-radius: 6px;
    box-shadow: 0 1.5px 4.5px rgba(0,0,0,0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.karte-zoom-btn:hover, .karte-zoom-btn:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(0,0,0,0.3);
}
.karte-zoom-btn svg { width: 1.4rem; height: 1.4rem; }

/* ---------- Übersicht im Panel (Wer? / Wann? / Wo?) ---------- */

.karte-panel.modus-uebersicht .karte-panel-fuss .karte-blaettern,
.karte-panel.modus-uebersicht .karte-panel-fuss .karte-vorlesen {
    visibility: hidden;
}

/* Liste der Einträge in der Tag-Ansicht */
.karte-gruppe-liste {
    display: flex;
    flex-direction: column;
    padding: 0.3rem 0 0.6rem;
}
.karte-gruppe-eintrag {
    background: none;
    border: 0;
    color: var(--weiss);
    text-align: left;
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.3;
    padding: 0.42rem 0;
}
.karte-gruppe-eintrag:hover, .karte-gruppe-eintrag:focus-visible { text-decoration: underline; }

/* Zeilenweiser Fade-in der Übersicht */
.karte-fade-zeile {
    opacity: 0;
    animation: karteZeileRein 0.45s ease-out forwards;
}
@keyframes karteZeileRein {
    from { opacity: 0; transform: translateY(0.55rem); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .karte-fade-zeile { animation: none; opacity: 1; }
}

/* Attribution dezent auf Rot */
body.karte .maplibregl-ctrl-attrib {
    background: rgba(255,255,255,0.75);
    font-size: 10px;
}

/* ---------- Karte mobil / hochkant ---------- */

@media (max-width: 900px), (orientation: portrait) and (max-width: 1200px) {
    .karte-layout #map {
        left: 0;
        right: 0;
        bottom: 50dvh;
    }
    .karte-panel {
        top: auto;
        bottom: 0;
        width: 100%;
        height: 50dvh;
        max-height: none;
        padding: 1rem 0 0.8rem 1.1rem;
        background: var(--rot);
    }
    .karte-rechts { width: 96px; gap: 0.6rem; }
    .karte-marke { padding: 0.8rem 0.6rem 0.7rem; }
    .karte-nav-btn { width: 64px; font-size: 0.68rem; }
    /* Zoom über dem unteren Inhaltspanel halten */
    .karte-zoom { width: 96px; bottom: calc(50dvh + 0.8rem); gap: 0.5rem; }
    .karte-zoom-btn { width: 64px; }
}
