/* Hero Evento */
.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.hero-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0.5),
            rgba(0, 0, 0, 0.7)
    );
    z-index: 1;
}

.hero-background img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Gallery Grid */
.gallery-item {
    text-decoration: none;
    display: block;
}

.gallery-image-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-md);
    aspect-ratio: 1;
    cursor: pointer;
    background: var(--glass-bg);
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: white;
}

.gallery-image-wrapper:hover .gallery-image {
    transform: scale(1.1);
}

.gallery-image-wrapper:hover .gallery-overlay {
    opacity: 1;
}

/* Loading Skeleton per Lazy Load */
.gallery-image-wrapper.loading {
    background: linear-gradient(
            90deg,
            #f0f0f0 25%,
            #e0e0e0 50%,
            #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

/* LIGHTBOX DOWNLOAD BUTTON */
.custom-download-btn {
    position: fixed;
    top: 20px;
    right: 80px; /* A sinistra del bottone chiudi (X) */
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 99999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.custom-download-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    color: #007bff;
}

.custom-download-btn:active {
    transform: scale(0.95);
}

.custom-download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Dark theme lightbox */
.glightbox-clean .custom-download-btn {
    background: rgba(33, 33, 33, 0.95);
    color: white;
}

.glightbox-clean .custom-download-btn:hover {
    background: rgba(33, 33, 33, 1);
    color: #4dabf7;
}

/* Progress Bar Custom Styling */
#download-progress {
    transition: width 0.3s ease;
}

#download-progress span {
    font-size: 0.9rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#download-status {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Responsive Gallery */
@media (max-width: 768px) {
    .gallery-image-wrapper {
        aspect-ratio: 1;
    }

    .custom-download-btn {
        width: 45px;
        height: 45px;
        top: 15px;
        right: 65px;
        font-size: 20px;
    }
}