.lotus-portfolio-gallery,
.lotus-portfolio-gallery * {
    box-sizing: border-box;
}

.lotus-portfolio-gallery {
    width: 100%;
    overflow: hidden;
}

/* ============================================================
   MAIN BOX
============================================================ */

.lotus-gallery-box {
    position: relative;
    width: 100%;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 12px;
    /* border: 1px solid #ffffff1a; */
}

/* ============================================================
   HEADER
============================================================ */

.lotus-gallery-header {
    position: relative;
    z-index: 100;
    text-align: center;
    padding: 65px 20px 0;
}

.lotus-gallery-header h2 {
    margin: 0 0 30px !important;
    padding: 0 !important;
    font-size: clamp(40px, 5vw, 72px);
    /* Can be overridden by Divi */
    line-height: 1.05;
    font-weight: 700;
    letter-spacing: -2px;
}

/* ============================================================
   BUTTON
============================================================ */

.lotus-gallery-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 24px;
    border-radius: 30px;
    background: #fff;

    color: #000;

    text-decoration: none !important;

    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    line-height: 1;

    transition:
        background 0.25s ease,
        transform 0.25s ease !important;
}

.lotus-gallery-button:hover {
    background: #e6e6e6;

}

.lotus-gallery-arrow,
.lotus-gallery-button .et-pb-icon {
    display: inline-block;
    font-size: 1.3em !important;
    line-height: 1;
    transition: transform 0.25s ease;
}

/* .lotus-gallery-button:hover .lotus-gallery-arrow,
.lotus-gallery-button:hover .et-pb-icon {
    transform: translateX(5px);
} */
.lotus-gallery-window {
    position: relative;
    width: 100%;
    height: 320px;
    margin-top: 20px;
    overflow: hidden;
}

.lotus-gallery-track {
    position: absolute;
    left: 50%;
    bottom: -130px;
    display: flex;
    align-items: flex-end;
    width: max-content;
    min-width: max-content;
    height: 330px;
    padding: 0;
    margin: 0;
    transform: translateX(-50%);
    will-change: transform;
    white-space: nowrap;
}

.lotus-gallery-card {
    position: relative;
    flex: 0 0 380px;
    width: 380px;
    height: 214px;
    margin-left: -285px;
    padding: 0;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    opacity: 0;
    transform: perspective(5000px) rotateY(-45deg) translate3d(0, 200px, 0);
    transform-origin: center center;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    will-change: transform, opacity;
    transition:
        transform 200ms cubic-bezier(0.25, 0.1, 0.25, 1),
        opacity 200ms ease;
    box-shadow:
        rgba(0, 0, 0, 0.01) 0.8px 0 0.8px 0,
        rgba(0, 0, 0, 0.03) 2.4px 0 2.4px 0,
        rgba(0, 0, 0, 0.08) 6.4px 0 6.4px 0,
        rgba(0, 0, 0, 0.25) 20px 0 20px 0;
}

/* First card */

.lotus-gallery-card:first-child {
    margin-left: 0;
}

/* ============================================================
   IMAGE
============================================================ */

.lotus-gallery-card img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    object-fit: cover;
    object-position: left top;
    user-select: none;
    -webkit-user-drag: none;
    /* border-radius is passed down if needed, but the container .lotus-gallery-card hides overflow */
}

/* ============================================================
   HOVER IMAGE (Pure CSS for Divi 5 Visual Builder compatibility)
============================================================ */
@media (min-width: 981px) {

    /* When track is hovered, push all cards down to 0 */
    .lotus-gallery-track:hover .lotus-gallery-card {
        transform: perspective(5000px) rotateY(-45deg) translate3d(0, 0, 0) !important;
    }

    /* Pop up the specific hovered card */
    .lotus-gallery-track .lotus-gallery-card:hover {
        transform: perspective(5000px) rotateY(-45deg) translate3d(0, -120px, 0) !important;
    }

    /* Scale the image slightly inside the hovered card */
    .lotus-gallery-card:hover img {
        transform: scale(1.02);
    }
}

/* ============================================================
   TABLET
============================================================ */


/* ============================================================
   MOBILE
============================================================ */

@media (max-width: 980px) {
    .lotus-portfolio-gallery {
        padding: 50px 10px;
    }

    .lotus-gallery-box {
        min-height: auto;
    }

    .lotus-gallery-header {
        padding: 50px 20px 30px;
    }

    .lotus-gallery-header h2 {
        font-size: 40px !important;

        letter-spacing: -1.5px;

        margin-bottom: 25px !important;
    }

    /* ========================================================
       MOBILE WINDOW

       All images can exist here.
       Horizontal scrolling handles overflow.
    ======================================================== */

    .lotus-gallery-window {
        height: auto;
        margin-top: 0;
        padding: 10px 0 35px;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
        -webkit-overflow-scrolling: touch;
    }

    .lotus-gallery-window::-webkit-scrollbar {
        display: none;
    }

    /* ========================================================
       MOBILE TRACK

       Automatically grows for 10 / 20 / 30+ images.
    ======================================================== */

    .lotus-gallery-track {
        position: relative;

        left: auto;
        bottom: auto;
        width: max-content;
        min-width: max-content;
        height: auto;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 16px;
        padding: 0 15px;
        margin: 0;
        transform: none !important;
    }

    /* ========================================================
       MOBILE CARD
    ======================================================== */

    .lotus-gallery-card {
        flex: 0 0 260px;
        width: 260px;
        height: 146px;
        margin-left: 0 !important;
        opacity: 1 !important;
        transform: none !important;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
        transition: transform 0.25s ease;
    }

    .lotus-gallery-card:hover {
        transform: scale(1.03) !important;
    }

    .lotus-gallery-card.lotus-card-hover {
        transform: scale(1.03) !important;
    }
}

/* ============================================================
   REDUCED MOTION
============================================================ */

@media (prefers-reduced-motion: reduce) {
    .lotus-gallery-card {
        transition: none !important;
    }
}