.wp-block-gallery.is-style-masonry {
  display: grid;
  
  @for $i from 1 through 8 {
    &.columns-#{$i} {
      grid-template-columns: repeat(#{$i}, 1fr);
    }
  }

  &.columns-default {
    grid-template-columns: repeat(3, 1fr);
  }

  .wp-block-image {
    min-width: 100%;
  }

  .wp-block-image:nth-child(odd) {
    grid-row: span 2;
  }
  .wp-block-image:nth-child(even) {
    grid-row: span 1;
  }
}