/* ========================================
   Photography Gallery - Masonry Grid & Lightbox
   ======================================== */

/* --- Gallery Container --- */
.gallery-header {
    text-align: center;
    padding: 8rem 5% 3rem;
    background: var(--bg-light);
}

.gallery-header h1 {
    margin-bottom: 1rem;
}

.gallery-header p {
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto;
}

.gallery-breadcrumb {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.95rem;
}

.gallery-breadcrumb a {
    color: var(--text-light);
    transition: var(--transition);
}

.gallery-breadcrumb a:hover {
    color: var(--secondary-color);
}

.gallery-breadcrumb span {
    color: var(--text-light);
}

/* --- Gallery Navigation Tabs --- */
.gallery-nav {
    background: var(--white);
    padding: 1.5rem 5%;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 70px;
    z-index: 100;
}

.gallery-nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.gallery-nav-link {
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    background: var(--bg-light);
    color: var(--text-dark);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
    transition: var(--transition);
}

.gallery-nav-link:hover {
    background: var(--secondary-color);
    color: var(--white);
    transform: translateY(-2px);
}

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

/* --- Masonry Grid --- */
.gallery-container {
    padding: 3rem 5%;
    max-width: 1400px;
    margin: 0 auto;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    background: linear-gradient(135deg, #e8e8e8 0%, #f5f5f5 50%, #e8e8e8 100%);
    background-size: 200% 200%;
    animation: shimmer 1.5s ease-in-out infinite;
    aspect-ratio: 4 / 3;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.gallery-item.loaded {
    animation: none;
    background: #f0f0f0;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
    display: block;
    opacity: 0;
}

.gallery-item img.loaded {
    opacity: 1;
}

.gallery-item:hover img.loaded {
    transform: scale(1.05);
}

.gallery-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item:hover .gallery-item-overlay {
    background: rgba(0, 0, 0, 0.3);
}

.gallery-item-icon {
    color: var(--white);
    font-size: 2.5rem;
    opacity: 0;
    transform: scale(0.5);
    transition: var(--transition);
}

.gallery-item:hover .gallery-item-icon {
    opacity: 1;
    transform: scale(1);
}

/* --- PhotoSwipe Base Styles --- */
.pswp {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.95);
    opacity: 0;
    transition: opacity 0.3s;
}

.pswp.pswp--open {
    opacity: 1;
}

.pswp__bg {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: #000;
}

.pswp__scroll-wrap {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.pswp__container {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pswp__item {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.pswp__img {
    max-width: 100%;
    max-height: 100%;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    display: block;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
}

/* PhotoSwipe UI */
.pswp__ui {
    z-index: 2000;
}

.pswp__top-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);
}

.pswp__counter {
    position: absolute;
    left: 0;
    top: 15px;
    height: 30px;
    font-size: 14px;
    line-height: 30px;
    color: #fff;
    padding: 0 15px;
}

.pswp__button {
    width: 50px;
    height: 50px;
    position: absolute;
    top: 5px;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.pswp__button:hover {
    opacity: 1;
}

.pswp__button--close {
    right: 5px;
}

.pswp__button--close::before {
    content: "×";
    color: #fff;
    font-size: 40px;
    line-height: 50px;
    display: block;
}

.pswp__button--arrow--left,
.pswp__button--arrow--right {
    top: 50%;
    margin-top: -25px;
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
}

.pswp__button--arrow--left {
    left: 20px;
}

.pswp__button--arrow--right {
    right: 20px;
}

.pswp__button--arrow--left::before {
    content: "‹";
    color: #fff;
    font-size: 50px;
    line-height: 60px;
    display: block;
}

.pswp__button--arrow--right::before {
    content: "›";
    color: #fff;
    font-size: 50px;
    line-height: 60px;
    display: block;
}

/* --- Gallery Stats --- */
.gallery-stats {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-light);
    font-size: 0.95rem;
}

/* --- Loading Animation --- */
.gallery-loading {
    text-align: center;
    padding: 4rem 0;
}

.gallery-loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--bg-light);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Responsive --- */
@media (max-width: 968px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }

    .gallery-nav-container {
        gap: 1rem;
    }

    .gallery-nav-link {
        font-size: 0.85rem;
        padding: 0.6rem 1.2rem;
    }
}

@media (max-width: 768px) {
    .gallery-header {
        padding: 6rem 5% 2rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }

    .gallery-nav {
        top: 60px;
    }

    .pswp__button--arrow--left,
    .pswp__button--arrow--right {
        width: 45px;
        height: 45px;
    }

    .pswp__button--arrow--left {
        left: 10px;
    }

    .pswp__button--arrow--right {
        right: 10px;
    }
}
