/* <so-marquee> — structural styles only. Tile look lives with the theme. */
so-marquee {
  --so-marquee-gap: 14px;
  --so-marquee-fade: 72px;

  display: block;
  position: relative;
  overflow: hidden;
  cursor: grab;
  /* Horizontal drags belong to the strip; vertical ones still scroll the page. */
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-mask-image: linear-gradient(
    to right,
    transparent,
    #000 var(--so-marquee-fade),
    #000 calc(100% - var(--so-marquee-fade)),
    transparent
  );
  mask-image: linear-gradient(
    to right,
    transparent,
    #000 var(--so-marquee-fade),
    #000 calc(100% - var(--so-marquee-fade)),
    transparent
  );
}

so-marquee[data-dragging] {
  cursor: grabbing;
}

/* While dragging, tiles must not steal the pointer or show hover states. */
so-marquee[data-dragging] .so-marquee__track > * {
  pointer-events: none;
}

.so-marquee__track {
  display: flex;
  width: max-content;
  will-change: transform;
}

/* Margin instead of gap: every tile carries its own spacing, so two sets are exactly 2× one set. */
.so-marquee__track > * {
  flex: none;
  margin-right: var(--so-marquee-gap);
}

/* Before the element upgrades (or with JS off) it is a plain scrollable row. */
so-marquee:not(:defined) {
  display: flex;
  gap: var(--so-marquee-gap);
  overflow-x: auto;
}

so-marquee:not(:defined) > * {
  flex: none;
}

@media (max-width: 640px) {
  so-marquee {
    --so-marquee-fade: 28px;
  }
}