/**
 * Gallery Grid Styles - Modern Collage Layout
 * Using CSS Variables from front.css
 */

/* Gallery Grid Container */
.apb-gallery-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-gap: var(--apb-spacing-md);
    margin-bottom: var(--apb-spacing-lg);
}

/* Large Image */
.apb-gallery-item.large-image {
    grid-column: 1;
    grid-row: 1 / span 2;
    height: 500px;
}

/* Small Images Grid */
.small-images-grid {
    grid-column: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(3, 1fr);
    grid-gap: var(--apb-spacing-md);
    height: 500px;
}

/* Individual Gallery Items */
.apb-gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all var(--apb-transition-speed) var(--apb-transition-easing);
    background-color: var(--apb-gray-200);
}

.apb-gallery-item:hover {
    transform: scale(1.02);
}

.apb-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: all var(--apb-transition-speed) var(--apb-transition-easing);
}

.apb-gallery-item:hover img {
    transform: scale(1.05);
}

/* Gallery Item Overlay (Optional) */
.apb-gallery-item:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    transition: background var(--apb-transition-speed) var(--apb-transition-easing);
}

.apb-gallery-item:hover:after {
    background: rgba(0, 0, 0, 0.1);
}

/* More Images Overlay for Last Item */
.apb-gallery-item.more-images {
    position: relative;
}

.more-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    color: var(--apb-white);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: var(--apb-font-size-xlarge);
    font-weight: var(--apb-font-weight-bold);
}

/* Fallback Text for No Images */
.apb-gallery-no-images {
    grid-column: 1 / -1;
    padding: var(--apb-spacing-lg);
    background-color: var(--apb-light-gray);
    border-radius: var(--apb-border-radius-md);
    text-align: center;
    color: var(--apb-gray-500);
}

/* Media Queries for Responsiveness */
@media (max-width: 992px) {
    .apb-gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .apb-gallery-item.large-image {
        grid-column: 1;
        grid-row: 1;
        height: 300px;
    }
    
    .small-images-grid {
        grid-column: 1;
        grid-row: auto;
        grid-template-rows: repeat(2, 150px) repeat(1, 200px);
        height: auto;
    }
}

@media (max-width: 768px) {
    .small-images-grid {
        grid-template-rows: repeat(3, auto);
    }
    
    /* Mobile Layout with large image on top, followed by 2 rows of images */
    .apb-gallery-item:not(.large-image) {
        min-height: 120px;
    }
}

@media (max-width: 576px) {
    .small-images-grid {
        grid-gap: var(--apb-spacing-sm);
    }
}

/* PhotoSwipe Overrides */
.pswp__bg {
    background: rgba(0, 0, 0, 0.9);
}

.pswp__button--arrow--left:before,
.pswp__button--arrow--right:before {
    background-color: rgba(0, 0, 0, 0.3);
}