/*
 * Roscoe Property Gallery v1.0.9
 * Desktop: grade estilo portal imobiliário.
 * Mobile: slider 100vw + lightbox fullscreen.
 */

body .roscoe-property-gallery,
body .roscoe-property-gallery * {
    box-sizing: border-box;
}

body .roscoe-property-gallery {
    width: 100%;
    margin: 0 0 30px;
    background: #000;
    position: relative;
    clear: both;
}

body .roscoe-property-gallery .roscoe-property-gallery__viewport {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #000;
}

body .roscoe-property-gallery .roscoe-property-gallery__track {
    width: 100%;
}

body .roscoe-property-gallery .roscoe-property-gallery__slide {
    display: none;
    width: 100%;
}

body .roscoe-property-gallery .roscoe-property-gallery__slide.is-active {
    display: block;
}

body .roscoe-property-gallery .roscoe-property-gallery__open {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    background: #000;
    cursor: zoom-in;
    position: relative;
    overflow: hidden;
}

body .roscoe-property-gallery .roscoe-property-gallery__open img,
body .roscoe-property-gallery .roscoe-property-gallery__open video,
body .roscoe-property-gallery .roscoe-property-gallery__open iframe {
    width: 100%;
    height: 520px;
    object-fit: cover;
    display: block;
    background: #000;
    border: 0;
    pointer-events: none;
    transition: transform .25s ease;
}

body .roscoe-property-gallery .roscoe-property-gallery__open:hover img,
body .roscoe-property-gallery .roscoe-property-gallery__open:hover video,
body .roscoe-property-gallery .roscoe-property-gallery__open:hover iframe {
    transform: scale(1.025);
}

.roscoe-property-gallery__play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    width: 64px;
    height: 44px;
    color: #db0000;
    pointer-events: none;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,.5));
    transition: transform .25s ease, color .25s ease;
}

.roscoe-property-gallery__play svg {
    width: 100%;
    height: 100%;
    display: block;
}

.roscoe-property-gallery__open:hover .roscoe-property-gallery__play {
    transform: translate(-50%, -50%) scale(1.08);
    color: #ff1f1f;
}

.roscoe-property-gallery__video-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 520px;
    color: #fff;
    background: #111;
    font-size: 22px;
}

.roscoe-property-gallery__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 48px;
    height: 74px;
    border: 0;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: 48px;
    line-height: 1;
    cursor: pointer;
}

.roscoe-property-gallery__nav--prev { left: 12px; }
.roscoe-property-gallery__nav--next { right: 12px; }

.roscoe-property-gallery__counter {
    position: absolute;
    right: 14px;
    bottom: 14px;
    z-index: 6;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(0,0,0,.65);
    color: #fff;
    font-size: 13px;
}

.roscoe-property-gallery__thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px;
    background: #111;
}

.roscoe-property-gallery__thumb {
    flex: 0 0 auto;
    width: 92px;
    height: 64px;
    border: 2px solid transparent;
    padding: 0;
    background: #222;
    color: #fff;
    cursor: pointer;
    overflow: hidden;
    font-size: 12px;
}

.roscoe-property-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.roscoe-property-gallery__thumb.is-active {
    border-color: #fff;
}

/* Desktop: layout em grade tipo Roscoe/portal imobiliário */
@media (min-width: 769px) {
    body .roscoe-property-gallery--desktop-grid {
        background: transparent;
    }

    body .roscoe-property-gallery--desktop-grid .roscoe-property-gallery__viewport {
        height: 50vh;
        min-height: 420px;
        max-height: 700px;
        background: transparent;
        overflow: hidden;
        border-radius: 0;
    }

    body .roscoe-property-gallery--desktop-grid .roscoe-property-gallery__track {
        display: grid;
        grid-template-columns: 2fr 1fr 1fr 1fr;
        grid-template-rows: 1fr 1fr;
        gap: 6px;
        height: 50vh;
        min-height: 420px;
        max-height: 700px;
        width: 100%;
    }

    body .roscoe-property-gallery--desktop-grid .roscoe-property-gallery__slide {
        display: block !important;
        width: 100%;
        height: 100%;
        min-width: 0;
    }

    body .roscoe-property-gallery--desktop-grid .roscoe-property-gallery__slide:first-child {
        grid-column: 1 / 2;
        grid-row: 1 / 3;
    }

    body .roscoe-property-gallery--desktop-grid .roscoe-property-gallery__slide:nth-child(n+8) {
        display: none !important;
    }

    body .roscoe-property-gallery--desktop-grid .roscoe-property-gallery__open,
    body .roscoe-property-gallery--desktop-grid .roscoe-property-gallery__open img,
    body .roscoe-property-gallery--desktop-grid .roscoe-property-gallery__open video,
    body .roscoe-property-gallery--desktop-grid .roscoe-property-gallery__open iframe,
    body .roscoe-property-gallery--desktop-grid .roscoe-property-gallery__video-placeholder {
        width: 100%;
        height: 100%;
    }

    body .roscoe-property-gallery--desktop-grid .roscoe-property-gallery__nav,
    body .roscoe-property-gallery--desktop-grid .roscoe-property-gallery__thumbs {
        display: none !important;
    }

    body .roscoe-property-gallery--desktop-grid .roscoe-property-gallery__counter {
        right: 16px;
        bottom: 16px;
        font-size: 14px;
        padding: 8px 13px;
    }
}

/* Lightbox */
.roscoe-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.96);
}

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

.roscoe-lightbox__content {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.roscoe-lightbox__content img,
.roscoe-lightbox__content video {
    max-width: 100vw;
    max-height: 100vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    background: #000;
}

.roscoe-lightbox__content iframe {
    width: 100vw;
    height: 100vh;
    border: 0;
    background: #000;
}

.roscoe-lightbox__close,
.roscoe-lightbox__nav {
    position: fixed;
    z-index: 1000001;
    border: 0;
    color: #fff;
    cursor: pointer;
}

.roscoe-lightbox__close {
    top: 18px;
    right: 24px;
    width: 54px;
    height: 54px;
    background: rgba(0,0,0,.35);
    font-size: 46px;
    line-height: 46px;
}

.roscoe-lightbox__nav {
    top: 50%;
    transform: translateY(-50%);
    width: 58px;
    height: 86px;
    background: rgba(255,255,255,.12);
    font-size: 58px;
    line-height: 58px;
}

.roscoe-lightbox__prev { left: 20px; }
.roscoe-lightbox__next { right: 20px; }


/* V1.2 - indicador de mais fotos no último item visível do desktop */
.roscoe-property-gallery__more {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: rgba(0,0,0,.56);
    color: #fff;
    font-size: 34px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: .02em;
    pointer-events: none;
}

.roscoe-property-gallery__more small {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}

@media (min-width: 769px) {
    .roscoe-property-gallery__more {
        display: flex;
    }
}

/* V1.4 - contador do lightbox */
.roscoe-lightbox__counter {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    z-index: 1000001;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
}

/* Mobile: largura total da janela + slider */
@media (max-width: 768px) {
    body .roscoe-property-gallery {
        width: 100vw;
        max-width: 100vw;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
        background: #000;
    }

    body .roscoe-property-gallery .roscoe-property-gallery__viewport {
        height: AUTO;
        background: #000;
    }

    body .roscoe-property-gallery .roscoe-property-gallery__track {
        display: block;
        height: auto;
    }

    body .roscoe-property-gallery .roscoe-property-gallery__slide {
        display: none !important;
        width: 100%;
    }

    body .roscoe-property-gallery .roscoe-property-gallery__slide.is-active {
        display: block !important;
    }

    body .roscoe-property-gallery .roscoe-property-gallery__open {
        width: 100%;
        height: clamp(225px, 40vh, 275px);
        min-height: 225px;
        max-height: 275px;
        overflow: hidden;
    }

    body .roscoe-property-gallery .roscoe-property-gallery__open img,
    body .roscoe-property-gallery .roscoe-property-gallery__open video,
    body .roscoe-property-gallery .roscoe-property-gallery__open iframe,
    body .roscoe-property-gallery .roscoe-property-gallery__video-placeholder {
        width: 100%;
        height: 100%;
        min-height: 0;
        max-height: none;
        object-fit: cover;
        object-position: center center;
    }

    @supports (height: 100dvh) {
        body .roscoe-property-gallery .roscoe-property-gallery__open {
            height: clamp(300px, 50dvh, 420px);
        }
    }

    .roscoe-property-gallery__thumbs {
        display: none;
    }

    .roscoe-property-gallery__nav {
        display: block;
        width: 42px;
        height: 64px;
        font-size: 42px;
        background: rgba(0,0,0,.45);
    }

    .roscoe-property-gallery__nav--prev { left: 8px; }
    .roscoe-property-gallery__nav--next { right: 8px; }

    .roscoe-property-gallery__counter {
        right: 12px;
        bottom: 12px;
    }

    .roscoe-lightbox__close {
        top: 10px;
        right: 10px;
        width: 48px;
        height: 48px;
        font-size: 42px;
    }

    .roscoe-lightbox__nav {
        width: 44px;
        height: 68px;
        font-size: 46px;
    }

    .roscoe-lightbox__prev { left: 8px; }
    .roscoe-lightbox__next { right: 8px; }

    .roscoe-property-gallery__play {
        width: 54px;
        height: 38px;
    }

    .roscoe-lightbox__counter {
        bottom: 14px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    body .roscoe-property-gallery .roscoe-property-gallery__open {
        height: clamp(225px, 40vh, 275px);
        min-height: 225px;
        max-height: 275px;
    }

    @supports (height: 100dvh) {
        body .roscoe-property-gallery .roscoe-property-gallery__open {
            height: clamp(300px, 50dvh, 380px);
        }
    }
}


/* v1.0.5 - reforço para temas antigos sem wp_head/wp_footer adequado */
@media (min-width: 769px) {
    body .roscoe-property-gallery.roscoe-property-gallery--desktop-grid {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 30px !important;
        overflow: hidden !important;
        background: transparent !important;
    }

    body .roscoe-property-gallery.roscoe-property-gallery--desktop-grid .roscoe-property-gallery__viewport {
        display: block !important;
        width: 100% !important;
        height: 50vh !important;
        min-height: 420px !important;
        max-height: 700px !important;
        overflow: hidden !important;
        position: relative !important;
    }

    body .roscoe-property-gallery.roscoe-property-gallery--desktop-grid .roscoe-property-gallery__track {
        display: grid !important;
        grid-template-columns: 2fr 1fr 1fr 1fr !important;
        grid-template-rows: 1fr 1fr !important;
        gap: 6px !important;
        width: 100% !important;
        height: 50vh !important;
        min-height: 420px !important;
        max-height: 700px !important;
        overflow: hidden !important;
    }

    body .roscoe-property-gallery.roscoe-property-gallery--desktop-grid .roscoe-property-gallery__slide {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        min-width: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body .roscoe-property-gallery.roscoe-property-gallery--desktop-grid .roscoe-property-gallery__slide:first-child {
        grid-column: 1 / 2 !important;
        grid-row: 1 / 3 !important;
    }

    body .roscoe-property-gallery.roscoe-property-gallery--desktop-grid .roscoe-property-gallery__slide:nth-child(n+8) {
        display: none !important;
    }

    body .roscoe-property-gallery.roscoe-property-gallery--desktop-grid .roscoe-property-gallery__open,
    body .roscoe-property-gallery.roscoe-property-gallery--desktop-grid .roscoe-property-gallery__open img,
    body .roscoe-property-gallery.roscoe-property-gallery--desktop-grid .roscoe-property-gallery__open video,
    body .roscoe-property-gallery.roscoe-property-gallery--desktop-grid .roscoe-property-gallery__open iframe {
        width: 100% !important;
        height: 100% !important;
        max-width: none !important;
        max-height: none !important;
        object-fit: cover !important;
        display: block !important;
    }
}

/* v1.0.6 - Capa de vídeo no grid */
body .roscoe-property-gallery .roscoe-property-gallery__video-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #000;
}

body .roscoe-property-gallery .roscoe-property-gallery__thumb--video {
    position: relative;
    overflow: hidden;
}

body .roscoe-property-gallery .roscoe-property-gallery__thumb--video img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

body .roscoe-property-gallery .roscoe-property-gallery__thumb-play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 20px;
    color: #db0000;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,.55));
    pointer-events: none;
}

body .roscoe-property-gallery .roscoe-property-gallery__thumb-play svg {
    width: 100%;
    height: 100%;
    display: block;
}


/* v1.0.7 - Desktop com 7 mídias: 1 principal + 6 secundárias em 3 colunas */
@media (min-width: 769px) {
  body .roscoe-property-gallery.roscoe-property-gallery--desktop-grid .roscoe-property-gallery__track {
    grid-template-columns: 2fr 1fr 1fr 1fr !important;
    grid-template-rows: 1fr 1fr !important;
  }

  body .roscoe-property-gallery.roscoe-property-gallery--desktop-grid .roscoe-property-gallery__slide:nth-child(n+8) {
    display: none !important;
  }
}


/* v1.0.8 - Altura desktop do grid em 50vh */
@media (min-width: 769px) {
  body .roscoe-property-gallery.roscoe-property-gallery--desktop-grid .roscoe-property-gallery__viewport,
  body .roscoe-property-gallery.roscoe-property-gallery--desktop-grid .roscoe-property-gallery__track {
    height: 50vh !important;
    min-height: 420px !important;
    max-height: 700px !important;
  }
}


/* v1.0.9 - V1.1 + V1.2 + V1.4
   - Ícone de play SVG vermelho menor.
   - Último item visível no desktop indica +N Fotos quando houver mais mídias.
   - Lightbox exibe contador central inferior. */

/* v1.1.1 - UX/performance/SEO refinements */
body .roscoe-property-gallery .roscoe-property-gallery__counter::before {
    content: "📷 ";
}

.roscoe-lightbox__caption {
    position: fixed;
    left: 50%;
    bottom: 72px;
    transform: translateX(-50%);
    z-index: 1000001;
    max-width: min(900px, 86vw);
    padding: 8px 14px;
    border-radius: 8px;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: 14px;
    line-height: 1.35;
    text-align: center;
    display: none;
}

.roscoe-lightbox__thumbs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000000;
    height: 74px;
    padding: 8px 72px;
    background: rgba(0,0,0,.72);
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.roscoe-lightbox__thumb {
    flex: 0 0 auto;
    width: 86px;
    height: 56px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 3px;
    background: #222;
    color: #fff;
    cursor: pointer;
    overflow: hidden;
}

.roscoe-lightbox__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.roscoe-lightbox__thumb.is-active {
    border-color: #fff;
}

.roscoe-pg-caption {
    margin-top: 6px;
}

@media (max-width: 768px) {
    .roscoe-lightbox__thumbs {
        display: none;
    }

    .roscoe-lightbox__caption {
        bottom: 52px;
        max-width: 90vw;
        font-size: 13px;
    }
}

@media (min-width: 769px) {
    .roscoe-lightbox__content {
        height: calc(100vh - 74px);
        padding-bottom: 74px;
    }

    .roscoe-lightbox__counter {
        bottom: 86px;
    }
}

/* ===========================
   V1.1.3 - Zoom, fullscreen e polish dos botões
=========================== */
body .roscoe-property-gallery .roscoe-property-gallery__nav,
body .roscoe-lightbox .roscoe-lightbox__nav,
body .roscoe-lightbox .roscoe-lightbox__close,
body .roscoe-lightbox .roscoe-lightbox__fullscreen {
    -webkit-tap-highlight-color: transparent;
    transition: transform .18s ease, background .18s ease, opacity .18s ease, box-shadow .18s ease;
}

body .roscoe-property-gallery .roscoe-property-gallery__nav:hover,
body .roscoe-lightbox .roscoe-lightbox__nav:hover,
body .roscoe-lightbox .roscoe-lightbox__close:hover,
body .roscoe-lightbox .roscoe-lightbox__fullscreen:hover {
    transform: translateY(-50%) scale(1.04);
    box-shadow: 0 10px 28px rgba(0,0,0,.28);
}

body .roscoe-lightbox .roscoe-lightbox__close,
body .roscoe-lightbox .roscoe-lightbox__fullscreen {
    top: 22px;
    transform: none;
    border-radius: 999px;
    width: 48px;
    height: 48px;
    background: rgba(20,20,20,.72);
    border: 1px solid rgba(255,255,255,.18);
    color: #fff;
    backdrop-filter: blur(6px);
}

body .roscoe-lightbox .roscoe-lightbox__close:hover,
body .roscoe-lightbox .roscoe-lightbox__fullscreen:hover {
    transform: scale(1.06);
    background: rgba(0,0,0,.9);
}

body .roscoe-lightbox .roscoe-lightbox__fullscreen {
    position: fixed;
    right: 86px;
    z-index: 1000001;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

body .roscoe-lightbox .roscoe-lightbox__toolbar {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1000002;
}

body .roscoe-lightbox .roscoe-lightbox__counter[aria-live] {
    min-width: 72px;
    text-align: center;
}

body .roscoe-lightbox .roscoe-lightbox__content.is-zoomed {
    overflow: auto;
    cursor: grab;
}

body .roscoe-lightbox .roscoe-lightbox__content img[data-roscoe-zoomable] {
    transition: transform .22s ease;
    transform-origin: center center;
    cursor: zoom-in;
}

body .roscoe-lightbox .roscoe-lightbox__content img.is-zoomed {
    max-width: none;
    max-height: none;
}

body .roscoe-lightbox .roscoe-lightbox__zoom-hint {
    position: fixed;
    left: 50%;
    bottom: 96px;
    transform: translateX(-50%);
    z-index: 1000001;
    display: none;
    color: rgba(255,255,255,.82);
    background: rgba(0,0,0,.42);
    border: 1px solid rgba(255,255,255,.12);
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 12px;
    pointer-events: none;
}

body .roscoe-lightbox button:focus-visible,
body .roscoe-property-gallery button:focus-visible {
    outline: 3px solid rgba(219,0,0,.88);
    outline-offset: 3px;
}

@media (max-width: 768px) {
    body .roscoe-lightbox .roscoe-lightbox__close,
    body .roscoe-lightbox .roscoe-lightbox__fullscreen {
        width: 42px;
        height: 42px;
        top: 14px;
    }

    body .roscoe-lightbox .roscoe-lightbox__fullscreen {
        right: 68px;
        font-size: 21px;
    }

    body .roscoe-lightbox .roscoe-lightbox__zoom-hint {
        bottom: 76px;
        font-size: 11px;
    }
}
