/**
 * Masonry Grid and Gallery Styles
 */

/* Gallery Section */
.gallery-section {
    background-color: var(--light);
    padding: 5rem 0;
}

/* Basic masonry grid setup */
.masonry-grid {
    width: 100%;
}

.masonry-grid-sizer,
.masonry-grid-item {
    padding: 0.5rem;
}

/* Gallery Items */
.gallery-item {
    position: relative;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease-in-out;
    margin-bottom: 1rem;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.gallery-item img {
    width: 100%;
    display: block;
    transition: transform 0.5s ease-in-out;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* Gallery Overlay */
.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.2) 50%, rgba(0, 0, 0, 0) 100%);
    display: flex;
    align-items: flex-end;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.gallery-info {
    color: white;
}

.gallery-info h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.gallery-info p {
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .masonry-grid-item,
    .masonry-grid-sizer {
        width: 50%;
    }
}

@media (max-width: 576px) {
    .masonry-grid-item,
    .masonry-grid-sizer {
        width: 100%;
    }
    
    .gallery-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.3) 50%, rgba(0, 0, 0, 0.1) 100%);
    }
}

/* Animation for gallery items */
.gallery-item {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered animation delay for gallery items */
.masonry-grid-item:nth-child(1) { animation-delay: 0.1s; }
.masonry-grid-item:nth-child(2) { animation-delay: 0.2s; }
.masonry-grid-item:nth-child(3) { animation-delay: 0.3s; }
.masonry-grid-item:nth-child(4) { animation-delay: 0.4s; }
.masonry-grid-item:nth-child(5) { animation-delay: 0.5s; }
.masonry-grid-item:nth-child(6) { animation-delay: 0.6s; }
.masonry-grid-item:nth-child(7) { animation-delay: 0.7s; }
.masonry-grid-item:nth-child(8) { animation-delay: 0.8s; }
.masonry-grid-item:nth-child(9) { animation-delay: 0.9s; }

/* Lightbox functionality */
.gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

.gallery-lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    border: 2px solid white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: -20px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    background: none;
    border: none;
    transition: transform 0.3s ease-in-out;
}

.lightbox-close:hover {
    transform: scale(1.2);
}

.lightbox-caption {
    position: absolute;
    bottom: -40px;
    left: 0;
    right: 0;
    color: white;
    text-align: center;
    font-size: 1.2rem;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    opacity: 0.7;
}

.lightbox-nav:hover {
    opacity: 1;
}

.lightbox-prev {
    left: -60px;
}

.lightbox-next {
    right: -60px;
}

@media (max-width: 768px) {
    .lightbox-nav {
        font-size: 2rem;
    }
    
    .lightbox-prev {
        left: -40px;
    }
    
    .lightbox-next {
        right: -40px;
    }
}