@media (min-width: 320px) {
    .gb-container figure.wp-block-gallery.has-nested-images{
        display:flex;
        flex-wrap: wrap;
        row-gap:20px;
        justify-content: space-between;
    }
    .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image){
        width:48%;
        aspect-ratio: 1/1;
        object-fit: cover;
        flex-grow:unset;
    }
    .post-gallery .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image){
        flex-grow:1;
    }
}

/* ==========================================================================
   Gallery scroll
   ==========================================================================
   Opt-in: add `gallery-scroll` next to `is-cropped` on the gallery block.
   Animates object-position so the cover crop pans top ↔ bottom. Without
   is-cropped there is no hidden crop to move, so those galleries are left
   alone. pan-image in gp-global-styles.css is a one-shot Ken Burns on a
   single figure — a different job, do not reuse it here.
   ========================================================================== */

   .gallery-scroll .wp-block-gallery {
    /* One direction. Alternate doubles it for the round trip. */
    --gallery-scroll-duration: 100s;
}

.gallery-scroll.gallery-scroll-fast .wp-block-gallery{ --gallery-scroll-duration: 8s; }
.gallery-scroll.gallery-scroll-slow .wp-block-gallery{ --gallery-scroll-duration: 22s; }

@media (prefers-reduced-motion: no-preference) {
    .gallery-scroll .wp-block-gallery .wp-block-image img {
        object-position: 50% 0%;
        animation: gallery-scroll-y var(--gallery-scroll-duration) linear infinite alternate;
    }

    /* Neighbouring tiles travel opposite ways so the row does not look like
       a single slab sliding in lockstep. */
    .gallery-scroll .wp-block-gallery .wp-block-image:nth-child(even) img {
        animation-direction: alternate-reverse;
    }

    .gallery-scroll .wp-block-gallery .wp-block-image:hover img,
    .gallery-scroll .wp-block-gallery .wp-block-image:focus-within img {
        animation-play-state: paused;
    }
}

@keyframes gallery-scroll-y {
    from { object-position: 50% 0%; }
    to   { object-position: 50% 100%; }
}
