:root {
    --gallery-overlay-bg: rgba(0, 0, 0, 0.8);
    --gallery-transition: 0.4s;
    --gallery-btn-bg: rgba(128, 128, 128, 0.5);
    --gallery-btn-hover: rgba(128, 128, 128, 0.8);
}

/* BASIS-CONTAINER */
.image-gallery.gallery-wrapper {
    position: relative;
    overflow: hidden;
    background: #fff; /* Wei�e Balken im normalen Modus */
    cursor: grab;
    width: 100%;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
}

.gallery-wrapper:active { 
    cursor: grabbing; 
}

.gallery-track {
    display: flex;
    transition: transform var(--gallery-transition) ease-in-out;
    align-items: center;
    background: #fff; /* Stellt sicher, dass auch der Track wei� ist */
}

.gallery-track img {
    flex-shrink: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    -webkit-user-drag: none;
}

/* BILDUNTERSCHRIFT (CAPTION) - Nur im Vollbild */
.gallery-caption {
    display: none;
    position: absolute;
    left: 0;
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
    color: white;
    font-family: sans-serif;
    font-weight: 500;
    text-align: center;
    text-shadow: 1px 1px 2px #000, -1px -1px 2px #000, 1px -1px 2px #000, -1px 1px 2px #000, 0px 0px 8px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 15;
}

/* DESKTOP AUTO-HIDE (Pfeile & Dots) */
.gallery-nav-btn,
.gallery-dots-container {
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.gallery-controls-visible .gallery-nav-btn,
.gallery-controls-visible .gallery-dots-container {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================
   VOLLBILD OVERLAY (Hintergrund bleibt dunkel)
   ============================================================ */
.gallery-overlay {
    position: fixed;
    top: 0; left: 0; 
    width: 100vw; height: 100vh;
    background: var(--gallery-overlay-bg);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.gallery-overlay.gallery-active { 
    display: flex; 
}

.gallery-overlay .gallery-wrapper {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    background: transparent !important; /* Kein Wei� im Vollbild */
    display: flex;
    flex-direction: column;
    padding: 100px 0;
    box-sizing: border-box;
}

.gallery-overlay .gallery-track { 
    height: 100% !important;
    background: transparent !important; /* Kein Wei� im Vollbild */
}

.gallery-overlay .gallery-caption {
    display: block;
    opacity: 1 !important;
    bottom: 65px;
    font-size: 16px;
}

.gallery-overlay .gallery-nav-btn,
.gallery-overlay .gallery-dots-container {
    opacity: 1 !important;
    pointer-events: auto !important;
}

.gallery-overlay .gallery-dots-container {
    bottom: 35px;
}

.gallery-overlay .gallery-nav-btn {
    top: 50%;
    transform: translateY(-50%);
}

/* ============================================================ */

/* STYLING DER STEUERELEMENTE */
.gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--gallery-btn-bg);
    border: none;
    cursor: pointer;
    z-index: 20;
    width: 55px; height: 55px;
    border-radius: 50%;
    display: flex; 
    align-items: center; 
    justify-content: center;
    filter: drop-shadow(0 0 5px rgba(0,0,0,0.5));
}

.gallery-nav-btn.gallery-prev { left: 30px; }
.gallery-nav-btn.gallery-next { right: 30px; }
.gallery-nav-btn.gallery-hidden { opacity: 0 !important; pointer-events: none; }

.gallery-dots-container {
    position: absolute;
    bottom: 12px; 
    left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 8px; z-index: 25;
}

.gallery-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: rgba(128, 128, 128, 0.5); /* Dots auf Wei� etwas dunkler f�r Kontrast */
    cursor: pointer;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
}

/* Im Vollbild die Dots wieder hell machen */
.gallery-overlay .gallery-dot {
    background: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
}

.gallery-dot.gallery-active {
    background: #000; /* Aktiver Dot schwarz auf wei�em Grund */
    transform: scale(1.3);
}

.gallery-overlay .gallery-dot.gallery-active {
    background: #fff; /* Aktiver Dot wei� im Vollbild */
}

.gallery-close-btn {
    position: absolute;
    top: 30px; right: 30px;
    color: white;
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1100;
}

/* --- MOBILE --- */
@media (max-width: 768px) {
    .gallery-nav-btn { display: none !important; }
    .gallery-dots-container { opacity: 1 !important; pointer-events: auto !important; bottom: 15px; }
    .gallery-overlay .gallery-wrapper { padding: 80px 0; }
}