/* Desktop gallery: large hero + four supporting images */

.pw-gallery {
    display: grid;
    grid-template-columns: 2.4fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 12px;
    width: 100%;
    aspect-ratio: 3 / 1;
    margin: 0;
}

.pw-gallery-item {
    position: relative;
    display: block;
    overflow: hidden;
    min-height: 0;
    background: #eee;
}

.pw-gallery-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 180ms ease;
}

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

/* Hero */
.pw-gallery-item.pw-gallery-hero {
    grid-column: 1;
    grid-row: 1 / span 2;
    min-height: 0;
}

/* Four supporting images */
.pw-gallery-item.pw-gallery-side:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
}

.pw-gallery-item.pw-gallery-side:nth-child(3) {
    grid-column: 3;
    grid-row: 1;
}

.pw-gallery-item.pw-gallery-side:nth-child(4) {
    grid-column: 2;
    grid-row: 2;
}

.pw-gallery-item.pw-gallery-side:nth-child(5) {
    grid-column: 3;
    grid-row: 2;
}

/* Remaining photos stay in the gallery for the lightbox,
   but do not occupy space in the page layout. */
.pw-gallery-item:nth-child(n+6) {
    display: none;
}

/* More photos control */
.pw-gallery-more {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 2;
    border: 0;
    border-radius: 3px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.94);
    color: #592626;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.1;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}

.pw-gallery-more:hover {
    background: #fff;
}

/* Mobile */
@media (max-width: 767.98px) {
    .pw-gallery {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 60vw 30vw;
        gap: 8px;
    }

    .pw-gallery-item.pw-gallery-hero {
        grid-column: 1 / span 2;
        grid-row: 1;
        min-height: 0;
    }

    .pw-gallery-item.pw-gallery-side:nth-child(2) {
        grid-column: 1;
        grid-row: 2;
    }

    .pw-gallery-item.pw-gallery-side:nth-child(3) {
        grid-column: 2;
        grid-row: 2;
    }

    /* Keep the first three photos visible on mobile.
       The remaining photos stay available to the lightbox. */
    .pw-gallery-item:nth-child(n+4) {
        display: none;
    }

    /* The + photos control is moved onto the second visible photo
       by the JavaScript for mobile. */
    .pw-gallery-more {
        right: 8px;
        bottom: 8px;
        padding: 7px 10px;
        font-size: 14px;
    }
}

/* Full-screen lightbox */

.pw-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 60px 70px 70px;
    background: rgba(0, 0, 0, 0.94);
}

.pw-lightbox.is-open {
    display: flex;
}

.pw-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 130px);
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
}

.pw-lightbox-close,
.pw-lightbox-prev,
.pw-lightbox-next {
    position: absolute;
    z-index: 2;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    font-family: Arial, sans-serif;
    line-height: 1;
    opacity: .9;
}

.pw-lightbox-close {
    top: 18px;
    right: 24px;
    font-size: 38px;
    font-weight: 300;
}

.pw-lightbox-prev,
.pw-lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    font-size: 46px;
    padding: 15px;
}

.pw-lightbox-prev {
    left: 18px;
}

.pw-lightbox-next {
    right: 18px;
}

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

.pw-lightbox-close:focus,
.pw-lightbox-prev:focus,
.pw-lightbox-next:focus {
    outline: none;
}

.pw-lightbox-close:focus-visible,
.pw-lightbox-prev:focus-visible,
.pw-lightbox-next:focus-visible {
    outline: 1px solid rgba(255, 255, 255, 0.65);
    outline-offset: 4px;
}

.pw-lightbox-meta {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: #fff;
    font-family: Arial, sans-serif;
    font-size: 14px;
    text-align: center;
}

.pw-lightbox-caption {
    max-width: 75%;
}

.pw-lightbox-counter {
    white-space: nowrap;
    opacity: .8;
}

/* Prevent the page behind the lightbox from scrolling. */

html.pw-lightbox-open,
html.pw-lightbox-open body {
    overflow: hidden;
}

/* Mobile lightbox */

@media (max-width: 767.98px) {
    .pw-lightbox {
        padding: 50px 42px 70px;
    }

    .pw-lightbox-prev,
    .pw-lightbox-next {
        font-size: 38px;
        padding: 10px;
    }

    .pw-lightbox-prev {
        left: 4px;
    }

    .pw-lightbox-next {
        right: 4px;
    }

    .pw-lightbox-close {
        top: 10px;
        right: 14px;
        font-size: 34px;
    }

    .pw-lightbox-meta {
        bottom: 12px;
        flex-direction: column;
        gap: 5px;
    }

    .pw-lightbox-caption {
        max-width: 90%;
    }
}