.photo-gallery {
    min-width: 0;
    margin: 0 0 28px;
}

.photo-gallery-stage[data-photo-ready] .gallery-image,
.photo-gallery[data-photo-layout="3"] .gallery-image {
    margin: 0;
}

.photo-gallery-stage[data-photo-ready] .gallery-image a {
    display: grid;
    place-items: center;
    height: clamp(260px, 58vw, 540px);
    padding: 12px;
    border-radius: 12px;
    background: var(--paper);
}

.prose .photo-gallery-stage[data-photo-ready] .gallery-image img {
    display: block;
    width: 100%;
    height: 100% !important;
    min-height: 0;
    margin: 0;
    object-fit: contain;
}

.photo-gallery-controls:not([hidden]) {
    display: grid;
    grid-template-columns: auto minmax(55px, auto) auto;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.photo-gallery-controls button {
    min-width: 44px;
    min-height: 44px;
    border: 1px solid var(--line, #d4dee8);
    border-radius: 8px;
    background: #fff;
    color: var(--blue);
    cursor: pointer;
}

.photo-gallery-controls button[data-photo-previous],
.photo-gallery-controls button[data-photo-next] {
    font-size: 24px;
    line-height: 1;
}

.photo-gallery-count {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.photo-gallery-thumbnails {
    display: flex;
    grid-column: 1 / -1;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding: 4px;
}

.photo-gallery-thumbnails button {
    width: 56px;
    padding: 2px;
}

.photo-gallery-thumbnails button[aria-pressed="true"] {
    border-color: var(--blue);
    box-shadow: inset 0 0 0 1px var(--blue);
}

.prose .photo-gallery-thumbnails img {
    display: block;
    width: 100%;
    height: 40px !important;
    margin: 0;
    object-fit: contain;
}

.photo-gallery[data-photo-layout="3"] .photo-gallery-stage {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr));
    gap: 12px;
}

.photo-gallery[data-photo-layout="3"] .gallery-image a {
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 3;
    padding: 8px;
    border-radius: 8px;
    background: var(--paper);
}

.prose .photo-gallery[data-photo-layout="3"] .gallery-image img {
    display: block;
    width: 100%;
    height: 100% !important;
    min-height: 0;
    margin: 0;
    object-fit: contain;
}
