.categories {
  padding: 24px 0;
  background: var(--page-background, #faf9f6);
}

.categories-container {
  width: 100%;
  max-width: 1536px;
  margin: 0 auto;
  padding: 0 16px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.category-card {
  position: relative;
  display: block;
  min-width: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: #d7d5cf;
  box-shadow: 0 1px 2px rgb(15 23 42 / 10%);
  cursor: pointer;
  isolation: isolate;
  transform: translateZ(0);
  transition:
    transform 300ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

.category-card::before {
  position: absolute;
  z-index: 1;
  inset: 0;
  content: "";
  background: linear-gradient(
    to top,
    rgb(0 0 0 / 80%) 0%,
    rgb(0 0 0 / 20%) 55%,
    transparent 100%
  );
  pointer-events: none;
}

.category-card::after {
  position: absolute;
  z-index: 3;
  inset: 0;
  border: 1px solid rgb(255 255 255 / 30%);
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.category-card:hover {
  z-index: 2;
  box-shadow: 0 12px 28px -10px rgb(15 23 42 / 42%);
  transform: scale(1.03);
}

.category-card:focus-visible {
  z-index: 2;
  outline: 3px solid rgb(37 99 235 / 34%);
  outline-offset: 3px;
}

.category-card.active,
.category-card.is-active,
.category-card[aria-pressed="true"],
.category-card[aria-current="true"] {
  box-shadow:
    0 0 0 2px var(--primary, #e86f2c),
    0 0 0 5px rgb(232 111 44 / 22%);
}

.category-card-image,
.category-card > img {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.category-card:hover .category-card-image,
.category-card:hover > img {
  transform: scale(1.1);
}

.category-card-label {
  position: absolute;
  z-index: 2;
  right: 4px;
  bottom: 8px;
  left: 4px;
  overflow: hidden;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgb(0 0 0 / 70%);
  white-space: nowrap;
}

@media (min-width: 640px) {
  .category-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 12px;
  }

  .category-card-label {
    right: 6px;
    bottom: 10px;
    left: 6px;
    font-size: 12px;
  }
}

@media (min-width: 768px) {
  .category-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .category-grid {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }

  .categories-container {
    padding: 0 32px;
  }
}

@media (min-width: 1280px) {
  .category-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .category-card,
  .category-card-image,
  .category-card > img {
    transition: none;
  }

  .category-card:hover,
  .category-card:hover .category-card-image,
  .category-card:hover > img {
    transform: none;
  }
}
