/* ======================================================
   JTM SOLUÇÕES
   GALERIA ÚNICA V3
   ====================================================== */

html,
body{
    width:100%;
    max-width:100%;
    overflow-x:hidden !important;
}

#jtm-gallery-unica-2026{
    position:relative;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;

    display:grid !important;
    grid-template-columns:repeat(4,minmax(0,1fr));
    grid-auto-flow:dense;

    gap:8px;
    margin:18px 0 0 !important;
    padding:0 !important;

    flex:0 0 100% !important;
    grid-column:1 / -1 !important;

    overflow:hidden;
}

#jtm-gallery-unica-2026 .jtm-gallery-item{
    position:relative;
    display:block;

    width:100%;
    min-width:0;

    aspect-ratio:4 / 3;

    margin:0;
    padding:0;
    border:0;
    border-radius:4px;

    overflow:hidden;

    background:#e8ebf2;

    cursor:zoom-in;

    appearance:none;

    opacity:0;
    transform:translateY(16px);

    transition:
        opacity .65s ease,
        transform .65s cubic-bezier(.2,.75,.25,1);
}

#jtm-gallery-unica-2026 .jtm-gallery-item.visible{
    opacity:1;
    transform:none;
}

/* Imagem principal */
#jtm-gallery-unica-2026 .jtm-gallery-item:nth-child(1){
    grid-column:span 2;
    grid-row:span 2;
    aspect-ratio:auto;
}

/* Pequenas variações editoriais */
#jtm-gallery-unica-2026 .jtm-gallery-item:nth-child(7n+5){
    grid-column:span 2;
}

#jtm-gallery-unica-2026 img{
    display:block;

    width:100%;
    height:100%;

    object-fit:cover;

    transition:
        transform .55s cubic-bezier(.2,.75,.25,1),
        filter .35s ease;
}

#jtm-gallery-unica-2026 .jtm-gallery-item:hover img{
    transform:scale(1.04);
    filter:saturate(1.05) contrast(1.015);
}

#jtm-gallery-unica-2026 .jtm-gallery-item::before{
    content:"";

    position:absolute;
    inset:0;
    z-index:2;

    pointer-events:none;

    background:
        linear-gradient(
            to top,
            rgba(5,10,25,.42),
            transparent 42%
        );

    opacity:.15;

    transition:opacity .3s ease;
}

#jtm-gallery-unica-2026 .jtm-gallery-item:hover::before{
    opacity:.75;
}

.jtm-gallery-expand{
    position:absolute;

    right:13px;
    bottom:13px;

    z-index:3;

    width:38px;
    height:38px;

    display:flex;
    align-items:center;
    justify-content:center;

    border-radius:50%;

    background:rgba(7,13,30,.75);
    backdrop-filter:blur(8px);

    color:#fff;

    opacity:0;
    transform:translateY(5px);

    transition:.25s ease;
}

.jtm-gallery-item:hover .jtm-gallery-expand{
    opacity:1;
    transform:none;
}

.jtm-gallery-expand svg{
    width:17px;
    height:17px;
}

/* GALERIA ANTIGA */

.jtm-gallery-original-hidden{
    display:none !important;
}

/* LIGHTBOX */

#jtm-gallery-lightbox{
    position:fixed;

    inset:0;

    z-index:99999999;

    width:100vw;
    height:100dvh;

    display:flex;
    align-items:center;
    justify-content:center;

    padding:70px 82px;

    background:rgba(4,8,19,.95);

    backdrop-filter:blur(11px);

    opacity:0;
    visibility:hidden;
    pointer-events:none;

    transition:
        opacity .28s ease,
        visibility .28s ease;
}

#jtm-gallery-lightbox.open{
    opacity:1;
    visibility:visible;
    pointer-events:auto;
}

.jtm-lightbox-stage{
    width:100%;
    height:100%;

    display:flex;
    align-items:center;
    justify-content:center;
}

#jtm-lightbox-photo{
    display:block;

    max-width:100%;
    max-height:calc(100dvh - 150px);

    width:auto;
    height:auto;

    object-fit:contain;

    box-shadow:
        0 30px 90px rgba(0,0,0,.42);
}

.jtm-lightbox-close,
.jtm-lightbox-prev,
.jtm-lightbox-next{
    position:absolute;

    z-index:10;

    border:
        1px solid rgba(255,255,255,.22);

    background:
        rgba(255,255,255,.09);

    color:#fff;

    backdrop-filter:blur(9px);

    cursor:pointer;

    transition:.25s ease;
}

.jtm-lightbox-close:hover,
.jtm-lightbox-prev:hover,
.jtm-lightbox-next:hover{
    background:#f58634;
    border-color:#f58634;
}

.jtm-lightbox-close{
    top:18px;
    right:20px;

    width:46px;
    height:46px;

    border-radius:50%;

    font-size:28px;
}

.jtm-lightbox-prev,
.jtm-lightbox-next{
    top:50%;

    width:48px;
    height:62px;

    transform:translateY(-50%);

    border-radius:5px;

    font-size:31px;
}

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

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

.jtm-lightbox-info{
    position:absolute;

    left:50%;
    bottom:18px;

    transform:translateX(-50%);

    width:min(760px,calc(100% - 30px));

    color:#fff;
    text-align:center;

    font-family:
        Montserrat,
        Arial,
        sans-serif;
}

#jtm-lightbox-caption{
    display:block;

    font-size:12px;
    font-weight:600;

    line-height:1.45;

    opacity:.88;
}

#jtm-lightbox-counter{
    display:block;

    margin-top:5px;

    font-size:10px;
    font-weight:700;

    letter-spacing:.12em;

    opacity:.52;
}

/* TABLET */

@media(max-width:900px){

    #jtm-gallery-unica-2026{
        grid-template-columns:
            repeat(2,minmax(0,1fr));
    }

    #jtm-gallery-unica-2026
    .jtm-gallery-item:nth-child(1),

    #jtm-gallery-unica-2026
    .jtm-gallery-item:nth-child(7n+5){

        grid-column:span 1;
        grid-row:span 1;

        aspect-ratio:4 / 3;
    }

    #jtm-gallery-lightbox{
        padding:65px 20px;
    }
}

/* MOBILE */

@media(max-width:560px){

    #jtm-gallery-unica-2026{
        grid-template-columns:
            repeat(2,minmax(0,1fr));

        gap:5px;
    }

    #jtm-gallery-unica-2026
    .jtm-gallery-item{

        aspect-ratio:1 / 1;
    }

    .jtm-gallery-expand{
        display:none;
    }

    #jtm-gallery-lightbox{
        padding:
            65px 10px
            78px;
    }

    #jtm-lightbox-photo{
        max-height:
            calc(100dvh - 155px);
    }

    .jtm-lightbox-prev{
        left:7px;
    }

    .jtm-lightbox-next{
        right:7px;
    }
}

@media(prefers-reduced-motion:reduce){

    #jtm-gallery-unica-2026 *,
    #jtm-gallery-lightbox *{
        transition:none !important;
    }
}

/* ==========================================================
   JTM | GALERIA FINAL ORGANIZADA
   Grade contínua, preenchida e sem vazios
   ========================================================== */

#jtm-gallery-unica-2026{
    width:calc(100% + 0px) !important;
    max-width:none !important;
    min-width:0 !important;

    display:grid !important;

    grid-template-columns:
        repeat(4,minmax(0,1fr)) !important;

    grid-auto-rows:auto !important;
    grid-auto-flow:row dense !important;

    gap:6px !important;

    margin-top:24px !important;
    margin-left:0 !important;
    margin-right:0 !important;
    margin-bottom:0 !important;

    padding:0 !important;

    overflow:hidden !important;
}

/* Remove qualquer destaque anterior que gerava buracos */

#jtm-gallery-unica-2026
.jtm-gallery-item,

#jtm-gallery-unica-2026
.jtm-gallery-item:nth-child(1),

#jtm-gallery-unica-2026
.jtm-gallery-item:nth-child(7n+5),

#jtm-gallery-unica-2026
.jtm-gallery-item:nth-child(n){

    grid-column:auto !important;
    grid-row:auto !important;

    width:100% !important;
    height:auto !important;

    aspect-ratio:4 / 3 !important;

    margin:0 !important;
    padding:0 !important;

    border-radius:2px !important;

    overflow:hidden !important;
}

#jtm-gallery-unica-2026
.jtm-gallery-item img{

    width:100% !important;
    height:100% !important;

    object-fit:cover !important;

    display:block !important;
}

/* Faz a galeria ocupar visualmente toda a largura útil
   mesmo quando o container Elementor possui padding interno */

#jtm-gallery-unica-2026{
    position:relative !important;
}

/* Tablet */

@media(max-width:1024px){

    #jtm-gallery-unica-2026{

        grid-template-columns:
            repeat(3,minmax(0,1fr)) !important;

        gap:5px !important;
    }
}

/* Mobile */

@media(max-width:767px){

    #jtm-gallery-unica-2026{

        grid-template-columns:
            repeat(2,minmax(0,1fr)) !important;

        gap:4px !important;
    }

    #jtm-gallery-unica-2026
    .jtm-gallery-item{

        aspect-ratio:1 / 1 !important;
    }
}

/* Mobile pequeno */

@media(max-width:420px){

    #jtm-gallery-unica-2026{

        grid-template-columns:
            repeat(2,minmax(0,1fr)) !important;

        gap:3px !important;
    }
}
