/**
 * DAM Gallery Block - Editor Styles
 */

.wp-block-dam-gallery {
  position: relative;
}

.wp-block-dam-gallery .blocks-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.wp-block-dam-gallery.columns-1 .blocks-gallery-grid {
  grid-template-columns: repeat(1, 1fr);
}

.wp-block-dam-gallery.columns-2 .blocks-gallery-grid {
  grid-template-columns: repeat(2, 1fr);
}

.wp-block-dam-gallery.columns-3 .blocks-gallery-grid {
  grid-template-columns: repeat(3, 1fr);
}

.wp-block-dam-gallery.columns-4 .blocks-gallery-grid {
  grid-template-columns: repeat(4, 1fr);
}

.wp-block-dam-gallery.columns-5 .blocks-gallery-grid {
  grid-template-columns: repeat(5, 1fr);
}

.wp-block-dam-gallery.columns-6 .blocks-gallery-grid {
  grid-template-columns: repeat(6, 1fr);
}

.wp-block-dam-gallery .blocks-gallery-item {
  position: relative;
  overflow: hidden;
}

.wp-block-dam-gallery .blocks-gallery-item img {
  width: 100%;
  height: auto;
  display: block;
}

.wp-block-dam-gallery.is-cropped .blocks-gallery-item {
  aspect-ratio: 1 / 1;
}

.wp-block-dam-gallery.is-cropped .blocks-gallery-item img {
  height: 100%;
  object-fit: cover;
}

.wp-block-dam-gallery .blocks-gallery-item figcaption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.875em;
  text-align: center;
}

.wp-block-dam-gallery .components-placeholder {
  min-height: 200px;
}

/* Masonry layout */
.wp-block-dam-gallery.layout-masonry .blocks-gallery-grid {
  display: block;
  column-count: 3;
  column-gap: 16px;
}

.wp-block-dam-gallery.layout-masonry .blocks-gallery-item {
  break-inside: avoid;
  margin-bottom: 16px;
}

/* Carousel layout */
.wp-block-dam-gallery.layout-carousel .blocks-gallery-grid {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: 16px;
}

.wp-block-dam-gallery.layout-carousel .blocks-gallery-item {
  flex: 0 0 auto;
  scroll-snap-align: start;
  width: 300px;
}
