/* A stable frame per viewport, independent of the original photo dimensions. */
.gallery-section .gallery-track {
    gap: 0;
    padding-bottom: 0;
    border-radius: 14px;
    scrollbar-width: none;
    touch-action: pan-x pan-y pinch-zoom;
}
.gallery-section .gallery-track.is-gallery-dragging {
    scroll-snap-type: none;
    scroll-behavior: auto;
    user-select: none;
}
@media (any-pointer: fine) {
    [data-content-gallery-slide] > a { cursor: grab; }
    .is-gallery-dragging [data-content-gallery-slide] > a { cursor: grabbing; }
}
.gallery-section .gallery-track::-webkit-scrollbar { display: none; }
.gallery-track > [data-content-gallery-slide] > a {
    display: block;
    position: relative;
    height: clamp(220px, 76vw, 480px);
    padding: 0;
    overflow: hidden;
    border-radius: 0;
    background: var(--paper, #f6f3ed);
}
.gallery-track > [data-content-gallery-slide] img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    object-fit: contain;
    object-position: center;
    -webkit-user-drag: none;
}
.gallery-track > [data-content-gallery-slide] figcaption {
    overflow-wrap: anywhere;
}
.gallery-section .gallery-controls {
    gap: 12px;
    margin-top: 10px;
}
.gallery-section .gallery-controls > button {
    width: 44px;
    height: 44px;
    border-color: transparent;
}
.gallery-dots {
    display: flex;
    justify-content: safe center;
    max-width: min(230px, 55vw);
    overflow-x: auto;
    scrollbar-width: thin;
}
.gallery-dots[hidden] { display: none; }
.gallery-controls .gallery-dots button {
    display: grid;
    place-items: center;
    flex: 0 0 24px;
    width: 24px;
    height: 36px;
    padding: 0;
    border: 0;
    color: var(--ink);
}
.gallery-dots button::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    opacity: .25;
}
.gallery-dots button[aria-current] { color: var(--accent); }
.gallery-dots button[aria-current]::before { opacity: 1; }
.has-gallery-dots .gallery-readable-count {
    position: absolute;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
}
.gallery-autoplay {
    display: grid;
    place-items: center;
    margin: 4px auto 0;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--ink);
    background: transparent;
}
.gallery-autoplay[hidden] { display: none; }

/* Only the photo fades; the frame, caption and slide geometry stay put. */
@media (prefers-reduced-motion: no-preference) {
    [data-content-gallery-slide] img {
        transition: opacity .3s ease;
    }
    [data-content-gallery-slide].is-gallery-inactive > a:not(:focus-visible) img {
        opacity: .65;
    }
}
