.nmw-logo-gallery {
  --nmw-marquee-height: 480px;
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  border: 1px solid #f3f4f6;
  padding: 1.5rem;
}
.nmw-logo-gallery__heading {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin: 0 0 1rem;
}
.nmw-logo-gallery__grid--cols-3,
.nmw-logo-gallery__grid--cols-4 {
  display: grid;
  gap: 0.75rem;
}
.nmw-logo-gallery__grid--cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.nmw-logo-gallery__grid--cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.nmw-logo-gallery__cell {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  border-radius: 0.75rem;
  padding: 0.625rem;
  background: #f9fafb;
  transition: background 0.3s, box-shadow 0.3s;
}
.nmw-logo-gallery__cell:hover {
  background: #f3f4f6;
}
.nmw-logo-gallery__cell--grayscale:hover {
  background: #ffffff;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.nmw-logo-gallery__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: filter 0.3s, opacity 0.3s;
}
.nmw-logo-gallery__img--grayscale {
  filter: grayscale(1);
  opacity: 0.45;
}
.nmw-logo-gallery__cell--grayscale:hover .nmw-logo-gallery__img--grayscale {
  filter: grayscale(0);
  opacity: 1;
}

/* Mobile: hide the duplicated marquee half so it reads as a normal grid. */
@media (max-width: 767px) {
  .nmw-logo-gallery__set--duplicate {
    display: none;
  }
}

/* Desktop: bounded viewport with vertical marquee animation.
   The widget is self-contained (no sibling column to stretch its height to),
   so the scroll window needs an explicit height — see --nmw-marquee-height. */
@media (min-width: 768px) {
  .nmw-logo-gallery__marquee {
    height: var(--nmw-marquee-height, 480px);
    position: relative;
    overflow: hidden;
    mask-image: linear-gradient(
      to bottom,
      transparent 0,
      #000 24px,
      #000 calc(100% - 24px),
      transparent 100%
    );
    -webkit-mask-image: linear-gradient(
      to bottom,
      transparent 0,
      #000 24px,
      #000 calc(100% - 24px),
      transparent 100%
    );
  }

  .nmw-logo-gallery__track {
    animation: nmw-logo-gallery-scroll var(--nmw-marquee-duration, 60s) linear infinite;
    will-change: transform;
  }

  .nmw-logo-gallery__marquee:hover .nmw-logo-gallery__track,
  .nmw-logo-gallery__marquee:focus-within .nmw-logo-gallery__track {
    animation-play-state: paused;
  }

  .nmw-logo-gallery__set--duplicate {
    margin-top: 0.75rem;
  }
}

@keyframes nmw-logo-gallery-scroll {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(var(--nmw-marquee-distance, -50%));
  }
}

@media (prefers-reduced-motion: reduce) {
  .nmw-logo-gallery__track {
    animation: none;
  }
}
