/* ========================================
   Photo Gallery Page Styles
   Google/Microsoft-inspired modern design
   ======================================== */

/* Page Subtitle */
.page-subtitle {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    margin-top: 12px;
    font-weight: 400;
}

/* Gallery Section */
.gallery-section {
    min-height: 60vh;
}

/* Masonry Grid */
.gallery-masonry {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* Gallery Card */
.gallery-card {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: var(--color-bg-alt);
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity 0.4s var(--ease-smooth),
        transform 0.4s var(--ease-smooth),
        box-shadow 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.gallery-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.gallery-card:hover {
    transform: translateY(-8px);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.12),
        0 8px 16px rgba(0, 0, 0, 0.08);
}

.gallery-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    transition: transform 0.5s var(--ease-smooth);
}

.gallery-card:hover img {
    transform: scale(1.08);
}

/* Card Overlay */
.gallery-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top,
            rgba(0, 0, 0, 0.7) 0%,
            rgba(0, 0, 0, 0.2) 40%,
            transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    padding: 20px;
}

.gallery-card:hover .gallery-card-overlay {
    opacity: 1;
}

.gallery-card-caption {
    color: white;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.4;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Empty State */
.gallery-empty {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 20px;
    color: var(--color-text-muted);
}

.gallery-empty svg {
    margin-bottom: 24px;
    opacity: 0.4;
}

.gallery-empty h3 {
    font-size: 1.5rem;
    color: var(--color-text-main);
    margin-bottom: 8px;
    font-weight: 600;
}

.gallery-empty p {
    font-size: 1rem;
    max-width: 300px;
}

/* Loading State */
.gallery-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--color-text-muted);
}

.gallery-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-brand-primary);
    border-radius: 50%;
    margin-bottom: 16px;
    animation: gallery-spin 0.8s linear infinite;
}

@keyframes gallery-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Pagination */
.gallery-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--color-border);
}

.pagination-btn {
    min-width: 44px;
    height: 44px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    color: var(--color-text-main);
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--color-brand-primary);
    color: var(--color-brand-primary);
    background: var(--color-brand-light);
}

.pagination-btn.active {
    background: var(--color-brand-primary);
    border-color: var(--color-brand-primary);
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-dots {
    color: var(--color-text-muted);
    padding: 0 8px;
}

/* ========================================
   Lightbox
   ======================================== */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
    left: 24px;
}

.lightbox-prev:hover {
    transform: translateY(-50%) translateX(-4px);
}

.lightbox-next {
    right: 24px;
}

.lightbox-next:hover {
    transform: translateY(-50%) translateX(4px);
}

.lightbox-content {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: calc(85vh - 60px);
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    text-align: center;
    max-width: 600px;
    line-height: 1.5;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 1024px) {
    .gallery-masonry {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .gallery-masonry {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .gallery-card {
        border-radius: 12px;
    }

    .gallery-card-overlay {
        opacity: 1;
        background: linear-gradient(to top,
                rgba(0, 0, 0, 0.5) 0%,
                transparent 60%);
        padding: 12px;
    }

    .gallery-card-caption {
        font-size: 0.8125rem;
    }

    .lightbox-nav {
        width: 44px;
        height: 44px;
    }

    .lightbox-prev {
        left: 12px;
    }

    .lightbox-next {
        right: 12px;
    }

    .lightbox-close {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
    }

    .pagination-btn {
        min-width: 40px;
        height: 40px;
        padding: 0 10px;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .gallery-masonry {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .gallery-card img {
        aspect-ratio: 16 / 10;
    }
}

/* ========================================
   Dark Mode Support
   ======================================== */

[data-theme="dark"] .gallery-card {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .gallery-card:hover {
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 8px 16px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .pagination-btn {
    background: var(--color-bg-alt);
}

[data-theme="dark"] .pagination-btn:hover:not(:disabled) {
    background: rgba(220, 38, 38, 0.15);
}