/* Gallery block > Styles > Marquee. */
.wp-block-gallery.is-style-marquee {
  --scala-gallery-height: max(500px, 33vh);
  --scala-gallery-gap: 24px;
}

.gallery-marquee,
.is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)).gallery-marquee {
  overflow: clip;
  width: 100vw !important;
  max-width: 100vw !important;
  margin-left: calc( (50vw - 50%) * -1) !important;
}

.gallery-marquee .wp-block-gallery.is-style-marquee {
  display: flex;
  width: -webkit-max-content;
  width: -moz-max-content;
  width: max-content;
}

.gallery-marquee .gallery-marquee-item {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--scala-gallery-gap);
  /* Include the loop seam in the animated track's width. */
  padding-right: var(--scala-gallery-gap);
  white-space: nowrap;
  animation: marquee 35s linear infinite;
}

.gallery-marquee .gallery-marquee-item .wp-block-image {
  max-width: 100%;
  height: var(--scala-gallery-height);
  width: auto;
  width: unset !important;
  margin: 0;
}

/* Keep an editable horizontal strip without the front-end cloning script. */
.editor-styles-wrapper .wp-block-gallery.is-style-marquee {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--scala-gallery-gap);
  overflow-x: auto;
  padding-bottom: 12px;
}

.editor-styles-wrapper .wp-block-gallery.is-style-marquee .wp-block-image {
  flex: 0 0 auto;
  width: auto !important;
  max-width: none;
  height: var(--scala-gallery-height);
  margin: 0;
}

.editor-styles-wrapper .wp-block-gallery.is-style-marquee .components-resizable-box__container {
  height: 100% !important;
}

.editor-styles-wrapper .wp-block-gallery.is-style-marquee .wp-block-image img {
  width: auto;
  max-width: none;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 781px) {
  .wp-block-gallery.is-style-marquee {
    --scala-gallery-height: 180px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-marquee .gallery-marquee-item {
    animation: none;
  }
}

@keyframes marquee {
  0% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(-100%);
  }
}
