/* Accessible photo carousel (inc/gallery.php) */

.twr-gallery {
    --twr-gallery-ratio: 4 / 3;
    --twr-gallery-focal-point: center 30%; /* keep faces in frame when cropping */

    max-width: var(--container-md);
    margin: var(--space-8) auto;
}

/* Native scroll-snap strip; list reset comes from base.css. */
.twr-gallery__track {
    display: flex;
    gap: var(--space-4);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
}

.twr-gallery__slide {
    flex: 0 0 100%;
    scroll-snap-align: center;
}

.twr-gallery__slide img {
    width: 100%;
    aspect-ratio: var(--twr-gallery-ratio);
    object-fit: cover;
    object-position: var(--twr-gallery-focal-point);
    border-radius: var(--radius-md);
}

.twr-gallery__controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    margin-top: var(--space-4);
}

/* display:flex above would otherwise override the [hidden] attribute. */
.twr-gallery__controls[hidden] {
    display: none;
}

.twr-gallery__btn {
    min-width: var(--tap-target-min);
    min-height: var(--tap-target-min);
    font-size: var(--text-xl);
    background: var(--bg-secondary);
    border: var(--border-width-2) solid var(--text-primary);
    border-radius: var(--radius-md);
}

.twr-gallery__btn:hover {
    background: var(--bg-tertiary);
}

.twr-gallery__btn[aria-disabled="true"] {
    opacity: 0.6;
    cursor: default;
}

.twr-gallery__count {
    min-width: 6ch;
    text-align: center;
}
