/* ==========================================================================
   IRONBEASTS - CATEGORY PHOTO CARDS  (cat-cards.css)
   The "Shop by Category" card: a 4:5 photo with the category's name over a
   shaded foot. On the homepage it sits on the scrolling track (home.css holds
   the track); on the 404 page in a plain grid (error.css). Loaded only on
   those two, never site-wide.
   ========================================================================== */

.cat-card {
  scroll-snap-align: start;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  /* Holds the card's shape while the photo loads, so nothing shifts. */
  background: var(--surface-3);
  color: var(--ib-white);
}

.cat-card img {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--t);
}

/* Only the foot of the photo is shaded, enough to carry the name; the rest
   of the picture is left alone. */
.cat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, var(--shade-5) 0%, var(--shade-2) 40%, transparent 65%);
  transition: background var(--t);
}

.cat-card:hover img {
  transform: scale(1.04);
}

.cat-card:hover::after {
  background: linear-gradient(to top, var(--shade-6) 0%, var(--shade-3) 45%, var(--shade-1) 100%);
}

.cat-card__name {
  position: relative;
  z-index: 2;
  padding: clamp(1rem, 2vw, 1.5rem) 1rem;
  text-align: center;
  font-family: var(--font-display);
  line-height: var(--lh-snug);
  font-weight: 600;
  font-size: var(--fs-fluid-md);
  letter-spacing: var(--ls-3);
  text-transform: uppercase;
}

/* The cards are narrow on a phone, so the name takes less of the photo. */
@media (max-width: 640px) {
  .cat-card__name {
    padding: .8rem .6rem;
    font-size: var(--fs-15);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cat-card img,
  .cat-card:hover img {
    transition: none;
    transform: none;
  }
}
