/* WP Gallery Extend
   標準ギャラリーブロックの保存構造を維持したまま、追加classとCSS変数で制御します。 */

.wp-block-gallery.wge-gallery,
.wp-block-gallery.has-nested-images.wge-gallery {
  display: grid !important;
  grid-template-columns: repeat(var(--wge-pc-cols, 3), minmax(0, 1fr));
  gap: var(--wp--style--unstable-gallery-gap, 16px);
}

.wp-block-gallery.wge-gallery > .wp-block-image,
.wp-block-gallery.has-nested-images.wge-gallery > .wp-block-image,
.wp-block-gallery.wge-gallery > figure,
.wp-block-gallery.has-nested-images.wge-gallery > figure {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
}

.wp-block-gallery.wge-gallery img,
.wp-block-gallery.has-nested-images.wge-gallery img {
  display: block;
  width: 100%;
}

.wp-block-gallery.wge-square img,
.wp-block-gallery.has-nested-images.wge-square img {
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: cover;
}

@media (max-width: 768px) {
  .wp-block-gallery.wge-gallery,
  .wp-block-gallery.has-nested-images.wge-gallery {
    grid-template-columns: repeat(var(--wge-sp-cols, 2), minmax(0, 1fr));
  }
}
