/* ============================================================
   COS WP Woo — карточка товара (конструктор видов)
   ------------------------------------------------------------
   Одна разметка, разные виды: `.wpc--<вид>` меняет раскладку,
   а не содержимое. Пространство имён `wpc-*` — отдельно от
   темовых `.pc-*`, чтобы на companion-теме карточки не дрались.
   ============================================================ */

.wpc {
  display: flex; flex-direction: column; gap: 10px;
  min-width: 0; position: relative;
  /* Оформление карточки — часть скина кита (пресет card_style в ThemeService).
     Фолбэки нулевые: без выбранного пресета карточка выглядит ровно как
     раньше, и витрина масла.сайт не меняется. */
  padding: var(--wpc-pad, 0);
  background: var(--wpc-bg, transparent);
  border: var(--wpc-border, 0);
  border-radius: var(--wpc-radius, 0);
  box-shadow: var(--wpc-shadow, none);
}

/* ---------- Медиа ---------- */
.wpc__top { position: relative; }
.wpc__media {
  display: block; position: relative; overflow: hidden;
  border-radius: var(--radius-md, 14px);
  background: var(--bg-soft, #F6F8FA);
  aspect-ratio: var(--wpc-ratio, 1 / 1);
}
.wpc__img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: opacity 320ms var(--ease-out, ease), transform 480ms var(--ease-out, ease);
}
.wpc__img--empty { display: block; width: 100%; height: 100%; }
.wpc__img--hover {
  position: absolute; inset: 0; opacity: 0;
}
.wpc--hoverimg .wpc__media:hover .wpc__img--hover { opacity: 1; }
.wpc--hoverimg .wpc__media:hover .wpc__img:not(.wpc__img--hover) { opacity: 0; }
.wpc__media:hover .wpc__img { transform: scale(1.03); }

@media (prefers-reduced-motion: reduce) {
  .wpc__img { transition: none; }
  .wpc__media:hover .wpc__img { transform: none; }
}

/* ---------- Бейджи ---------- */
.wpc__badges {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  pointer-events: none;
}
.wpc__badge {
  padding: 3px 9px; border-radius: var(--radius-pill, 999px);
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  background: var(--neutral-900, #1B2128); color: #fff;
}
.wpc__badge--sale { background: #C4453D; }
.wpc__badge--new  { background: var(--ms-accent, #2A9BC4); }
.wpc__badge--hot  { background: #E08A2B; }
.wpc__badge--out  { background: var(--neutral-500, #6C7682); }

/* ---------- Действия поверх фото ---------- */
.wpc__acts {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: flex; flex-direction: column; gap: 6px;
  opacity: 0; transform: translateX(6px);
  transition: opacity 200ms var(--ease-out, ease), transform 200ms var(--ease-out, ease);
}
.wpc:hover .wpc__acts,
.wpc:focus-within .wpc__acts { opacity: 1; transform: none; }
/* На тач-устройствах наведения нет — показываем сразу. */
@media (hover: none) {
  .wpc__acts { opacity: 1; transform: none; }
}
.wpc__act {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border-default, #E2E6EB);
  background: #fff; color: var(--fg-secondary, #4A5663);
  display: grid; place-items: center; cursor: pointer; padding: 0;
  box-shadow: var(--shadow-1, 0 1px 2px rgba(19,22,29,.05));
  transition: color 160ms, border-color 160ms;
}
.wpc__act:hover { color: var(--ms-accent, #2A9BC4); border-color: var(--ms-accent, #2A9BC4); }
.wpc__act.is-active { color: #C4453D; border-color: #C4453D; }

/* ---------- Текстовая часть ---------- */
.wpc__body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wpc__cat {
  font-size: 12px; color: var(--fg-muted, #6C7682); text-decoration: none;
  text-transform: uppercase; letter-spacing: .04em;
}
.wpc__cat:hover { color: var(--ms-accent, #2A9BC4); }
.wpc__sku { font-size: 12px; color: var(--fg-muted, #6C7682); font-variant-numeric: tabular-nums; }
.wpc__title { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.35; }
.wpc__title a { color: inherit; text-decoration: none; }
.wpc__title a:hover { color: var(--ms-accent, #2A9BC4); }

.wpc__rating { display: flex; align-items: center; gap: 3px; font-size: 13px; color: var(--neutral-300, #C7CDD5); }
.wpc__star.is-on { color: #F0A93B; }
.wpc__reviews { margin-left: 4px; font-size: 12px; color: var(--fg-muted, #6C7682); }

.wpc__swatches { display: flex; gap: 5px; flex-wrap: wrap; }
.wpc__swatch {
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: var(--radius-xs, 6px);
  border: 1px solid var(--border-default, #E2E6EB);
  display: inline-grid; place-items: center;
  font-size: 11px; color: var(--fg-secondary, #4A5663);
}
.wpc__swatch--color { padding: 0; width: 22px; border-radius: 50%; }
.wpc__swatch--more { border-style: dashed; color: var(--fg-muted, #6C7682); }

.wpc__avail { font-size: 12px; font-weight: 600; }
.wpc__avail--in_stock  { color: var(--success, #2E7D5B); }
.wpc__avail--backorder { color: #B57A17; }
.wpc__avail--out_of_stock { color: var(--fg-muted, #6C7682); }

.wpc__excerpt {
  margin: 0; font-size: 13px; line-height: 1.5;
  color: var(--fg-secondary, #4A5663);
}

.wpc__price { font-size: 16px; font-weight: 680; margin-top: auto; }
.wpc__price del { font-size: 13px; font-weight: 500; color: var(--fg-muted, #6C7682); margin-right: 6px; }
.wpc__price ins { text-decoration: none; color: #C4453D; }

.wpc__sold { display: flex; flex-direction: column; gap: 4px; }
.wpc__soldbar {
  height: 6px; border-radius: var(--radius-pill, 999px);
  background: var(--neutral-200, #E2E6EB); overflow: hidden;
}
.wpc__soldbar > span { display: block; height: 100%; background: var(--ms-accent, #2A9BC4); }
.wpc__soldnum { font-size: 12px; color: var(--fg-muted, #6C7682); }

/* Кнопка покупки — штатная разметка WooCommerce внутри нашей обёртки. */
.wpc__cart .button,
.wpc__cart .added_to_cart {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 10px 16px;
  border-radius: var(--radius-sm, 8px);
  background: var(--ms-accent, #2A9BC4); color: #fff;
  font-size: 14px; font-weight: 620; text-decoration: none; border: 0; cursor: pointer;
}
.wpc__cart .button:hover { background: var(--ms-accent-700, #217C9D); color: #fff; }
.wpc__cart .added_to_cart { background: transparent; color: var(--ms-accent, #2A9BC4); }

/* =========================================================================
   ВИДЫ
   ====================================================================== */

/* Минимал и компакт — только суть. */
.wpc--minimal .wpc__body,
.wpc--compact .wpc__body { gap: 4px; }
.wpc--compact .wpc__title { font-size: 14px; }

/* Стандарт: кнопка появляется при наведении, чтобы сетка была спокойнее. */
.wpc--standard .wpc__cart {
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height 240ms var(--ease-out, ease), opacity 200ms var(--ease-out, ease);
}
.wpc--standard:hover .wpc__cart,
.wpc--standard:focus-within .wpc__cart { max-height: 60px; opacity: 1; }
@media (hover: none) {
  .wpc--standard .wpc__cart { max-height: none; opacity: 1; overflow: visible; }
}

/* С панелью по наведению: описание и кнопки выезжают поверх низа карточки. */
.wpc--hover { overflow: visible; }
.wpc--hover .wpc__excerpt { display: none; }
.wpc--hover:hover .wpc__excerpt,
.wpc--hover:focus-within .wpc__excerpt { display: block; }

/* Список: фото слева, текст справа. */
.wpc--list {
  display: grid; grid-template-columns: 200px minmax(0, 1fr);
  gap: 18px; align-items: start;
}
.wpc--list .wpc__media { aspect-ratio: 1 / 1; }
.wpc--list .wpc__price { margin-top: 8px; }
.wpc--list .wpc__cart .button { width: auto; }
@media (max-width: 560px) { .wpc--list { grid-template-columns: 110px minmax(0, 1fr); gap: 12px; } }

/* Акционная: цена крупнее, полоса продаж заметнее. */
.wpc--deal .wpc__price { font-size: 20px; }
.wpc--deal .wpc__soldbar { height: 8px; }

/* B2B: артикул и наличие важнее картинки. */
.wpc--b2b .wpc__media { aspect-ratio: 4 / 3; }
.wpc--b2b .wpc__title { font-size: 14px; font-weight: 620; }
.wpc--b2b .wpc__sku { order: -1; font-weight: 600; color: var(--fg-secondary, #4A5663); }

/* Свотчи-вид: варианты сразу видны, без наведения. */
.wpc--swatches .wpc__swatches { margin-top: 2px; }
