/**
 * DJ Refresh — "Our Products" category tiles.
 * Figma: 8 equal columns, 16px gutters. Each tile is a 166px-tall #f2f2f2 panel with the
 * product centred, and a bold label 12px below.
 */

.djr-categories {
  --djr-cat-tile-h: 166px;
  --djr-cat-gap: 16px;

  background: var(--djr-white);
  border-bottom: 1px solid var(--djr-surface);
}
a.djr-categories__tile:hover {
  text-decoration: none;
}
a.djr-categories__tile:hover span {
  color: var(--djr-red)!important;
}
.djr-categories__title {
  margin-bottom: 36px;
}

/* One row that scrolls horizontally when the tiles overflow. When they all fit, it just reads as
   a left-aligned row (no scroll). The djr-scroller JS adds arrows + drives the progress bar, and
   toggles .is-scrollable / .is-static based on whether the track actually overflows. */
.djr-categories__grid {
  display: flex;
  gap: var(--djr-cat-gap);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-padding-left: var(--djr-gutter);
}

.djr-categories__grid::-webkit-scrollbar {
  display: none;
}

.djr-categories__item {
  flex: 0 0 auto;
  width: 200px;
  min-width: 0;
  scroll-snap-align: start;
}

.djr-categories__tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.djr-categories__media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--djr-cat-tile-h);
  border-radius: var(--djr-radius);
  background: var(--djr-surface);
  overflow: hidden;
  transition: background-color 0.2s ease;
}

.djr-categories__image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  object-fit: contain;
  transition: transform 0.25s ease;
}

/* Lifestyle photo revealed on hover — same treatment as the mega-menu tile: fills the box and
   fades over the product-on-grey. */
.djr-categories__hover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.djr-categories__tile:hover .djr-categories__media,
.djr-categories__tile:focus-visible .djr-categories__media {
  background: #e9e9e9;
}

.djr-categories__tile:hover .djr-categories__image,
.djr-categories__tile:focus-visible .djr-categories__image {
  transform: scale(1.06);
}

.djr-categories__tile:hover .djr-categories__hover,
.djr-categories__tile:focus-visible .djr-categories__hover {
  opacity: 1;
}

.djr-categories__label {
  font-size: var(--djr-body-size);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  color: var(--djr-ink);
}

/* Progress bar shows only when the track actually overflows (JS adds .is-scrollable). */
.djr-categories__scroller .djr-scroller__bar {
  display: none;
  margin-top: 28px;
}

.djr-categories__scroller.is-scrollable .djr-scroller__bar {
  display: block;
}

/* ---------- Responsive ---------- */

@media (max-width: 1200px) {
  .djr-categories__item {
    width: 190px;
  }
}

@media (max-width: 700px) {
  .djr-categories {
    --djr-cat-tile-h: 120px;
  }

  .djr-categories__grid {
    /* Proximity so touch swipes move freely instead of snapping back to a card edge. */
    touch-action: pan-x;
  }

  .djr-categories__item {
    width: 45vw;
    max-width: 190px;
  }

  .djr-categories__label {
    font-size: 14px;
  }
}
