/* Центрирование заголовков */
#main-title,
#mobile-title {
  text-align: center;
}

/* Грид на десктопе */
.product-list {
  display: grid;
  gap: 1rem;
}

@media (min-width: 768px) {
  .relative .carousel-list {
    overflow-x: hidden;  /* прячем скроллинг */
    padding: 0;          /* убираем боковые «буферы» */
  }
}

/* Мобильный свайп для основного списка */
@media (max-width: 767px) {
  .product-list {
    display: flex !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 1rem;
    padding-bottom: .5rem;
  }
  .product-list .product-item {
    flex: 0 0 100%;
    scroll-snap-align: start;
  }
}

/* Фото 3:4 */
.product-list .product-item img {
  aspect-ratio: 3/4;
  object-fit: cover;
}

/* Центрирование модалок */
#about-modal,
#login-modal,
#product-modal,
#edit-modal,
#success-modal {
  align-items: center;
  justify-content: center;
}

/* —————————————————————————————
   КАРУСЕЛЬ ТОВАРОВ (отдельно от grid)
   ————————————————————————————— */
.relative {
  position: relative;
}

/* сам скролл-контейнер */
.carousel-list {
  display: flex;
  gap: 1rem;
  padding: 0 2.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* фиксируем по 4 карточки в ряд */
.carousel-list .product-item {
  flex: 0 0 25%;
  scroll-snap-align: start;
}

/* общий стиль стрелок */
.prev,
.next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 2rem;
  height: 2rem;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.prev { left: 0.5rem; }
.next { right: 0.5rem; }

/* —————————————————————————————
   Мобильная версия карусели
   ————————————————————————————— */
@media (max-width: 767px) {
  .carousel-list {
    padding: 0;
  }
  .carousel-list .product-item {
    flex: 0 0 100%;
  }
  .prev,
  .next {
    display: none !important;
  }
}

.text-2xl {
  font-size: 1.2rem !important;
}

/* Ограничиваем размер картинки в модалке */
#modal-image {
  display: block;
  max-width: 90vw;
  max-height: 90vh;
  margin: 0 auto;
}
#close-product {
  z-index: 50;
  cursor: pointer;
}

@media (min-width: 768px) {
  .container {
    max-width: 90% !important;
  }
  .carousel-list .product-item {
    flex: 0 0 calc((100% - 3rem) / 4) !important;
  }
  .relative {
    overflow: hidden;
  }
}

/* Фоновое изображение для десктопа */
@media (min-width: 768px) {
  body {
    background-image: url('img/sewing-pattern.jpg');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    background-attachment: fixed;
    background-color: #faf9f6;
    background-blend-mode: multiply;
    min-height: 100vh;
  }
}

/* Фоновое изображение для мобильных */
@media (max-width: 767px) {
  body {
    background: none !important;
    position: relative;
    z-index: 0;
    min-height: 100vh;
  }
  body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('img/sewing-patternm.jpg');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    z-index: -1;
  }
}