/**
 * Section: Catalog Section (#catalog / .catalog-section)
 * Space Chemical Design System
 * Figma spec: node 353:594, 1440x822px, #2B2B2B
 * Header: 1286x64px, gap 60px
 * 4 cards: 284x558px, gap 50px
 * Smart Slider: Responsive carousel when items overflow screen width
 */

.catalog-section {
  width: 100%;
  min-height: auto;
  padding: 60px 0 72px;
  background-color: #2B2B2B;
  color: var(--color-white, #FFFFFF);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.catalog-section__container {
  max-width: var(--sc-container-max, 1440px);
  margin: 0 auto;
  padding: 0 var(--space-77, 77px);
  box-sizing: border-box;
}

/* Header Row: Title (46px, line-height 64px) + Actions (Controls + "Перейти в каталог") */
.catalog-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 50px;
  height: auto;
  min-height: auto;
  box-sizing: border-box;
  gap: 24px;
}

.catalog-section__title {
  font-family: var(--font-cygre, 'Cygre', sans-serif);
  font-size: clamp(30px, 3.2vw, 42px);
  font-weight: 700;
  line-height: 1.15;
  color: var(--color-white, #FFFFFF);
  margin: 0;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.catalog-section__header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

/* Slider Header Controls (Prev/Next Arrows) */
.catalog-slider__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 1;
  transition: opacity var(--sc-transition-fast, 0.2s ease), visibility var(--sc-transition-fast, 0.2s ease);
}

.catalog-slider__controls.is-hidden {
  display: none !important;
}

.catalog-slider__arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--color-white, #FFFFFF);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-sizing: border-box;
  padding: 0;
  transition: all var(--sc-transition-fast, 0.2s ease);
}

.catalog-slider__arrow:hover:not(:disabled) {
  background-color: var(--color-primary, #FF5C00);
  border-color: var(--color-primary, #FF5C00);
  color: var(--color-white, #FFFFFF);
  transform: scale(1.06);
}

.catalog-slider__arrow:active:not(:disabled) {
  transform: scale(0.95);
}

.catalog-slider__arrow:disabled {
  opacity: 0.28;
  cursor: not-allowed;
  pointer-events: none;
}

.catalog-section__all-link {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 284px;
  height: 44px;
  padding: 0 23px;
  border-radius: 12px;
  border: 1px solid #FFFFFF;
  background: transparent;
  font-family: var(--font-nt-somic, 'NT Somic', sans-serif);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--color-white, #FFFFFF);
  text-decoration: none;
  box-sizing: border-box;
  transition: all var(--sc-transition-fast, 0.2s ease);
  flex-shrink: 0;
}

.catalog-section__all-link:hover {
  background-color: var(--color-primary, #FF5C00);
  border-color: var(--color-primary, #FF5C00);
  color: var(--color-white, #FFFFFF);
}

.catalog-section__all-arrow {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
}

/* Slider Track Wrapper */
.catalog-slider__wrapper {
  position: relative;
  width: 100%;
}

/* 4-Product Row / Slider Track */
.catalog-section__grid.catalog-slider__track {
  display: flex;
  gap: 50px;
  justify-content: space-between;
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
  user-select: none;
  -webkit-user-select: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 4px 0 16px;
}

.catalog-section__grid.catalog-slider__track.is-draggable {
  cursor: grab;
}

.catalog-section__grid.catalog-slider__track.is-dragging {
  cursor: grabbing !important;
  scroll-behavior: auto !important;
  scroll-snap-type: none !important;
}

.catalog-section__grid.catalog-slider__track.is-dragging * {
  cursor: grabbing !important;
}

.catalog-section__grid.catalog-slider__track::-webkit-scrollbar {
  display: none;
}

/* Individual Product Card */
.product-item {
  width: 284px;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  flex-shrink: 0;
  scroll-snap-align: start;
  -webkit-user-drag: none;
  user-drag: none;
}

.product-item__card-top {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 284px;
  height: auto;
  flex: 1;
}

/* Image container (284x260px, border 1px solid #909090, r: 20px) */
.product-item__image-box {
  width: 284px;
  height: 260px;
  background-color: var(--color-white, #FFFFFF);
  border: 1px solid #909090;
  border-radius: var(--radius-card, 20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
  transition: box-shadow var(--sc-transition-normal, 0.25s ease);
}

/* Card hover: elevation shadow + subtle zoom */
.product-item:hover .product-item__image-box {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.product-item__img {
  width: 100%;
  height: 100%;
  max-width: 272px;
  max-height: 248px;
  object-fit: contain;
  display: block;
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.product-item:hover .product-item__img {
  transform: scale(1.04);
}

/* Product Info */
.product-item__info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  height: auto;
  box-sizing: border-box;
}

.product-item__title {
  font-family: var(--font-cygre, 'Cygre', sans-serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--color-white, #FFFFFF);
  margin: 0;
}

.product-item__category {
  font-family: var(--font-nt-somic, 'NT Somic', sans-serif);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.2;
  color: #909090;
  margin: 0;
}

/* Button (Figma: товары кнопка, 100%x46px, r: 12px, #FF5C00) */
.product-item__btn {
  width: 100%;
  height: 46px;
  border-radius: var(--radius-sm, 12px);
  background-color: var(--color-primary, #FF5C00);
  color: var(--color-white, #FFFFFF);
  font-family: var(--font-inter, 'Inter', sans-serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: background-color var(--sc-transition-normal, 0.2s ease), box-shadow var(--sc-transition-normal, 0.2s ease);
}

.product-item:hover .product-item__btn,
.product-item__btn:hover {
  background-color: var(--color-primary-hover, #E05200);
  box-shadow: 0 4px 16px rgba(255, 92, 0, 0.35);
}

/* Slider Footer: Interactive Dots & Slide Counter */
.catalog-slider__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
  width: 100%;
  box-sizing: border-box;
}

.catalog-slider__footer.is-hidden {
  display: none !important;
}

.catalog-slider__dots {
  display: flex;
  align-items: center;
  gap: 8px;
}

.catalog-slider__dot {
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.catalog-slider__dot:hover {
  background: rgba(255, 255, 255, 0.55);
}

.catalog-slider__dot.is-active {
  width: 28px;
  background: var(--color-primary, #FF5C00);
  box-shadow: 0 0 14px rgba(255, 92, 0, 0.5);
}

.catalog-slider__counter {
  font-family: var(--font-nt-somic, 'NT Somic', sans-serif);
  font-size: 14px;
  font-weight: 500;
  color: #909090;
  letter-spacing: 0.05em;
}

.catalog-slider__counter .catalog-slider__current {
  color: var(--color-white, #FFFFFF);
  font-weight: 700;
}

/* Responsive: Laptops & Tablets (< 1350px) */
@media (max-width: 1350px) {
  .catalog-section {
    height: auto;
    padding: 60px 0 70px;
  }

  .catalog-section__grid.catalog-slider__track {
    justify-content: flex-start;
    gap: 32px;
    padding-bottom: 20px;
    cursor: grab;
  }

  .catalog-section__grid.catalog-slider__track:active {
    cursor: grabbing;
  }
}

/* Responsive: Tablets (< 1024px) */
@media (max-width: 1024px) {
  .catalog-section__container {
    padding: 0 32px;
  }

  .catalog-section__header {
    height: auto;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 50px;
  }

  .catalog-section__title {
    font-size: clamp(30px, 4.2vw, 38px);
  }

  .catalog-section__header-actions {
    gap: 12px;
  }

  .catalog-section__all-link {
    width: auto;
    padding: 0 20px;
  }
}

/* Responsive: Mobile (< 768px) */
@media (max-width: 767px) {
  .catalog-section {
    padding: 44px 0 54px;
  }

  .catalog-section__container {
    padding: 0 20px;
  }

  .catalog-section__header {
    height: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
  }

  .catalog-section__title {
    font-size: clamp(26px, 7vw, 34px);
    line-height: 1.15;
  }

  .catalog-section__header-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
  }

  .catalog-section__all-link {
    flex: 1;
    width: auto;
    height: 42px;
    padding: 0 16px;
    font-size: 13px;
  }

  .catalog-slider__controls {
    display: flex !important;
    gap: 8px;
  }

  .catalog-slider__arrow {
    width: 42px;
    height: 42px;
  }

  /* Full-bleed horizontal swipe track with peek on mobile */
  .catalog-section__grid.catalog-slider__track {
    gap: 16px;
    padding: 8px 20px 20px 20px;
    margin: 0 -20px;
    width: calc(100% + 40px);
    scroll-padding: 0 20px;
    justify-content: flex-start;
  }

  .product-item {
    width: 280px;
    height: auto;
    min-height: 0;
    gap: 14px;
  }

  .product-item__card-top {
    width: 100%;
    height: auto;
    gap: 14px;
  }

  .product-item__image-box {
    width: 100%;
    height: 248px;
    padding: 6px;
  }

  .product-item__img {
    width: 100%;
    height: 100%;
    max-width: 268px;
    max-height: 236px;
  }

  .product-item__info {
    width: 100%;
    height: auto;
    gap: 8px;
  }

  .product-item__title {
    font-size: 19px;
    line-height: 1.15;
  }

  .product-item__category {
    font-size: 13px;
  }

  .product-item__btn {
    width: 100%;
    height: 48px;
    font-size: 16px;
    margin-top: 0;
  }

  .catalog-slider__footer {
    margin-top: 16px;
  }
}
