.elementor-widget-ce_custom_gallery .cg-gallery {
    --cg-gap: 8px;
    display: flex;
    width: 100%;
    gap: var(--cg-gap);
    box-sizing: border-box;
}

.elementor-widget-ce_custom_gallery .cg-col,
.elementor-widget-ce_custom_gallery .cg-row {
    display: flex;
    min-width: 0;
    gap: var(--cg-gap);
}

.elementor-widget-ce_custom_gallery .cg-col { flex-direction: column; }
.elementor-widget-ce_custom_gallery .cg-row { min-height: 0; }

.elementor-widget-ce_custom_gallery .cg-row > .cg-item {
    flex: 1 1 0;
    width: 50%;
    min-width: 0;
}

.elementor-widget-ce_custom_gallery .cg-item {
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
}

.elementor-widget-ce_custom_gallery .cg-item a,
.elementor-widget-ce_custom_gallery .cg-item img {
    display: block;
    width: 100%;
    height: 100%;
}

.elementor-widget-ce_custom_gallery .cg-item img {
    object-fit: cover;
    transition: transform 0.4s ease, filter 0.3s ease;
}

.elementor-widget-ce_custom_gallery .cg-full {
    flex: 1 1 100% !important;
    width: 100% !important;
}

.elementor-widget-ce_custom_gallery :is(
    .cg-layout-hero .cg-col-hero,
    .cg-layout-hero .cg-item,
    .cg-layout-split .cg-col,
    .cg-layout-split .cg-item,
    .cg-layout-trio .cg-col-trio,
    .cg-layout-trio .cg-item,
    .cg-layout-quad .cg-col-quad,
    .cg-layout-quad .cg-item
) { height: 100%; }

.elementor-widget-ce_custom_gallery :is(
    .cg-layout-hero .cg-col-hero,
    .cg-layout-trio .cg-col-trio,
    .cg-layout-quad .cg-col-quad
) { flex: 1; }

.elementor-widget-ce_custom_gallery :is(.cg-layout-trio, .cg-layout-quad) .cg-row-top {
    flex: 0 0 calc(50% - var(--cg-gap) / 2);
}

.elementor-widget-ce_custom_gallery :is(.cg-layout-trio, .cg-layout-quad) .cg-row-bottom {
    flex: 1 1 50%;
}

.elementor-widget-ce_custom_gallery :is(.cg-layout-penta, .cg-layout-hexa) .cg-col-left {
    flex: 0 0 50%;
    width: 50%;
    max-width: 50%;
    height: 100%;
}

.elementor-widget-ce_custom_gallery :is(.cg-layout-penta, .cg-layout-hexa) .cg-col-right {
    flex: 0 0 calc(50% - var(--cg-gap));
    max-width: calc(50% - var(--cg-gap));
    height: 100%;
}

.elementor-widget-ce_custom_gallery :is(.cg-layout-penta, .cg-layout-hexa) .cg-col-left .cg-row-top {
    flex: 0 0 calc(45% - var(--cg-gap) / 2);
}

.elementor-widget-ce_custom_gallery :is(.cg-layout-penta, .cg-layout-hexa) .cg-col-left .cg-slot-3 {
    flex: 1 1 55%;
}

.elementor-widget-ce_custom_gallery :is(.cg-layout-penta, .cg-layout-hexa) .cg-col-right .cg-slot-4 {
    flex: 0 0 calc(55% - var(--cg-gap) / 2);
}

.elementor-widget-ce_custom_gallery :is(.cg-layout-penta, .cg-layout-hexa) .cg-col-right .cg-row-bottom {
    flex: 1 1 35%;
}

.elementor-widget-ce_custom_gallery :is(.cg-layout-penta, .cg-layout-hexa) .cg-item {
    flex: 1 1 auto;
    min-height: 0;
}

.elementor-widget-ce_custom_gallery :is(.cg-col-left .cg-row-top, .cg-col-right .cg-row-bottom) .cg-item {
    height: 100%;
}

.elementor-widget-ce_custom_gallery .cg-more-overlay {
    position: absolute;
    z-index: 2;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.elementor-widget-ce_custom_gallery .cg-more-overlay span {
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.elementor-widget-ce_custom_gallery .cg-hover-zoom .cg-item:hover img { transform: scale(1.07); }
.elementor-widget-ce_custom_gallery .cg-hover-bright .cg-item:hover img { filter: brightness(1.18) saturate(1.1); }

.elementor-widget-ce_custom_gallery .cg-hover-overlay .cg-item::after {
    position: absolute;
    z-index: 1;
    inset: 0;
    background: transparent;
    content: '';
    pointer-events: none;
    transition: background 0.3s ease;
}

.elementor-widget-ce_custom_gallery .cg-hover-overlay .cg-item:hover::after {
    background: rgba(0, 0, 0, 0.35);
}

@media (max-width: 767px) {
    .elementor-widget-ce_custom_gallery .cg-gallery {
        flex-direction: column !important;
        height: auto !important;
    }

    .elementor-widget-ce_custom_gallery :is(.cg-col, .cg-col-hero, .cg-col-left, .cg-col-right, .cg-col-trio, .cg-col-quad) {
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
    }

    .elementor-widget-ce_custom_gallery .cg-row {
        flex: 0 0 auto !important;
        height: auto !important;
    }

    .elementor-widget-ce_custom_gallery .cg-item {
        flex: 1 1 0 !important;
        width: auto !important;
        height: 180px !important;
        min-height: 180px !important;
    }

    .elementor-widget-ce_custom_gallery .cg-row > .cg-item {
        flex: 1 1 50% !important;
        width: 50% !important;
    }

    .elementor-widget-ce_custom_gallery :is(.cg-layout-hero .cg-item, .cg-layout-split .cg-col > .cg-item) {
        width: 100% !important;
        height: 180px !important;
        min-height: 180px !important;
    }

    .elementor-widget-ce_custom_gallery :is(.cg-slot-3, .cg-slot-4) {
        flex: 0 0 180px !important;
        width: 100% !important;
        height: 180px !important;
        min-height: 180px !important;
    }

    .elementor-widget-ce_custom_gallery .cg-item > a,
    .elementor-widget-ce_custom_gallery .cg-item img {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
    }

    .elementor-widget-ce_custom_gallery .cg-item img {
        object-fit: cover !important;
    }
}
