/* ============================================================
   GALERIE

   Eigene Datei, damit seite.css unverändert aus base.html
   übernommen bleibt.

   Betroffen sind drei Dinge:
     1. die Album-Kacheln im Raster (Foto statt gezeichneter Fläche)
     2. die große Fotoansicht zum Blättern
     3. die eigene Galerieseite mit allen Alben und einem Album
   ============================================================ */

/* ------------------------------------------------------------
   1. Album-Kacheln

   .gal-item gibt Rahmen, Rundung und Seitenverhältnis bereits vor.
   Ein <img> braucht zusätzlich object-fit, sonst würde es verzerrt.
   ------------------------------------------------------------ */

/* Die Kacheln stehen in derselben Größe da wie die gezeichnete Bühne im
   Abschnitt „Aktuelles“: 360 Pixel hoch, zwei nebeneinander. `min()` hält
   sie auf schmalen Geräten in der Spur – ohne das wären sie dort breiter
   als der Bildschirm. seite.css bleibt unangetastet. */
.gal {
    grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
}

.gal-item {
    aspect-ratio: auto;
    height: 360px;
}

.gal-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Gezeichnetes Motiv, wenn kein Titelbild gewählt ist.
   seite.css setzt die Maße für .gal-item canvas bereits. */

/* Die Jahreszahl im gezeichneten Bild. */
.gal-jahr {
    position: absolute;
    top: 16px;
    left: 18px;
    font-size: clamp(1.6rem, 4.2vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1;
    color: #fff;
    text-shadow: 0 2px 10px rgba(16, 26, 33, .6), 0 1px 2px rgba(16, 26, 33, .8);
    pointer-events: none;
}

/* Album ohne Bild: eine ruhige Fläche statt eines leeren Rahmens. */
.gal-leerbild {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    background: linear-gradient(140deg, #E8EDF1, #F6F2EA);
    color: var(--ink-3);
    font-size: .85rem;
    text-align: center;
    padding: 18px;
}

/* Zahl der Fotos, unten rechts auf der Kachel – oben links steht die
   Jahreszahl des gezeichneten Motivs. */
.gal-zahl {
    position: absolute;
    bottom: 16px;
    right: 18px;
    z-index: 1;
    padding: .3em .7em;
    border-radius: 99px;
    background: rgba(16, 26, 33, .62);
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
}

/* Als Schaltfläche oder Verweis gebaut, damit die Kachel mit der Tastatur
   erreichbar ist. Die Gestaltung bleibt die der Vorlage. */
button.gal-item,
a.gal-item {
    display: block;
    font: inherit;
    text-align: left;
    padding: 0;
    color: inherit;
    text-decoration: none;
}

button.gal-item:focus-visible,
a.gal-item:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: 3px;
}

/* Die Beschriftung steht in einem <span>, damit sie auch in einer
   Schaltfläche stehen darf. */
.gal-item .gal-cap {
    display: block;
}

/* Platz für die Zahl der Fotos, damit ein langer Titel nicht darunter läuft. */
.gal-item:has(.gal-zahl) .gal-cap {
    padding-right: 96px;
}

/* Ein Album ohne Foto lässt sich nicht öffnen. */
.gal-item-still {
    cursor: default;
}

.gal-item-still:hover {
    transform: none;
    box-shadow: var(--sh-1);
}

/* Hinweis unter dem Raster, wenn noch kein Album veröffentlicht ist. */
.gal-leer {
    margin: 0;
    padding: 34px 20px;
    border: 1px dashed var(--line);
    border-radius: var(--r-l);
    text-align: center;
    color: var(--ink-3);
}

/* Verweis zur eigenen Galerieseite. */
.gal-mehr {
    margin-top: 26px;
    text-align: center;
}

/* ------------------------------------------------------------
   2. Große Fotoansicht

   Eigenes Fenster, unabhängig von der gezeichneten Lightbox der
   Vorlage (#lightbox), damit beide sich nicht ins Gehege kommen.
   ------------------------------------------------------------ */

.foto-lb {
    position: fixed;
    inset: 0;
    z-index: 210;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(16, 22, 28, .92);
    backdrop-filter: blur(6px);
}

.foto-lb.open {
    display: flex;
}

.foto-lb-box {
    position: relative;
    display: flex;
    flex-direction: column;
    max-width: 1100px;
    max-height: 100%;
    width: 100%;
}

.foto-lb-bild {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    flex: 1 1 auto;
}

.foto-lb-bild img {
    max-width: 100%;
    /* Platz für Titel, Zähler und die Leiste der Vorschaubilder */
    max-height: calc(100vh - 300px);
    width: auto;
    height: auto;
    display: block;
    border-radius: var(--r-l);
    box-shadow: var(--sh-3);
    background: #0d1317;
}

.foto-lb-txt {
    flex: 0 0 auto;
    margin-top: 14px;
    color: #fff;
    text-align: center;
}

.foto-lb-txt b {
    display: block;
    font-size: 1.05rem;
    font-weight: 800;
}

.foto-lb-txt span {
    display: block;
    margin-top: 4px;
    font-size: .88rem;
    opacity: .82;
}

.foto-lb-zaehler {
    display: block;
    margin-top: 8px;
    font-size: .8rem;
    opacity: .6;
}

/* Schaltflächen: schließen, zurück, weiter */
.foto-lb button {
    position: absolute;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: var(--ink);
    font-size: 1.2rem;
    font-family: inherit;
    cursor: pointer;
    transition: .2s;
}

.foto-lb button:hover {
    background: #fff;
    transform: scale(1.06);
}

.foto-lb button:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: 2px;
}

.foto-lb-zu {
    top: -8px;
    right: -8px;
}

.foto-lb-zurueck {
    top: 50%;
    left: -10px;
    transform: translateY(-50%);
}

.foto-lb-weiter {
    top: 50%;
    right: -10px;
    transform: translateY(-50%);
}

/* Seit Schritt 53 mit vorangestelltem .foto-lb: Die allgemeine Regel
   „.foto-lb button:hover“ war spezifischer und ersetzte beim Darüberfahren
   das translateY(-50%) durch scale(1.06) – die Knöpfe rutschten dadurch
   um die halbe Höhe nach unten. */
.foto-lb .foto-lb-zurueck:hover,
.foto-lb .foto-lb-weiter:hover {
    transform: translateY(-50%) scale(1.06);
}

.foto-lb button[hidden] {
    display: none;
}

@media (max-width: 720px) {
    .foto-lb {
        padding: 16px;
    }

    .foto-lb-zu {
        top: 0;
        right: 0;
    }

    .foto-lb-zurueck {
        left: 0;
    }

    .foto-lb-weiter {
        right: 0;
    }

    .foto-lb-bild img {
        max-height: calc(100vh - 290px);
    }
}

/* Leiste der Vorschaubilder unter Titel und Zähler (seit Schritt 14a).
   Waagerecht, bei vielen Fotos mit Scrollbalken darunter. */
.foto-lb-leiste {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    margin-top: 14px;
    padding: 4px 4px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .55) rgba(255, 255, 255, .1);
}

.foto-lb-leiste:empty {
    display: none;
}

.foto-lb-leiste::-webkit-scrollbar {
    height: 8px;
}

.foto-lb-leiste::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, .1);
    border-radius: 99px;
}

.foto-lb-leiste::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .55);
    border-radius: 99px;
}

/* Die Vorschau-Knöpfe stehen im Fluss, nicht wie die übrigen Knöpfe
   des Fensters frei über dem Bild – daher die Rücknahme von position,
   Rundung, Hintergrund und Vergrößerung. */
.foto-lb .foto-lb-vorschau {
    position: static;
    flex: 0 0 auto;
    display: block;
    width: 84px;
    height: 60px;
    padding: 0;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: 10px;
    background: rgba(255, 255, 255, .08);
    opacity: .6;
    transition: opacity .2s ease, border-color .2s ease;
}

.foto-lb .foto-lb-vorschau:hover {
    opacity: 1;
    transform: none;
    background: rgba(255, 255, 255, .08);
}

.foto-lb .foto-lb-vorschau.aktiv {
    opacity: 1;
    border-color: #fff;
}

.foto-lb-vorschau img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 720px) {
    .foto-lb .foto-lb-vorschau {
        width: 64px;
        height: 46px;
    }
}

/* ------------------------------------------------------------
   3. Eigene Galerieseite
   ------------------------------------------------------------ */

/* Abstand unter der Kopfleiste, da die Seite keinen Hero hat. */
.galerieseite {
    padding-top: 116px;
}

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

.galerie-zurueck {
    display: inline-block;
    margin-bottom: 14px;
    font-size: .9rem;
    font-weight: 700;
    color: var(--ink-3);
}

.galerie-zurueck:hover {
    color: var(--brand);
}

/* Raster der Fotos innerhalb eines Albums. */
.album-raster {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.album-foto {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--r-m);
    overflow: hidden;
    background: var(--white);
    box-shadow: var(--sh-1);
    aspect-ratio: 4 / 3;
    cursor: pointer;
    transition: .25s ease;
}

.album-foto:hover {
    transform: translateY(-4px);
    box-shadow: var(--sh-3);
}

.album-foto:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: 3px;
}

.album-foto img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Angaben über dem Fotoraster. */
.album-angaben {
    margin-bottom: 22px;
    color: var(--ink-2);
}

.album-angaben p {
    margin: 0 0 10px;
}

.album-meta {
    font-size: .9rem;
    color: var(--ink-3);
}
