/*---------------- GALLERY PAGE STYLES ----------------*/

.galleryPageWrap {
    background-image: url(../images/backgrounds/bg_07.png);
    background-image: url(../images/backgrounds/bg_07.webp);
    background-size: cover;
    background-position: center top;
}

/* Masonry Grid Layout - Random Sizes */

.galleryHead {
    font-size: 1.6rem;
    max-width: 35rem;
    margin: 6rem auto 3rem;
}

.galleryGrid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 15rem;
    gap: 1rem;
    padding: 2rem 0;
    grid-auto-flow: dense;
}

.galleryItem {
    cursor: pointer;
    overflow: hidden;
    border-radius: 0;
    position: relative;
    transition: all 0.3s ease;
}

.galleryItem::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3Cline x1='11' y1='8' x2='11' y2='14'%3E%3C/line%3E%3Cline x1='8' y1='11' x2='14' y2='11'%3E%3C/line%3E%3C/svg%3E") no-repeat center;
    background-size: 0;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    pointer-events: none;
    z-index: 2;
}

.galleryItem:hover::after {
    background-color: rgba(0, 0, 0, 0.3);
    background-size: 2.5rem;
}

.galleryItem img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.galleryItem:hover img {
    transform: scale(1.1);
}

/* Random size variations */
.galleryItem.size-small {
    grid-row: span 1;
    grid-column: span 1;
}

.galleryItem.size-medium {
    grid-row: span 2;
    grid-column: span 1;
}

.galleryItem.size-large {
    grid-row: span 2;
    grid-column: span 2;
}

.galleryItem.size-tall {
    grid-row: span 2;
    grid-column: span 1;
}

.galleryItem.size-wide {
    grid-row: span 1;
    grid-column: span 2;
}

/* Lightbox Styles */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

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

.lightbox__image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox__close {
    position: fixed;
    top: 2rem;
    right: 2rem;
    width: 3rem;
    height: 3rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10001;
}

.lightbox__close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg);
}

.lightbox__close::before,
.lightbox__close::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: white;
}

.lightbox__close::before {
    transform: rotate(45deg);
}

.lightbox__close::after {
    transform: rotate(-45deg);
}

.lightbox__arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 3rem;
    height: 3rem;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10001;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.lightbox__arrow:hover {
    opacity: 1;
}

.lightbox__arrow--prev {
    left: 2rem;
}

.lightbox__arrow--next {
    right: 2rem;
}

.lightbox__arrow img {
    width: 100%;
    height: 100%;
    filter: brightness(0) invert(1);
}

.lightbox__counter {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    z-index: 10001;
}

/*---------------- RESPONSIVE STYLES ----------------*/

@media(max-width: 1199px) {
    .galleryGrid {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: 15rem;
    }
}

@media(max-width: 767px) {
    .galleryGrid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 15rem;
        gap: 0.5rem;
    }

    /* Simplify sizes on smaller screens */
    .galleryItem.size-large {
        grid-row: span 2;
        grid-column: span 1;
    }

    .galleryItem.size-wide {
        grid-row: span 1;
        grid-column: span 1;
    }

    .lightbox__close,
    .lightbox__arrow {
        width: 2.5rem;
        height: 2.5rem;
    }

    .lightbox__close {
        top: 1rem;
        right: 1rem;
    }

    .lightbox__arrow--prev {
        left: 1rem;
    }

    .lightbox__arrow--next {
        right: 1rem;
    }

    .lightbox__counter {
        bottom: 1rem;
        font-size: 0.875rem;
    }
}