/* --- 1. UNIFORM GRID (3:2) --- */
.wpgal-grid {
    --wpgal-cols: 3;
    display: grid;
    grid-template-columns: repeat(var(--wpgal-cols), 1fr);
    gap: 15px;
}
.wpgal-item, .wpgal-cover-item { margin-bottom: 0; break-inside: avoid; }
.wpgal-item img, .wpgal-cover-item img {
    width: 100%; 
    height: auto; 
    aspect-ratio: 3 / 2; 
    object-fit: cover;   
    display: block;
    cursor: pointer; transition: transform 0.2s ease-in-out;
}
.wpgal-item img:hover, .wpgal-cover-item img:hover { transform: scale(1.02); }

/* --- 2. MASONRY (Originalformat) --- */
.wpgal-masonry {
    --wpgal-cols: 3;
    column-count: var(--wpgal-cols);
    column-gap: 15px;
}
.wpgal-masonry-item { break-inside: avoid; margin-bottom: 15px; }
.wpgal-masonry-item img {
    width: 100%; height: auto; display: block;
    cursor: pointer; transition: transform 0.2s ease-in-out;
}
.wpgal-masonry-item img:hover { transform: scale(1.02); }

/* Globaler Foto-Credit unter Grid & Masonry */
.wpgal-global-credits {
    text-align: right; font-size: 12px; color: #777; margin-top: 15px;
}
/* Einzelner Credit (für Cover-Modus) */
.wpgal-item-photog {
    text-align: right; font-size: 11px; color: #777; margin-top: 4px; padding-right: 2px;
}

@media (max-width: 900px) { 
    .wpgal-grid, .wpgal-masonry { --wpgal-cols: 2 !important; } 
    .wpgal-masonry { column-count: 2; }
}
@media (max-width: 600px) { 
    .wpgal-grid, .wpgal-masonry { --wpgal-cols: 1 !important; } 
    .wpgal-masonry { column-count: 1; }
}

/* --- 3. ENDLOS SLIDER (Laufband) --- */
.wpgal-slider { width: 100%; overflow: hidden; position: relative; box-sizing: border-box; }
.wpgal-slider-track { display: inline-flex; width: max-content; height: 100%; animation: wpgal-scroll 30s linear infinite; }
.wpgal-slider-track:hover { animation-play-state: paused; }
.wpgal-slider-item { height: 100%; flex-shrink: 0; padding-right: 15px; }
.wpgal-slider-item img { height: 100%; width: auto; object-fit: cover; cursor: pointer; transition: transform 0.2s ease; display: block; }
.wpgal-slider-item img:hover { transform: scale(1.03); }
@keyframes wpgal-scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* --- 4. LIGHTBOX BASE --- */
#wpgal-lightbox {
    position: fixed !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100vw !important; height: 100vh !important; max-width: 100vw !important; max-height: 100vh !important;
    margin: 0 !important; padding: 0 !important; z-index: 999999 !important;
    display: flex; flex-direction: column; align-items: center; justify-content: center; box-sizing: border-box;
}
#wpgal-lightbox.hidden { display: none !important; }
.wpgal-lightbox-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.95); }

/* --- 5. LIGHTBOX CONTENT (Touch/Drag & Shrink-Wrap) --- */
.wpgal-lightbox-content {
    position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between;
    width: 100vw !important; height: 80vh !important; padding: 0 20px; box-sizing: border-box;
}
.wpgal-image-wrapper {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    flex: 1; height: 100%; position: relative; max-width: calc(100vw - 140px);
    user-select: none; -webkit-user-select: none; touch-action: pan-y; 
}
#wpgal-media-container { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
#wpgal-media-inner { display: inline-block; max-width: 100%; text-align: center; position: relative; }

#wpgal-main-img { 
    display: block; margin: 0 auto;
    max-width: 100%; max-height: 70vh; 
    width: auto; height: auto;
    opacity: 0; transition: opacity 0.3s ease-in-out; 
    cursor: grab; 
}
#wpgal-main-img:active { cursor: grabbing; }
#wpgal-main-img.is-loaded { opacity: 1; }

/* --- 6. TEXT & UI --- */
.wpgal-image-info { 
    width: 100%; margin-top: 10px; display: flex; justify-content: space-between; 
    color: #fff; font-size: 14px; text-align: left; box-sizing: border-box;
}
#wpgal-caption { flex: 1; padding-right: 15px; } 
#wpgal-copyright { text-align: right; font-size: 13px; opacity: 0.8; white-space: nowrap; } 

.wpgal-prev, .wpgal-next, .wpgal-close { background: none; border: none; color: white; font-size: 3rem; cursor: pointer; padding: 10px; z-index: 3; }
.wpgal-close { position: absolute; top: 20px; right: 30px; font-size: 2.5rem; }

#wpgal-thumbnail-strip {
    position: relative; z-index: 2; display: flex; gap: 10px; margin-top: 10px; max-width: 90vw; overflow-x: auto; white-space: nowrap; scroll-behavior: smooth;
    -ms-overflow-style: none; scrollbar-width: none; 
}
#wpgal-thumbnail-strip::-webkit-scrollbar { display: none; }
#wpgal-thumbnail-strip img { height: 60px; flex-shrink: 0; cursor: pointer; opacity: 0.4; transition: opacity 0.2s; object-fit: cover; }
#wpgal-thumbnail-strip img:hover { opacity: 0.8; }
#wpgal-thumbnail-strip img.active { opacity: 1; border: 2px solid white; transform: scale(1.05); }

.wpgal-share-buttons { z-index: 2; margin-top: 10px; display: flex; align-items: center; gap: 15px; color: #fff; }
.wpgal-share-text { font-size: 15px; font-weight: 500; }
.wpgal-share-buttons button { background: none; border: none; cursor: pointer; padding: 0; display: flex; transition: transform 0.2s ease; }
.wpgal-share-buttons button:hover { transform: scale(1.1); }
.wpgal-spinner { display: none; position: absolute; top: 45%; left: 50%; transform: translate(-50%, -50%); width: 50px; height: 50px; border: 4px solid rgba(255, 255, 255, 0.3); border-top: 4px solid #ffffff; border-radius: 50%; animation: wpgal-spin 1s linear infinite; z-index: 10; }
.wpgal-spinner.is-active { display: block; }
@keyframes wpgal-spin { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }