.public-gallery-viewer {
    --gallery-media-height: min(65vh, 680px);
    --gallery-panel: var(--mt-tone-112d2b, #112d2b);
    --gallery-button: var(--mt-tone-173b38, #173b38);
    --gallery-border: var(--mt-tone-547774, #547774);
    display: grid;
    place-items: center;
    touch-action: auto;
}

@supports (height: 100dvh) {
    .public-gallery-viewer {
        --gallery-media-height: min(65dvh, 680px);
    }
}

.public-gallery-viewer .goverlay {
    background: rgb(4 20 20 / 88%);
}

.public-gallery-viewer .gcontainer {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 0 12px;
    box-sizing: border-box;
    width: min(1100px, calc(100% - 32px));
    height: auto;
    max-height: calc(100% - 32px);
    padding: 48px 56px 20px;
    overflow: auto;
    border-radius: 12px;
    background: var(--gallery-panel);
    color: white;
}

.public-gallery-viewer .gslider {
    grid-area: 1 / 2;
    height: var(--gallery-media-height);
    min-width: 0;
    touch-action: none;
}

.public-gallery-viewer .ginner-container,
.public-gallery-viewer .gslide-image img,
.public-gallery-viewer .gvideo-wrapper {
    max-height: var(--gallery-media-height);
}

.public-gallery-viewer .gslide-image img {
    max-width: 100%;
    min-width: 0;
    object-fit: contain;
}

.public-gallery-viewer .gvideo-wrapper {
    max-width: min(100%, calc(var(--gallery-media-height) * 16 / 9)) !important;
}

.public-gallery-viewer .gbtn {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--gallery-border);
    border-radius: 8px;
    background: var(--gallery-button);
    color: white;
    opacity: 1;
}

.public-gallery-viewer .gbtn svg {
    width: 24px;
}

.public-gallery-viewer .gbtn path {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.public-gallery-viewer :is(.gprev, .gnext) {
    position: relative;
    inset: auto;
    grid-row: 1;
}

.public-gallery-viewer .gprev {
    grid-column: 1;
}

.public-gallery-viewer .gnext {
    grid-column: 3;
}

.public-gallery-viewer .gclose {
    inset: auto;
    inset-block-start: 8px;
    inset-inline-end: 8px;
}

.public-gallery-viewer:dir(rtl) :is(.gprev, .gnext) svg {
    transform: scaleX(-1);
}

.public-gallery-details {
    grid-column: 2;
    min-width: 0;
    text-align: center;
}

.public-gallery-caption {
    margin: 16px 0;
    overflow-wrap: anywhere;
}

.public-gallery-position {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

.public-gallery-thumbnail-toggle {
    min-width: 44px;
    min-height: 44px;
    padding: 0 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.public-gallery-thumbnail-toggle:hover,
.public-gallery-thumbnail-toggle[aria-expanded="true"] {
    background: var(--gallery-button);
    text-decoration: underline;
}

.public-gallery-thumbnails {
    display: flex;
    justify-content: safe center;
    gap: 0.4rem;
    margin: 8px 0 0;
    padding: 4px;
    overflow-x: auto;
}

.public-gallery-thumbnails[hidden],
.public-gallery-caption[hidden] {
    display: none;
}

.public-gallery-thumbnails button {
    flex: 0 0 56px;
    height: 48px;
    padding: 0;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: 6px;
    background: var(--gallery-button);
    color: white;
    cursor: pointer;
}

.public-gallery-thumbnails button[aria-current="true"] {
    border-color: white;
}

.public-gallery-thumbnails img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.public-gallery-viewer button:focus-visible {
    outline: 3px solid var(--mt-focus, #77aaa3);
    outline-offset: 2px;
}

@media (max-width: 680px) {
    .public-gallery-viewer {
        --gallery-media-height: 55vh;
    }

    @supports (height: 100dvh) {
        .public-gallery-viewer {
            --gallery-media-height: 55dvh;
        }
    }

    .public-gallery-viewer .gcontainer {
        width: calc(100% - 16px);
        padding: 56px 8px 16px;
        column-gap: 4px;
    }
}
