/* =========================================================
   Карточка товара (каталог, главная, похожие товары)
   Разметка: woocommerce/content-product.php
   ========================================================= */
.catalog-card {
  container-type: inline-size; /* ряд «цена + кнопка» включается по ширине самой карточки */
  list-style: none;
  margin: 0;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 12px 12px 14px;
  border: 1px solid #ebe4de;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 2px 12px rgba(46, 36, 29, 0.07);
  color: var(--color-text, #2e241d);
  transition: box-shadow 0.25s;
}

.card:hover {
  box-shadow: 0 8px 24px rgba(46, 36, 29, 0.13);
}

.card__link {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
}

.card__link:focus-visible {
  outline: 2px solid var(--color-primary, #33271e);
  outline-offset: 4px;
  border-radius: 8px;
}

/* ---------- Бейдж ---------- */
.card__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  padding: 3px 8px;
  border-radius: 4px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
}
.card__badge--new  { background: #b85c0f; }
.card__badge--hit  { background: #0b7a12; }
.card__badge--sale { background: #c8340a; }

/* ---------- Картинка ---------- */
.card__media {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 140px;
  margin: 18px 0 12px;
}

.card__img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
}

.catalog-card.is-out .card__img { opacity: 0.85; }

/* ---------- Название ---------- */
.card__title {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.25;
}

/* ---------- Цена + кнопка ---------- */
.card__buy {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.card__price {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 2.6em; /* одинаковая высота блока цены у обычных и скидочных товаров */
}

.card__old {
  color: var(--color-muted, #a8948a);
  font-size: 0.75rem;
  line-height: 1.2;
  text-decoration: line-through;
}
.card__old .price__int,
.card__old .price__dec,
.card__old .price__cur { font-size: inherit; font-weight: 400; }

.card__current { line-height: 1.1; white-space: nowrap; }

.price__int { font-size: 1.25rem; font-weight: 500; }
.price__dec { font-size: 0.8125rem; font-weight: 500; }
.price__cur { font-size: 1rem; font-weight: 500; }

.card__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--color-primary, #33271e);
  color: #fff;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s;
}

.card__btn:hover { background: var(--color-primary-hover, #4a392c); color: #fff; }
.card__btn:focus-visible { outline: 2px solid var(--color-primary, #33271e); outline-offset: 3px; }

.card__btn--disabled,
.card__btn--disabled:hover {
  background: #e8ddd8;
  color: #fff;
  cursor: default;
}

.card__btn.loading { opacity: 0.6; pointer-events: none; }
.card__buy .added_to_cart { display: none; } /* ссылка «Просмотр корзины» от WooCommerce — в шапке будет счётчик */

/* ---------- Широкая карточка: цена слева, кнопка справа ---------- */
@container (min-width: 270px) {
  .card__media { height: 230px; margin-top: 20px; }
  .card__title { font-size: 1.25rem; }
  .card__buy { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 12px; }
  .card__price { min-height: 0; }
  .price__int { font-size: 1.75rem; }
  .price__dec { font-size: 1.125rem; }
  .price__cur { font-size: 1.375rem; }
  .card__btn { min-height: 44px; padding: 10px 20px; font-size: 1.125rem; }
}

@media (min-width: 700px) {
  .card { padding: 14px 16px 16px; }
  .card__badge { top: 12px; left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .card__btn { transition: none; }
}
