/* ========================================================================
   Auxilium Galerie (auxgallery): Hauptbild mit Vorschaubildern
 ========================================================================== */

.auxgallery {
    --auxgallery-gap: 10px;
    --auxgallery-radius: 0px;
    --auxgallery-duration: .35s;
}

.auxgallery--gap-medium { --auxgallery-gap: 20px; }
.auxgallery--gap-default { --auxgallery-gap: 30px; }
.auxgallery--gap-large { --auxgallery-gap: 40px; }
.auxgallery--rounded { --auxgallery-radius: 8px; }
.auxgallery--no-transition { --auxgallery-duration: 0s; }

/* Anordnung: Vorschaubilder unten/oben als Zeile, links/rechts als Spalte */
.auxgallery-layout {
    display: flex;
    flex-direction: column;
    gap: var(--auxgallery-gap);
}

.auxgallery--thumbs-top .auxgallery-layout { flex-direction: column-reverse; }

.auxgallery-main { min-width: 0; }

/* Bühne: alle Bilder in derselben Rasterzelle, nur das aktive sichtbar */
.auxgallery-stage {
    position: relative;
    display: grid;
    overflow: hidden;
    border-radius: var(--auxgallery-radius);
}

.auxgallery-slide {
    grid-area: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--auxgallery-duration) ease, visibility 0s linear var(--auxgallery-duration);
}

.auxgallery-slide.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity var(--auxgallery-duration) ease, visibility 0s;
}

a.auxgallery-slide { cursor: zoom-in; }

/* Noch nicht benötigte Hauptbilder: nicht anzeigen, damit der Browser sie nicht sofort lädt (auxgallery.js) */
.auxgallery-slide.is-pending { display: none; }

/* Ohne festes Format: Höhe der Bühne = aktuelles Bild (die übrigen liegen darüber und zählen nicht mit);
   beim Wechsel gleitet die Höhe um (auxgallery.js) */
.auxgallery-stage:not([style*="aspect-ratio"]) .auxgallery-slide:not(.is-active) {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
}

.auxgallery-stage.is-resizing { transition: height var(--auxgallery-duration, .3s) ease; }

.auxgallery-slide img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Bühne mit festem Seitenverhältnis: Bild füllt die Fläche */
.auxgallery-stage[style*="aspect-ratio"] .auxgallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auxgallery-zoom {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .75);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
    color: #1d1d1d;
    pointer-events: none;
    opacity: .85;
    transition: opacity .2s ease;
}

.auxgallery-stage:hover .auxgallery-zoom { opacity: 1; }

.auxgallery-captions { margin-top: 8px; }

/* Vorschaubilder: Spalten je Gerät (Breakpoints wie YOOtheme), Werte als CSS-Variablen am Element */
.auxgallery { --auxgallery-cols: var(--auxgallery-cols-xs, 4); }
@media (min-width: 640px) { .auxgallery { --auxgallery-cols: var(--auxgallery-cols-s, 5); --auxgallery-side: var(--auxgallery-side-s, 20%); } }
@media (min-width: 960px) { .auxgallery { --auxgallery-cols: var(--auxgallery-cols-m, 6); --auxgallery-side: var(--auxgallery-side-m, 20%); } }
@media (min-width: 1200px) { .auxgallery { --auxgallery-cols: var(--auxgallery-cols-l, 6); --auxgallery-side: var(--auxgallery-side-l, 20%); } }
@media (min-width: 1600px) { .auxgallery { --auxgallery-cols: var(--auxgallery-cols-xl, 8); --auxgallery-side: var(--auxgallery-side-xl, 20%); } }

.auxgallery-thumbs {
    display: grid;
    grid-template-columns: repeat(var(--auxgallery-cols), minmax(0, 1fr));
    gap: var(--auxgallery-gap);
    margin: 0;
    padding: 0;
    list-style: none;
}

.auxgallery-thumbs > li { margin: 0; padding: 0; min-width: 0; }
.auxgallery-thumbs > li[hidden] { display: none; }

/* Eine Zeile, seitlich scrollbar: sichtbar sind so viele Bilder wie Spalten */
.auxgallery--scroll .auxgallery-thumbs {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - (var(--auxgallery-cols) - 1) * var(--auxgallery-gap)) / var(--auxgallery-cols));
    overflow-x: auto;
    scrollbar-width: thin;
    padding-bottom: 4px;
}

.auxgallery-thumb {
    display: block;
    width: 100%;
    aspect-ratio: var(--auxgallery-thumb-ratio, 4 / 3);
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--auxgallery-radius);
    overflow: hidden;
    background: none;
    cursor: pointer;
    outline: 2px solid transparent;
    outline-offset: -2px;
    transition: opacity .2s ease, outline-color .2s ease;
}

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

.auxgallery--dim .auxgallery-thumb { opacity: .55; }
.auxgallery--dim .auxgallery-thumb:hover,
.auxgallery--dim .auxgallery-thumb:focus-visible { opacity: .85; }

.auxgallery-thumb.is-active {
    opacity: 1 !important;
    outline-color: var(--auxgallery-active, currentColor);
}

.auxgallery-thumb:focus-visible {
    outline-color: var(--auxgallery-active, currentColor);
    outline-style: dashed;
}

/* Links/rechts: Leiste neben dem Hauptbild, Breite je Gerät, so hoch wie das Hauptbild (ab 640 px);
   auf dem Telefon unter dem Hauptbild mit den Spalten für Phone */
@media (min-width: 640px) {
    .auxgallery--thumbs-left .auxgallery-layout,
    .auxgallery--thumbs-right .auxgallery-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) var(--auxgallery-side);
        align-items: stretch;
    }

    .auxgallery--thumbs-left .auxgallery-layout { grid-template-columns: var(--auxgallery-side) minmax(0, 1fr); }
    .auxgallery--thumbs-left .auxgallery-nav { order: -1; }

    .auxgallery--thumbs-left .auxgallery-nav,
    .auxgallery--thumbs-right .auxgallery-nav { position: relative; }

    .auxgallery--thumbs-left .auxgallery-thumbs,
    .auxgallery--thumbs-right .auxgallery-thumbs {
        position: absolute;
        inset: 0;
        grid-template-columns: repeat(var(--auxgallery-side-cols, 1), minmax(0, 1fr));
        grid-auto-flow: row;
        grid-auto-columns: auto;
        align-content: start;
        overflow-y: auto;
        scrollbar-width: thin;
    }
}
