/* ===== Categories Section ===== */

/* --- Base (Mobile) --- */
.categories {
  position: relative;
  padding: var(--space-2xl) 0;
  background: var(--az-dark-2);
  overflow: hidden;
}

.categories__texture {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.3;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 2px,
    rgba(244, 131, 46, 0.012) 2px,
    rgba(244, 131, 46, 0.012) 3px
  );
}

.categories__header {
  text-align: center;
  margin-bottom: var(--space-xl);
  position: relative;
  z-index: 2;
}

.categories__title {
  font-size: var(--fs-h1);
  color: var(--text-primary);
}

/* ── Grid — mosaic layout ── */
.categories__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  position: relative;
  z-index: 2;
}

/* ── Tile ── */
.categories__tile {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius-md);
  aspect-ratio: 16 / 10;
  text-decoration: none;
  color: inherit;
}

.categories__tile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s ease;
  filter: brightness(0.55) saturate(0.85);
}

.categories__tile:hover .categories__tile-img {
  transform: scale(1.06);
  filter: brightness(0.75) saturate(1);
}

/* Dark gradient overlay */
.categories__tile-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(10, 8, 6, 0.85) 0%,
    rgba(10, 8, 6, 0.2) 50%,
    transparent 100%
  );
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.categories__tile:hover .categories__tile-overlay {
  opacity: 0.7;
}

/* Solid overlay for custom tile */
.categories__tile-overlay--solid {
  background: var(--az-dark-3);
  border: 1px solid var(--border-subtle);
  border-radius: inherit;
  opacity: 1;
}

.categories__tile--custom:hover .categories__tile-overlay--solid {
  border-color: var(--border-orange);
  background: var(--az-dark-4);
  opacity: 1;
}

/* Content */
.categories__tile-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: clamp(1rem, 2vw, 1.5rem);
  z-index: 2;
  transform: translateY(0);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.categories__tile:hover .categories__tile-content {
  transform: translateY(-4px);
}

.categories__tile-count {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--az-orange);
  letter-spacing: 0.08em;
  opacity: 0.8;
}

.categories__tile-name {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 1.5vw + 0.5rem, 1.6rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

/* Custom order tile — centered content */
.categories__tile-content--custom {
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
}

.categories__tile-custom-icon {
  color: var(--az-orange);
  margin-bottom: 0.75rem;
  transition: transform 0.3s ease;
}

.categories__tile--custom:hover .categories__tile-custom-icon {
  transform: rotate(90deg);
}

.categories__tile-custom-sub {
  font-family: var(--font-body);
  font-size: var(--fs-small);
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Bottom border glow on hover */
.categories__tile::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 15%;
  right: 15%;
  height: 0;
  background: radial-gradient(ellipse, rgba(244,131,46,0.2) 0%, transparent 70%);
  filter: blur(8px);
  transition: height 0.4s ease;
  pointer-events: none;
  z-index: 1;
}

.categories__tile:hover::after {
  height: 20px;
}


/* --- Tablet (768px+) --- */
@media (min-width: 768px) {
  .categories__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .categories__tile--wide {
    grid-column: span 2;
    aspect-ratio: 21 / 8;
  }

  .categories__tile:not(.categories__tile--wide) {
    aspect-ratio: 4 / 3;
  }
}

/* --- Desktop (1024px+) --- */
@media (min-width: 1024px) {
  .categories__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .categories__tile--wide {
    grid-column: span 2;
    aspect-ratio: 21 / 8;
  }

  .categories__tile:not(.categories__tile--wide) {
    aspect-ratio: 4 / 3;
  }
}

/* Build reveal */
.reveal-cat {
  opacity: 0;
  transform: translateY(20px);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .reveal-cat {
    opacity: 1;
    transform: none;
  }

  .categories__tile-img {
    transition: none;
  }
}
