:root {
    --primary-purple: #8b5cf6;
    --dark-bg: #1e1b4b;
}

.gallery-section {
    padding: 80px 5%;
    background: #f8fafc;
}

.gallery-title {
    text-align: center;
    margin-bottom: 50px;
    font-size: 2.5rem;
    color: var(--dark-bg);
    font-weight: 700;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Exactly 3 per row */
    gap: 25px;
    perspective: 1000px;
}

.gallery-item {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.6s;
    height: 518px;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
}

/* 3D Hover Effect */
.gallery-item:hover {
    transform: rotateX(5deg) rotateY(-5deg) scale(1.05);
    box-shadow: 0 25px 50px -12px rgba(139, 92, 246, 0.5);
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.overlay {
    position: absolute;
    inset: 0;
    background: rgba(139, 92, 246, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.gallery-item:hover .overlay {
    opacity: 1;
}

.overlay i {
    color: white;
    font-size: 2rem;
}

/* Lightbox Styles */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.95);
    display: none;
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.lightbox-content img {
    max-width: 85vw;
    max-height: 80vh;
    border-radius: 10px;
    transform: scale(0.9);
    transition: transform 0.4s ease;
}

.nav-btn {
    position: absolute;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    padding: 20px;
    transition: color 0.3s;
}

.nav-btn:hover { color: var(--primary-purple); }
.prev { left: 5%; }
.next { right: 5%; }
.close-btn { position: absolute; top: 30px; right: 40px; color: white; font-size: 3rem; cursor: pointer; }

/* Pagination Styles */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 50px;
    gap: 10px;
    width: 100%;
}

.pagination-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid #e2e8f0;
    background: white;
    color: var(--dark-bg);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--primary-purple);
    color: var(--primary-purple);
    transform: translateY(-2px);
}

.pagination-btn.active {
    background: var(--primary-purple);
    color: white;
    border-color: var(--primary-purple);
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.3);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f8fafc;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive Design */
@media (max-width: 992px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-title {
        font-size: 2rem;
        margin-bottom: 30px;
    }

    .gallery-item {
        height: 468px;
    }

    .nav-btn {
        font-size: 2rem;
        padding: 10px;
    }

    .prev { left: 10px; }
    .next { right: 10px; }
    
    .close-btn {
        top: 20px;
        right: 20px;
        font-size: 2.5rem;
    }
}