/* Бесконечная лента плиток.
 *
 * Набор плиток отрисован дважды. Лента едет ровно на ширину одного набора,
 * и в конце цикла кадр совпадает с началом — стык не виден. Поэтому же ленту
 * нельзя останавливать на произвольной позиции: только пауза, без перемотки.
 */

.marquee {
  position: relative;
  overflow: hidden;
  /* Плитки у краёв растворяются, а не обрезаются линейкой. */
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent 0,
    #000 7%,
    #000 93%,
    transparent 100%
  );
  mask-image: linear-gradient(
    90deg,
    transparent 0,
    #000 7%,
    #000 93%,
    transparent 100%
  );
}

.marquee__track {
  display: flex;
  width: max-content;
  animation: marquee-drift 68s linear infinite;
}

/* Движение справа налево: плитки выезжают из правого края навстречу чтению.
   Лента уходит ровно на один набор, и в этот момент кадр совпадает со
   стартовым — поэтому мгновенный возврат в ноль не заметен. */
@keyframes marquee-drift {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

.marquee:hover .marquee__track,
.marquee:focus-within .marquee__track {
  animation-play-state: paused;
}

.marquee__group {
  display: flex;
  gap: 20px;
  padding-right: 20px; /* тот же зазор на стыке наборов */
}

.tile {
  position: relative;
  flex: 0 0 340px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
  overflow: hidden;
  transition: transform 0.25s ease, background 0.25s ease;
}

/* Подсветка в углу — постоянная, она и делает плитку «светящейся». */
.tile::after {
  content: "";
  position: absolute;
  top: -90px;
  right: -70px;
  width: 240px;
  height: 200px;
  z-index: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(107, 43, 255, 0.42) 0%,
    rgba(58, 137, 251, 0.14) 45%,
    transparent 72%
  );
  pointer-events: none;
  transition: opacity 0.25s ease;
}

/* Градиентная кромка проявляется при наведении. */
.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--gradient);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.tile:hover {
  transform: translateY(-4px);
  background: var(--surface-2);
}

.tile:hover::before {
  opacity: 1;
}

.tile__icon {
  z-index: 1;
  font-size: 30px;
  line-height: 1;
  margin-bottom: 18px;
  position: relative;
}

.tile h3 {
  z-index: 1;
  margin-bottom: 10px;
  position: relative;
}

.tile p {
  z-index: 1;
  color: var(--ink-soft);
  font-size: 15px;
  margin: 0;
  position: relative;
}

@media (max-width: 720px) {
  .tile {
    flex: 0 0 272px;
    padding: 24px;
  }

  .marquee__group {
    gap: 14px;
    padding-right: 14px;
  }
}

/* Тем, кто отключил анимацию, лента бесполезна: отдаём обычную прокрутку
   пальцем и убираем дубль, иначе список читался бы дважды. */
@media (prefers-reduced-motion: reduce) {
  .marquee {
    overflow-x: auto;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .marquee__track {
    animation: none;
    transform: none;
  }

  .marquee__group[aria-hidden="true"] {
    display: none;
  }
}
