/* Angelo Property Gallery
   Author: Angelo Web Design
   https://angeloweb.co.uk/
*/

.angelo-property-gallery,
.angelo-property-gallery *,
.angelo-gallery-modal,
.angelo-gallery-modal *,
.angelo-gallery-lightbox,
.angelo-gallery-lightbox * {
    box-sizing: border-box;
}

.angelo-property-gallery {
    position: relative;
    width: 100%;
}

.angelo-property-gallery__grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    aspect-ratio: 2.3 / 1;
    overflow: hidden;
    border-radius: 14px;
    background: #eee;
}

.angelo-property-gallery__item,
.angelo-gallery-modal__featured,
.angelo-gallery-modal__photo {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    background: transparent;
}

.angelo-property-gallery__item {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    cursor: pointer;
    background: #e9e9e9;
}

.angelo-property-gallery__item--1 {
    grid-column: 1;
    grid-row: 1 / 3;
}

.angelo-property-gallery__item--2 {
    grid-column: 2;
    grid-row: 1;
}

.angelo-property-gallery__item--3 {
    grid-column: 3;
    grid-row: 1;
}

.angelo-property-gallery__item--4 {
    grid-column: 2;
    grid-row: 2;
}

.angelo-property-gallery__item--5 {
    grid-column: 3;
    grid-row: 2;
}

.angelo-property-gallery__item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity .22s ease;
}

.angelo-property-gallery--count-1 .angelo-property-gallery__grid {
    display: block;
    aspect-ratio: 16 / 9;
}

.angelo-property-gallery--count-1 .angelo-property-gallery__item--1 {
    width: 100%;
    height: 100%;
}

.angelo-property-gallery--count-2 .angelo-property-gallery__grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
}

.angelo-property-gallery--count-2 .angelo-property-gallery__item--1,
.angelo-property-gallery--count-2 .angelo-property-gallery__item--2 {
    grid-row: 1;
}

.angelo-property-gallery--count-2 .angelo-property-gallery__item--1 {
    grid-column: 1;
}

.angelo-property-gallery--count-2 .angelo-property-gallery__item--2 {
    grid-column: 2;
}

.angelo-property-gallery--count-3 .angelo-property-gallery__grid {
    grid-template-columns: 2fr 1fr;
}

.angelo-property-gallery--count-3 .angelo-property-gallery__item--2,
.angelo-property-gallery--count-3 .angelo-property-gallery__item--3 {
    grid-column: 2;
}

.angelo-property-gallery--count-3 .angelo-property-gallery__item--2 {
    grid-row: 1;
}

.angelo-property-gallery--count-3 .angelo-property-gallery__item--3 {
    grid-row: 2;
}

.angelo-property-gallery--count-4 .angelo-property-gallery__grid {
    grid-template-columns: 2fr 1fr;
}

.angelo-property-gallery--count-4 .angelo-property-gallery__item--2 {
    grid-column: 2;
    grid-row: 1;
}

.angelo-property-gallery--count-4 .angelo-property-gallery__item--3,
.angelo-property-gallery--count-4 .angelo-property-gallery__item--4 {
    grid-row: 2;
}

.angelo-property-gallery--count-4 .angelo-property-gallery__item--3 {
    grid-column: 1;
}

.angelo-property-gallery--count-4 .angelo-property-gallery__item--4 {
    grid-column: 2;
}

.angelo-property-gallery__show-all {
    position: absolute;
    right: 20px;
    bottom: 20px;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 15px;
    border: 1px solid #222;
    border-radius: 9px;
    background: #fff;
    color: #222;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

.angelo-property-gallery__show-all svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

.angelo-property-gallery__mobile-count {
    display: none;
}

@media (hover: hover) {
    .angelo-property-gallery__item:hover img {
        opacity: .94;
    }
}

/* Full-screen all-photos view */
.angelo-gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    color: #222;
}

.angelo-gallery-modal.is-open {
    display: block;
}

.angelo-gallery-modal__header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding: 0 24px;
    border-bottom: 1px solid rgba(0,0,0,.06);
    background: rgba(255,255,255,.97);
    backdrop-filter: blur(8px);
}

.angelo-gallery-icon-button,
.angelo-gallery-lightbox__close,
.angelo-gallery-lightbox__prev,
.angelo-gallery-lightbox__next {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.angelo-gallery-icon-button {
    background: transparent;
    color: #222;
}

.angelo-gallery-icon-button:hover {
    background: #f2f2f2;
}

.angelo-gallery-icon-button svg,
.angelo-gallery-lightbox__close svg,
.angelo-gallery-lightbox__prev svg,
.angelo-gallery-lightbox__next svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.angelo-gallery-modal__count {
    font-size: 14px;
    font-weight: 600;
}

.angelo-gallery-modal__inner {
    width: min(900px, calc(100% - 48px));
    margin: 18px auto 80px;
}

.angelo-gallery-modal__featured,
.angelo-gallery-modal__photo {
    display: block;
    width: 100%;
    cursor: zoom-in;
    overflow: hidden;
}

.angelo-gallery-modal__featured {
    margin-bottom: 8px;
}

.angelo-gallery-modal__featured img,
.angelo-gallery-modal__photo img {
    display: block;
    width: 100%;
    height: auto;
    transition: opacity .2s ease;
}

.angelo-gallery-modal__masonry {
    columns: 2;
    column-gap: 8px;
}

.angelo-gallery-modal__photo {
    margin: 0 0 8px;
    break-inside: avoid;
}

@media (hover: hover) {
    .angelo-gallery-modal__featured:hover img,
    .angelo-gallery-modal__photo:hover img {
        opacity: .9;
    }
}

/* Lightbox */
.angelo-gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.96);
    color: #fff;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.angelo-gallery-lightbox.is-open {
    display: flex;
}

.angelo-gallery-lightbox__image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(100% - 180px);
    height: calc(100% - 120px);
}

.angelo-gallery-lightbox__image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.angelo-gallery-lightbox__close,
.angelo-gallery-lightbox__prev,
.angelo-gallery-lightbox__next {
    position: absolute;
    z-index: 10;
    background: rgba(255,255,255,.12);
    color: #fff;
}

.angelo-gallery-lightbox__close:hover,
.angelo-gallery-lightbox__prev:hover,
.angelo-gallery-lightbox__next:hover {
    background: rgba(255,255,255,.22);
}

.angelo-gallery-lightbox__close {
    top: 22px;
    left: 22px;
}

.angelo-gallery-lightbox__prev {
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
}

.angelo-gallery-lightbox__next {
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
}

.angelo-gallery-lightbox__counter {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 600;
}

body.angelo-gallery-no-scroll {
    overflow: hidden !important;
}

@media (max-width: 991px) {
    .angelo-property-gallery__grid {
        grid-template-columns: 1.5fr 1fr;
    }

    .angelo-property-gallery__item--1 {
        grid-column: 1;
        grid-row: 1 / 3;
    }

    .angelo-property-gallery__item--2 {
        grid-column: 2;
        grid-row: 1;
    }

    .angelo-property-gallery__item--3 {
        grid-column: 2;
        grid-row: 2;
    }

    .angelo-property-gallery__item--4,
    .angelo-property-gallery__item--5 {
        display: none;
    }

    .angelo-property-gallery--count-1 .angelo-property-gallery__item--1,
    .angelo-property-gallery--count-2 .angelo-property-gallery__item--1,
    .angelo-property-gallery--count-2 .angelo-property-gallery__item--2 {
        display: block;
    }
}

@media (max-width: 767px) {
    .angelo-property-gallery__grid,
    .angelo-property-gallery--count-1 .angelo-property-gallery__grid,
    .angelo-property-gallery--count-2 .angelo-property-gallery__grid,
    .angelo-property-gallery--count-3 .angelo-property-gallery__grid,
    .angelo-property-gallery--count-4 .angelo-property-gallery__grid {
        display: block;
        width: 100%;
        aspect-ratio: 1.25 / 1;
        border-radius: 0;
    }

    .angelo-property-gallery__item {
        display: none !important;
    }

    .angelo-property-gallery__item--1 {
        display: block !important;
        width: 100%;
        height: 100%;
    }

    .angelo-property-gallery__show-all {
        display: none;
    }

    .angelo-property-gallery__mobile-count {
        position: absolute;
        right: 12px;
        bottom: 12px;
        z-index: 5;
        display: inline-flex;
        align-items: center;
        min-height: 26px;
        padding: 5px 9px;
        border-radius: 5px;
        background: rgba(34,34,34,.82);
        color: #fff;
        font-size: 13px;
        font-weight: 600;
        line-height: 1;
    }

    .angelo-gallery-modal__header {
        min-height: 58px;
        padding: 0 12px;
    }

    .angelo-gallery-modal__inner {
        width: 100%;
        margin: 0 auto 40px;
    }

    .angelo-gallery-modal__featured {
        margin-bottom: 6px;
        aspect-ratio: 16 / 9;
    }

    .angelo-gallery-modal__featured img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    /*
     * Airbnb-style mobile all-photos layout:
     * one full-width image, then a pair, then full-width, repeating.
     * The overview tiles may crop slightly for a clean mosaic; the lightbox
     * always shows the complete original image.
     */
    .angelo-gallery-modal__masonry {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        columns: auto;
    }

    .angelo-gallery-modal__photo {
        align-self: start;
        margin: 0;
        aspect-ratio: 4 / 3;
    }

    .angelo-gallery-modal__photo--wide {
        grid-column: 1 / -1;
        aspect-ratio: 16 / 9;
    }

    .angelo-gallery-modal__photo img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .angelo-gallery-lightbox__image-wrap {
        width: 100%;
        height: calc(100% - 130px);
        padding: 0 10px;
    }

    .angelo-gallery-lightbox__close {
        top: 14px;
        left: 12px;
    }

    .angelo-gallery-lightbox__counter {
        top: 28px;
    }

    .angelo-gallery-lightbox__prev,
    .angelo-gallery-lightbox__next {
        top: auto;
        bottom: 20px;
        width: 42px;
        height: 42px;
        transform: none;
    }

    .angelo-gallery-lightbox__prev {
        left: calc(50% - 55px);
    }

    .angelo-gallery-lightbox__next {
        right: calc(50% - 55px);
    }
}

