.gallery-plugin {
    margin: 0 ;
    /* max-width: 1180px; */
    padding: 0 0 48px;
}

.gallery-plugin__grid {
    align-items: start;
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.gallery-plugin__grid-item {
    aspect-ratio: 3 / 2;
    margin: 0;
    overflow: hidden;
    position: relative;
}

.gallery-plugin__grid-item button {
    background: transparent;
    border: 0;
    cursor: pointer;
    display: block;
    height: 100%;
    inset: 0;
    padding: 0;
    position: absolute;
    width: 100%;
}

.gallery-plugin__grid-item img {
    display: block;
    height: 100%;
    inset: 0;
    object-fit: cover;
    object-position: center;
    position: absolute;
    transition: transform 160ms ease, box-shadow 160ms ease;
    width: 100%;
}

.gallery-plugin__grid-item button:focus-visible img,
.gallery-plugin__grid-item button:hover img {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    transform: translateY(-2px);
}

.gallery-plugin figcaption {
    color: #444;
    font-size: 0.95rem;
    line-height: 1.35;
    margin-top: 8px;
}

.gallery-plugin__empty {
    color: #555;
    font-size: 1rem;
}

.gallery-plugin__back {
    margin: 0 0 18px;
}

.gallery-plugin__cards {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.gallery-plugin__card {
    border: 1px solid #d8dee4;
    margin: 0;
}

.gallery-plugin__card a {
    color: inherit;
    display: grid;
    gap: 8px;
    padding: 12px;
    text-decoration: none;
}

.gallery-plugin__card img {
    aspect-ratio: 4 / 3;
    display: block;
    object-fit: cover;
    width: 100%;
}

.gallery-plugin__card span {
    font-size: 1.05rem;
    font-weight: 600;
}

.gallery-plugin__card small {
    color: #555;
}

.gallery-plugin__lightbox[hidden] {
    display: none;
}

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

.gallery-plugin__lightbox {
    inset: 0;
    position: fixed;
    z-index: 2147483000;
}

.gallery-plugin__lightbox-backdrop {
    background: rgba(0, 0, 0, 0.82);
    inset: 0;
    position: absolute;
}

.gallery-plugin__lightbox-content {
    align-items: center;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    grid-template-rows: minmax(0, 1fr) auto;
    inset: 24px;
    overflow: hidden;
    position: absolute;
}

.gallery-plugin__lightbox-content img {
    grid-column: 2;
    max-height: calc(100vh - 120px);
    max-height: calc(100dvh - 120px);
    max-width: 100%;
    object-fit: contain;
    place-self: center;
}

.gallery-plugin__lightbox-content p {
    color: #fff;
    grid-column: 2;
    line-height: 1.4;
    margin: 12px 0 0;
    min-height: 1.4em;
    text-align: center;
}

.gallery-plugin__lightbox-close,
.gallery-plugin__lightbox-nav,
.gallery-plugin__control {
    align-items: center;
    background: #0b4dc7;;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    font-size: 32px;
    height: 44px;
    justify-content: center;
    line-height: 1;
    width: 44px;
    color: #fff;
     opacity: 0.8;
}

.gallery-plugin__lightbox-close {
    position: absolute;
    right: 0;
    top: 0;
    z-index: 1;
}

.gallery-plugin__lightbox-nav--prev {
    grid-column: 1;
    grid-row: 1;
}

.gallery-plugin__lightbox-nav--next {
    grid-column: 3;
    grid-row: 1;
}

.gallery-plugin__carousel {
    margin: 0 auto;
    max-width: 1000px;
    position: relative;
}

.gallery-plugin__carousel-track {
    background: #fff;
    min-height: 320px;
    overflow: hidden;
    position: relative;
}

.gallery-plugin__slide {
    inset: 0;
    margin: 0;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transition: opacity 260ms ease;
}

.gallery-plugin__slide.is-active {
    opacity: 1;
    pointer-events: auto;
    position: relative;
}

.gallery-plugin__slide img {
    aspect-ratio: 16 / 9;
    display: block;
    max-height: 640px;
    object-fit: contain;
    width: 100%;
}

.gallery-plugin__slide figcaption {
    background: rgba(0, 0, 0, 0.68);
    bottom: 0;
    color: #fff;
    left: 0;
    margin: 0;
    padding: 12px 16px;
    position: absolute;
    right: 0;
}

.gallery-plugin__control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.gallery-plugin__control--prev {
    left: 12px;
}

.gallery-plugin__control--next {
    right: 12px;
}

.gallery-plugin__dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 14px;
}

.gallery-plugin__dots button {
    background: #bbb;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    height: 12px;
    padding: 0;
    width: 12px;
}

.gallery-plugin__dots button.is-active {
    background: #222;
}

@media (max-width: 700px) {
    .gallery-plugin {
        padding: 0 0 36px;
    }

    .gallery-plugin__grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .gallery-plugin__lightbox-content {
        grid-template-columns: 40px minmax(0, 1fr) 40px;
        inset: 12px;
    }

    .gallery-plugin__lightbox-close,
    .gallery-plugin__lightbox-nav,
    .gallery-plugin__control {
        font-size: 26px;
        height: 38px;
        width: 38px;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .gallery-plugin__lightbox-content {
        grid-template-columns: 34px minmax(0, 1fr) 34px;
        inset: 8px;
    }

    .gallery-plugin__lightbox-content img {
        max-height: calc(100dvh - 48px);
        max-width: calc(100dvw - 84px);
    }

    .gallery-plugin__lightbox-content p {
        font-size: 0.9rem;
        margin-top: 6px;
    }

    .gallery-plugin__lightbox-close,
    .gallery-plugin__lightbox-nav {
        font-size: 22px;
        height: 32px;
        width: 32px;
    }
}
