.cos-pdf-gallery {
    --cos-gap: 16px;
    --cos-arrow-size: 46px;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.cos-pdf-gallery *,
.cos-pdf-gallery *::before,
.cos-pdf-gallery *::after {
    box-sizing: border-box;
}

.cos-pdf-gallery__viewer {
    display: grid;
    grid-template-columns: var(--cos-arrow-size) minmax(0, 1fr) var(--cos-arrow-size);
    align-items: center;
    gap: var(--cos-gap);
}

.cos-pdf-gallery__stage {
    min-height: 300px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.cos-pdf-gallery__main-link {
    display: flex;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    text-decoration: none;
}

.cos-pdf-gallery__main-image {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    flex: 0 1 auto;
    object-fit: contain !important;
    object-position: center center !important;
    transition: opacity .2s ease;
}

.cos-pdf-gallery__arrow,
.cos-pdf-gallery__thumb-scroll {
    border: 0;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transition: transform .18s ease, opacity .18s ease;
}

.cos-pdf-gallery__arrow {
    width: var(--cos-arrow-size);
    height: var(--cos-arrow-size);
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
}

.cos-pdf-gallery__arrow:hover,
.cos-pdf-gallery__arrow:focus-visible,
.cos-pdf-gallery__thumb-scroll:hover,
.cos-pdf-gallery__thumb-scroll:focus-visible {
    transform: scale(1.08);
}

.cos-pdf-gallery button:focus-visible,
.cos-pdf-gallery a:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 3px;
}

.cos-pdf-gallery__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px calc(var(--cos-arrow-size) + var(--cos-gap)) 8px;
}

.cos-pdf-gallery__title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.35;
}

.cos-pdf-gallery__open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 10px 18px;
    border-radius: 999px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

.cos-pdf-gallery__open:hover,
.cos-pdf-gallery__open:focus {
    color: #fff;
    filter: brightness(.92);
}

.cos-pdf-gallery__thumbs-wrap {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.cos-pdf-gallery__thumbs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
    padding: 5px 2px 8px;
}

.cos-pdf-gallery__thumb {
    width: 92px;
    height: 110px;
    flex: 0 0 92px;
    padding: 3px;
    border: 3px solid transparent;
    background: rgba(255,255,255,.72);
    cursor: pointer;
    scroll-snap-align: center;
    opacity: .72;
    transition: opacity .18s ease, border-color .18s ease, transform .18s ease;
}

.cos-pdf-gallery__thumb:hover,
.cos-pdf-gallery__thumb.is-active {
    opacity: 1;
    transform: translateY(-2px);
}

.cos-pdf-gallery__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.cos-pdf-gallery__thumb-scroll {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(215, 101, 54, .95);
    color: #fff;
    font-size: 20px;
}

.cos-pdf-gallery.has-single-item .cos-pdf-gallery__arrow,
.cos-pdf-gallery.has-single-item .cos-pdf-gallery__thumb-scroll {
    visibility: hidden;
}

.cos-pdf-gallery__empty {
    padding: 24px;
    border: 1px dashed #999;
    background: #fafafa;
    text-align: center;
}

@media (max-width: 767px) {
    .cos-pdf-gallery {
        --cos-gap: 8px;
        --cos-arrow-size: 38px;
    }

    .cos-pdf-gallery__viewer {
        grid-template-columns: 38px minmax(0, 1fr) 38px;
    }

    .cos-pdf-gallery__arrow {
        font-size: 23px;
    }

    .cos-pdf-gallery__meta {
        align-items: flex-start;
        flex-direction: column;
        padding-left: 46px;
        padding-right: 46px;
    }

    .cos-pdf-gallery__thumb {
        width: 72px;
        height: 90px;
        flex-basis: 72px;
    }
}

@media (max-width: 480px) {
    .cos-pdf-gallery__viewer {
        display: block;
        position: relative;
    }

    .cos-pdf-gallery__arrow {
        position: absolute;
        z-index: 2;
        top: 50%;
        transform: translateY(-50%);
    }

    .cos-pdf-gallery__arrow:hover,
    .cos-pdf-gallery__arrow:focus-visible {
        transform: translateY(-50%) scale(1.08);
    }

    .cos-pdf-gallery__arrow--prev { left: 8px; }
    .cos-pdf-gallery__arrow--next { right: 8px; }

    .cos-pdf-gallery__meta {
        padding-left: 0;
        padding-right: 0;
    }
}
