/* 
* BrainSpark Digital - Gallery Styles
* Masonry-style gallery with lightbox functionality
*/

/* Gallery Variables */
:root {
    --gallery-gradient: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
    --gallery-card-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --gallery-hover-transform: translateY(-8px);
    --gallery-border-radius: 12px;
    --gallery-transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Gallery Header Section */
.gallery-header {
    padding: 8rem 0 4rem;
    background-color: var(--background-alt);
    position: relative;
    overflow: hidden;
}

.gallery-header::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: var(--gallery-gradient);
    opacity: 0.1;
    z-index: 1;
}

.gallery-header::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -80px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: var(--gallery-gradient);
    opacity: 0.05;
    z-index: 1;
}

.gallery-header .section-header {
    position: relative;
    z-index: 2;
}

.gallery-header h1 {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

.gallery-header p {
    font-size: 1.8rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Gallery Section */
.gallery-section {
    padding: 6rem 0 8rem;
}

/* Gallery Grid - Masonry Style */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    position: relative;
}

/* Gallery Item */
.gallery-item {
    border-radius: var(--gallery-border-radius);
    overflow: hidden;
    box-shadow: var(--gallery-card-shadow);
    transition: var(--gallery-transition);
    background: var(--card-bg);
}

.gallery-item:hover {
    transform: var(--gallery-hover-transform);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Vary heights for masonry effect */
.gallery-item:nth-child(3n+1) .gallery-image {
    height: 280px;
}

.gallery-item:nth-child(3n+2) .gallery-image {
    height: 320px;
}

.gallery-item:nth-child(3n) .gallery-image {
    height: 260px;
}

/* Gallery Image */
.gallery-image {
    position: relative;
    overflow: hidden;
    height: 300px;
}

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

.gallery-item:hover .gallery-image img {
    transform: scale(1.08);
}

/* Gallery Overlay */
.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.2));
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-overlay h3 {
    color: white;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.gallery-link {
    color: white;
    text-decoration: none;
    font-size: 1.4rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.6rem;
    border: 2px solid white;
    border-radius: 30px;
    transition: all 0.3s ease;
}

.gallery-link:hover {
    background: white;
    color: var(--primary-color);
}

.gallery-zoom {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.gallery-zoom:hover {
    background: white;
    color: var(--primary-color);
    transform: scale(1.1);
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    text-align: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: var(--gallery-border-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-title {
    color: white;
    font-size: 1.8rem;
    margin-top: 2rem;
    font-weight: 500;
}

/* Gallery Empty State */
.gallery-empty {
    text-align: center;
    padding: 8rem 2rem;
}

.gallery-empty i {
    font-size: 6rem;
    color: var(--text-muted);
    opacity: 0.3;
    margin-bottom: 2rem;
}

.gallery-empty h3 {
    font-size: 2.4rem;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.gallery-empty p {
    font-size: 1.6rem;
    color: var(--text-muted);
}

/* Gallery Pagination */
.gallery-pagination {
    margin-top: 5rem;
    display: flex;
    justify-content: center;
}

.gallery-pagination .pagination {
    display: flex;
    gap: 0.8rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.gallery-pagination .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 50%;
    background: var(--card-bg);
    color: var(--text-dark);
    text-decoration: none;
    font-size: 1.4rem;
    font-weight: 500;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    box-shadow: var(--gallery-card-shadow);
}

.gallery-pagination .page-link:hover,
.gallery-pagination .page-link.active {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.gallery-pagination .page-link.prev,
.gallery-pagination .page-link.next {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    box-shadow: none;
}

.gallery-pagination .page-link.prev:hover,
.gallery-pagination .page-link.next:hover {
    background: var(--primary-color);
    color: white;
}

/* Responsive */
@media (max-width: 992px) {
    .gallery-header h1 {
        font-size: 3.2rem;
    }
    
    .gallery-header p {
        font-size: 1.6rem;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .gallery-header {
        padding: 6rem 0 3rem;
    }
    
    .gallery-header h1 {
        font-size: 2.8rem;
    }
    
    .gallery-section {
        padding: 4rem 0 6rem;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1.2rem;
    }
    
    .gallery-item:nth-child(3n+1) .gallery-image,
    .gallery-item:nth-child(3n+2) .gallery-image,
    .gallery-item:nth-child(3n) .gallery-image {
        height: 220px;
    }
    
    .gallery-overlay h3 {
        font-size: 1.6rem;
    }
    
    .gallery-link {
        font-size: 1.2rem;
        padding: 0.6rem 1.2rem;
    }
    
    .gallery-zoom {
        width: 3.5rem;
        height: 3.5rem;
        font-size: 1.4rem;
    }
    
    .lightbox-close {
        top: 1rem;
        right: 1rem;
        width: 4rem;
        height: 4rem;
        font-size: 1.6rem;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .gallery-item:nth-child(3n+1) .gallery-image,
    .gallery-item:nth-child(3n+2) .gallery-image,
    .gallery-item:nth-child(3n) .gallery-image {
        height: 260px;
    }
}
