/* Premium Gallery Styles */

/* Masonry Layout */
.gallery-masonry {
    column-count: 1;
    column-gap: 1.5rem;
}

@media (min-width: 640px) {
    .gallery-masonry {
        column-count: 2;
    }
}

@media (min-width: 1024px) {
    .gallery-masonry {
        column-count: 3;
    }
}

.gallery-item {
    break-inside: avoid;
    margin-bottom: 1.5rem;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    transform: translateZ(0); /* Fix for webkit flickering */
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    background: #f0f0f0; /* Placeholder color */
}

.gallery-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* Premium Caption Overlay */
.gallery-caption {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%);
    padding: 2rem 1.5rem 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.gallery-item:hover .gallery-caption {
    opacity: 1;
    transform: translateY(0);
}

/* Filter Bar */
.filter-btn {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary);
    z-index: -1;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.filter-btn:hover::before,
.filter-btn.active::before {
    transform: scaleX(1);
    transform-origin: left;
}

.filter-btn:hover,
.filter-btn.active {
    color: white;
    border-color: transparent;
}

/* Enhanced Lightbox */
.lightbox-content-wrapper {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-img {
    max-height: 80vh;
    width: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.lightbox-img.zoomed {
    transform: scale(1.5);
    cursor: zoom-out;
}

.lightbox-toolbar {
    position: absolute;
    top: -3rem;
    right: 0;
    display: flex;
    gap: 1rem;
}

.lightbox-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
}

.lightbox-btn:hover {
    background: white;
    color: black;
    transform: scale(1.1);
}

/* Loading State */
.gallery-loader {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
