/* ============================================================
   DATEI: ba-rep-gallery-lightbox.css
   FUNKTION: Styles für Repeater Galerie & Lightbox
   VERSION: FINAL PRODUCTION
============================================================ */

/* --- Gallery Grid Layout --- */
.ba-gallery-wrapper {
    width: 100%;
    margin-bottom: 50px;
    position: relative;
    z-index: 1;
}

.ba-gallery-section {
    margin-bottom: 60px;
}

.ba-gallery-headline {
    font-size: 20px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #191919;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee8df;
    display: inline-block;
    width: 100%;
}

.ba-gallery-grid {
    display: grid;
    gap: 20px; 
    /* DESKTOP: 3 Spalten */
    grid-template-columns: repeat(3, 1fr);
    align-items: start; /* Verhindert, dass niedrigere Bilder gestreckt werden */
}

/* --- Gallery Item (Container) --- */
.ba-gallery-item {
    position: relative;
    background-color: transparent; /* Kein Hintergrund mehr nötig */
    overflow: hidden;
    border-radius: 2px;
    
    /* ORIGINAL SCHNITT: Kein Aspect-Ratio erzwingen */
    height: auto;
    
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 10;
}

.ba-gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
    z-index: 20;
}

/* --- Das Bild (Thumbnail) --- */
.ycript-thumb {
    width: 100%;
    height: auto; /* WICHTIG: Originalhöhe behalten */
    object-fit: contain; /* Zeigt das ganze Bild */
    cursor: pointer;
    transition: transform 0.5s ease, filter 0.3s ease;
    display: block;
    margin: 0 !important;
}

.ycript-thumb:hover {
    transform: scale(1.03); /* Etwas subtilerer Zoom */
    filter: brightness(0.97);
}

/* --- Lightbox Overlay --- */
#ycript-lightbox-overlay {
    display: none;
    position: fixed;
    top: 0; 
    left: 0;
    width: 100vw; 
    height: 100vh;
    background: rgba(20, 20, 20, 0.95);
    z-index: 2147483647; 
    justify-content: center;
    align-items: center;
    flex-direction: column;
    backdrop-filter: blur(5px);
}

/* --- Lightbox Content --- */
#ycript-lightbox-content {
    position: relative;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2147483648; 
}

#ycript-lightbox-image {
    width: 100%;
    max-width: 980px;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    border: 1px solid #333;
    background: #000;
}

#ycript-lightbox-title {
    color: #b7a89a;
    margin-top: 15px;
    font-size: 15px;
    text-align: center;
    font-weight: 400;
    letter-spacing: 0.5px;
    font-family: sans-serif;
}

/* --- Controls (Desktop) --- */
#ycript-lightbox-close {
    position: fixed;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 70px;
    font-weight: 100;
    line-height: 0.8;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2147483651;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

#ycript-lightbox-close:hover { 
    color: #b7a89a; 
    transform: rotate(90deg) scale(1.1);
}

.ycript-controls {
    position: fixed; 
    top: 50%;
    left: 0;
    width: 100%;
    height: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transform: translateY(-50%);
    pointer-events: none;
    padding: 0 2vw;
    box-sizing: border-box;
    z-index: 2147483650;
}

#ycript-prev, #ycript-next {
    pointer-events: auto;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 60px;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    padding: 20px;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

#ycript-prev:hover, #ycript-next:hover {
    color: #b7a89a;
    transform: scale(1.1);
}

/* --- Responsive Styles --- */

/* Tablet (< 1024px) */
@media (max-width: 1024px) {
    /* TABLET: 2 Spalten */
    .ba-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile (< 768px) */
@media (max-width: 768px) {
    
    /* MOBILE: 1 Spalte */
    .ba-gallery-grid {
        grid-template-columns: 1fr;
        gap: 15px; /* Etwas mehr Abstand Mobil */
    }
    
    .ba-gallery-headline {
        font-size: 16px;
    }

    /* Lightbox Anpassungen */
    #ycript-lightbox-content {
        width: 95%;       
        max-height: 85vh; 
        gap: 15px;        
    }

    /* Controls unter das Bild verschieben */
    .ycript-controls {
        position: relative !important; 
        top: auto;
        left: auto;
        transform: none;
        width: 100%;
        height: auto;
        justify-content: center;
        gap: 20px;
        padding: 0;
        pointer-events: auto; 
        order: 2; 
    }
    
    /* Touch-Buttons */
    #ycript-prev, #ycript-next {
        font-size: 24px; 
        width: 50px;
        height: 50px;
        background: rgba(255, 255, 255, 0.1); 
        border-radius: 50%; 
        padding: 0; 
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(255, 255, 255, 0.2);
        transition: transform 0.1s ease, background 0.2s ease;
    }
    
    #ycript-prev:active, #ycript-next:active {
        background: #b7a89a;
        color: #fff;
        border-color: #b7a89a;
        transform: scale(0.9);
    }
    
    #ycript-lightbox-close {
        top: 15px;
        right: 15px;
        font-size: 40px;
        background: rgba(0,0,0,0.5); 
        width: 40px;
        height: 40px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 0;
        padding-bottom: 4px; 
    }
}

/* Mobile Small (< 480px) */
@media (max-width: 479px) {
    #ycript-prev, #ycript-next {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

/* Mobile Micro (< 350px) */
@media (max-width: 349px) {
    #ycript-prev, #ycript-next {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    .ycript-controls {
        gap: 15px !important; 
    }
}