.roark-expose-gallery {
    --roark-gallery-columns: 3;
    --roark-gallery-gap: 12px;
    --roark-gallery-image-height: 260px;
    position: relative;
    overflow-x: clip;
}

.roark-expose-gallery--full {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

.roark-expose-gallery--boxed {
    width: auto;
    margin-left: auto;
    margin-right: auto;
}

/* ── Center a short row instead of packing it left ───────────────────────
 * expose-gallery.js sets `data-center-{mobile,tablet,desktop}="1"` on the
 * root whenever there are fewer real slides than that breakpoint's slots
 * (e.g. 2 photos capped to a 3-slot desktop row) — `transform: none`
 * neutralizes Swiper's own translate3d positioning (irrelevant here: with
 * fewer real slides than slots there is nothing to scroll to, and nav is
 * hidden accordingly — see toggleControlsForLock()) so the flex row's own
 * `justify-content: center` takes over instead of Swiper's slide-to-slide
 * offset math, which needs real neighbour slides on both sides to center a
 * row this short.
 */
@media (max-width: 767px) {
    [data-center-mobile="1"] .swiper-wrapper {
        transform: none !important;
        justify-content: center;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    [data-center-tablet="1"] .swiper-wrapper {
        transform: none !important;
        justify-content: center;
    }
}

@media (min-width: 1200px) {
    [data-center-desktop="1"] .swiper-wrapper {
        transform: none !important;
        justify-content: center;
    }
}

/* ── Empty-state collapse ─────────────────────────────────────────────────
 * ExposeGalleryWidget prints a hidden `.roark-expose-gallery--empty` marker
 * instead of a photo swiper/grid when there is nothing distinct to show
 * (`hide_if_single_image: yes` and ≤1 real photo — the hero above already
 * shows that same photo — or simply no photos and no videos at all). `:has()`
 * lets the surrounding section (`roark-expose-gallery-section`, set in
 * PropertyExposeTemplate::buildGallerySection()) collapse to zero height in
 * that case instead of leaving its own padding/background behind as a bare
 * strip. Also written as a plain empty-state class so a saved template on an
 * existing install (pre-dating this marker) still benefits once its
 * `_elementor_data` is rebuilt, without needing any other markup change.
 */
.roark-expose-gallery-section:has(.roark-expose-gallery--empty) {
    display: none;
}

.roark-expose-gallery__swiper {
    position: relative;
}

.roark-expose-gallery__grid {
    display: grid;
    grid-template-columns: repeat(var(--roark-gallery-columns), minmax(0, 1fr));
    gap: var(--roark-gallery-gap);
}

.roark-expose-gallery__slide {
    height: auto;
}

.roark-expose-gallery__item {
    position: relative;
    margin: 0;
    overflow: hidden;
}

.roark-expose-gallery__link {
    position: relative;
    display: block;
    height: var(--roark-gallery-image-height);
    text-decoration: none;
    color: inherit;
}

.roark-expose-gallery__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.roark-expose-gallery__overlay {
    position: absolute;
    inset: 0;
    transition: background 0.2s ease;
    pointer-events: none;
}

/* Floor plan badge — icon pill, bottom-right corner */
.roark-expose-gallery__badge {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    padding: 6px;
    border-radius: 4px;
    line-height: 0;
    backdrop-filter: blur(4px);
}

.roark-expose-gallery__badge svg {
    display: block;
}

.roark-expose-gallery__caption {
    margin: 0;
}

.roark-expose-gallery__pagination {
    position: relative;
    margin-top: 18px;
    text-align: center;
}

.roark-gallery-nav {
    position: absolute;
    top: calc(50% - 22px);
    z-index: 3;
    width: 40px;
    height: 40px;
    border: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.roark-gallery-prev {
    left: 10px;
}

.roark-gallery-next {
    right: 10px;
}

.roark-expose-gallery .swiper-pagination-bullet {
    opacity: 0.3;
}

.roark-expose-gallery .swiper-pagination-bullet-active {
    opacity: 1;
}

.roark-expose-gallery .swiper-wrapper,
.roark-expose-gallery .swiper-slide {
    height: auto;
}

.roark-expose-gallery .swiper-slide .roark-expose-gallery__item,
.roark-expose-gallery .swiper-slide .roark-expose-gallery__link,
.roark-expose-gallery .swiper-slide .roark-expose-gallery__image {
    height: var(--roark-gallery-image-height);
}

@media (max-width: 767px) {
    .roark-expose-gallery__grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
}

/* PhotoSwipe caption bar */
.pswp__caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1500;
    padding: 10px 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.65) 0%, transparent 100%);
    pointer-events: none;
}

.pswp__caption span {
    display: block;
    color: #fff;
    font-size: 0.9rem;
    line-height: 1.4;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    text-align: center;
}

.pswp__caption:empty {
    display: none;
}

/* ── Videos & 3D tours (below the image gallery) ────────────────────────── */
.roark-expose-videos {
    width: 100%;
    margin-top: 1.5rem;
}

.roark-expose-videos__title {
    margin: 0 0 1rem;
}

.roark-expose-videos__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.roark-expose-videos__item {
    margin: 0;
    min-width: 0;
}

.roark-expose-videos__embed {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    border-radius: var(--roark-radius-card, 10px);
    overflow: hidden;
    background: #000;
}

.roark-expose-videos__embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.roark-expose-videos__player {
    width: 100%;
    border-radius: var(--roark-radius-card, 10px);
    background: #000;
    aspect-ratio: 16 / 9;
}

.roark-expose-videos__caption {
    margin-top: 0.5rem;
    color: #374151;
    font-size: 0.95em;
}

@media (max-width: 767px) {
    .roark-expose-videos__grid {
        grid-template-columns: 1fr;
    }
}
