/**
 * Bausteine — Kachel, Ergebniszeile, Chips, Leerzustand
 *
 * Phase 3 des Redesigns. Gehoert zu den Vorlagen in includes/bausteine/.
 * Die Werte stammen aus dem Entwurf.
 */

/* ------------------------------------------------------------------ *
 * Raster
 * ------------------------------------------------------------------ */

.karten-raster {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.zeilen-liste {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ------------------------------------------------------------------ *
 * Kachel
 * ------------------------------------------------------------------ */

.karte {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
}

.karte:hover {
    border-color: var(--ink-3);
    color: var(--ink);
    text-decoration: none;
}

.karte-bild {
    display: block;
    height: 170px;
    width: 100%;
    flex: none;
}

.karte-bild img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.karte-text {
    padding: 20px 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.karte-kategorie {
    font: 600 var(--t-xs)/1 var(--font-body);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
}

.karte-name {
    font: 500 var(--t-h3)/1.3 var(--font-display);
}

.karte-ort {
    font-size: var(--t-sm);
    color: var(--ink-2);
}

/* ------------------------------------------------------------------ *
 * Ergebniszeile
 * ------------------------------------------------------------------ */

.zeile {
    display: flex;
    gap: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--surface);
    padding: 14px;
    color: var(--ink);
    text-decoration: none;
}

.zeile:hover {
    border-color: var(--ink-3);
    color: var(--ink);
    text-decoration: none;
}

.zeile-bild {
    display: block;
    width: 158px;
    height: 126px;
    border-radius: var(--radius);
    overflow: hidden;
    flex: none;
}

.zeile-bild img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.zeile-text {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.zeile-kopf {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
}

.zeile-name {
    font: 500 var(--t-h3)/1.25 var(--font-display);
}

.zeile-entfernung {
    font: 600 var(--t-xs)/1 var(--font-body);
    color: var(--ink-3);
    white-space: nowrap;
}

.zeile-meta {
    font-size: var(--t-sm);
    color: var(--ink-2);
}

/* ------------------------------------------------------------------ *
 * Kachel ohne Foto
 *
 * Der Anfangsbuchstabe in der Serife auf ruhigem Grund. Der Entwurf setzt
 * hier bewusst keine graue Flaeche hin: eine Luecke soll nach Absicht
 * aussehen, nicht nach Fehler.
 * ------------------------------------------------------------------ */

.kachel-initiale {
    background: var(--bg-2);
    color: var(--ink-3);
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-weight: 400;
    line-height: 1;
}

.karte-bild.kachel-initiale {
    font-size: calc(4rem * var(--fs));
}

.zeile-bild.kachel-initiale {
    font-size: calc(2.4rem * var(--fs));
}

/* ------------------------------------------------------------------ *
 * Chips
 * ------------------------------------------------------------------ */

.chips {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.chip {
    border: 1px solid var(--line);
    border-radius: var(--radius-xs);
    padding: 5px 9px;
    font: 500 var(--t-xs)/1 var(--font-body);
    color: var(--ink-2);
}

.chip-mehr {
    color: var(--ink-3);
}

/* ------------------------------------------------------------------ *
 * Leerzustand
 * ------------------------------------------------------------------ */

.leer {
    border: 1px dashed var(--line);
    border-radius: var(--radius-xl);
    padding: 48px 24px;
    text-align: center;
    background: var(--surface-2);
}

.leer-titel {
    font: 400 var(--t-h2)/1.2 var(--font-display);
    margin: 0 0 8px;
}

.leer-text {
    font-size: var(--t-body);
    color: var(--ink-2);
    margin: 0 auto 20px;
    max-width: 44ch;
}

.knopf-voll {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--tap);
    padding: 12px 22px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--accent-ink);
    font: 600 var(--t-sm)/1 var(--font-body);
    text-decoration: none;
}

.knopf-voll:hover {
    background: var(--accent-hover);
    color: var(--accent-ink);
    text-decoration: none;
}

/* ------------------------------------------------------------------ *
 * Schmale Bildschirme
 * ------------------------------------------------------------------ */

@media (max-width: 640px) {
    .zeile {
        gap: 12px;
        padding: 12px;
    }

    .zeile-bild {
        width: 96px;
        height: 96px;
    }

    .zeile-kopf {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* ------------------------------------------------------------------ *
 * Listenseiten: Kopf und Filterchips
 * ------------------------------------------------------------------ */

.liste-innen {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 40px 64px;
}

.seiten-kopf {
    margin-bottom: 26px;
}

.seiten-kopf h1 {
    margin: 0 0 8px;
    font: 400 var(--t-h1)/1.1 var(--font-display);
    letter-spacing: -0.02em;
}

.seiten-kopf p {
    margin: 0;
    font-size: var(--t-sm);
    color: var(--ink-2);
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    align-items: center;
    margin-bottom: 26px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: var(--tap);
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    border: 1px solid transparent;
    color: var(--accent);
    font: 600 var(--t-sm)/1 var(--font-body);
    text-decoration: none;
}

.filter-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}

.filter-chip-weg {
    font-size: var(--t-xs);
    opacity: 0.75;
}

.filter-alle-weg {
    font: 500 var(--t-sm)/1 var(--font-body);
    color: var(--ink-3);
    text-decoration: underline;
}

/* Text, den nur ein Vorleseprogramm bekommt. Nicht display:none — das
   nimmt ihn auch dort heraus. */
.nur-vorlesen {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 900px) {
    .liste-innen {
        padding: 32px 20px 48px;
    }
}

/* ------------------------------------------------------------------ *
 * Bildergalerie der Detailseite
 *
 * Bisher ungestaltet: die Vorschaubilder standen in ihrer Dateigroesse
 * nebeneinander. Ein Raster, das sich nach der Breite richtet, und
 * einheitliche Kacheln statt unterschiedlich hoher Bilder.
 * ------------------------------------------------------------------ */

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.gallery-item {
    display: block;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-2);
    border: 1px solid var(--line-2);
}

.gallery-item picture {
    display: block;
}

.gallery-image {
    display: block;
    width: 100%;
    /* Feste Form, damit die Reihe nicht wegen eines Hochformats springt */
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.gallery-item:hover .gallery-image,
.gallery-item:focus-visible .gallery-image {
    opacity: 0.92;
}

@media (max-width: 520px) {
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }
}

/* ------------------------------------------------------------------ *
 * Öffnungszeiten auf der Detailseite
 * ------------------------------------------------------------------ */

.zeiten-tabelle {
    border-collapse: collapse;
    width: 100%;
    font-size: var(--t-sm);
}

.zeiten-tabelle th,
.zeiten-tabelle td {
    text-align: left;
    padding: 6px 0;
    vertical-align: top;
    border-bottom: 1px solid var(--line-2);
}

.zeiten-tabelle th {
    font-weight: 500;
    color: var(--ink-2);
    white-space: nowrap;
    padding-right: 14px;
}

.zeiten-tabelle td {
    color: var(--ink);
}

.zeiten-tabelle tr:last-child th,
.zeiten-tabelle tr:last-child td {
    border-bottom: 0;
}

.zeiten-jetzt {
    margin: 0 0 10px;
    font: 600 var(--t-sm)/1 var(--font-body);
}

/* Nicht nur die Farbe traegt die Aussage — der Text sagt es auch. */
.zeiten-jetzt.ist-offen {
    color: var(--olive);
}

.zeiten-jetzt.ist-zu {
    color: var(--ink-3);
}

.zeiten-leer {
    font-size: var(--t-sm);
    color: var(--ink-2);
}

/* ------------------------------------------------------------------ *
 * Bearbeiten-Knopf für Angemeldete
 * ------------------------------------------------------------------ */

.admin-bearbeiten {
    float: right;
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    padding: 10px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink-2);
    font: 600 var(--t-xs)/1 var(--font-body);
    text-decoration: none;
}

.admin-bearbeiten:hover {
    color: var(--ink);
    border-color: var(--ink-3);
    text-decoration: none;
}

/* ------------------------------------------------------------------ *
 * Karte
 *
 * Lädt erst auf Klick. Die Fläche hat schon vorher ihre endgültige Höhe,
 * damit beim Laden nichts springt.
 * ------------------------------------------------------------------ */

.karte-kopf {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.karte-kopf h2 {
    margin: 0;
    font: 400 var(--t-h2)/1.2 var(--font-display);
}

.karte-quelle {
    font-size: var(--t-xs);
    color: var(--ink-3);
}

.karte-flaeche {
    height: 320px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-2);
    border: 1px solid var(--line-2);
}

.karte-frage {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    text-align: center;
}

.karte-frage p {
    margin: 0;
    max-width: 42ch;
    font-size: var(--t-sm);
    color: var(--ink-2);
}

.karte-fehler {
    padding: 24px;
    font-size: var(--t-sm);
    color: var(--ink-2);
}

/* Leaflet zeichnet auf hellen Kacheln; der Rahmen bleibt in der Farbwelt. */
.karte-flaeche.ist-geladen {
    background: var(--surface-2);
}

/* Doppelte Klasse fuer die Spezifitaet: Leaflet setzt auf
   .leaflet-marker-icon ein display:block. Die Ladereihenfolge ist in
   karte.js geregelt, das hier ist der Guertel dazu. */
.karte-marker.karte-marker {
    display: grid;
    place-items: center;
    /* Groesse kommt von Leaflet (iconSize), hier nur die Form. Kein
       eigenes width/padding: das wuerde sich mit dem inline-Stil beissen. */
    height: 28px;
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: var(--accent-ink);
    font: 700 13px/1 var(--font-body);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
    text-align: center;
    white-space: nowrap;
}

.karte-blase a {
    color: var(--accent);
    text-decoration: none;
}

.karte-liste {
    margin: 14px 0 0;
    padding-left: 1.4em;
    font-size: var(--t-sm);
}

.karte-liste li {
    margin-bottom: 6px;
}

.karte-liste a {
    color: var(--ink);
    text-decoration: none;
}

.karte-liste a:hover {
    color: var(--accent);
}

.karte-zusatz {
    display: block;
    color: var(--ink-3);
    font-size: var(--t-xs);
}


/* ------------------------------------------------------------------ *
 * Karte ueber die volle Breite
 * ------------------------------------------------------------------ */

.karte-voll {
    background: var(--surface);
    border-top: 1px solid var(--line-2);
    padding: 48px 40px;
    margin-top: var(--spacing-2xl);
}

.karte-voll-innen {
    max-width: 1200px;
    margin: 0 auto;
}

.karte-voll .karte-flaeche {
    height: 520px;
}

/* Bei vielen Orten wird eine einspaltige Liste sehr lang */
.karte-voll .karte-liste {
    columns: 3 220px;
    column-gap: 32px;
}

@media (max-width: 900px) {
    .karte-voll {
        padding: 32px 20px;
    }

    .karte-voll .karte-flaeche {
        height: 380px;
    }
}


/* ------------------------------------------------------------------ *
 * Hervorhebung: Marker angeklickt
 *
 * Karte, Ergebnisliste und die Liste unter der Karte zeigen denselben
 * Eintrag. Ein Klick auf den Marker hebt ihn ueberall hervor, das
 * Schliessen der Blase nimmt es zurueck.
 * ------------------------------------------------------------------ */

.zeile.ist-hervorgehoben {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.karte-liste li.ist-hervorgehoben {
    background: var(--accent-soft);
    border-radius: var(--radius-xs);
    /* Der Aufzaehlungspunkt sitzt ausserhalb; etwas Luft nach links, damit
       die Flaeche nicht mitten im Text anfaengt. */
    margin-left: -8px;
    padding: 2px 8px;
}

.karte-liste li.ist-hervorgehoben a {
    color: var(--accent);
}

.karte-marker.ist-gewaehlt {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--accent);
    z-index: 1000;
}

/* Der Wechsel darf zu sehen sein, muss aber niemanden aufhalten. */
.zeile,
.karte-liste li,
.karte-marker {
    transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}


.karte-widerruf {
    display: block;
    margin-top: 10px;
    background: none;
    border: 0;
    padding: 4px 0;
    font: 500 var(--t-xs)/1.4 var(--font-body);
    color: var(--ink-3);
    text-decoration: underline;
    cursor: pointer;
}

.karte-widerruf:hover {
    color: var(--ink);
}


.zeiten-hinweis {
    margin: 12px 0 0;
    font-size: var(--t-xs);
    line-height: 1.5;
    color: var(--ink-3);
}

.zeiten-hinweis a {
    color: var(--ink-2);
}

.zeiten-hinweis a:hover {
    color: var(--accent);
}

/* Bedienhinweis unter der Karte, über dem Widerruf */
.karte-hinweis {
    margin: 10px 0 0;
    font-size: var(--t-xs);
    line-height: 1.5;
    color: var(--ink-2);
}
