.apex_gallery {
    --apex-accent: var(--dsei-copper, var(--dsei-blue, #0b6cb5));
    --apex-ink: var(--dsei-ink, #1c2430);
    --apex-paper: var(--dsei-paper, var(--dsei-surface, #f5f7fb));
    --apex-card: var(--dsei-cream, #ffffff);
    --apex-line: var(--dsei-line, #dbe3ee);
    padding: 20px 0 56px;
}

.apex_gallery--scroll {
    padding: 28px 0 12px;
}

.apex_gallery-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.apex_gallery-item,
.apex_gallery-scroll-item,
.apex_gallery-thumb {
    border: 1px solid var(--apex-line);
    background: var(--apex-card);
    padding: 0;
    overflow: hidden;
    cursor: pointer;
}

.apex_gallery-item img,
.apex_gallery-scroll-item img,
.apex_gallery-thumb img,
.apex_gallery-modal-image {
    width: 100%;
    height: 140px;
    object-fit: contain;
    background: #fff;
    display: block;
}

.apex_gallery-actions {
    margin-top: 18px;
    text-align: center;
}

.apex_gallery-view-more,
.apex_gallery-dir {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    padding: 10px 18px;
    border: 0;
    background: var(--apex-accent);
    color: #fff;
    font-weight: 650;
    cursor: pointer;
}

.apex_gallery-dir {
    min-width: 0;
    background: transparent;
    color: var(--apex-ink);
    border: 1px solid var(--apex-line);
}

.apex_gallery-dir.is-active {
    background: var(--apex-accent);
    color: #fff;
    border-color: var(--apex-accent);
}

.apex_gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(12, 18, 28, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.apex_gallery-modal[hidden] {
    display: none !important;
}

.apex_gallery-modal-dialog {
    width: min(960px, 100%);
    max-height: 92vh;
    overflow: hidden;
    background: var(--apex-card);
    display: flex;
    flex-direction: column;
}

.apex_gallery-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--apex-line);
}

.apex_gallery-modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: var(--apex-ink);
}

.apex_gallery-modal-close {
    border: 0;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--apex-ink);
}

.apex_gallery-modal-stage {
    position: relative;
    padding: 18px 56px;
    background: #111;
}

.apex_gallery-modal-image {
    height: min(52vh, 460px);
    object-fit: contain;
}

.apex_gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #111;
    cursor: pointer;
}

.apex_gallery-nav-prev { left: 10px; }
.apex_gallery-nav-next { right: 10px; }

.apex_gallery-modal-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 16px 16px;
    scroll-behavior: smooth;
}

.apex_gallery-thumb {
    flex: 0 0 92px;
}

.apex_gallery-thumb img {
    height: 68px;
}

.apex_gallery-thumb.is-active {
    outline: 2px solid var(--apex-accent);
}

.apex_gallery-slider-wrap {
    position: relative;
}

.apex_gallery-slider.owl-carousel {
    position: relative;
}

.apex_gallery-slide {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.apex_gallery-scroll-item {
    margin: 0;
    border: 1px solid var(--apex-line);
    background: #fff;
    overflow: hidden;
}

.apex_gallery-scroll-item img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    display: block;
}

.apex_gallery-arrow {
    position: absolute;
    top: 50%;
    z-index: 5;
    width: 48px;
    height: 48px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 50%;
    background: #fff;
    color: #222;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    font-size: 22px;
    line-height: 46px;
    text-align: center;
    cursor: pointer;
    transform: translateY(-50%);
}

.apex_gallery-arrow-prev { left: 12px; }
.apex_gallery-arrow-next { right: 12px; }

.apex_gallery-arrow:hover {
    background: #f4f4f4;
}

.apex_gallery-slider .owl-nav,
.apex_gallery-slider .owl-dots {
    display: none;
}

@media (max-width: 767.98px) {
    .apex_gallery-scroll-item img {
        height: 160px;
    }

    .apex_gallery-arrow {
        width: 38px;
        height: 38px;
        line-height: 36px;
        font-size: 18px;
    }
}

@media (max-width: 991.98px) {
    .apex_gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .apex_gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .apex_gallery-modal-stage {
        padding: 16px 44px;
    }
}
