/* Home layout fixes — horizontal rows everywhere except "Nouveaux Projets" */

#reco-grid,
#pop-grid,
#new-grid,
#maj-list {
  min-width: 0;
}

#reco-grid .card,
#pop-grid .card,
#new-grid .card,
#maj-list .maj-item {
  overflow: hidden;
}

/* Recommendation + Popular: one horizontal row, like a catalogue carousel. */
#reco-grid,
#pop-grid {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: stretch;
  gap: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 3px 18px;
  margin: 0;
  scroll-snap-type: x proximity;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}

#reco-grid::-webkit-scrollbar,
#pop-grid::-webkit-scrollbar {
  display: none;
  height: 0;
}

#reco-grid .card,
#pop-grid .card {
  flex: 0 0 clamp(152px, 16vw, 190px);
  width: clamp(152px, 16vw, 190px);
  min-width: 0;
  scroll-snap-align: start;
}

/* Last updates: also one horizontal row, never a multi-row pile. */
#maj-list {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: stretch;
  gap: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 3px 16px;
  margin: 0;
  scroll-snap-type: x proximity;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}

#maj-list::-webkit-scrollbar {
  display: none;
  height: 0;
}

#maj-list .maj-item {
  flex: 0 0 clamp(280px, 29vw, 390px);
  width: clamp(280px, 29vw, 390px);
  min-width: 0;
  scroll-snap-align: start;
}

#reco-grid .card-body,
#pop-grid .card-body,
#new-grid .card-body {
  min-height: 72px;
}

/* Trending: keep the ranking number beside the cover instead of layering it over text. */
#trend-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 3px 18px;
  margin: 0;
  scroll-snap-type: x proximity;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}

#trend-row::-webkit-scrollbar {
  display: none;
  height: 0;
}

#trend-row .trend-item {
  flex: 0 0 212px;
  width: 212px;
  min-width: 212px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: start;
  gap: 4px;
  scroll-snap-align: start;
}

#trend-row .trend-num {
  width: 46px;
  margin: 72px 0 0;
  font-size: 3.55rem;
  line-height: .82;
  z-index: 0;
}

#trend-row .trend-main {
  width: 162px;
  min-width: 0;
  z-index: 1;
}

#trend-row .trend-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
}

#trend-row .trend-meta {
  min-width: 0;
}

#trend-row .trend-meta strong,
#trend-row .trend-meta small {
  max-width: 100%;
}

/* Genres: one horizontal line instead of a multi-row wall of chips. */
#genres-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 3px 14px;
  margin: 0;
  scrollbar-width: none;
  overscroll-behavior-inline: contain;
}

#genres-row::-webkit-scrollbar {
  display: none;
  height: 0;
}

#genres-row .chip {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Stats remain a single horizontal strip on compact screens too. */
.stats-bar {
  flex-wrap: nowrap !important;
  justify-content: flex-start !important;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 3px 3px 14px;
  scrollbar-width: none;
}

.stats-bar::-webkit-scrollbar {
  display: none;
  height: 0;
}

.stats-bar .stat {
  flex: 0 0 min(300px, 76vw);
  min-width: 0;
}

/* "Nouveaux Projets" is the only intentionally vertical section. */
#new-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
  align-items: start;
}

.home-load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}

.home-load-more {
  min-width: 150px;
  justify-content: center;
  cursor: pointer;
}

.home-load-more[disabled] {
  opacity: .55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

@media (max-width: 720px) {
  #reco-grid .card,
  #pop-grid .card {
    flex-basis: 156px;
    width: 156px;
  }

  #maj-list .maj-item {
    flex-basis: 290px;
    width: 290px;
  }

  #trend-row .trend-item {
    flex-basis: 202px;
    width: 202px;
    min-width: 202px;
  }

  #trend-row .trend-main {
    width: 156px;
  }

  #new-grid {
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 16px;
  }
}
