/* Teaspot products slider (home blocks) */
.ts-products {
  --ts-products-gap: var(--product-grid-gap, 20px);
  --ts-products-visible: 4;
  width: 100%;
  /* одинаковый отступ сверху/снизу: после stats и между «Новинки» / «Рекомендуем» */
  margin: var(--products-section-gap, 96px) 0;
  box-sizing: border-box;
  scroll-margin-top: 120px;
}

/* Запас, чтобы заголовок последнего блока можно было доскроллить из-под шапки */
#common-home #content > .ts-products:last-child {
  margin-bottom: 120px;
}

.ts-products__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 30px; /* было 20px, +50% */
  /* не прячется под sticky-шапку при скролле к низу главной */
  position: sticky;
  top: 72px;
  z-index: 4;
  background: var(--color-bg, #F2F2F2);
  padding: 10px 0;
  box-sizing: border-box;
}

.ts-products__title {
  margin: 0;
  font-family: inherit;
  font-size: var(--font-products-title, 28px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text, #1A1A1A);
}

.ts-products__title-spacer {
  display: block;
  min-height: 1em;
}

.ts-products__all {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--ctrl-height, 40px);
  padding: 0 16px;
  border-radius: var(--radius-btn, 10px);
  background: #ffffff;
  color: var(--color-text, #1A1A1A);
  font-size: var(--font-btn, 16px);
  font-weight: 500;
  text-decoration: none;
  outline: none;
  box-shadow: none;
  transition: background 0.15s ease;
}

.ts-products__all:hover,
.ts-products__all:focus,
.ts-products__all:active {
  background: var(--color-surface-hover, #E5E3E3);
  color: var(--color-text, #1A1A1A);
  text-decoration: none;
  outline: none;
  box-shadow: none;
}

.ts-products__all-chevron {
  font-size: 18px;
  line-height: 1;
  margin-top: -1px;
}

.ts-products__viewport {
  position: relative;
}

.ts-products__track {
  display: flex;
  align-items: stretch;
  gap: var(--ts-products-gap);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  outline: none;
  box-shadow: none;
}

.ts-products__track::-webkit-scrollbar {
  display: none;
}

.ts-products__slide {
  flex: 0 0 calc((100% - (var(--ts-products-visible) - 1) * var(--ts-products-gap)) / var(--ts-products-visible));
  max-width: calc((100% - (var(--ts-products-visible) - 1) * var(--ts-products-gap)) / var(--ts-products-visible));
  scroll-snap-align: start;
  min-width: 0;
}

.ts-products__slide .ts-card {
  /* та же карточка, что в каталоге — высота по контенту, не растягиваем */
  height: auto;
  min-height: 100%;
}

.ts-products__nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  color: var(--color-text, #1A1A1A);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(26, 26, 26, 0.12);
  outline: none;
  padding: 0;
}

.ts-products__nav--next {
  right: 0;
  transform: translate(40%, -50%);
}

.ts-products__nav--prev {
  left: 0;
  transform: translate(-40%, -50%);
}

.ts-products__nav:hover,
.ts-products__nav:focus,
.ts-products__nav:active {
  outline: none;
  box-shadow: 0 4px 18px rgba(26, 26, 26, 0.16);
}

.ts-products__nav.is-hidden {
  display: none;
}

@media (max-width: 1280px) {
  .ts-products {
    --ts-products-visible: 3 !important;
  }
}

@media (max-width: 992px) {
  .ts-products {
    --ts-products-visible: 2 !important;
  }

  .ts-products__title {
    font-size: 24px;
  }

  .ts-products__nav {
    width: 42px;
    height: 42px;
  }

  .ts-products__nav--next {
    transform: translate(20%, -50%);
  }

  .ts-products__nav--prev {
    transform: translate(-20%, -50%);
  }
}

@media (max-width: 768px) {
  .ts-products {
    --ts-products-visible: 2 !important;
    --products-section-gap: 72px; /* 2× прежних 36px */
  }

  .ts-products__title {
    font-size: 22px;
  }

  .ts-products__all {
    height: 36px;
    padding: 0 12px;
    font-size: 14px;
  }

  /* стрелки внутри сетки — иначе translate(±40%) даёт горизонтальный скролл */
  .ts-products__nav {
    display: inline-flex;
    width: 48px;
    height: 48px;
  }

  .ts-products__nav--next {
    right: 0;
    transform: translate(0, -50%);
  }

  .ts-products__nav--prev {
    left: 0;
    transform: translate(0, -50%);
  }
}
