/**
 * Advanced Gallery – Stylesheets v2.1
 */

/* ─── Greyd-Pfeil-Font-Anbindung (Fallback, falls Greyd-CSS noch nicht geladen) ─── */
.adv-gallery-arrow .arrow_right:before {
    content: "\24";
}
.adv-gallery-arrow .arrow_left:before {
    content: "\23";
}

/* ─── Außen-Container ─────────────────────────────────────────────────────────── */
.adv-gallery-container {
    width: 100%;
    outline: none;
}

/* ─── Hauptbild-Bereich: 16:9, Position relative für Caption-Overlay ─────────── */
.adv-gallery-main {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    margin-bottom: 12px;
    position: relative;
}

.adv-gallery-main-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}

/* ─── Bildunterschrift – absolute Box unten rechts auf dem Bild ───────────────── */
/* Höhere Spezifität (.adv-gallery-main davor) überschreibt .blur { position: relative } */
.adv-gallery-main .adv-gallery-caption {
    position: absolute;
    bottom: var(--wp--preset--spacing--small, 16px);
    right: var(--wp--preset--spacing--small, 16px);
    max-width: 55%;
    overflow: hidden;

    /* Box-Design aus Vorlage */
    border-color: #939ca3;
    border-width: 1px;
    border-style: solid;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    background-color: #00000014; 
    padding-top: 20px;
    padding-right: 20px;
    padding-bottom: 20px;
    padding-left: 20px;

    /* Typografie */
    font-size: var(--wp--preset--font-size--small);
    font-weight: 600;
    color: #fff;
    line-height: 1.4;

    /* Blur + Opacity gemeinsam animieren – kein Ruck, weiches Einblenden */
    opacity: 0;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    transition: opacity 0.35s ease-in-out,
                backdrop-filter 0.35s ease-in-out,
                -webkit-backdrop-filter 0.35s ease-in-out;

    /* Pointer-Events nicht blockieren wenn unsichtbar */
    pointer-events: none;
}

.adv-gallery-caption.is-visible {
    opacity: 1;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: auto;
}

.adv-gallery-caption-text {
    display: block;
}

/* ─── Slider-Leiste (Pfeil + Thumbs + Pfeil) ─────────────────────────────────── */
.adv-gallery-slider-wrapper {
    display: flex;
    align-items: center;
    gap: 30px; /* 10px Basis + 20px mehr = 30px zwischen Button und Thumbs */
    width: 100%;
}

/* ─── Thumbnail-Track ─────────────────────────────────────────────────────────── */
.adv-gallery-thumbs-track {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-behavior: smooth;
    gap: 8px;
    padding: 4px 0;
    flex: 1 1 auto;
    /* Scrollbar verbergen */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.adv-gallery-thumbs-track::-webkit-scrollbar {
    display: none;
}

/* ─── Einzelnes Thumbnail – Desktop: 16:9, feste Höhe ────────────────────────── */
.adv-gallery-thumb {
    flex: 0 0 auto;
    height: 68px;
    width: calc(68px * 16 / 9); /* ≈ 121px */
    aspect-ratio: 16 / 9;
    object-fit: cover;
    object-position: center center;
    cursor: pointer;
    opacity: 0.45;
    transition: opacity 0.2s ease-in-out;
    border: none;
    display: block;
}

/* Aktives Bild: volle Deckkraft */
.adv-gallery-thumb.is-active {
    opacity: 1;
}

/* Hover: leicht aufhellen, kein Rahmen */
.adv-gallery-thumb:hover {
    opacity: 0.75;
}

/* Aktives Bild bleibt bei 100 % auch im Hover */
.adv-gallery-thumb.is-active:hover {
    opacity: 1;
}

/* ─── Pfeil-Button-Wrapper ────────────────────────────────────────────────────── */
.adv-gallery-btn-wrap {
    flex: 0 0 auto;
    margin: 0 !important;
}

/* ─── Greyd-Button-Overrides für reine Icon-Buttons ──────────────────────────── */
.adv-gallery-arrow.button {
    padding: 10px 14px !important;
    min-width: unset !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
}

/* ─── Responsive: unter 600px → Hauptbild 3:2, Thumbnails exakt 3 nebeneinander  */
@media (max-width: 599px) {

    /* Hauptbild: 3:2 statt 16:9 */
    .adv-gallery-main {
        aspect-ratio: 3 / 2;
    }

    /* Caption: volle Breite minus beidseitiger Außenabstand */
    .adv-gallery-main .adv-gallery-caption {
        max-width: calc(100% - 2 * var(--wp--preset--spacing--small, 16px));
        padding: 12px;
    }

    /* Thumbnail-Track: Scroll-Snapping aktivieren */
    .adv-gallery-thumbs-track {
        scroll-snap-type: x mandatory;
    }

    /* Thumbnails: genau 3 sichtbar, 16:9, mittiges ist aktiv */
    .adv-gallery-thumb {
        flex: 0 0 calc((100% - 16px) / 3); /* (100% - 2 × 8px gap) / 3 */
        width: calc((100% - 16px) / 3);
        height: auto;
        aspect-ratio: 16 / 9;
        scroll-snap-align: center;
    }

    /* Pfeil-Buttons schmaler auf Mobile */
    .adv-gallery-arrow.button {
        padding: 8px 10px !important;
    }

    /* Weniger Abstand auf Mobile */
    .adv-gallery-slider-wrapper {
        gap: 12px;
    }
}
