/* Keep the catalog background continuous when only a few products are listed. */
html {
  min-height: 100%;
  background: var(--page, #f7f7f5);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

.catalog-page {
  position: relative;
  isolation: isolate;
  min-height: calc(100vh - 72px);
  min-height: calc(100dvh - 72px);
  overflow: hidden;
}

.catalog-page::before {
  position: absolute;
  z-index: -1;
  right: max(-80px, calc((100vw - 1900px) / 2));
  bottom: -72px;
  width: min(48vw, 920px);
  aspect-ratio: 92 / 62;
  background: url('../assets/catalog-ambient-cards.svg') center / contain no-repeat;
  content: '';
  opacity: .82;
  pointer-events: none;
}

.catalog-page::after {
  position: absolute;
  z-index: -2;
  right: 0;
  bottom: 0;
  width: min(58vw, 1120px);
  height: min(56vh, 620px);
  background: radial-gradient(circle at 70% 64%, rgba(228, 61, 77, .075), transparent 55%);
  content: '';
  pointer-events: none;
}

.catalog-heading::after {
  top: 0;
  right: 0;
  width: min(42%, 520px);
  height: 100%;
  border: 0;
  border-radius: 0;
  background: url('../assets/catalog-heading-game-cards.svg') right center / auto 100% no-repeat;
  opacity: .92;
}

/* Give sparse catalogs a calmer reading rhythm without changing card structure. */
.catalog-featured {
  gap: 20px;
  padding-inline: 24px;
  margin-bottom: 52px;
}

.catalog-grid {
  gap: 42px 32px;
  padding: 0 24px 28px;
}

.catalog-item {
  border-radius: 10px;
  touch-action: manipulation;
}

.catalog-item:focus-visible {
  outline: 3px solid rgba(228, 61, 77, .24);
  outline-offset: 4px;
}

.catalog-item__title {
  margin-top: 14px;
  line-height: 1.35;
}

.catalog-item__meta {
  margin-top: 7px;
}

/* CDKEY uses a platform-led horizontal card language inspired by card stores. */
.catalog-grid--cdkey {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.catalog-item--cdkey {
  display: grid;
  grid-template-columns: minmax(126px, 42%) minmax(0, 1fr);
  min-height: 164px;
  overflow: hidden;
  border: 1px solid rgba(20, 29, 43, .1);
  border-radius: 16px;
  background: linear-gradient(135deg, #fff 45%, #f7f4f2 100%);
  box-shadow: 0 8px 24px rgba(24, 31, 43, .07);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.catalog-item--cdkey:hover {
  transform: translateY(-3px);
  border-color: rgba(228, 61, 77, .28);
  box-shadow: 0 14px 32px rgba(24, 31, 43, .11);
}

.catalog-item--cdkey:focus-visible {
  outline: 3px solid rgba(228, 61, 77, .24);
  outline-offset: 3px;
}

.catalog-item--cdkey .catalog-item__image {
  height: 164px;
  aspect-ratio: auto;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #eceff3;
}

.catalog-item--cdkey .catalog-item__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.catalog-item--cdkey .catalog-item__body {
  display: flex;
  min-width: 0;
  padding: 22px 20px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.catalog-item--cdkey .catalog-item__title {
  margin: 0;
  font-size: clamp(16px, 1.25vw, 20px);
  line-height: 1.25;
}

.catalog-item--cdkey .catalog-item__meta {
  margin-top: 8px;
  color: #697386;
}

.catalog-item__platform {
  display: inline-flex;
  margin-top: 18px;
  padding: 5px 10px;
  border: 1px solid rgba(228, 61, 77, .16);
  border-radius: 999px;
  background: rgba(228, 61, 77, .07);
  color: #b8293a;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.catalog-cdkey-view .catalog-featured {
  margin: 0;
}

#catalogFilters button[data-filter^="cdkey:"] span {
  padding-left: 10px;
}

@media (max-width: 980px) {
  .catalog-grid--cdkey { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .catalog-page {
    min-height: calc(100vh - 62px);
    min-height: calc(100dvh - 62px);
  }

  .catalog-page::before {
    right: -170px;
    bottom: -12px;
    width: 560px;
    opacity: .28;
  }

  .catalog-heading::after {
    right: -80px;
    width: 270px;
    opacity: .7;
  }

  .catalog-featured {
    gap: 14px;
    padding-inline: 6px;
    margin-bottom: 34px;
  }

  .catalog-grid {
    gap: 30px 18px;
    padding: 0 6px 22px;
  }

  .catalog-item--cdkey {
    grid-template-columns: 120px minmax(0, 1fr);
    min-height: 144px;
  }

  .catalog-item--cdkey .catalog-item__image { height: 144px; }
  .catalog-item--cdkey .catalog-item__body { padding: 18px 16px; }
  .catalog-item__platform { margin-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .catalog-page::before,
  .catalog-page::after { animation: none; }

  .catalog-item--cdkey { transition: none; }
}
