/* =========================================================
   GALLERY.CSS — Gallery grid, filter tabs, lightbox
   ========================================================= */

/* --- Preview Grid (Homepage) --- */
.pn-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* --- Full Gallery Masonry Grid --- */
.pn-gallery-masonry {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.pn-gallery-masonry .pn-gallery-item:nth-child(5n+1) { grid-row: span 2; }

/* --- Gallery Item --- */
.pn-gallery-item {
    cursor: pointer;
    border-radius: var(--pn-card-radius);
    overflow: hidden;
    position: relative;
}

.gallery-item-inner {
    position: relative;
    height: 220px;
    overflow: hidden;
}

.pn-gallery-masonry .pn-gallery-item:nth-child(5n+1) .gallery-item-inner {
    height: 100%;
    min-height: 456px;
}

.gallery-item-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    display: block;
}

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

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.gallery-item-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    text-align: center;
}

.gallery-zoom {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

.pn-gallery-item:hover .gallery-zoom {
    background: var(--pn-primary);
    border-color: var(--pn-primary);
    transform: translate(-50%, -50%) scale(1.1);
}

.gallery-item-title {
    color: #fff;
    font-size: 0.9rem;
    margin: 0 0 4px;
    font-family: var(--pn-heading-font);
}

.gallery-item-cat {
    display: inline-block;
    background: var(--pn-primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 50px;
    letter-spacing: 0.05em;
}

/* Hide/show by filter */
.pn-gallery-item.filtered-out {
    display: none;
}

/* --- Category Filter Tabs --- */
.gallery-filter-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.gallery-filter-btn {
    padding: 10px 24px;
    border-radius: 50px;
    border: 2px solid var(--pn-border);
    background: #fff;
    color: var(--pn-text);
    font-family: var(--pn-body-font);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--pn-transition);
}

.gallery-filter-btn:hover {
    border-color: var(--pn-primary);
    color: var(--pn-primary);
}

.gallery-filter-btn.active {
    background: var(--pn-primary);
    border-color: var(--pn-primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(193,96,122,0.30);
}

/* --- Lightbox --- */
.pn-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.92);
    cursor: pointer;
    backdrop-filter: blur(6px);
}

.lightbox-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 90vw;
    max-height: 90vh;
    z-index: 2;
}

.pn-lightbox.active .lightbox-content {
    transform: translate(-50%, -50%) scale(1);
}

.lightbox-img-wrap {
    border-radius: 12px;
    overflow: hidden;
    max-width: 90vw;
    max-height: 80vh;
}

.lightbox-img-wrap img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    display: block;
    border-radius: 12px;
}

.lightbox-close {
    position: fixed;
    top: 20px;
    right: 24px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    transition: all var(--pn-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    backdrop-filter: blur(4px);
}

.lightbox-close:hover {
    background: var(--pn-primary);
    border-color: var(--pn-primary);
    transform: rotate(90deg);
}

.lightbox-prev,
.lightbox-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(0,0,0,0.5);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--pn-transition);
    z-index: 3;
    backdrop-filter: blur(4px);
}

.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

.lightbox-prev:hover,
.lightbox-next:hover {
    background: var(--pn-primary);
    border-color: var(--pn-primary);
}

.lightbox-caption {
    text-align: center;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    margin-top: 14px;
}
