.wbpro-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: var(--wbpro-gallery-gap, 16px);
}

.wbpro-gallery>figure {
    min-width: 0;

    flex: 1 1 calc((100% - (var(--wbpro-gallery-cols, 3) - 1) * var(--wbpro-gallery-gap, 16px)) / var(--wbpro-gallery-cols, 3));
}

@media (max-width: 560px) {
    .wbpro-gallery {
        --wbpro-gallery-cols: 2 !important;
    }
}

.wbpro-gallery figure {
    margin: 0;
}

.wbpro-gallery .wbpro-gallery__frame {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    background: #f0f0f1;
    aspect-ratio: var(--wbpro-gallery-ratio, 1 / 1);
}

.wbpro-gallery .wbpro-gallery__thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.wbpro-gallery figure:hover .wbpro-gallery__thumb {
    transform: scale(1.06);
}

.wbpro-gallery figcaption {
    font-size: 12px;
    line-height: 1.4;
    color: inherit;
    opacity: 0.8;
    margin-top: 6px;
    padding: 0 4px 4px;
    text-align: center;
}

@media (prefers-reduced-motion: reduce) {
    .wbpro-gallery .wbpro-gallery__thumb {
        transition: none;
    }

    .wbpro-gallery figure:hover .wbpro-gallery__thumb {
        transform: none;
    }
}

.wbpro-gallery--featured {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
        "hero side1"
        "hero side2"
        "rest rest";
}

.wbpro-gallery--featured > .wbpro-gallery__hero {
    grid-area: hero;
    flex: none;
}

.wbpro-gallery--featured > .wbpro-gallery__side:nth-of-type(2) {
    grid-area: side1;
    flex: none;
}

.wbpro-gallery--featured > .wbpro-gallery__side:nth-of-type(3) {
    grid-area: side2;
    flex: none;
}

.wbpro-gallery--featured > .wbpro-gallery__hero .wbpro-gallery__frame {
    aspect-ratio: unset;
    height: 100%;
}

.wbpro-gallery--featured > .wbpro-gallery__side .wbpro-gallery__frame {
    aspect-ratio: var(--wbpro-gallery-ratio, 1 / 1);
}

.wbpro-gallery--featured > .wbpro-gallery__rest {
    grid-column: auto;
    grid-area: unset;
    flex: 1 1 calc((100% - (var(--wbpro-gallery-cols, 3) - 1) * var(--wbpro-gallery-gap, 16px)) / var(--wbpro-gallery-cols, 3));
}

.wbpro-gallery--featured > .wbpro-gallery__rest .wbpro-gallery__frame {
    aspect-ratio: var(--wbpro-gallery-ratio, 1 / 1);
}

.wbpro-gallery--featured > .wbpro-gallery__rest:first-of-type {
    grid-column: 1 / -1;
}

@media (max-width: 560px) {
    .wbpro-gallery--featured {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "hero hero"
            "side1 side2"
            "rest rest";
    }

    .wbpro-gallery--featured > .wbpro-gallery__hero .wbpro-gallery__frame {
        aspect-ratio: var(--wbpro-gallery-ratio, 1 / 1);
        height: auto;
    }

    .wbpro-gallery--featured > .wbpro-gallery__rest {
        grid-area: unset;
        grid-column: auto;
    }

    .wbpro-gallery--featured > .wbpro-gallery__rest:first-of-type {
        grid-column: auto;
    }
}

.wbpro-gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(10, 10, 12, 0.88);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.wbpro-gallery-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

body.wbpro-gallery-lightbox-open {
    overflow: hidden;
}

.wbpro-gallery-lightbox__panel {
    position: relative;
    max-width: min(92vw, 1100px);
}

.wbpro-gallery-lightbox__figure {
    margin: 0;
    text-align: center;
}

.wbpro-gallery-lightbox__img {
    max-width: 92vw;
    max-height: 80vh;
    display: block;
    margin: 0 auto;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.wbpro-gallery-lightbox__caption {
    color: #fff;
    margin-top: 14px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 90vw;
    margin-left: auto;
    margin-right: auto;
}

.wbpro-gallery-lightbox__close,
.wbpro-gallery-lightbox__prev,
.wbpro-gallery-lightbox__next {
    position: absolute;
    border: none;
    cursor: pointer;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    display: grid;
    place-items: center;
    line-height: 1;
    transition: background 0.15s ease;
}

.wbpro-gallery-lightbox__close:hover,
.wbpro-gallery-lightbox__prev:hover,
.wbpro-gallery-lightbox__next:hover {
    background: rgba(255, 255, 255, 0.25);
}

.wbpro-gallery-lightbox__close {
    top: -16px;
    right: -16px;
    width: 40px;
    height: 40px;
    font-size: 24px;
}

.wbpro-gallery-lightbox__prev,
.wbpro-gallery-lightbox__next {
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    font-size: 20px;
}

.wbpro-gallery-lightbox__prev {
    left: -56px;
}

.wbpro-gallery-lightbox__next {
    right: -56px;
}

.wbpro-gallery-lightbox__counter {
    position: absolute;
    bottom: -30px;
    right: 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

.wbpro-gallery-lightbox__close:focus-visible,
.wbpro-gallery-lightbox__prev:focus-visible,
.wbpro-gallery-lightbox__next:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .wbpro-gallery-lightbox {
        transition: none;
    }
}

@media (max-width: 900px) {
    .wbpro-gallery-lightbox__prev {
        left: 8px;
    }

    .wbpro-gallery-lightbox__next {
        right: 8px;
    }

    .wbpro-gallery-lightbox__img {
        max-width: calc(100vw - 120px);
    }
}

@media (max-width: 560px) {
    .wbpro-gallery-lightbox {
        padding: 0;
        align-items: center;
    }

    .wbpro-gallery-lightbox__panel {
        max-width: 100vw;
        width: 100vw;
    }

    .wbpro-gallery-lightbox__img {
        max-width: 100vw;
        max-height: 75vh;
        border-radius: 0;
    }

    .wbpro-gallery-lightbox__close {
        top: 8px;
        right: 8px;
    }

    .wbpro-gallery-lightbox__prev,
    .wbpro-gallery-lightbox__next {
        top: 50%;
        transform: translateY(-50%);
        width: 40px;
        height: 40px;
        font-size: 18px;
        background: rgba(0, 0, 0, 0.35);
    }

    .wbpro-gallery-lightbox__prev {
        left: 8px;
    }

    .wbpro-gallery-lightbox__next {
        right: 8px;
    }

    .wbpro-gallery-lightbox__counter {
        bottom: -24px;
    }
}

.wbpro-gallery>.wbpro-gallery-skeleton {
    flex: 1 1 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
}

.wbpro-gallery>.wbpro-gallery-skeleton.wbpro-gallery-skeleton--featured {
    flex: 1 1 100%;
    max-width: 100%;
}

.wbpro-gallery-editor-empty {
    display: block;
    width: 100%;
    max-width: 100%;
    border: 1px dashed #8c8f94;
    border-radius: 6px;
    padding: 24px 16px;
    text-align: center;
    color: #646970;
    font-size: 16px;
}

@media (min-width: 480px) {
    .wbpro-gallery>.wbpro-gallery-editor-empty {
        max-width: 420px;
    }
}

.wbpro-gallery-editor-empty__icon {
    display: block;
    font-size: 24px;
    margin-bottom: 8px;
}

.wbpro-gallery-skeleton {
    display: grid;
    grid-template-columns: repeat(var(--wbpro-gallery-cols, 3), 1fr);
    gap: var(--wbpro-gallery-gap, 16px);
}

.wbpro-gallery-skeleton span {
    display: block;
    aspect-ratio: var(--wbpro-gallery-ratio, 1 / 1);
    border-radius: 8px;
    background: linear-gradient(90deg, #f0f0f1 25%, #e0e0e0 37%, #f0f0f1 63%);
    background-size: 400% 100%;
    animation: wbpro-gallery-shimmer 1.4s ease infinite;
}

.wbpro-gallery-skeleton--featured {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--wbpro-gallery-gap, 16px);
    width: 100%;
}

.wbpro-gallery-skeleton--featured .wbpro-gallery-skeleton__hero {
    display: block;
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    border-radius: 8px;
    background: linear-gradient(90deg, #f0f0f1 25%, #e0e0e0 37%, #f0f0f1 63%);
    background-size: 400% 100%;
    animation: wbpro-gallery-shimmer 1.4s ease infinite;
}

.wbpro-gallery-skeleton--featured .wbpro-gallery-skeleton__sides {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    gap: var(--wbpro-gallery-gap, 16px);
}

.wbpro-gallery-skeleton--featured .wbpro-gallery-skeleton__sides span {
    flex: 1;
    display: block;
    aspect-ratio: var(--wbpro-gallery-ratio, 1 / 1);
    border-radius: 8px;
    background: linear-gradient(90deg, #f0f0f1 25%, #e0e0e0 37%, #f0f0f1 63%);
    background-size: 400% 100%;
    animation: wbpro-gallery-shimmer 1.4s ease infinite;
}

.wbpro-gallery-skeleton--dim {
    opacity: 0.45;
    animation: none;
}

.wbpro-gallery-skeleton--dim span,
.wbpro-gallery-skeleton--dim .wbpro-gallery-skeleton__hero {
    animation: none;
    background: #e8e8e8;
}

.wbpro-gallery > .wbpro-gallery-editor-empty {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.92);
    border: 1px dashed #8c8f94;
    z-index: 1;
    width: auto;
    max-width: 320px;
}

.wbpro-gallery {
    position: relative;
}

@keyframes wbpro-gallery-shimmer {
    0% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0 50%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wbpro-gallery-skeleton span {
        animation: none;
    }
}

.wbpro-gallery-layout-preview__notice {
    margin: 0 0 8px;
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1.4;
    color: #646970;
    background: #f6f7f7;
    border: 1px dashed #c3c4c7;
    border-radius: 4px;
}

.wbpro-gallery-layout-preview__item {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e0e0e0 0%, #ececed 100%);
}

.wbpro-gallery-layout-preview__number {
    font-size: 13px;
    font-weight: 600;
    color: #8c8f94;
}