/* ==========================================================================
   Marquee — a row that keeps scrolling: logos, testimonials, announcements.

   <div class="marquee" data-moey-marquee aria-label="Our customers">
     <ul class="marquee-group"> <li>…</li> … </ul>
   </div>

   moey.js repeats the group to fill the width (copies are hidden from screen readers), sets the
   speed (data-moey-speed, px per second), adds a pause button and stops while off screen.
   Hover or focus pauses it; with reduced motion it stands still and scrolls by hand.
   .marquee-reverse · .marquee-vertical (give it a height) · --mo-marquee-gap · --mo-marquee-fade
   ========================================================================== */

.marquee {
  --mo-marquee-gap: 2.5rem;
  --mo-marquee-fade: 3rem;
  --mo-marquee-duration: 30s;
  position: relative;
  display: flex;
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, #000 var(--mo-marquee-fade), #000 calc(100% - var(--mo-marquee-fade)), transparent);
}
.marquee-inner { display: flex; flex: none; gap: var(--mo-marquee-gap); min-width: max-content; }
.marquee-group {
  display: flex;
  flex: none;
  gap: var(--mo-marquee-gap);
  align-items: center;
  padding: 0;
  margin: 0;
  list-style: none;
}
.marquee-group > * { flex: none; }
@media (prefers-reduced-motion: no-preference) {
  .marquee.is-ready > .marquee-inner { animation: mo-marquee var(--mo-marquee-duration) linear infinite; }
  .marquee.is-ready.marquee-reverse > .marquee-inner { animation-direction: reverse; }
  .marquee:is(:hover, :focus-within, .is-paused, .is-offscreen) > .marquee-inner { animation-play-state: paused; }
}
/* the half-way point: one full set of copies has gone by */
@keyframes mo-marquee { to { translate: calc(-50% - var(--mo-marquee-gap) / 2) 0; } }
@keyframes mo-marquee-rtl { to { translate: calc(50% + var(--mo-marquee-gap) / 2) 0; } }
@keyframes mo-marquee-y { to { translate: 0 calc(-50% - var(--mo-marquee-gap) / 2); } }
.marquee:dir(rtl) > .marquee-inner { animation-name: mo-marquee-rtl; }
.marquee:dir(rtl) { mask-image: linear-gradient(to left, transparent, #000 var(--mo-marquee-fade), #000 calc(100% - var(--mo-marquee-fade)), transparent); }

/* Vertical */
.marquee-vertical { flex-direction: column; mask-image: linear-gradient(transparent, #000 var(--mo-marquee-fade), #000 calc(100% - var(--mo-marquee-fade)), transparent); }
.marquee-vertical > .marquee-inner,
.marquee-vertical .marquee-group { flex-direction: column; min-width: 0; }
.marquee-vertical > .marquee-inner { animation-name: mo-marquee-y !important; }

/* The pause button (moving content must be stoppable) */
.marquee-pause {
  position: absolute;
  inset-block-end: .25rem;
  inset-inline-end: .25rem;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  color: var(--mo-fg-2);
  cursor: pointer;
  background: color-mix(in oklab, var(--mo-bg-surface) 85%, transparent);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 0 0 1px var(--mo-border-color);
  opacity: .7;
}
.marquee-pause:hover, .marquee-pause:focus-visible { opacity: 1; }
.marquee-pause:focus-visible { outline: var(--mo-focus-ring-width) solid var(--mo-theme-focus-ring); }
.marquee-pause::before { width: .75rem; height: .75rem; content: ""; background: linear-gradient(90deg, currentcolor 0 35%, transparent 35% 65%, currentcolor 65%); }
.marquee.is-paused .marquee-pause::before { width: .8rem; background: currentcolor; clip-path: polygon(15% 0, 100% 50%, 15% 100%); }
/* Reduced motion: a still row you scroll yourself, no copies, no button */
@media (prefers-reduced-motion: reduce) {
  .marquee { overflow-x: auto; mask-image: none; scrollbar-width: thin; }
  .marquee-vertical { overflow-y: auto; }
  .marquee .marquee-copy, .marquee-pause { display: none; }
}
