/* ===============================
   Category Carousel Section
   =============================== */

/* Section title */
.category-carousel-section .section-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 1rem;
  text-align: left;
  padding-left: 0;
}

/* Embla parent carousel */
.category-carousel-section .embla.parent-carousel {
  width: 100%;
}

/* Parent carousel slide */
.category-carousel-section .embla__slide {
  display: flex;
  justify-content: center;
}

/* Mobile: single card */
@media (max-width: 575.98px) {
  .category-carousel-section .embla__slide {
    flex: 0 0 100%;
  }
}

/* Tablet: three cards */
@media (min-width: 576px) and (max-width: 1200px) {
  .category-carousel-section .embla__slide {
    flex: 0 0 33.3333%;
  }
}

/* Desktop: five cards */
@media (min-width: 1201px) {
  .category-carousel-section .embla__slide {
    flex: 0 0 20%;
  }
}

/* Category card (inside parent slide) */
.category-carousel-section .category-card {
  width: 100%;
  max-width: 500px;
  background: var(--surface);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Child carousel inside category card */
.category-card .embla.child-carousel {
  width: 100%;
  flex: 1;
  position: relative;
}

/* Child carousel slides (each slide = 2x2 child-grid) */
.category-card .embla.child-carousel .embla__slide {
  flex: 0 0 100%;
  display: flex;
  justify-content: center;
}

/* Child carousel nav buttons */
.category-card .child-carousel button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.8);
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 2;
}
.category-card .child-carousel .child-prev { left: 0; }
.category-card .child-carousel .child-next { right: 0; }

/* Child-grid (2x2 layout inside each slide) */
.child-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0.5rem;
  width: 100%;
}

/* Individual child category card */
.child-category-card {
  position: relative;
  background: #f7f7f7;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.child-category-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.child-category-card .title {
  display: none;
}


.category-carousel-section .embla.parent-carousel .embla__prev,
.category-carousel-section .embla.parent-carousel .embla__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.category-carousel-section .embla.parent-carousel .embla__prev { left: 10px; }
.category-carousel-section .embla.parent-carousel .embla__next { right: 10px; }

.category-carousel-section .embla.parent-carousel .embla__prev:hover,
.category-carousel-section .embla.parent-carousel .embla__next:hover { background: rgba(0,0,0,0.7); }

.category-carousel-section:hover .embla.parent-carousel .embla__prev,
.category-carousel-section:hover .embla.parent-carousel .embla__next {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}


.child-carousel + .category-footer {
  margin-top: 2.5rem; /* more space only when immediately after a child carousel */
}

@media (max-width: 991.98px) {
  .category-carousel-section {
    width: 95vw;
    padding: 1.5rem 0.75rem;
  }

  .category-carousel-section .category-card {
    max-width: 90vw;
  }

  .category-carousel-section .embla.parent-carousel .embla__prev,
  .category-carousel-section .embla.parent-carousel .embla__next {
    display: none;
  }
}

@media (max-width: 991.98px) {
  .category-footer h3 {
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
  }
}

@media (max-width: 575.98px) {
  .category-footer h3 {
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
  }
}

@media (max-width: 575.98px) {
  .child-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .child-category-card .title {
    font-size: 0.85rem;
  }
}

@media (min-width: 992px) {
  .child-category-card:hover .title {
    display: block;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0,0,0,0.65);
    color: #fff;
    text-align: center;
    font-size: 0.85rem;
    padding: 0.3rem 0;
  }
}
