/* ==========================================================================
   categories.css — "Tile discovery starts here" collection list.
   Requires common.css.

   Desktop: a 5-column grid of category cards.
   Tablet / mobile: a horizontal scroll-snap slider showing ~2 cards with a
                    peek of the next, driven by the prev/next buttons in
                    categories.js.
   ========================================================================== */

.categories {
  background: #f3f1ec;
}

.categories__inner {
  padding-top: 3.6rem;
  padding-bottom: 1.5rem;
}

.categories__header {
  margin-bottom: 2rem;
}

.categories__title {
  margin: 0;
  font-size: 3rem;
  font-weight: 400;
  line-height: 1.2;
}

/* --- Track ---------------------------------------------------------------- */
.categories__list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc(50% - 0.75rem);
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.categories__list::-webkit-scrollbar {
  display: none;
}

.categories__item {
  scroll-snap-align: start;
}

/* --- Card ----------------------------------------------------------------- */
.category-card__link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.category-card__media {
  overflow: hidden;
  background: #fff;
  aspect-ratio: 1080 / 1350;
}

.category-card__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.category-card__link:hover .category-card__image {
  transform: scale(1.04);
}

.category-card__content {
  padding: 1.5rem 0.5rem 0;
}

.category-card__heading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  font-size: 1.8rem;
  font-weight: 500;
  line-height: 1.3;
}

.category-card__caption {
  margin: 0.6rem 0 0;
  font-size: 1.4rem;
  line-height: 1.5;
  color: rgba(var(--text-color), 0.75);
}

.category-card__caption p {
  display: -webkit-box;
  -webkit-line-clamp: 2;       /* number of lines to show */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.category-card__arrow {
  display: inline-flex;
  flex: 0 0 auto;
}

.category-card__arrow svg {
  width: 1.4rem;
  height: 1rem;
  transition: transform 0.2s ease;
}

.category-card__link:hover .category-card__arrow svg {
  transform: translateX(0.4rem);
}

/* --- Controls ------------------------------------------------------------- */
.categories__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
}

.categories__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: #303030;
  cursor: pointer;
}

.categories__button:hover {
  background: rgba(var(--text-color), 0.06);
}

.categories__button svg {
  width: 1.4rem;
  height: 1rem;
}

.categories__button--prev svg {
  transform: rotate(90deg);
}

.categories__button--next svg {
  transform: rotate(-90deg);
}

.categories__button:disabled {
  opacity: 0.3;
  cursor: default;
}

.categories__counter {
  font-size: 1.4rem;
  letter-spacing: 0.05rem;
}

/* --- Desktop -------------------------------------------------------------- */
@media (min-width: 990px) {
  .categories__inner {
    padding-top: 4.8rem;
    padding-bottom: 2rem;
  }

  .categories__title {
    font-size: 4rem;
  }

  .categories__list {
    grid-auto-columns: calc((100% - 6rem) / 5);
  }

  /* Five cards fit on screen — no need to scroll or show the controls. */
  .categories__controls {
    display: none;
  }
}
