/* Styles for the image gallery. The photo viewer is components/ui/lightbox, styled in sections.css. */

/* One button per bike. */
.gallery-bikes {
    padding-block: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}

.gallery-bikes .pill-list {
    margin-bottom: 0;
}

/* Each bike's photos, under its name. */
.gallery-group {
    scroll-margin-top: var(--header-height);
}

.gallery-group + .gallery-group {
    margin-top: var(--space-8);
}

.gallery-group__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-3) var(--space-5);
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

.gallery-group__count {
    margin-top: var(--space-1);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.gallery-group__links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

/* The photos, in the same shape and on the same background as on the model page. */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}

@media (min-width: 640px) {
    .gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.gallery-grid a {
    display: block;
    overflow: hidden;
    border-radius: var(--radius-card);
    background: var(--color-media);
    cursor: zoom-in;
}

.gallery-grid a:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
}

.gallery-grid img {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
}

/* On the all bikes page each bike shows two full rows: 4, 6 or 8 photos. */
@media (max-width: 639.98px) {
    .gallery-grid--preview > :nth-child(n+5) {
        display: none;
    }
}

@media (min-width: 640px) and (max-width: 1023.98px) {
    .gallery-grid--preview > :nth-child(n+7) {
        display: none;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .gallery-grid img {
        transition: transform 0.3s;
    }

    .gallery-grid a:hover img {
        transform: scale(1.04);
    }
}
