/* ================================================================= */
/* Сетка каталога                                                    */
/* ================================================================= */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 28px;
}

/* ================================================================= */
/* Карточка изделия                                                  */
/* ================================================================= */
.product-card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-delicate);
  padding: 16px;
  box-shadow: var(--shadow-warm);
  display: flex;
  flex-direction: column;
 /* transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;*/
  position: relative;
  overflow: hidden;
}
/*
.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(197, 160, 89, 0.4);
}*/

/* ================================================================= */
/* Слайдер с точками и стрелками                                     */
/* ================================================================= */
.card-slider-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  overflow: hidden;
  background: #f4efe9;
  margin-bottom: 16px;
}

.card-slider {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  cursor: default; /* Обычный курсор-стрелка */
}

.card-slider::-webkit-scrollbar {
  display: none;
}

.slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  scroll-snap-align: start;
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: auto;
  cursor: pointer;
}

/* Точки пагинации */
.slider-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(8px);
  padding: 5px 9px;
  border-radius: 20px;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: rgba(51, 43, 37, 0.35);
  transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1);
  cursor: pointer;
}

.dot.active {
  width: 14px;
  border-radius: 4px;
  background-color: var(--text-main);
}

/* Стрелочки перелистывания (десктоп: всплывают при наведении) */
.slider-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border-delicate);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.25s ease, background 0.2s ease, transform 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.card-slider-wrapper:hover .slider-arrow {
  opacity: 1;
}

.slider-arrow:hover {
  background: #ffffff;
  transform: translateY(-50%) scale(1.1);
}

.slider-arrow.prev { left: 10px; }
.slider-arrow.next { right: 10px; }

/* ================================================================= */
/* Текстовая информация и артикул                                    */
/* ================================================================= */
.product-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
  line-height: 1.15;
  
  /* Ограничение строго в 1 строку с троеточием */
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 1.15em; /* Высота ровно под 1 строку */
}

/*
.product-dim {
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--text-soft);
  background: transparent;
  padding: 0;
  margin: 0 0 12px 0;
  align-self: flex-start;
  width: 100%;

  /* Ограничение не более 2 строк с троеточием */
 /* display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;

  /* Высота ровно под 2 строки (1.35 * 2 = 2.7em) для стабильной сетки */
 /* min-height: 2.7em;
}*/

.product-dim {
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--text-soft);
  background: transparent;
  padding: 0;
  margin: 0 0 12px 0;
  align-self: flex-start;
  width: 100%;
  cursor: pointer; /* Показываем, что текст кликабелен */
  user-select: none;
  -webkit-tap-highlight-color: transparent;

  /* Ограничение строго в 2 строки */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 2.7em;
  transition: color 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .product-dim:hover {
    color: var(--text-main);
  }
}

/* Всплывающее облачко с полным описанием */
.product-dim-popover {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 60px; /* Располагается над кнопками/артикулом */
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-delicate);
  border-radius: 14px;
  padding: 14px 34px 14px 14px;
  box-shadow: 0 8px 24px rgba(78, 61, 46, 0.15);
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

/* Состояние открытия */
.product-dim-popover.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.product-dim-popover .popover-text {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-main);
  max-height: 180px;
  overflow-y: auto;
}

/* Крестик закрытия */
.product-dim-popover .popover-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 22px;
  height: 22px;
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: var(--text-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.product-dim-popover .popover-close:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.05);
}






.product-art {
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--text-art);
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  display: inline-block;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease, opacity 0.2s ease;
  white-space: nowrap;
  /* Убираем мобильную подсветку и синий оверлей тапа */
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.product-color-name {
  font-size: 0.82rem;
  color: var(--text-art);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Строка мета-информации: цвет слева, артикул справа */
.product-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.product-art:hover {
  color: var(--text-main);
}

.product-art.copied {
  color: #00aa66 !important;
}

/* Ховер включаем ТОЛЬКО для устройств с настоящей мышью, 
   чтобы он не залипал на сенсорных экранах смартфонов */
@media (hover: hover) and (pointer: fine) {
  .product-art:hover {
    color: var(--text-main);
  }
}

/* Принудительно возвращаем цвет при фокусе на мобильных */
.product-art:focus,
.product-art:focus-visible {
  color: var(--text-art);
  outline: none;
}

/* ================================================================= */
/* Палитра цветов (свотчи)                                           */
/* ================================================================= */
.color-swatches {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0;
  margin-bottom: 10px;
}

.swatch-label {
  font-size: 0.82rem;
  color: var(--text-light);
  font-weight: 500;
}

.swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.2s ease;
  position: relative;
}

.swatch:hover {
  transform: scale(1.18);
}

.swatch.active {
  transform: scale(1.22);
  box-shadow: 0 0 0 1px var(--gold-accent), 0 3px 8px rgba(0, 0, 0, 0.2);
}

.swatch[data-color="sand"] { background-color: var(--color-sand); }
.swatch[data-color="bordo"] { background-color: var(--color-bordo); }
.swatch[data-color="milk"] { background-color: var(--color-milk); }
.swatch[data-color="graphite"] { background-color: var(--color-graphite); }
.swatch[data-color="olive"] { background-color: var(--color-olive); }
.swatch[data-color="terracotta"] { background-color: var(--color-terracotta); }
.swatch[data-color="skygray"] { background-color: var(--color-skygray); }
.swatch[data-color="mustard"] { background-color: var(--color-mustard); }
.swatch[data-color="black"] { background-color: var(--color-black); }


/* ================================================================= */
/* Адаптив для планшетов и смартфонов                                */
/* ================================================================= */
@media (max-width: 768px) {

  .product-dim-popover {
    left: 8px;
    right: 8px;
    bottom: 50px;
    padding: 10px 28px 10px 10px;
    border-radius: 12px;
  }

  .product-dim-popover .popover-text {
    font-size: 0.76rem;
    line-height: 1.35;
    max-height: 140px;
  }


  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .product-card {
    padding: 10px;
    border-radius: 16px;
  }

  .card-slider-wrapper {
    border-radius: 12px;
    margin-bottom: 10px;
  }

  /* На мобильных устройствах стрелки скрыты, навигация свайпом */
  .slider-arrow {
    display: none;
  }

  /* Заголовок на мобилках строго в 2 строки */
  .product-title {
    font-size: 0.85rem;
    line-height: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 1.8em; /* 1.25 * 2 строки */
    margin-bottom: 6px;
  }

  .product-dim {
    font-size: 0.74rem;
    line-height: 1.3;
    padding: 0;
    margin-bottom: 8px;
    min-height: 2.6em; /* 1.3 * 2 строки на экранах смартфонов */
  }


  .product-color-name,
  .product-art {
    font-size: 0.64rem;
  }

  .color-swatches {
    margin-bottom: 10px;
    gap: 6px;
  }

  .swatch {
    width: 20px;
    height: 20px;
  }

  .card-actions {
    gap: 6px;
  }

}

@media (max-width: 380px) {
  .cards-grid {
    gap: 8px;
  }

  .product-card {
    padding: 8px;
  }
}


/* ================================================================= */
/* Шторка подробного описания (Bottom Sheet / Modal)                 */
/* ================================================================= */
/*
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 24, 20, 0.45);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.bottom-sheet-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Контейнер на десктопе: элегантная карточка по центру *//*
.bottom-sheet-content {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-delicate, #ede7de);
  border-radius: 20px;
  padding: 22px 26px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-sizing: border-box;
}

.bottom-sheet-overlay.open .bottom-sheet-content {
  transform: translateY(0) scale(1);
}

.bottom-sheet-handle {
  display: none; /* На десктопе скрыта *//*
}

.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.bottom-sheet-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main, #332b25);
  margin: 0;
}

.bottom-sheet-close {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--text-soft, #736961);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.2s ease;
}

.bottom-sheet-close:hover {
  color: var(--text-main, #332b25);
}

.bottom-sheet-body {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-main, #332b25);
  max-height: 60vh;
  overflow-y: auto;
}

/* ----------------------------------------------------------------- */
/* Мобильный адаптив: классическая выезжающая снизу шторка           */
/* ----------------------------------------------------------------- *//*
@media (max-width: 768px) {
  .bottom-sheet-overlay {
    align-items: flex-end; /* Прижимаем к нижнему краю экрана */
 /*   padding: 0;
  }

  .bottom-sheet-content {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 12px 18px 26px;
    transform: translateY(100%); /* Прячем за нижний край */
 /*   transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .bottom-sheet-overlay.open .bottom-sheet-content {
    transform: translateY(0);
  }

  /* Полоска-индикатор для свайпа */
 /* .bottom-sheet-handle {
    display: block;
    width: 38px;
    height: 4px;
    background: rgba(0, 0, 0, 0.16);
    border-radius: 4px;
    margin: 0 auto 12px;
  }

  .bottom-sheet-title {
    font-size: 0.96rem;
  }

  .bottom-sheet-body {
    font-size: 0.84rem;
    line-height: 1.45;
    max-height: 70vh;
  }
}*/