.ednc-udd-gallery-preview {
    width: 100%;
    box-sizing: border-box;
}

.ednc-udd-gallery-preview *,
.ednc-udd-gallery-preview *::before,
.ednc-udd-gallery-preview *::after,
.ednc-udd-lightbox *,
.ednc-udd-lightbox *::before,
.ednc-udd-lightbox *::after {
    box-sizing: border-box;
}

.ednc-udd-gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 12px;
}

.ednc-udd-gallery-title {
    margin: 0;
    padding: 0;
    font: inherit;
    font-size: clamp(20px, 2vw, 28px);
    font-weight: 700;
    line-height: 1.25;
    color: #3f3f3f;
}

.ednc-udd-gallery-all {
    -webkit-appearance: none !important;
    appearance: none !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    color: #3f3f3f !important;
    padding: 6px 0 !important;
    margin: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font: inherit;
    font-size: 14px;
    font-weight: 700 !important;
    line-height: 1.4;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none !important;
    border-radius: 0 !important;
}

.ednc-udd-gallery-all:hover,
.ednc-udd-gallery-all:focus-visible {
    color: #222 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

.ednc-udd-gallery-arrow {
    font-size: 1.1em;
    line-height: 1;
}

.ednc-udd-gallery-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: var(--ednc-udd-gallery-gap, 6px);
    height: var(--ednc-udd-gallery-height, 420px);
    overflow: hidden;
    border-radius: var(--ednc-udd-gallery-radius, 0px);
}

.ednc-udd-gallery-item {
    -webkit-appearance: none !important;
    appearance: none !important;
    position: relative;
    display: block;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    overflow: hidden;
    cursor: zoom-in;
    line-height: 0 !important;
    border-radius: var(--ednc-udd-gallery-radius, 0px) !important;
}

.ednc-udd-gallery-thumb {
    display: block;
    width: 100%;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover;
    object-position: center;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    transition: transform .28s ease, filter .28s ease;
}

.ednc-udd-gallery-item:hover .ednc-udd-gallery-thumb,
.ednc-udd-gallery-item:focus-visible .ednc-udd-gallery-thumb {
    transform: scale(1.025);
    filter: brightness(.92);
}

.ednc-udd-gallery-item:focus-visible {
    outline: 2px solid rgba(55,55,55,.55) !important;
    outline-offset: -2px !important;
}

.ednc-udd-gallery-caption {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 6px 8px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    text-align: left;
    background: rgba(20,20,20,.68);
    border-radius: 3px;
    pointer-events: none;
}

/* 6-image editorial mosaic: one large left image + five supporting images. */
.ednc-udd-gallery-count-6 .ednc-udd-gallery-item:nth-child(1) { grid-column: 1 / 6; grid-row: 1 / 3; }
.ednc-udd-gallery-count-6 .ednc-udd-gallery-item:nth-child(2) { grid-column: 6 / 10; grid-row: 1; }
.ednc-udd-gallery-count-6 .ednc-udd-gallery-item:nth-child(3) { grid-column: 10 / 13; grid-row: 1; }
.ednc-udd-gallery-count-6 .ednc-udd-gallery-item:nth-child(4) { grid-column: 6 / 8; grid-row: 2; }
.ednc-udd-gallery-count-6 .ednc-udd-gallery-item:nth-child(5) { grid-column: 8 / 10; grid-row: 2; }
.ednc-udd-gallery-count-6 .ednc-udd-gallery-item:nth-child(6) { grid-column: 10 / 13; grid-row: 2; }

.ednc-udd-gallery-count-5 .ednc-udd-gallery-item:nth-child(1) { grid-column: 1 / 6; grid-row: 1 / 3; }
.ednc-udd-gallery-count-5 .ednc-udd-gallery-item:nth-child(2) { grid-column: 6 / 10; grid-row: 1; }
.ednc-udd-gallery-count-5 .ednc-udd-gallery-item:nth-child(3) { grid-column: 10 / 13; grid-row: 1; }
.ednc-udd-gallery-count-5 .ednc-udd-gallery-item:nth-child(4) { grid-column: 6 / 9; grid-row: 2; }
.ednc-udd-gallery-count-5 .ednc-udd-gallery-item:nth-child(5) { grid-column: 9 / 13; grid-row: 2; }

.ednc-udd-gallery-count-4 .ednc-udd-gallery-item:nth-child(1) { grid-column: 1 / 7; grid-row: 1 / 3; }
.ednc-udd-gallery-count-4 .ednc-udd-gallery-item:nth-child(2) { grid-column: 7 / 13; grid-row: 1; }
.ednc-udd-gallery-count-4 .ednc-udd-gallery-item:nth-child(3) { grid-column: 7 / 10; grid-row: 2; }
.ednc-udd-gallery-count-4 .ednc-udd-gallery-item:nth-child(4) { grid-column: 10 / 13; grid-row: 2; }

.ednc-udd-gallery-count-3 .ednc-udd-gallery-item:nth-child(1) { grid-column: 1 / 8; grid-row: 1 / 3; }
.ednc-udd-gallery-count-3 .ednc-udd-gallery-item:nth-child(2) { grid-column: 8 / 13; grid-row: 1; }
.ednc-udd-gallery-count-3 .ednc-udd-gallery-item:nth-child(3) { grid-column: 8 / 13; grid-row: 2; }

.ednc-udd-gallery-count-2 .ednc-udd-gallery-item:nth-child(1) { grid-column: 1 / 7; grid-row: 1 / 3; }
.ednc-udd-gallery-count-2 .ednc-udd-gallery-item:nth-child(2) { grid-column: 7 / 13; grid-row: 1 / 3; }
.ednc-udd-gallery-count-1 .ednc-udd-gallery-item:nth-child(1) { grid-column: 1 / 13; grid-row: 1 / 3; }

/* For 7-12 previews, keep the first image prominent and use a clean supporting grid. */
.ednc-udd-gallery-count-7 .ednc-udd-gallery-item,
.ednc-udd-gallery-count-8 .ednc-udd-gallery-item,
.ednc-udd-gallery-count-9 .ednc-udd-gallery-item,
.ednc-udd-gallery-count-10 .ednc-udd-gallery-item,
.ednc-udd-gallery-count-11 .ednc-udd-gallery-item,
.ednc-udd-gallery-count-12 .ednc-udd-gallery-item {
    grid-column: span 2;
}

.ednc-udd-gallery-count-7 .ednc-udd-gallery-item:nth-child(1),
.ednc-udd-gallery-count-8 .ednc-udd-gallery-item:nth-child(1),
.ednc-udd-gallery-count-9 .ednc-udd-gallery-item:nth-child(1),
.ednc-udd-gallery-count-10 .ednc-udd-gallery-item:nth-child(1),
.ednc-udd-gallery-count-11 .ednc-udd-gallery-item:nth-child(1),
.ednc-udd-gallery-count-12 .ednc-udd-gallery-item:nth-child(1) {
    grid-column: span 4;
}

/* Global lightbox. */
body.ednc-udd-lightbox-open {
    overflow: hidden !important;
}

.ednc-udd-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px 70px 58px;
    color: #fff;
}

.ednc-udd-lightbox.is-open {
    display: flex;
}

.ednc-udd-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 10, 16, .94);
    cursor: zoom-out;
}

.ednc-udd-lightbox-stage {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.ednc-udd-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 10px 45px rgba(0,0,0,.35);
    pointer-events: auto;
}

.ednc-udd-lightbox-close,
.ednc-udd-lightbox-prev,
.ednc-udd-lightbox-next {
    position: absolute;
    z-index: 2;
    appearance: none;
    border: 0;
    color: #fff;
    background: rgba(0,0,0,.32);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background .2s ease, transform .2s ease;
}

.ednc-udd-lightbox-close:hover,
.ednc-udd-lightbox-prev:hover,
.ednc-udd-lightbox-next:hover,
.ednc-udd-lightbox-close:focus-visible,
.ednc-udd-lightbox-prev:focus-visible,
.ednc-udd-lightbox-next:focus-visible {
    background: rgba(255,255,255,.16);
    outline: none;
}

.ednc-udd-lightbox-close {
    top: 18px;
    right: 22px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    font-size: 32px;
    line-height: 1;
}

.ednc-udd-lightbox-prev,
.ednc-udd-lightbox-next {
    top: 50%;
    width: 50px;
    height: 64px;
    margin-top: -32px;
    border-radius: 6px;
    font-size: 42px;
    line-height: 1;
}

.ednc-udd-lightbox-prev { left: 14px; }
.ednc-udd-lightbox-next { right: 14px; }

.ednc-udd-lightbox-meta {
    position: absolute;
    z-index: 2;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    width: min(900px, calc(100% - 40px));
    text-align: center;
    pointer-events: none;
}

.ednc-udd-lightbox-counter {
    font-size: 13px;
    opacity: .75;
}

.ednc-udd-lightbox-caption {
    margin-top: 4px;
    font-size: 14px;
    line-height: 1.45;
}

@media (max-width: 767px) {
    .ednc-udd-gallery-header {
        align-items: flex-end;
        margin-bottom: 10px;
    }

    .ednc-udd-gallery-all {
        font-size: 13px;
    }

    .ednc-udd-gallery-grid {
        height: auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: none;
        grid-auto-rows: auto;
    }

    .ednc-udd-gallery-grid .ednc-udd-gallery-item {
        grid-column: auto !important;
        grid-row: auto !important;
        aspect-ratio: 1 / 1;
    }

    .ednc-udd-gallery-grid .ednc-udd-gallery-item:first-child {
        grid-column: 1 / -1 !important;
        aspect-ratio: 16 / 10;
    }

    .ednc-udd-lightbox {
        padding: 56px 12px 72px;
    }

    .ednc-udd-lightbox-close {
        top: 8px;
        right: 8px;
    }

    .ednc-udd-lightbox-prev,
    .ednc-udd-lightbox-next {
        width: 42px;
        height: 54px;
        margin-top: -27px;
        font-size: 34px;
        background: rgba(0,0,0,.45);
    }

    .ednc-udd-lightbox-prev { left: 4px; }
    .ednc-udd-lightbox-next { right: 4px; }
}
