/* ============================================
   Gallery Grid + Lightbox Styles
   ============================================ */

/* === GALLERY GRID === */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 0 0 var(--section-padding);
}

.gallery-grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.gallery-grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4/3;
    background: #f5f5f5;
}

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

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

.gallery-item::after {
    content: '';
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
}

.gallery-item:hover::after {
    background: rgba(0, 0, 0, 0.15);
}

/* === JUSTIFIED GALLERY (masonry-style rows) === */
.gallery-justified {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    padding: 0 0 var(--section-padding);
}

.gallery-justified .gallery-item {
    position: relative;
    height: clamp(160px, 33vw, 400px);
    flex-grow: 1;
    overflow: hidden;
    cursor: pointer;
    background: #f5f5f5;
    aspect-ratio: auto;
}

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

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

.gallery-justified .gallery-item::after {
    content: '';
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
}

.gallery-justified .gallery-item:hover::after {
    background: rgba(0, 0, 0, 0.15);
}

/* Hide border overlay on specific pages */
.no-gallery-border .gallery-justified .gallery-item::after {
    display: none;
}

/* === LIGHTBOX === */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    z-index: 2010;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.lightbox-close:hover {
    opacity: 1;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    z-index: 2010;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    opacity: 1;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-family: var(--font-primary);
    font-size: 14px;
    letter-spacing: 2px;
    z-index: 2010;
}
