/* ==========================================
   PRODUCT CATEGORIES GRID
   Responsive grid layout for category cards
   ========================================== */

.product-categories-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 60px 20px;
}

.categories-header {
  margin-bottom: 30px;
}

.categories-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0;
}

/* Grid Container */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* Desktop layout tweaks (4 columns with selected wide cards) */
@media (min-width: 1024px) {
  .category-card:nth-child(1),
  .category-card:nth-child(6),
  .category-card:nth-child(7) {
    grid-column: span 2;
    /* Keep height consistent with 1-column cards */
    aspect-ratio: 32 / 10;
  }
}

/* Category Card */
.category-card {
  position: relative;
  display: block;
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  aspect-ratio: 16 / 10;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.category-card:hover {
  transform: scale(1.03);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

/* Card Image */
.category-card-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.category-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.4s ease;
}



.category-card:hover .category-card-image img {
  transform: scale(1.08);
}

/* Dark Overlay */
.category-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.1) 0%,
    rgba(0, 0, 0, 0.35) 50%,
    rgba(0, 0, 0, 0.7) 100%
  );
  transition: background 0.3s ease;
}

.category-card:hover .category-card-overlay {
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.05) 0%,
    rgba(0, 0, 0, 0.25) 50%,
    rgba(0, 0, 0, 0.6) 100%
  );
}

/* Card Content (Title, Count, Arrow) */
.category-card-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 20px;
  z-index: 2;
}

.category-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.category-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  line-height: 1.3;
}

.category-card-count {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
  font-weight: 400;
}

/* Arrow Icon */
.category-card-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: #ffffff;
  font-size: 0.9rem;
  opacity: 0.9;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.category-card:hover .category-card-arrow {
  transform: translateX(4px);
  opacity: 1;
}

/* ==========================================
   RESPONSIVE BREAKPOINTS
   ========================================== */

/* Tablet: 2 columns */
@media (max-width: 1023px) {
  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .category-card {
    aspect-ratio: 16 / 9;
  }

  .category-card-title {
    font-size: 1.15rem;
  }

  .category-card-content {
    padding: 16px;
  }
}

/* Mobile: 1 column (alternating 1 full + 2 side-by-side) */
@media (max-width: 768px) {
  .product-categories-section {
    padding: 40px 12px;
  }

  .categories-header {
    margin-bottom: 20px;
    padding: 0 4px;
  }

  /* Nudge specific category images slightly left (Solar Generator + Batteries) */
  
  .category-card:nth-child(2) .category-card-image img,
  .category-card:nth-child(3) .category-card-image img {
  object-position: 60% center;
  }

  .category-card:nth-child(1) .category-card-image img{
    object-position: 80% center;
  }

  .categories-header h2 {
    font-size: 1.5rem;
  }

  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  /* First card spans full width */
  .category-card:nth-child(1) {
    grid-column: span 2;
    aspect-ratio: 16 / 9;
  }

  /* Cards 2-3, 4-5, etc. are side by side */
  .category-card:nth-child(n+2) {
    aspect-ratio: 1 / 1;
  }

  /* Every 5th card (6th, 11th, etc.) spans full width */
  .category-card:nth-child(6) {
    grid-column: span 2;
    aspect-ratio: 16 / 9;
  }

  .category-card:nth-child(7) {
    grid-column: span 2;
    aspect-ratio: 16 / 9;
  }

  .category-card {
    border-radius: 10px;
  }

  /* Disable hover effects on mobile */
  .category-card:hover {
    transform: none;
    box-shadow: none;
  }

  .category-card:hover .category-card-image img {
    transform: none;
  }

  .category-card:hover .category-card-overlay {
    background: linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.1) 0%,
      rgba(0, 0, 0, 0.35) 50%,
      rgba(0, 0, 0, 0.7) 100%
    );
  }

  .category-card-content {
    padding: 14px;
  }

  .category-card-title {
    font-size: 1.05rem;
  }

  .category-card-count {
    font-size: 0.8rem;
  }

  .category-card-arrow {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }
}

/* Extra small screens */
@media (max-width: 400px) {
  .product-categories-section {
    padding: 30px 10px;
  }

  .categories-grid {
    gap: 10px;
  }

  .category-card-content {
    padding: 12px;
  }

  .category-card-title {
    font-size: 0.95rem;
  }

  .category-card-count {
    font-size: 0.75rem;
  }
}
