/* 3D Scroll Gallery Module Styles */

.et_pb_3d_scroll_gallery {
    position: relative;
    width: 100%;
    min-height: 550px;
    background-color: #000000;
    overflow: hidden;
    box-sizing: border-box;
}

.et_pb_3d_scroll_gallery .sg {
    position: relative;
    width: 100%;
    height: var(--sg-module-height, 100vh);
    min-height: 550px;
    overflow: hidden;
    background: transparent;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    cursor: grab;
    box-sizing: border-box;
}

.et_pb_3d_scroll_gallery .sg.drag {
    cursor: grabbing;
}

.et_pb_3d_scroll_gallery .sg-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: block;
}

.et_pb_3d_scroll_gallery .sg-stage {
    position: absolute;
    inset: 0;
    perspective: 700px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.et_pb_3d_scroll_gallery .sg-scene {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    transform-style: preserve-3d;
    pointer-events: auto;
}

.et_pb_3d_scroll_gallery .sg-card {
    position: absolute;
    left: 0;
    top: 0;
    width: 160px;
    height: 208px;
    margin: -104px 0 0 -80px;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    will-change: transform, opacity;
}

.et_pb_3d_scroll_gallery .sg-tile {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
    cursor: pointer;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.65), 0 0 15px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition:
        transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
        box-shadow 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
        border-color 0.3s ease;
}

.et_pb_3d_scroll_gallery .sg-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    -webkit-user-drag: none;
    border-radius: 11px;
}

.et_pb_3d_scroll_gallery .sg-tile:hover {
    transform: scale(1.1);
    border-color: var(--sg-hover-color, rgba(49, 184, 198, 0.9));
    box-shadow:
        0 25px 50px var(--sg-hover-color, rgba(49, 184, 198, 0.45)),
        0 0 35px var(--sg-hover-color, rgba(49, 184, 198, 0.3));
}

.et_pb_3d_scroll_gallery .sg-modal {
    position: absolute;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: default;
}

.et_pb_3d_scroll_gallery .sg-modal.open {
    display: flex;
    animation: sgFade 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes sgFade {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.et_pb_3d_scroll_gallery .sg-close {
    position: absolute;
    top: 24px;
    right: 28px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #ffffff;
    z-index: 100000;
    transition: background 0.2s ease, transform 0.2s ease;
}

.et_pb_3d_scroll_gallery .sg-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg) scale(1.05);
}

.et_pb_3d_scroll_gallery .sg-big {
    perspective: 1000px;
    width: min(88vw, 460px);
    max-width: 90%;
    box-sizing: border-box;
}

.et_pb_3d_scroll_gallery .sg-big img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    display: block;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.15s ease-out;
    box-shadow:
        0 40px 80px rgba(0, 0, 0, 0.8),
        0 0 50px rgba(49, 184, 198, 0.3);
}

/* Divi Visual Builder specific helper styles */
.et-fb .et_pb_3d_scroll_gallery,
.et-vb .et_pb_3d_scroll_gallery,
[data-vb-id] .et_pb_3d_scroll_gallery {
    min-height: 550px;
    display: block;
}
