/* Каталог на главной: сетка карточек (меню категорий — выдвижная панель) */

.catalog {
  padding: calc(var(--space-xl) / 2) var(--space-l) var(--space-xl) var(--space-l);
  max-width: var(--max-width-catalog);
  margin: 0 auto;
}

.catalog__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

/* Плейсхолдер до загрузки каталога (уменьшает CLS). Обёртка display:contents — элементы сетки идут в .catalog__grid */
.catalog-skeleton {
  display: contents;
}

.catalog-skeleton__card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--card-width);
  margin: 0 auto;
  border-radius: var(--card-radius);
  overflow: hidden;
  background: #fff;
  min-height: 0;
}

.catalog-skeleton__media {
  aspect-ratio: 3 / 4;
  width: 100%;
  background: linear-gradient(90deg, #ececec 0%, #f5f5f5 45%, #ececec 90%);
  background-size: 200% 100%;
  animation: catalog-skeleton-shimmer 1.15s ease-in-out infinite;
}

.catalog-skeleton__body {
  height: 72px;
  padding: var(--space-s);
  background: #fff;
  box-sizing: border-box;
}

@keyframes catalog-skeleton-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

@media (max-width: 1200px) {
  .catalog__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 767px) {
  .catalog {
    padding-left: 6px;
    padding-right: 6px;
  }

  .catalog__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
}

/* Карточка товара */
.product-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--card-width);
  margin: 0 auto;
  height: 100%;
}

.product-card__image-wrap {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--card-radius) var(--card-radius) 0 0;
  overflow: hidden;
  background: #fff;
}

.product-card__image-wrap a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
}

/* Десктоп: одна картинка; мобильная: галерея (если несколько фото) */
.product-card__image-link--gallery {
  display: none;
}

@media (max-width: 768px) {
  .product-card__image-wrap--has-gallery .product-card__image-link--single {
    display: none;
  }
  .product-card__image-link--gallery {
    display: flex;
  }
}

.product-card__gallery-viewport {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.product-card__gallery-strip {
  display: flex;
  flex-shrink: 0;
  height: 100%;
  width: calc(var(--card-gallery-n, 1) * 100%);
  will-change: transform;
}

.product-card__gallery-slide {
  flex: 0 0 calc(100% / var(--card-gallery-n, 1));
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.product-card__gallery-slide .product-card__image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-card__gallery-dots {
  display: none;
}

@media (max-width: 768px) {
  .product-card__image-wrap--has-gallery .product-card__gallery-dots {
    display: flex;
    justify-content: center;
    gap: 4px;
    position: absolute;
    bottom: 6px;
    left: 0;
    right: 0;
    z-index: 1;
    pointer-events: none;
  }
}

.product-card__gallery-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transition: background 0.2s ease;
}

.product-card__gallery-dot.is-active {
  background: var(--color-accent);
}

.product-card__image-wrap picture {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.product-card__image {
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.product-card__body {
  padding: var(--space-s) var(--space-s) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  flex: 1;
  min-height: 0;
  background: #ffffff;
  border-radius: 0 0 var(--card-radius) var(--card-radius);
}

.product-card__title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

.product-card__title a {
  color: inherit;
}

.product-card__title a:hover {
  color: var(--color-accent);
  text-decoration: none;
}

.product-card__price {
  font-size: 0.8125rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35em;
}

.product-card__discount {
  font-size: 0.75rem;
  font-weight: 600;
  color: #cb11ab;
  background: none;
}

.product-card__price-old {
  text-decoration: line-through;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-right: 0;
}

.product-card__price-current {
  color: var(--color-text, #111);
}

.product-card__rating {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-xs) 0;
}

.product-card__rating-star {
  color: #eab308;
}

.product-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
  margin-top: var(--space-xs);
}

.product-card__btn {
  display: inline-block;
  padding: 4px var(--space-s);
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: var(--btn-shine-radius);
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-primary);
  border: var(--btn-shine-border);
  background: var(--btn-shine);
  color: #fff;
  box-shadow: none;
  transition: background 0.2s ease-in-out, color 0.2s ease-in-out;
}

.product-card__btn:hover {
  text-decoration: none;
  background: #e9592d;
  color: #fff;
}

.product-card__btn--secondary {
  background: var(--btn-shine);
  color: #fff;
}

.product-card__btn:hover,
.product-card__btn--secondary:hover {
  background: #e9592d;
  opacity: 1;
  color: #fff;
}
