/* Repris à l'identique de l'ancien includes/carousel.php */
/*
 * Carrousel des jeux du header
 * - 7 jeux maximum visibles sur grand écran
 * - défilement infini avec les deux flèches
 * - le nombre visible diminue seulement quand la largeur d'écran l'impose
 */
html body .carousel-wrapper.pm-header-carousel-gap.pm-games-carousel {
  --pm-games-visible: 7;
  --pm-games-gap: 12px;

  width: min(760px, calc(100% - (var(--pm-content-gutter, 20px) * 2))) !important;
  max-width: min(760px, calc(100% - (var(--pm-content-gutter, 20px) * 2))) !important;
  margin-top: 68px !important;
  margin-right: auto !important;
  margin-left: auto !important;
  position: relative;
}

html body .pm-games-carousel .pm-games-carousel-viewport {
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
  padding: 1rem 0 !important;
  scroll-snap-type: none !important;
  overscroll-behavior: none !important;
}

html body .pm-games-carousel .pm-games-carousel-track {
  display: flex;
  align-items: stretch;
  gap: var(--pm-games-gap);
  width: 100%;
  transform: translate3d(0, 0, 0);
  transition: transform .28s ease;
  will-change: transform;
}

html body .pm-games-carousel .pm-games-carousel-item {
  display: block;
  flex: 0 0 calc(
    (100% - ((var(--pm-games-visible) - 1) * var(--pm-games-gap)))
    / var(--pm-games-visible)
  ) !important;
  min-width: 0;
  scroll-snap-align: none !important;
}

html body .pm-games-carousel .carousel-img {
  display: block;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 9 / 13;
  object-fit: cover;
}

html body .pm-games-carousel.pm-games-carousel--no-nav .carousel-arrow {
  display: none !important;
}

/* Les flèches restent utilisables dès qu'il existe d'autres jeux à afficher. */
html body .pm-games-carousel .carousel-arrow {
  z-index: 5;
}

/* Tablettes : toujours "maximum 7", mais on évite de rendre les jaquettes illisibles. */
@media (max-width: 900px) {
  html body .carousel-wrapper.pm-games-carousel {
    --pm-games-visible: 6;
  }
}

@media (max-width: 768px) {
  html body .carousel-wrapper.pm-header-carousel-gap.pm-games-carousel {
    --pm-games-visible: 5;
    margin-top: 86px !important;
  }

  /* responsive.css masquait auparavant toutes les flèches sur mobile. */
  html body .pm-games-carousel:not(.pm-games-carousel--no-nav) .carousel-arrow {
    display: flex !important;
  }
}

@media (max-width: 620px) {
  html body .carousel-wrapper.pm-games-carousel {
    --pm-games-visible: 4;
  }
}

@media (max-width: 480px) {
  html body .carousel-wrapper.pm-games-carousel {
    --pm-games-visible: 3;
    --pm-games-gap: 9px;
  }
}

/* Accueil : bloc AdSense fixe au début de la liste des jeux (2 jaquettes de large) ; les jeux défilent à côté. */
html body .pm-games-carousel--with-ad .pm-games-carousel-viewport { display: flex; gap: var(--pm-games-gap); }
html body .pm-games-carousel--with-ad .pm-games-carousel-track { flex: 1 1 auto; min-width: 0; }
html body .pm-games-carousel--with-ad .pm-games-carousel-ad {
  position: relative; z-index: 2; flex: 0 0 calc((100% - 6 * var(--pm-games-gap)) / 7 * 2 + var(--pm-games-gap));
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  border-radius: 10px; background: var(--card-bg, #1f1f1f); box-shadow: 0 0 0 1px var(--card-border, rgba(255,255,255,.08));
}
html body .pm-games-carousel--with-ad .pm-games-carousel-ad .pm-ad { width: 100%; }
html body .pm-games-carousel--with-ad .pm-games-carousel-ad .pm-ad__label { margin: 4px 0 2px; }
html body .carousel-wrapper.pm-games-carousel--with-ad { --pm-games-visible: 5; }
@media (max-width: 900px) { html body .carousel-wrapper.pm-games-carousel--with-ad { --pm-games-visible: 4; } }
@media (max-width: 768px) { html body .carousel-wrapper.pm-games-carousel--with-ad { --pm-games-visible: 3; } }
/* Petits écrans, ou Google sans annonce : le bloc disparaît et les jeux reprennent toute la place. */
@media (max-width: 620px) {
  html body .pm-games-carousel--with-ad .pm-games-carousel-ad { display: none; }
  html body .carousel-wrapper.pm-games-carousel--with-ad { --pm-games-visible: 4; }
}
@media (max-width: 480px) { html body .carousel-wrapper.pm-games-carousel--with-ad { --pm-games-visible: 3; } }
html body .pm-games-carousel--with-ad.pm-ad-unfilled .pm-games-carousel-ad { display: none; }
html body .carousel-wrapper.pm-games-carousel--with-ad.pm-ad-unfilled { --pm-games-visible: 7; }
@media (max-width: 900px) { html body .carousel-wrapper.pm-games-carousel--with-ad.pm-ad-unfilled { --pm-games-visible: 6; } }
@media (max-width: 768px) { html body .carousel-wrapper.pm-games-carousel--with-ad.pm-ad-unfilled { --pm-games-visible: 5; } }
