/* Master control for all UI elements */
.gallery-overlay {
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    pointer-events: none; /* Prevents interaction when hidden */
}
/* Toggle visibility on container hover */
.gallery-container:hover .gallery-overlay {
    opacity: 1;
    pointer-events: auto;
}

.gallery-container {
    position: relative;
    max-width: 199px; 
    margin: auto;
}

.gallery {
    position: relative;
    width: 100%;
    height: 199px; /* originally 177px */
    overflow: hidden;
    background-color: #f0f0f0;
}
/* Spinner logic */
/* Spinner logic - Fixed to spin AND stay centered */
.gallery:not(.loaded)::after {
    content: "";
    position: absolute;
    top: 50%; 
    left: 50%;
    /* We must keep 'rotate' inside the same transform string as the centering logic */
    transform: translate(-50%, -50%) translateY(-3px) rotate(0deg);
    width: 20px; 
    height: 20px;
    border: 3px solid rgba(0,0,0,0.1);
    border-top-color: #333;
    border-radius: 50%;
    animation: spin 1s linear infinite; /* Changed to linear for a smoother spin */
    z-index: 5;
}
/* Updated Animation to include the centering offsets */
@keyframes spin { 
    from { transform: translate(-50%, -50%) translateY(-3px) rotate(0deg); }
    to { transform: translate(-50%, -50%) translateY(-3px) rotate(360deg); } 
}
.gallery-img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0;
    object-fit: contain;
    transition: opacity 2s ease-in-out; /* Slower transition for a smoother slide show */
}
.gallery-img.loaded.active { opacity: 1; }

/* Fast fade for manual/keyboard sliding */
.gallery-img.fast-transition {
    transition: opacity 0.4s ease-in-out;
}

/* --- Minimal Arrow Nav (No Circle) --- */
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%) translateY(-3px); 
    background: none;
    color: rgba(255, 255, 255, 0.6);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 28px; 
    font-weight: 900; /* Makes the arrow symbol much thicker */
    padding: 10px;
    user-select: none;
    line-height: 1;
    -webkit-text-stroke: 2px rgba(255, 255, 255, 0.6); /* Optional: adds a microscopic "bold" boost */
    outline: none;
}
.prev { left: 0px; }
.next { right: 0px; }

.nav-btn:hover {
    color: white;
    -webkit-text-stroke: 2px white;
    /*transform: translateY(-50%) translateY(-3px) scale(1.1);*/
    /*text-shadow: 0 0 8px rgba(0,0,0,0.8);*/
}

/* --- Dots Inside Gallery --- */
.dots-container {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 5px;
}
.dot {
    cursor: pointer;
    height: 7px;
    width: 7px;
    background-color: rgba(255, 255, 255, 0.5); 
    border-radius: 50%;
    display: inline-block;
    transition: all 0.3s ease;
    pointer-events: auto;
    /*box-shadow: 0 0 2px rgba(0,0,0,0.5);*/
}
.active-dot, .dot:hover {
    background-color: white;
    transform: scale(1.2);
}