/*
 * Product groups grid.
 * Desktop mirrors the old page: four columns, three rows (RTL, so column 1 is on the right):
 *   manga  manga  | figures figures
 *   funko  funko  | cosplay models
 *   plush  plush  | gachapon gachapon
 * Tablets get two equal columns, phones a single column.
 */

.products {
  padding-block: 1.5rem 3rem;
}

.products__grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: 190px 190px 250px;
  grid-template-areas:
    "manga   manga   figures  figures"
    "funko   funko   cosplay  models"
    "plush   plush   gachapon gachapon";
}

.tile--manga    { grid-area: manga; }
.tile--figures  { grid-area: figures; }
.tile--funko    { grid-area: funko; }
.tile--cosplay  { grid-area: cosplay; }
.tile--models   { grid-area: models; }
.tile--plush    { grid-area: plush; }
.tile--gachapon { grid-area: gachapon; }

/* ---------- One tile ---------- */

.tile {
  position: relative;
  overflow: hidden;
  background: var(--color-dark);
  color: #ffffff;
}

.tile__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

/* Dark layer on the picture so the white name stays readable. */
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
}

.tile:hover .tile__image {
  transform: scale(1.04);
}

.tile__body {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
}

.tile__title {
  margin: 0;
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.tile__text {
  max-width: 18rem;
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

/* ---------- Tablets ---------- */

@media (max-width: 900px) {
  .products__grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: none;
    grid-auto-rows: 200px;
    grid-template-areas:
      "manga   figures"
      "funko   cosplay"
      "models  plush"
      "gachapon gachapon";
  }
}

/* ---------- Phones ---------- */

@media (max-width: 560px) {
  .products__grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 190px;
    grid-template-areas:
      "manga" "figures" "funko" "cosplay" "models" "plush" "gachapon";
  }
}
