/* =========================================================
   SHARED GRID
   Portee: Gameotheque + Saturday
   ========================================================= */

/* Shared utilities */
.icon-game svg {
  width: auto !important;
  height: 25px !important;
}

.flex-grow-1 {
  flex-grow: 1;
}

.filters-sidebar {
  min-width: 260px;
}

.filters-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 0.5rem;
  align-items: start;
  overflow: visible;
}

#filters-sticky {
  position: static;
}

@media (min-width: 992px) {
  #filters-sticky {
    position: sticky;
    top: 150px;
    align-self: flex-start;
    height: fit-content;
  }
}

@media (max-width: 991.98px) {
  .filters-layout {
    grid-template-columns: 1fr;
  }
}

.input-group .form-control {
  padding-right: 2.5rem;
}

.table-responsive {
  overflow-x: inherit !important;
}

/* Compact desktop filters on the two game collections. */
:is(#gameotheque-page, #sdr-page) .filters-layout {
  grid-template-columns: 280px minmax(0, 1fr);
}

:is(#gameotheque-page, #sdr-page) .filters-layout > * {
  min-width: 0;
}

:is(#gameotheque-page, #sdr-page) .filters-sidebar {
  min-width: 0;
  padding: 1.25rem !important;
}

:is(#gameotheque-page, #sdr-page) .filters-sidebar h2 {
  font-size: 1.2rem;
}

:is(#gameotheque-page, #sdr-page) .filters-sidebar h5 {
  font-size: 1rem;
}

:is(#gameotheque-page, #sdr-page) .filters-sidebar .btn {
  font-size: 0.75rem;
}

/* Keep cards in rows before Isotope takes over positioning. */
:is(#gameotheque-page, #sdr-page) .game-grid:not(.isotope-ready) {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}

/* Reserve cover space even while lazy images are still downloading. */
#gameotheque-page .card-game .card-img {
  aspect-ratio: 2 / 3;
}

#gameotheque-page .card-game .card-img button,
#gameotheque-page .card-game .card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 991.98px) {
  :is(#gameotheque-page, #sdr-page) .filters-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Shared card grid */
.game-grid {
  margin: 0 auto;
}

.card-game {
  margin: 0.5rem;
  width: calc(100% / 2 - var(--card-spacing));
}

@media screen and (min-width: 576px) {
  .card-game {
    width: calc(100% / 3 - var(--card-spacing));
  }
}

@media screen and (min-width: 768px) {
  .card-game {
    width: calc(100% / 4 - var(--card-spacing));
  }
}

@media screen and (min-width: 1200px) {
  .card-game {
    width: calc(100% / 6 - var(--card-spacing));
  }
}

@media screen and (min-width: 1600px) {
  .card-game {
    width: calc(100% / 7 - var(--card-spacing));
  }
}
