/* ============================================================
   КАРТКА ТОВАРУ (каталог / головна / пошук / related)
   Реф. D: біле текстове поле + теги + ціна / наявність
   ============================================================ */
.product-card {
  --pc-img-radius: 16px;
  --pc-pad: clamp(10px, 1.4vw, 14px);
  --pc-price: #973232;
  --pc-price-old: #555555;
  --pc-tag: #3d6b3f;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--pc-pad);
  background: #ffffff;
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: none;
}

.product-card__media {
  position: relative;
  background: transparent;
  border-radius: var(--pc-img-radius);
}

.product-card__media-link {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--pc-img-radius);
  overflow: hidden;
  background: var(--c-oat);
  text-decoration: none;
  color: inherit;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.product-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--t-slow) var(--ease);
}

.product-card__media-link .ph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

@media (hover: hover) and (pointer: fine) {
  .product-card:hover .product-card__img {
    transform: scale(1.03);
  }
}

/* Wishlist */
.product-card__wish {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--c-ink) 10%, transparent);
  background: #ffffff;
  color: var(--c-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--t-fast) ease, border-color var(--t-fast) ease, background-color var(--t-fast) ease;
}

.product-card__wish:hover,
.product-card__wish[aria-pressed="true"] {
  color: var(--c-cart);
  border-color: color-mix(in srgb, var(--c-cart) 35%, transparent);
}

.product-card__wish[aria-pressed="true"] svg {
  fill: var(--c-cart);
  stroke: var(--c-cart);
}

/* Дії: лічильник + кошик знизу фото (поточна поведінка) */
.product-card__actions {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  display: flex;
  align-items: stretch;
  gap: 8px;
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}

.product-card__qty {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 4px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--c-ink) 12%, transparent);
}

.product-card__qty-btn {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--c-ink);
  font-family: var(--f-ui);
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.product-card__qty-btn:disabled,
.product-card__qty-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.product-card__qty-input {
  width: 36px;
  min-height: 40px;
  border: 0;
  background: transparent;
  text-align: center;
  font-family: var(--f-ui);
  font-size: 15px;
  font-weight: 600;
  color: var(--c-ink);
  -moz-appearance: textfield;
  appearance: textfield;
}

.product-card__qty-input::-webkit-outer-spin-button,
.product-card__qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.product-card__cart {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border: 1px solid color-mix(in srgb, var(--c-sage) 35%, transparent);
  border-radius: 10px;
  background: #ffffff;
  color: var(--c-cart);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--c-ink) 12%, transparent);
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease, border-color var(--t-fast) ease, transform var(--t-fast) ease;
}

.product-card__cart:hover:not(:disabled) {
  background: #ffffff;
  color: var(--c-sagehover);
  border-color: var(--c-sage);
}

.product-card__cart:active:not(:disabled) {
  transform: scale(0.96);
}

.product-card__cart:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.product-card__cart[data-added="1"] {
  background: color-mix(in srgb, var(--c-sage) 12%, #ffffff);
  color: var(--c-sage);
  border-color: var(--c-sage);
}

@media (hover: hover) and (pointer: fine) {
  .product-card__actions {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
  }

  .product-card:hover .product-card__actions,
  .product-card:focus-within .product-card__actions {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
}

@media (hover: none), (pointer: coarse) {
  .product-card__actions {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
}

/* --- Body: теги → назва → ціна + наявність --- */
.product-card__body {
  padding: 14px 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.product-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.product-card__tag {
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.25;
  color: var(--pc-tag);
  text-transform: lowercase;
}

.product-card__tag:nth-child(n + 4) {
  display: none;
}

.product-card__name {
  font-family: var(--f-accent);
  font-size: clamp(16px, 2.1vw, 22px);
  font-weight: 700;
  line-height: 1.22;
  color: var(--c-ink);
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card__name:hover {
  color: var(--c-cart);
  text-decoration: none;
}

.product-card__volume {
  font-family: var(--f-ui);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--pc-tag);
  line-height: 1.3;
  margin-top: 4px;
}

.product-card__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-top: auto;
  padding-top: 10px;
}

.product-card__prices {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.product-card__price {
  font-family: var(--f-accent);
  font-size: clamp(20px, 2.5vw, 26px);
  font-weight: 700;
  color: var(--pc-price);
  line-height: 1.15;
  white-space: nowrap;
}

.product-card__price-old,
.product-card__prices .price--old {
  order: -1;
  position: static;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.15;
  color: var(--pc-price-old);
  text-decoration: line-through;
  white-space: nowrap;
}

.product-card__stock {
  font-family: var(--f-ui);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--pc-tag);
  line-height: 1.3;
  text-align: left;
}

.product-card__stock.is-out {
  color: var(--c-danger);
}

/* --- Адаптив: планшет / мобільний / iOS Safari --- */
@media (max-width: 899px) {
  .product-card {
    --pc-img-radius: 14px;
    --pc-pad: 10px;
    border-radius: 20px;
  }

  .product-card__wish {
    width: 38px;
    height: 38px;
    top: 8px;
    right: 8px;
  }

  .product-card__actions {
    left: 8px;
    right: 8px;
    bottom: 8px;
    gap: 6px;
  }

  .product-card__qty {
    min-height: 42px;
  }

  .product-card__cart {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
  }

  .product-card__body {
    padding: 12px 2px 4px;
    gap: 7px;
  }

  .product-card__name {
    font-size: 15px;
  }

  .product-card__price {
    font-size: 20px;
  }
}

@media (max-width: 599px) {
  .product-card {
    --pc-img-radius: 12px;
    --pc-pad: 8px;
    border-radius: 16px;
  }

  .product-card__wish {
    width: 36px;
    height: 36px;
    top: 6px;
    right: 6px;
  }

  .product-card__actions {
    left: 6px;
    right: 6px;
    bottom: 6px;
  }

  .product-card__qty {
    min-height: 40px;
    border-radius: 7px;
  }

  .product-card__qty-btn {
    width: 36px;
    height: 36px;
  }

  .product-card__qty-input {
    width: 28px;
    min-height: 36px;
    font-size: 14px;
  }

  .product-card__cart {
    flex-basis: 42px;
    width: 42px;
    height: 42px;
    border-radius: 8px;
  }

  .product-card__body {
    padding: 10px 0 2px;
    gap: 6px;
  }

  .product-card__tag {
    font-size: 11px;
  }

  .product-card__name {
    font-size: 14px;
  }

  .product-card__volume {
    font-size: 11.5px;
  }

  .product-card__price {
    font-size: 18px;
  }

  .product-card__price-old,
  .product-card__prices .price--old {
    font-size: 12px;
  }

  .product-card__stock {
    font-size: 11.5px;
  }

  .product-card__meta {
    padding-top: 8px;
  }
}

@supports (-webkit-touch-callout: none) {
  .product-card {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-card__img,
  .product-card__actions,
  .product-card__cart {
    transition: none;
  }

  .product-card:hover .product-card__img {
    transform: none;
  }
}
