/* ==========================================================================
   Games slider block
   ========================================================================== */

.games-slider {
  position: relative;
  padding-bottom: 0.5rem;
}

/* Baseline layout for the brief window before Swiper's JS has run (or on
   the rare chance it fails to load at all) — a plain equal-width
   horizontal row that scrolls, instead of slides stacking full-width on
   top of each other. Scoped to :not(.swiper-initialized) so it switches
   off the instant Swiper adds that class — otherwise this overflow-x:auto
   keeps producing a second, redundant native scrollbar underneath
   Swiper's own transform-driven sliding even after it's fully working. */
.games-slider:not(.swiper-initialized) .swiper-wrapper {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
}

.games-slider:not(.swiper-initialized) .swiper-slide {
  flex: 0 0 auto;
  width: 45%;
}

@media (min-width: 480px) {
  .games-slider:not(.swiper-initialized) .swiper-slide {
    width: 31%;
  }
}

@media (min-width: 768px) {
  .games-slider:not(.swiper-initialized) .swiper-slide {
    width: 23%;
  }
}

@media (min-width: 1024px) {
  .games-slider:not(.swiper-initialized) .swiper-slide {
    width: 18.5%;
  }
}

@media (min-width: 1440px) {
  .games-slider:not(.swiper-initialized) .swiper-slide {
    width: 15.5%;
  }
}

.game-card {
  display: flex;
  flex-direction: column;
  background-color: var(--color-bg-dark);
  border-radius: var(--radius-card);
  overflow: hidden;
  height: 100%;
}

.game-card__media {
  position: relative;
  flex-shrink: 0;
  /* Matches the game cover artwork's native ~427:575 proportions so the
     title text near the bottom of the cover is never cropped off. */
  aspect-ratio: 427 / 575;
}

.game-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-card__play {
  position: absolute;
  inset: auto 0.75rem 0.75rem 0.75rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--transition-base), transform var(--transition-base);
  padding: 0.6rem 1rem;
  font-size: var(--font-size-small);
}

.game-card:hover .game-card__play,
.game-card:focus-within .game-card__play {
  opacity: 1;
  transform: translateY(0);
}

.game-card__name {
  padding: 0.75rem;
  color: var(--color-white);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-medium);
  line-height: 1.3;
  text-align: center;
  margin: 0;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* Fixed to exactly two lines so every card in the row is the same
     height no matter how long the individual game name is. */
  min-height: calc(1.3em * 2 + 1.5rem);
}

.games-slider .swiper-button-prev,
.games-slider .swiper-button-next {
  color: var(--color-accent-light);
  background-color: var(--color-card-bg);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
}

.games-slider .swiper-button-prev::after,
.games-slider .swiper-button-next::after {
  font-size: 1rem;
}

@media (max-width: 767px) {
  .games-slider .swiper-button-prev,
  .games-slider .swiper-button-next {
    display: none;
  }
}
