/**
 * NONINO Bildblock + Lightbox
 *
 * Stylesheet fuer Sektionen vom Typ "bild" (Aushaenge, Plakate) sowie fuer
 * die zugehoerige Vollbild-Ansicht (Lightbox).
 *
 * Erstellt: 2026-08-04
 *
 * Hinweis zur Skalierung:
 * Die Website nutzt ein festes 900px-Layout mit <meta name="viewport" content="width=900">.
 * Auf dem Handy skaliert der Browser die gesamte Seite herunter (z. B. Faktor 0,43 bei
 * 390px Geraetebreite). Damit Bedienelemente der Lightbox trotzdem fingergerecht gross
 * bleiben, setzt lightbox.js die Variable --nlb-scale auf den Kehrwert dieser Skalierung.
 * Alle Touch-Flaechen werden damit multipliziert.
 */

:root {
    --nlb-scale: 1;
}

/* ==========================================================================
   Bildblock (Vorschau-Karten im Seiteninhalt)
   ========================================================================== */

.bildblock {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 18px;
    margin: 14px auto 6px;
    max-width: 100%;
}

.bildblock-item {
    /* Karten teilen sich die Breite, brechen bei Bedarf um */
    flex: 0 1 236px;
    max-width: 236px;
    margin: 0;
    padding: 0;
}

/* Die Karte ist ein echter Link: funktioniert auch ohne JavaScript */
.bildblock-link {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
    text-decoration: none;
    color: inherit;
    cursor: zoom-in;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.08);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.bildblock-link img {
    display: block;
    width: 100%;
    height: auto;
    /* Verhindert Layout-Sprung, bis das Bild geladen ist */
    background: #f4f4f4;
    transition: transform 0.35s ease;
}

/* --- Hover-/Fokus-Effekt: signalisiert "vergroesserbar" -------------------- */

.bildblock-link:hover,
.bildblock-link:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
    border-color: rgba(153, 0, 153, 0.45);
}

.bildblock-link:hover img,
.bildblock-link:focus-visible img {
    transform: scale(1.05);
}

.bildblock-link:focus-visible {
    outline: 3px solid #990099;
    outline-offset: 3px;
}

/* Abdunkelung beim Hover, damit die Lupe gut lesbar bleibt */
.bildblock-link::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(25, 7, 7, 0);
    transition: background 0.22s ease;
    pointer-events: none;
}

.bildblock-link:hover::after,
.bildblock-link:focus-visible::after {
    background: rgba(25, 7, 7, 0.22);
}

/* --- Lupen-Badge ---------------------------------------------------------- */

.bildblock-zoom {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: #190707;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.86);
    transition: opacity 0.22s ease, transform 0.22s ease;
    pointer-events: none;
}

.bildblock-zoom svg {
    display: block;
    width: 14px;
    height: 14px;
    flex: none;
}

.bildblock-link:hover .bildblock-zoom,
.bildblock-link:focus-visible .bildblock-zoom {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* --- Bildunterschrift ----------------------------------------------------- */

.bildblock-caption {
    margin: 7px 2px 0;
    font-family: 'Comic Relief', cursive, sans-serif;
    font-size: 13px;
    line-height: 1.3;
    color: #190707;
    text-align: center;
}

/*
 * Touch-Geraete (Handy/Tablet)
 *
 * Hier gibt es zwei Besonderheiten:
 *
 * 1. Es gibt keinen Hover-Zustand. Das Lupen-Badge muss daher dauerhaft
 *    sichtbar sein - und zwar in der oberen rechten Ecke, wo bei Aushaengen
 *    normalerweise kein Text steht.
 *
 * 2. Der Browser verkleinert die gesamte 900px-Seite auf die Geraetebreite
 *    (Faktor ca. 0,43 beim iPhone). Nach Breite laesst sich das Handy deshalb
 *    nicht erkennen - wohl aber am groben Zeiger. Die Karten werden hier
 *    untereinander gestellt und deutlich groesser gezeichnet, damit auf dem
 *    Bildschirm eine brauchbare Vorschaugroesse ankommt.
 */
@media (hover: none), (pointer: coarse) {
    .bildblock {
        gap: 28px;
    }

    .bildblock-item {
        flex: 1 1 100%;
        max-width: 560px;
    }

    .bildblock-link {
        border-radius: 18px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .bildblock-zoom {
        left: auto;
        top: 14px;
        right: 14px;
        bottom: auto;
        opacity: 1;
        transform: none;
        gap: 9px;
        padding: 13px 22px;
        font-size: 22px;
    }

    .bildblock-zoom svg {
        width: 24px;
        height: 24px;
    }

    .bildblock-link:hover .bildblock-zoom,
    .bildblock-link:focus-visible .bildblock-zoom {
        transform: none;
    }

    .bildblock-link::after {
        /* Kein Abdunkeln ohne echten Hover */
        display: none;
    }

    .bildblock-caption {
        margin-top: 12px;
        font-size: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bildblock-link,
    .bildblock-link img,
    .bildblock-zoom {
        transition: none;
    }

    .bildblock-link:hover,
    .bildblock-link:focus-visible {
        transform: none;
    }

    .bildblock-link:hover img,
    .bildblock-link:focus-visible img {
        transform: none;
    }
}

/* ==========================================================================
   Lightbox (Vollbild-Ansicht)
   ========================================================================== */

.nlb {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    background: rgba(12, 8, 12, 0.97);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    /* Eigenes Scrollen unterbinden, Pinch-Zoom des Browsers bleibt moeglich */
    overscroll-behavior: contain;
}

.nlb.is-open {
    opacity: 1;
    visibility: visible;
}

/* Sperrt das Scrollen der Seite hinter der Lightbox */
body.nlb-open {
    overflow: hidden;
}

/* --- Kopfzeile ------------------------------------------------------------ */

.nlb-bar {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: calc(8px * var(--nlb-scale)) calc(10px * var(--nlb-scale));
    color: #ffffff;
    font-family: Arial, Helvetica, sans-serif;
}

.nlb-counter {
    font-size: calc(13px * var(--nlb-scale));
    line-height: 1;
    opacity: 0.75;
    padding-left: calc(4px * var(--nlb-scale));
    /* Bei nur einem Bild ausgeblendet, haelt aber den Platz */
    min-width: 1px;
}

.nlb-btn {
    appearance: none;
    -webkit-appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    /* 44px = empfohlene Mindestgroesse fuer Touch-Bedienung */
    width: calc(44px * var(--nlb-scale));
    height: calc(44px * var(--nlb-scale));
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.18s ease, transform 0.18s ease;
}

.nlb-btn:hover,
.nlb-btn:focus-visible {
    background: rgba(255, 255, 255, 0.3);
}

.nlb-btn:focus-visible {
    outline: calc(2px * var(--nlb-scale)) solid #ffffff;
    outline-offset: calc(2px * var(--nlb-scale));
}

.nlb-btn svg {
    display: block;
    flex: none;
    width: calc(22px * var(--nlb-scale));
    height: calc(22px * var(--nlb-scale));
}

/* --- Bildbuehne ----------------------------------------------------------- */

.nlb-stage {
    flex: 1 1 auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 0 calc(6px * var(--nlb-scale));
}

.nlb-img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.55);
    transition: opacity 0.15s ease;
}

.nlb.is-loading .nlb-img {
    opacity: 0.35;
}

/* Blaettern-Buttons: schweben ueber dem Bild */
.nlb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: calc(50px * var(--nlb-scale));
    height: calc(50px * var(--nlb-scale));
    background: rgba(0, 0, 0, 0.5);
}

.nlb-nav:hover,
.nlb-nav:focus-visible {
    background: rgba(0, 0, 0, 0.75);
}

.nlb-prev {
    left: calc(6px * var(--nlb-scale));
}

.nlb-next {
    right: calc(6px * var(--nlb-scale));
}

.nlb[data-count="1"] .nlb-nav,
.nlb[data-count="1"] .nlb-counter {
    display: none;
}

/* --- Fusszeile ------------------------------------------------------------ */

.nlb-foot {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(6px * var(--nlb-scale));
    padding: calc(8px * var(--nlb-scale)) calc(14px * var(--nlb-scale)) calc(12px * var(--nlb-scale));
    color: #ffffff;
    text-align: center;
}

.nlb-caption {
    margin: 0;
    font-family: 'Comic Relief', cursive, sans-serif;
    font-size: calc(14px * var(--nlb-scale));
    line-height: 1.35;
    color: #ffffff;
}

.nlb-caption:empty {
    display: none;
}

.nlb-original {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: calc(6px * var(--nlb-scale));
    padding: calc(9px * var(--nlb-scale)) calc(16px * var(--nlb-scale));
    white-space: nowrap;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: calc(12px * var(--nlb-scale));
    line-height: 1;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.nlb-original svg {
    display: block;
    flex: none;
    width: calc(14px * var(--nlb-scale));
    height: calc(14px * var(--nlb-scale));
}

.nlb-original:hover,
.nlb-original:focus-visible {
    background: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

.nlb-original:focus-visible {
    outline: calc(2px * var(--nlb-scale)) solid #ffffff;
    outline-offset: calc(2px * var(--nlb-scale));
}

.nlb-hint {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: calc(11px * var(--nlb-scale));
    line-height: 1.3;
    opacity: 0.6;
}

@media (prefers-reduced-motion: reduce) {
    .nlb,
    .nlb-img,
    .nlb-btn {
        transition: none;
    }
}

/* Nur fuer Screenreader */
.nlb-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
