/*
 * QARAR B2B — Independent Premium Gallery
 */

.qarar-home-v2 > [data-builder-section="gallery"] {
    order: 65 !important;
}

.qarar-gallery-section {
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 16%, rgba(201,9,29,.055), transparent 32%),
        #fff;
}

.qarar-gallery-heading {
    margin-bottom: 24px;
}

.qarar-gallery {
    --gallery-card-width: min(58vw, 650px);
    --gallery-card-height: clamp(330px, 40vw, 500px);
    position: relative;
}

.qarar-gallery__filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 28px;
}

.qarar-gallery__filter {
    min-height: 38px;
    padding: 7px 16px;
    border: 1px solid #e6dfda;
    border-radius: 999px;
    background: #fff;
    color: #555;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition:
        color .2s ease,
        border-color .2s ease,
        background .2s ease,
        transform .2s ease;
}

.qarar-gallery__filter:hover {
    transform: translateY(-1px);
    border-color: rgba(201,9,29,.35);
    color: #c9091d;
}

.qarar-gallery__filter.is-active {
    border-color: #c9091d;
    background: #c9091d;
    color: #fff;
}

.qarar-gallery__stage {
    position: relative;
    height: var(--gallery-card-height);
    perspective: 1300px;
    transform-style: preserve-3d;
}

.qarar-gallery__card {
    position: absolute;
    top: 0;
    left: 50%;
    width: var(--gallery-card-width);
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 22px;
    background: #171717;
    box-shadow: 0 24px 60px rgba(0,0,0,.16);
    cursor: pointer;
    transform-origin: center;
    transition:
        transform .65s cubic-bezier(.2,.75,.2,1),
        opacity .5s ease,
        filter .5s ease,
        box-shadow .4s ease;
}

.qarar-gallery__card[hidden] {
    display: none !important;
}

.qarar-gallery__card picture,
.qarar-gallery__card img {
    display: block;
    width: 100%;
    height: 100%;
}

.qarar-gallery__card img {
    object-fit: cover;
    transform: scale(1.015);
    transition: transform .7s cubic-bezier(.2,.75,.2,1);
}

.qarar-gallery__shade {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(
            180deg,
            rgba(10,10,10,.04) 20%,
            rgba(10,10,10,.18) 58%,
            rgba(10,10,10,.74) 100%
        );
}

.qarar-gallery__caption {
    position: absolute;
    z-index: 2;
    right: 24px;
    bottom: 22px;
    left: 24px;
    display: grid;
    gap: 3px;
    color: #fff;
    text-align: right;
}

.qarar-gallery__caption strong {
    font-size: clamp(18px,2vw,26px);
    line-height: 1.35;
}

.qarar-gallery__caption small {
    color: rgba(255,255,255,.82);
    font-size: 11px;
    font-weight: 700;
}

.qarar-gallery__card.is-active {
    z-index: 5;
    opacity: 1;
    filter: none;
    transform: translateX(-50%) translateZ(0) scale(1);
    box-shadow: 0 30px 80px rgba(0,0,0,.22);
}

.qarar-gallery__card.is-prev {
    z-index: 4;
    opacity: .82;
    filter: saturate(.82) brightness(.88);
    transform:
        translateX(calc(-50% + 70%))
        translateZ(-120px)
        rotateY(-3deg)
        scale(.86);
}

.qarar-gallery__card.is-next {
    z-index: 4;
    opacity: .82;
    filter: saturate(.82) brightness(.88);
    transform:
        translateX(calc(-50% - 70%))
        translateZ(-120px)
        rotateY(3deg)
        scale(.86);
}

.qarar-gallery__card.is-far-prev {
    z-index: 2;
    opacity: .25;
    transform:
        translateX(calc(-50% + 112%))
        translateZ(-220px)
        scale(.68);
}

.qarar-gallery__card.is-far-next {
    z-index: 2;
    opacity: .25;
    transform:
        translateX(calc(-50% - 112%))
        translateZ(-220px)
        scale(.68);
}

.qarar-gallery__card.is-hidden {
    z-index: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) scale(.6);
}

@media (hover:hover) and (pointer:fine) {
    .qarar-gallery__card.is-active:hover img {
        transform: scale(1.055);
    }

    .qarar-gallery__card.is-active:hover {
        box-shadow: 0 36px 90px rgba(0,0,0,.26);
    }
}

.qarar-gallery__controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 26px;
}

.qarar-gallery__arrow {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid #ded7d2;
    border-radius: 50%;
    background: #fff;
    color: #111;
    font: inherit;
    font-size: 18px;
    cursor: pointer;
    transition:
        color .2s ease,
        border-color .2s ease,
        background .2s ease,
        transform .2s ease;
}

.qarar-gallery__arrow:hover:not(:disabled) {
    color: #fff;
    border-color: #c9091d;
    background: #c9091d;
    transform: translateY(-2px);
}

.qarar-gallery__arrow:disabled {
    opacity: .35;
    cursor: default;
}

.qarar-gallery__counter {
    min-width: 74px;
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    color: #999;
    direction: ltr;
    font-size: 12px;
}

.qarar-gallery__counter strong {
    color: #c9091d;
    font-size: 20px;
    font-weight: 900;
}

.qarar-gallery-lightbox {
    position: fixed;
    z-index: 9999;
    inset: 0;
    display: grid;
    grid-template-columns: 70px minmax(0,1fr) 70px;
    align-items: center;
    gap: 16px;
    padding: 42px 24px 24px;
    background: rgba(8,8,8,.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.qarar-gallery-lightbox[hidden] {
    display: none !important;
}

.qarar-gallery-lightbox__figure {
    width: min(1100px,100%);
    margin: 0 auto;
}

.qarar-gallery-lightbox__figure img {
    display: block;
    width: 100%;
    max-height: 78vh;
    object-fit: contain;
    border-radius: 16px;
}

.qarar-gallery-lightbox__figure figcaption {
    margin-top: 14px;
    color: #fff;
    text-align: center;
    font-size: 14px;
    font-weight: 800;
}

.qarar-gallery-lightbox__close,
.qarar-gallery-lightbox__nav {
    border: 0;
    color: #fff;
    background: rgba(255,255,255,.1);
    cursor: pointer;
}

.qarar-gallery-lightbox__close {
    position: absolute;
    top: 20px;
    left: 22px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
}

.qarar-gallery-lightbox__nav {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    font-size: 20px;
}

body.qarar-gallery-lightbox-open {
    overflow: hidden;
}

.gallery-mobile-hidden {
    display: block;
}

.gallery-desktop-hidden {
    display: none;
}

@media (max-width:767px) {
    .qarar-gallery {
        --gallery-card-width: min(82vw,460px);
        --gallery-card-height: clamp(300px,105vw,430px);
    }

    .qarar-gallery__filters {
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        padding-bottom: 2px;
    }

    .qarar-gallery__filters::-webkit-scrollbar {
        display: none;
    }

    .qarar-gallery__filter {
        flex: 0 0 auto;
    }

    .qarar-gallery__card {
        border-radius: 17px;
    }

    .qarar-gallery__card.is-prev {
        opacity: .38;
        transform: translateX(calc(-50% + 88%)) scale(.72);
    }

    .qarar-gallery__card.is-next {
        opacity: .38;
        transform: translateX(calc(-50% - 88%)) scale(.72);
    }

    .qarar-gallery__card.is-far-prev,
    .qarar-gallery__card.is-far-next {
        opacity: 0;
        pointer-events: none;
    }

    .qarar-gallery-lightbox {
        grid-template-columns: 44px minmax(0,1fr) 44px;
        gap: 6px;
        padding-inline: 10px;
    }

    .qarar-gallery-lightbox__nav {
        width: 42px;
        height: 42px;
    }

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

    .gallery-desktop-hidden {
        display: block;
    }
}

@media (min-width:768px) {
    .gallery-desktop-hidden {
        display: none !important;
    }
}

@media (prefers-reduced-motion:reduce) {
    .qarar-gallery__card,
    .qarar-gallery__card img,
    .qarar-gallery__filter,
    .qarar-gallery__arrow {
        transition: none !important;
        animation: none !important;
    }
}


/* QARAR Gallery performance layer */
.qarar-gallery__card.is-active,
.qarar-gallery__card.is-prev,
.qarar-gallery__card.is-next {
    will-change: transform, opacity;
}

.qarar-gallery__card img {
    opacity: 0;
}

.qarar-gallery__card.is-media-ready img {
    opacity: 1;
}

.qarar-gallery__card.is-media-loading::before {
    content: "";
    position: absolute;
    z-index: 1;
    inset: 0;
    background:
        linear-gradient(
            110deg,
            #1c1c1c 8%,
            #282828 18%,
            #1c1c1c 33%
        );
    background-size: 200% 100%;
    animation: qararGallerySkeleton 1.2s linear infinite;
}

.qarar-gallery__card.is-media-ready::before,
.qarar-gallery__card.is-media-error::before {
    display: none;
}

@keyframes qararGallerySkeleton {
    to {
        background-position-x: -200%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .qarar-gallery__card.is-media-loading::before {
        animation: none !important;
    }
}
