/* Infinite marquee — pure CSS.
   Two identical groups sit side by side; the track moves by exactly one group
   (-50%) and starts again, so the loop has no seam. */

.marquee {
  --marquee-duration: 32s; /* time to travel one group: lower = faster */
  --marquee-gap: clamp(24px, 4vw, 56px);
  overflow: hidden;
  /* soft edges instead of a hard cut */
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}

.marquee__track {
  display: flex;
  width: max-content;
  animation: marquee var(--marquee-duration) linear infinite;
}

.marquee__group {
  display: flex;
  align-items: center;
  gap: var(--marquee-gap);
  margin: 0;
  /* the gap after the last item, so both groups have exactly the same width */
  padding: 0 var(--marquee-gap) 0 0;
  list-style: none;
}

.marquee__group li {
  display: flex;
  align-items: center;
  gap: var(--marquee-gap);
  white-space: nowrap;
  font: 700 clamp(40px, 7vw, 96px)/1.1 var(--font-display, system-ui, sans-serif);
  letter-spacing: -0.03em;
}

/* a small star between items */
.marquee__group li::after {
  content: "";
  width: 0.36em;
  height: 0.36em;
  background: var(--accent, #ff6a3d);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
}

.marquee--reverse .marquee__track { animation-direction: reverse; }
.marquee--reverse { --marquee-duration: 44s; }

.marquee--outline .marquee__group li {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--muted, #9c9488);
}
.marquee--outline .marquee__group li::after { background: var(--muted, #9c9488); }

/* pause: hover, keyboard focus inside, or the pause button */
.marquee:hover .marquee__track,
.marquee:focus-within .marquee__track,
.marquee.is-paused .marquee__track {
  animation-play-state: paused;
}

@keyframes marquee {
  to { transform: translateX(-50%); }
}

/* Reduced motion: no autoplay. The list stays still and can be scrolled by hand. */
@media (prefers-reduced-motion: reduce) {
  .marquee {
    overflow-x: auto;
    scroll-snap-type: x proximity;
    mask-image: none;
  }
  .marquee__track { animation: none; }
  .marquee__group[aria-hidden="true"] { display: none; }
  .marquee__group li { scroll-snap-align: start; }
  .marquee-toggle { display: none; }
}

/* demo layout */
.mq-stage {
  min-height: 100svh;
  display: grid;
  align-content: center;
  gap: 32px;
  padding: 96px 0 64px;
}
.mq-stage .demo-note { padding: 0 28px; }
.marquee-toggle {
  justify-self: start;
  margin-left: 28px;
  border: 1px solid #463f37;
  background: transparent;
  color: inherit;
  border-radius: 999px;
  padding: 10px 18px;
  font: 500 14px var(--font-ui, system-ui, sans-serif);
  cursor: pointer;
}
.marquee-toggle:hover { border-color: currentColor; }
