/**
 * DomShop product cards — single source of truth.
 *
 * Surfaces: homepage, shop archive, related/upsells, cart & wishlist cross-sells.
 * Loaded last (enqueue priority 999) so WC/block skins cannot restyle cards.
 */

/* -------------------------------------------------------------------------- */
/* Grids                                                                       */
/* -------------------------------------------------------------------------- */

.ds-product-grid,
.woocommerce .related.products > ul.products,
.woocommerce .upsells.products > ul.products,
.woocommerce .ds-products ul.products,
.entry-content .ds-products ul.products {
  display: grid !important;
  /* Wide desktop: one row of 6 (CSS px — Windows/Mac scaling shrinks this). */
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  width: 100%;
  float: none !important;
}

.ds-product-grid::before,
.ds-product-grid::after,
.woocommerce .related.products > ul.products::before,
.woocommerce .related.products > ul.products::after,
.woocommerce .upsells.products > ul.products::before,
.woocommerce .upsells.products > ul.products::after,
.woocommerce .ds-products ul.products::before,
.woocommerce .ds-products ul.products::after {
  display: none !important;
  content: none !important;
}

/* Shop archive: cards join .ds-shop-flow columns (sidebar + products) */
.ds-shop-flow > ul.products,
.woocommerce .ds-shop-flow > ul.products,
.woocommerce-page .ds-shop-flow > ul.products {
  display: contents !important;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  width: auto !important;
  float: none !important;
  grid-template-columns: unset !important;
  gap: unset !important;
}

/* Hide WC sale flash — cards use .ds-sale-ribbon */
.ds-product-card span.onsale,
.woocommerce ul.products li.product.ds-product-card span.onsale,
.woocommerce .related.products span.onsale,
.woocommerce .upsells.products span.onsale {
  display: none !important;
}

/* -------------------------------------------------------------------------- */
/* Card shell                                                                  */
/* -------------------------------------------------------------------------- */

.ds-product-card,
body.woocommerce ul.products li.product.ds-product-card,
body.woocommerce-page ul.products li.product.ds-product-card,
body.woocommerce-cart ul.products li.product.ds-product-card,
body.woocommerce-checkout ul.products li.product.ds-product-card {
  /*
   * Density tokens scale with the card’s own width (cqi), so pad/badge/actions
   * shrink with the image — not only on viewport media queries.
   */
  container-type: inline-size;
  container-name: ds-card;
  --ds-card-pad: clamp(8px, 4.2cqi + 3px, 14px);
  --ds-card-radius: clamp(10px, 3cqi + 6px, 14px);
  --ds-card-image-pad: clamp(8px, 5.5cqi + 2px, 18px);
  --ds-card-body-pad-top: clamp(6px, 3cqi + 4px, 12px);
  --ds-card-action: clamp(30px, 12cqi + 10px, 40px);
  --ds-card-action-gap: clamp(4px, 2cqi + 2px, 8px);
  --ds-card-swatch: clamp(28px, 12cqi + 8px, 40px);
  --ds-card-swatch-gap: clamp(3px, 1.5cqi + 1px, 6px);
  --ds-card-badge-size: clamp(9px, 2.2cqi + 6px, 11px);
  --ds-card-badge-pad-y: clamp(4px, 1.2cqi + 2px, 6px);
  --ds-card-badge-pad-x: clamp(6px, 1.8cqi + 3px, 9px);
  --ds-card-badge-pad: var(--ds-card-badge-pad-y) var(--ds-card-badge-pad-x);
  --ds-card-hit: clamp(34px, 14cqi + 10px, 48px);
  --ds-card-title-size: clamp(0.82rem, 2.2cqi + 0.55rem, 0.98rem);
  --ds-card-excerpt-size: clamp(0.72rem, 1.6cqi + 0.5rem, 0.84rem);
  --ds-card-price-size: clamp(0.88rem, 2cqi + 0.55rem, 1.02rem);
  display: flex !important;
  flex-direction: column;
  background: #fff !important;
  color: var(--ds-text) !important;
  border: 1px solid var(--ds-line) !important;
  border-radius: var(--ds-card-radius) !important;
  overflow: hidden;
  padding: var(--ds-card-pad) !important;
  position: relative;
  list-style: none !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  float: none !important;
  clear: none !important;
  text-align: left !important;
  box-shadow: none;
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    transform 0.25s ease;
}

.ds-product-card__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 6px;
  padding: var(--ds-card-body-pad-top) 2px 2px;
  color: var(--ds-text);
  text-align: left !important;
  min-width: 0;
}

/* Color / gallery swatches under media — click swaps card preview */
.ds-product-card__swatches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ds-card-swatch-gap);
  margin: 0;
  padding: 10px 2px 0;
  /* One thumb row + top padding — keeps card height when only main/empty. */
  min-height: calc(var(--ds-card-swatch) + 10px);
  box-sizing: content-box;
}

.ds-product-card__swatches.is-empty {
  pointer-events: none;
}

.ds-product-card__swatch {
  position: relative;
  box-sizing: border-box;
  flex: 0 0 var(--ds-card-swatch);
  width: var(--ds-card-swatch);
  height: var(--ds-card-swatch);
  margin: 0;
  padding: 2px;
  border: 1px solid var(--ds-line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--ds-ease);
}

.ds-product-card__swatch:hover,
.ds-product-card__swatch:focus-visible,
.ds-product-card__swatch.is-active {
  border-color: var(--ds-brand);
  outline: none;
}

.ds-product-card__swatch:focus-visible {
  box-shadow: 0 0 0 2px rgba(var(--ds-brand-rgb), 0.25);
}

.ds-product-card__swatch img,
body.woocommerce ul.products li.product.ds-product-card .ds-product-card__swatch img,
body.woocommerce-page ul.products li.product.ds-product-card .ds-product-card__swatch img,
.ds-products .ds-product-card .ds-product-card__swatch img {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: cover !important;
  margin: 0 !important;
  display: block !important;
  border-radius: 4px;
  transform: none !important;
  transition: none !important;
}

.ds-product-card__swatch.is-out-of-stock img {
  opacity: 0.72;
  filter: grayscale(0.2);
}

.ds-product-card__swatch.is-out-of-stock::before {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: 1;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
  pointer-events: none;
}

.ds-product-card__swatch.is-out-of-stock::after {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: 2;
  border-radius: 4px;
  background: linear-gradient(
    to top right,
    transparent calc(50% - 0.5px),
    rgba(80, 80, 80, 0.35) calc(50% - 0.5px),
    rgba(80, 80, 80, 0.35) calc(50% + 0.5px),
    transparent calc(50% + 0.5px)
  );
  pointer-events: none;
}

.ds-product-card__media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--ds-peach-soft);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0;
  margin: 0;
}

.ds-product-card__image {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: var(--ds-card-image-pad);
  overflow: hidden;
}

/*
 * SpeedyCache/WebP wraps imgs in <picture>. Without an explicit box,
 * picture shrink-wraps to the chosen srcset file (300 vs 400) so the
 * first eager cards look smaller than lazy ones that pick a larger file.
 */
.ds-product-card__image picture,
.ds-product-card__media > a > picture {
  display: flex !important;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  margin: 0 !important;
}

.ds-product-card__image picture source {
  display: none;
}

/* Swatch preview: slide outgoing left, incoming from right */
.ds-product-card__image.is-sliding .ds-product-card__slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: var(--ds-card-image-pad);
  margin: 0;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.ds-product-card__image.is-sliding picture.ds-product-card__slide {
  padding: var(--ds-card-image-pad);
}

.ds-product-card__image.is-sliding .ds-product-card__slide--out {
  z-index: 1;
  transform: translate3d(0, 0, 0);
}

.ds-product-card__image.is-sliding .ds-product-card__slide--in {
  z-index: 2;
  transform: translate3d(100%, 0, 0);
}

.ds-product-card__image.is-sliding-active .ds-product-card__slide--out {
  transform: translate3d(-100%, 0, 0);
}

.ds-product-card__image.is-sliding-active .ds-product-card__slide--in {
  transform: translate3d(0, 0, 0);
}

/*
 * Keep hover zoom during swipe — do NOT reset scale to 1 (that looked like
 * the preview shrinking mid-transition). Parent slide still uses translateX only.
 */
.ds-product-card__image.is-sliding img {
  transition: none !important;
}

@media (hover: hover) and (pointer: fine) {
  .ds-product-card:hover .ds-product-card__image.is-sliding img,
  body.woocommerce ul.products li.product.ds-product-card:hover .ds-product-card__image.is-sliding img,
  body.woocommerce-page ul.products li.product.ds-product-card:hover .ds-product-card__image.is-sliding img {
    transform: scale(1.06) !important;
    transition: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ds-product-card__image.is-sliding .ds-product-card__slide {
    transition: none;
  }
}

.ds-product-card__media img,
body.woocommerce ul.products li.product.ds-product-card img,
body.woocommerce-page ul.products li.product.ds-product-card img {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: contain;
  margin: 0 auto !important;
  display: block !important;
  transition: transform 0.45s ease;
}

/* -------------------------------------------------------------------------- */
/* Hover / focus                                                               */
/* -------------------------------------------------------------------------- */

@media (hover: hover) and (pointer: fine) {
  .ds-product-card:hover,
  body.woocommerce ul.products li.product.ds-product-card:hover,
  body.woocommerce-page ul.products li.product.ds-product-card:hover,
  body.woocommerce-cart ul.products li.product.ds-product-card:hover {
    background: #fff !important;
    color: var(--ds-text) !important;
    border-color: rgba(var(--ds-brand-rgb), 0.28) !important;
    box-shadow: 0 14px 36px rgba(17, 17, 17, 0.08);
    transform: translateY(-3px);
  }

  .ds-product-card:hover .ds-product-card__title,
  body.woocommerce ul.products li.product.ds-product-card:hover .ds-product-card__title {
    color: var(--ds-brand) !important;
  }

  .ds-product-card:hover .ds-product-card__media img {
    transform: scale(1.06);
  }

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

.ds-product-card:focus-within {
  border-color: rgba(var(--ds-brand-rgb), 0.28) !important;
  box-shadow: 0 0 0 3px rgba(var(--ds-brand-rgb), 0.18);
}

/* -------------------------------------------------------------------------- */
/* Ribbon / badges / stock                                                     */
/* Layout: sale top-left, New/Featured/HIT top-right, stock bottom-left        */
/* -------------------------------------------------------------------------- */

.ds-sale-ribbon {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  width: 78px;
  height: 78px;
  overflow: hidden;
  pointer-events: none;
}

.ds-sale-ribbon__text {
  position: absolute;
  top: 14px;
  left: -28px;
  width: 110px;
  padding: 4px 0;
  background: #e31c23;
  color: #fff;
  font-family: var(--ds-font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
  transform: rotate(-45deg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.ds-product-card__badges {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  max-width: calc(100% - 90px);
  pointer-events: none;
}

.ds-badge-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ds-font);
  font-size: var(--ds-card-badge-size);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  padding: var(--ds-card-badge-pad);
  border-radius: 999px;
  white-space: nowrap;
}

.ds-badge-tag--new {
  background: var(--ds-brand);
  color: #fff;
}

.ds-badge-tag--feat {
  background: var(--ds-gold);
  color: #111;
}

/* Bestsellers “HIT” sticker — gold star behind readable label */
.ds-badge-tag--hit {
  position: relative;
  z-index: 0;
  width: var(--ds-card-hit);
  height: var(--ds-card-hit);
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #111;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-indent: 0.06em;
  transform: rotate(-12deg);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.22));
}

.ds-badge-tag--hit::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--ds-gold);
  /* Fat 5-point star — room for HIT in the center */
  clip-path: polygon(
    50% 0%,
    63% 32%,
    100% 36%,
    72% 58%,
    82% 96%,
    50% 76%,
    18% 96%,
    28% 58%,
    0% 36%,
    37% 32%
  );
}

.ds-product-card__stock {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 3;
  background: rgba(17, 17, 17, 0.88);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  max-width: calc(100% - 64px);
}

/* -------------------------------------------------------------------------- */
/* Actions (+ / wishlist)                                                      */
/* -------------------------------------------------------------------------- */

.ds-product-card__actions {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: var(--ds-card-action-gap);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}

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

.ds-product-card:focus-within .ds-product-card__actions {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/*
 * Cart — same chrome as wishlist heart, same cart glyph as the header.
 * Empty outline when not in cart; filled brand cart when .is-in-cart / .added.
 * Icon never flips to white (avoids invisible-on-white hover bugs).
 */
.ds-product-card__action--cart .button,
.ds-product-card__action--cart a.button,
.ds-product-card__action--cart a.button.add_to_cart_button,
.ds-product-card__action--cart .add_to_cart_button,
.ds-product-card__action--cart a.added_to_cart,
body.woocommerce .ds-product-card .ds-product-card__action--cart .button,
body.woocommerce .ds-product-card .ds-product-card__action--cart a.button,
body.woocommerce .ds-product-card .ds-product-card__action--cart a.button.add_to_cart_button,
body.woocommerce .ds-product-card .ds-product-card__action--cart .add_to_cart_button,
body.woocommerce .ds-product-card .ds-product-card__action--cart a.added_to_cart,
body.woocommerce-page .ds-product-card .ds-product-card__action--cart a.button.add_to_cart_button,
body.woocommerce-cart .ds-product-card .ds-product-card__action--cart a.button.add_to_cart_button,
body.woocommerce-cart .ds-product-card .ds-product-card__action--cart .add_to_cart_button,
body.woocommerce ul.products li.product.ds-product-card .ds-product-card__action--cart a.button.add_to_cart_button {
  display: block !important;
  align-items: unset !important;
  justify-content: unset !important;
  gap: 0 !important;
  width: var(--ds-card-action) !important;
  height: var(--ds-card-action) !important;
  min-width: var(--ds-card-action) !important;
  min-height: var(--ds-card-action) !important;
  padding: 0 !important;
  margin: 0 !important;
  background: #fff !important;
  color: transparent !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  border-radius: 10px !important;
  box-shadow: 0 6px 16px rgba(17, 17, 17, 0.1) !important;
  font-size: 0 !important;
  line-height: 0 !important;
  font-weight: 400 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  text-decoration: none !important;
  white-space: normal !important;
  overflow: hidden !important;
  text-indent: 0 !important;
  position: relative !important;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease !important;
}

.ds-product-card__action--cart .button::before,
.ds-product-card__action--cart a.button::before,
.ds-product-card__action--cart a.button.add_to_cart_button::before,
.ds-product-card__action--cart .add_to_cart_button::before,
body.woocommerce .ds-product-card .ds-product-card__action--cart .button::before,
body.woocommerce .ds-product-card .ds-product-card__action--cart a.button::before,
body.woocommerce .ds-product-card .ds-product-card__action--cart a.button.add_to_cart_button::before,
body.woocommerce .ds-product-card .ds-product-card__action--cart .add_to_cart_button::before,
body.woocommerce-cart .ds-product-card .ds-product-card__action--cart a.button.add_to_cart_button::before,
body.woocommerce-cart .ds-product-card .ds-product-card__action--cart .add_to_cart_button::before {
  content: "" !important;
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  width: 18px !important;
  height: 18px !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: translate(-50%, -50%) !important;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 6h15l-1.5 9h-12L6 6zm0 0L5 3H2' stroke='%23111111' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='9' cy='20' r='1.5' fill='%23111111'/%3E%3Ccircle cx='18' cy='20' r='1.5' fill='%23111111'/%3E%3C/svg%3E") center / contain no-repeat !important;
  speak: never;
}

.ds-product-card__action--cart.is-in-cart .button::before,
.ds-product-card__action--cart.is-in-cart a.button::before,
.ds-product-card__action--cart.is-in-cart .add_to_cart_button::before,
.ds-product-card__action--cart .button.added::before,
.ds-product-card__action--cart a.button.added::before,
.ds-product-card__action--cart .add_to_cart_button.added::before,
body.woocommerce .ds-product-card .ds-product-card__action--cart.is-in-cart .button::before,
body.woocommerce .ds-product-card .ds-product-card__action--cart.is-in-cart a.button::before,
body.woocommerce .ds-product-card .ds-product-card__action--cart .button.added::before,
body.woocommerce-cart .ds-product-card .ds-product-card__action--cart.is-in-cart .button::before,
body.woocommerce-cart .ds-product-card .ds-product-card__action--cart .button.added::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23a65e38' d='M6 6h15l-1.5 9h-12L6 6z'/%3E%3Cpath fill='none' stroke='%23a65e38' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M6 6L5 3H2'/%3E%3Ccircle cx='9' cy='20' r='1.5' fill='%23a65e38'/%3E%3Ccircle cx='18' cy='20' r='1.5' fill='%23a65e38'/%3E%3C/svg%3E") !important;
}

.ds-product-card__action--cart .button > *,
.ds-product-card__action--cart a.button > *,
.ds-product-card__action--cart a.added_to_cart,
body.woocommerce .ds-product-card__action--cart .button > *,
body.woocommerce .ds-product-card__action--cart a.button > *,
body.woocommerce .ds-product-card__action--cart a.added_to_cart {
  display: none !important;
}

.ds-product-card .ds-product-card__action--cart .button:hover,
.ds-product-card .ds-product-card__action--cart a.button:hover,
.ds-product-card .ds-product-card__action--cart a.button.add_to_cart_button:hover,
.ds-product-card .ds-product-card__action--cart .add_to_cart_button:hover,
.ds-product-card:hover .ds-product-card__action--cart .button,
.ds-product-card:hover .ds-product-card__action--cart a.button,
.ds-product-card:hover .ds-product-card__action--cart .add_to_cart_button,
.ds-product-card:hover .ds-product-card__action--cart a.button:hover,
.ds-product-card:hover .ds-product-card__action--cart a.button.add_to_cart_button:hover,
.ds-product-card .ds-product-card__action--cart .button:focus-visible,
.ds-product-card .ds-product-card__action--cart a.button:focus-visible,
body.woocommerce .ds-product-card .ds-product-card__action--cart a.button:hover,
body.woocommerce .ds-product-card .ds-product-card__action--cart a.button.add_to_cart_button:hover,
body.woocommerce .ds-product-card:hover .ds-product-card__action--cart a.button,
body.woocommerce .ds-product-card:hover .ds-product-card__action--cart a.button:hover,
body.woocommerce .ds-product-card:hover .ds-product-card__action--cart a.button.add_to_cart_button:hover,
body.woocommerce-cart .ds-product-card .ds-product-card__action--cart a.button:hover,
body.woocommerce-cart .ds-product-card:hover .ds-product-card__action--cart a.button:hover,
body.woocommerce-cart .ds-product-card:hover .ds-product-card__action--cart a.button.add_to_cart_button:hover {
  background: #fff !important;
  border-color: var(--ds-brand) !important;
  color: transparent !important;
  box-shadow: 0 8px 20px rgba(var(--ds-brand-rgb), 0.28) !important;
  outline: none;
}

.ds-product-card .ds-product-card__action--cart .button:focus-visible,
.ds-product-card .ds-product-card__action--cart a.button:focus-visible {
  box-shadow: 0 0 0 3px rgba(var(--ds-brand-rgb), 0.35) !important;
}

/*
 * Sold out: same cart control, lightly shaded, with a thin diagonal strike.
 * Out-of-stock loop links omit .add_to_cart_button, so they must not inherit
 * the solid black secondary-button skin. Selectors stay heavier than that skin.
 */
.ds-product-card.outofstock .ds-product-card__action--cart .button,
.ds-product-card.outofstock .ds-product-card__action--cart a.button,
.ds-product-card.outofstock .ds-product-card__action--cart a.button.ds-card-cart,
.ds-product-card.outofstock:hover .ds-product-card__action--cart .button,
.ds-product-card.outofstock:hover .ds-product-card__action--cart a.button,
.ds-product-card.outofstock:hover .ds-product-card__action--cart a.button.ds-card-cart,
.ds-product-card.outofstock .ds-product-card__action--cart .button:hover,
.ds-product-card.outofstock .ds-product-card__action--cart a.button:hover,
.ds-product-card.outofstock .ds-product-card__action--cart a.button.ds-card-cart:hover,
body.woocommerce .ds-product-card.outofstock .ds-product-card__action--cart a.button.ds-card-cart,
body.woocommerce .ds-product-card.outofstock:hover .ds-product-card__action--cart a.button.ds-card-cart,
body.woocommerce .ds-product-card.outofstock .ds-product-card__action--cart a.button.ds-card-cart:hover,
body.woocommerce-cart .ds-product-card.outofstock .ds-product-card__action--cart a.button.ds-card-cart,
body.woocommerce-cart .ds-product-card.outofstock:hover .ds-product-card__action--cart a.button.ds-card-cart:hover {
  background: #f2f2f2 !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  box-shadow: none !important;
  color: transparent !important;
  cursor: not-allowed;
}

.ds-product-card.outofstock .ds-product-card__action--cart .button::before,
.ds-product-card.outofstock .ds-product-card__action--cart a.button::before,
.ds-product-card.outofstock .ds-product-card__action--cart.is-in-cart .button::before,
.ds-product-card.outofstock .ds-product-card__action--cart .button.added::before,
body.woocommerce .ds-product-card.outofstock .ds-product-card__action--cart a.button.ds-card-cart::before,
body.woocommerce .ds-product-card.outofstock .ds-product-card__action--cart.is-in-cart a.button::before,
body.woocommerce-cart .ds-product-card.outofstock .ds-product-card__action--cart a.button::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 6h15l-1.5 9h-12L6 6zm0 0L5 3H2' stroke='%23707070' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='9' cy='20' r='1.5' fill='%23707070'/%3E%3Ccircle cx='18' cy='20' r='1.5' fill='%23707070'/%3E%3C/svg%3E") !important;
}

.ds-product-card.outofstock .ds-product-card__action--cart .button::after,
.ds-product-card.outofstock .ds-product-card__action--cart a.button::after,
body.woocommerce .ds-product-card.outofstock .ds-product-card__action--cart a.button.ds-card-cart::after,
body.woocommerce-cart .ds-product-card.outofstock .ds-product-card__action--cart a.button::after {
  content: "" !important;
  position: absolute !important;
  left: 4px !important;
  right: 4px !important;
  top: 50% !important;
  height: 1.5px !important;
  margin: 0 !important;
  padding: 0 !important;
  background: rgba(50, 50, 50, 0.72) !important;
  border: 0 !important;
  border-radius: 1px !important;
  transform: translateY(-50%) rotate(-45deg) !important;
  transform-origin: center !important;
  pointer-events: none !important;
  z-index: 1 !important;
}

.ds-product-card.outofstock .ds-product-card__action--cart .button:focus-visible,
.ds-product-card.outofstock .ds-product-card__action--cart a.button:focus-visible,
body.woocommerce .ds-product-card.outofstock .ds-product-card__action--cart a.button.ds-card-cart:focus-visible {
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.16) !important;
  outline: none;
}

/* Wishlist heart — same chrome as cart */
.ds-product-card__action--wish {
  position: relative;
  width: 40px;
  height: 40px;
}

.ds-product-card__action--wish .yith-wcwl-add-to-wishlist,
.ds-product-card__action--wish .yith-add-to-wishlist-button-block {
  margin: 0 !important;
  line-height: 0;
  width: var(--ds-card-action);
  height: var(--ds-card-action);
}

.ds-product-card__action--wish .yith-wcwl-add-button,
.ds-product-card__action--wish .yith-wcwl-wishlistaddedbrowse,
.ds-product-card__action--wish .yith-wcwl-wishlistexistsbrowse {
  margin: 0 !important;
  width: var(--ds-card-action);
  height: var(--ds-card-action);
  position: relative;
}

.ds-product-card__action--wish .yith-wcwl-tooltip,
.ds-product-card__action--wish .separator,
.ds-product-card__action--wish .feedback,
.ds-product-card__action--wish .view-wishlist,
.ds-product-card__action--wish .yith-wcwl-add-to-wishlist-button__label {
  display: none !important;
}

.ds-product-card__action--wish a,
.ds-product-card__action--wish button {
  display: grid !important;
  place-items: center;
  width: var(--ds-card-action) !important;
  height: var(--ds-card-action) !important;
  min-width: var(--ds-card-action) !important;
  padding: 0 !important;
  margin: 0 !important;
  background: #fff !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  border-radius: 10px !important;
  box-shadow: 0 6px 16px rgba(17, 17, 17, 0.1);
  color: transparent !important;
  text-decoration: none !important;
  font-size: 0 !important;
  line-height: 0 !important;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.ds-product-card__action--wish a > *,
.ds-product-card__action--wish button > *,
.ds-product-card__action--wish .yith-wcwl-icon,
.ds-product-card__action--wish svg,
.ds-product-card__action--wish img,
.ds-product-card__action--wish i {
  display: none !important;
}

.ds-product-card__action--wish a::before,
.ds-product-card__action--wish button::before,
.ds-product-card__action--wish .yith-wcwl-wishlistaddedbrowse::before,
.ds-product-card__action--wish .yith-wcwl-wishlistexistsbrowse::before {
  content: "";
  width: 18px;
  height: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M12.1 20.3S4 15.2 4 9.5A4.5 4.5 0 0 1 12 7a4.5 4.5 0 0 1 8 2.5c0 5.7-8.1 10.8-8.1 10.8z' stroke='%23111111' stroke-width='1.8' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.ds-product-card__action--wish a:hover,
.ds-product-card__action--wish button:hover,
.ds-product-card__action--wish a:focus-visible,
.ds-product-card__action--wish button:focus-visible {
  background: #fff !important;
  border-color: var(--ds-brand) !important;
  box-shadow: 0 8px 20px rgba(var(--ds-brand-rgb), 0.28);
}

.ds-product-card__action--wish a:hover::before,
.ds-product-card__action--wish button:hover::before,
.ds-product-card__action--wish a:focus-visible::before,
.ds-product-card__action--wish button:focus-visible::before {
  /* Keep dark heart — never white-on-white */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M12.1 20.3S4 15.2 4 9.5A4.5 4.5 0 0 1 12 7a4.5 4.5 0 0 1 8 2.5c0 5.7-8.1 10.8-8.1 10.8z' stroke='%23111111' stroke-width='1.8' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.ds-product-card__action--wish.is-in-wishlist a,
.ds-product-card__action--wish .yith-wcwl-add-to-wishlist.exists a,
.ds-product-card__action--wish .yith-wcwl-wishlistaddedbrowse,
.ds-product-card__action--wish .yith-wcwl-wishlistexistsbrowse {
  background: #fff !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(17, 17, 17, 0.1);
}

.ds-product-card__action--wish.is-in-wishlist a::before,
.ds-product-card__action--wish .yith-wcwl-add-to-wishlist.exists a::before,
.ds-product-card__action--wish .yith-wcwl-wishlistaddedbrowse::before,
.ds-product-card__action--wish .yith-wcwl-wishlistexistsbrowse::before,
.ds-product-card__action--wish .yith-wcwl-wishlistaddedbrowse a::before,
.ds-product-card__action--wish .yith-wcwl-wishlistexistsbrowse a::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23a65e38' d='M12.1 20.3S4 15.2 4 9.5A4.5 4.5 0 0 1 12 7a4.5 4.5 0 0 1 8 2.5c0 5.7-8.1 10.8-8.1 10.8z'/%3E%3C/svg%3E");
}

.ds-product-card__action--wish .yith-wcwl-wishlistaddedbrowse,
.ds-product-card__action--wish .yith-wcwl-wishlistexistsbrowse {
  display: grid !important;
  place-items: center;
}

.ds-product-card__action--wish .yith-wcwl-wishlistaddedbrowse > a,
.ds-product-card__action--wish .yith-wcwl-wishlistexistsbrowse > a {
  position: absolute !important;
  inset: 0 !important;
  opacity: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* -------------------------------------------------------------------------- */
/* Title / price / meta                                                        */
/* -------------------------------------------------------------------------- */

.ds-product-card__title,
body.woocommerce .ds-product-card__title,
body.woocommerce-cart .ds-product-card__title,
body.woocommerce a.ds-product-card__title {
  display: -webkit-box !important;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: var(--ds-font) !important;
  font-weight: 650 !important;
  font-size: var(--ds-card-title-size) !important;
  line-height: 1.35 !important;
  margin: 0 !important;
  color: var(--ds-text) !important;
  text-align: left !important;
  text-decoration: none !important;
  transition: color 0.2s ease;
}

.ds-product-card__excerpt {
  /* Always reserve 2 lines so cards without copy keep the same frame height. */
  --ds-excerpt-lines: 2;
  font-size: var(--ds-card-excerpt-size);
  line-height: 1.4;
  min-height: calc(var(--ds-card-excerpt-size) * 1.4 * var(--ds-excerpt-lines));
  color: var(--ds-muted) !important;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ds-product-card__excerpt.is-empty {
  visibility: hidden;
  user-select: none;
  pointer-events: none;
}

.ds-product-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-top: auto;
  padding-top: 4px;
}

.ds-product-card__price,
.ds-product-card__price .price,
.ds-product-card__price .amount,
.ds-product-card__price ins,
.ds-product-card__price ins .amount,
body.woocommerce .ds-product-card__price,
body.woocommerce .ds-product-card__price .price,
body.woocommerce .ds-product-card__price .amount,
body.woocommerce .ds-product-card__price ins,
body.woocommerce .ds-product-card__price ins .amount,
body.woocommerce ul.products li.product .ds-product-card__price,
body.woocommerce ul.products li.product .ds-product-card__price .amount,
body.woocommerce-cart .ds-product-card__price,
body.woocommerce-cart .ds-product-card__price .amount {
  font-weight: 700 !important;
  color: var(--ds-text) !important;
  font-size: var(--ds-card-price-size) !important;
  text-align: left !important;
  text-decoration: none !important;
}

.ds-product-card__price ins,
.ds-product-card__price ins .amount,
body.woocommerce .ds-product-card__price ins .amount {
  color: var(--ds-brand) !important;
}

.ds-product-card__price del,
.ds-product-card__price del .amount,
body.woocommerce .ds-product-card__price del,
body.woocommerce .ds-product-card__price del .amount,
body.woocommerce ul.products li.product .ds-product-card__price del,
body.woocommerce ul.products li.product .ds-product-card__price del .amount {
  color: var(--ds-muted) !important;
  font-size: 0.82rem !important;
  margin-left: 6px;
  font-weight: 500 !important;
}

/* Sale price yellow chip — all cards (same as single product) */
.ds-product-card__price:has(del) ins,
.ds-product-card__price .price:has(del) ins,
body.woocommerce .ds-product-card__price:has(del) ins,
body.woocommerce ul.products li.product .ds-product-card__price:has(del) ins {
  display: inline-block !important;
  padding: 0.18em 0.42em !important;
  background: var(--ds-gold) !important;
  color: var(--ds-text) !important;
  border-radius: 6px !important;
  text-decoration: none !important;
  vertical-align: baseline;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.ds-product-card__price:has(del) ins .amount,
.ds-product-card__price .price:has(del) ins .amount,
body.woocommerce .ds-product-card__price:has(del) ins .amount,
body.woocommerce ul.products li.product .ds-product-card__price:has(del) ins .amount {
  color: inherit !important;
}

.ds-product-card__rating {
  color: var(--ds-brand-dark);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

/* -------------------------------------------------------------------------- */
/* Related / upsells section                                                   */
/* -------------------------------------------------------------------------- */

.woocommerce .related.products,
.woocommerce .upsells.products {
  margin-top: 56px;
  clear: both;
  width: 100%;
}

/* -------------------------------------------------------------------------- */
/* Recommendation / product-widget titles — same “title + trakica” as picks */
/* -------------------------------------------------------------------------- */

.woocommerce .related.products > h2,
.woocommerce .upsells.products > h2 {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 1.25rem;
  padding: 0;
  font-family: var(--ds-font);
  font-size: 28px;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-align: left;
  color: #102b50;
  background: none;
  border-radius: 0;
}

.woocommerce .related.products > h2::after,
.woocommerce .upsells.products > h2::after {
  content: "";
  flex: 1 1 auto;
  min-width: 24px;
  height: 1px;
  margin: 0;
  border-radius: 0;
  background: #dce4ef;
}

.ds-products--color-match .ds-section-head,
.ds-products--cross-sells .ds-section-head,
.ds-products--recently-viewed .ds-section-head,
.ds-products .ds-section-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  margin: 0 0 1.25rem;
  padding: 0;
  text-align: left;
  background: none;
  border-radius: 0;
}

.ds-products--color-match .ds-section-title,
.ds-products--cross-sells .ds-section-title,
.ds-products--recently-viewed .ds-section-title,
.ds-products .ds-section-title {
  position: static;
  display: block;
  width: auto;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  font-size: 28px;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-align: left;
  color: #102b50;
}

.ds-products--color-match .ds-section-title::after,
.ds-products--cross-sells .ds-section-title::after,
.ds-products--recently-viewed .ds-section-title::after,
.ds-products .ds-section-title::after {
  content: none;
  display: none;
}

/* -------------------------------------------------------------------------- */
/* Motion preference                                                           */
/* -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .ds-product-card,
  .ds-product-card__media img,
  .ds-product-card__actions,
  .ds-product-card__title {
    transition: none !important;
  }

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

  .ds-product-card:hover .ds-product-card__media img {
    transform: none;
  }
}

/* -------------------------------------------------------------------------- */
/* Responsive                                                                  */
/* -------------------------------------------------------------------------- */

/*
 * Full-width product widgets (NOT shop-flow): home, related, upsells,
 * color-match, recently viewed, wishlist/cart bands when full-bleed.
 * Always render up to 6 cards; CSS hides extras for a clean one-row pack.
 * Akcija uses a flex carousel (one-by-one loop) with the same visible-count ladder.
 * Breakpoints use CSS px (Windows 1920@150% ≈ 1280; Mac Retina “Looks like”):
 *   >1600: 6×1  |  ≤1600: 5×1  |  ≤1200: 4×1  |  ≤900: 2×N  |  ≤560: 1×N
 * Hide rules must beat card `display:flex !important`.
 */

/* Wide desktop — one row of 6 (hide 7+ if homepage fetched more). */
.ds-products ul.products > li.product.ds-product-card:nth-child(n + 7),
.ds-products ul.products > li.ds-product-card:nth-child(n + 7),
.ds-products .ds-product-grid > li.ds-product-card:nth-child(n + 7),
.woocommerce .related.products > ul.products > li.product.ds-product-card:nth-child(n + 7),
.woocommerce .upsells.products > ul.products > li.product.ds-product-card:nth-child(n + 7) {
  display: none !important;
}

/* Laptop / scaled desktop — catch 1920@125% (~1536) and 1920@150% (~1280) */
@media (max-width: 1600px) {
  .ds-product-grid,
  .woocommerce .related.products > ul.products,
  .woocommerce .upsells.products > ul.products,
  .woocommerce .ds-products ul.products,
  .entry-content .ds-products ul.products {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }

  /* Widget grids only — never shop-flow archive */
  .ds-products ul.products > li.product.ds-product-card:nth-child(n + 6),
  .ds-products ul.products > li.ds-product-card:nth-child(n + 6),
  .ds-products .ds-product-grid > li.ds-product-card:nth-child(n + 6),
  .woocommerce .related.products > ul.products > li.product.ds-product-card:nth-child(n + 6),
  .woocommerce .upsells.products > ul.products > li.product.ds-product-card:nth-child(n + 6) {
    display: none !important;
  }
}

@media (max-width: 1200px) {
  .ds-product-grid,
  .woocommerce .related.products > ul.products,
  .woocommerce .upsells.products > ul.products,
  .woocommerce .ds-products ul.products,
  .entry-content .ds-products ul.products {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  .ds-products ul.products > li.product.ds-product-card:nth-child(n + 5),
  .ds-products ul.products > li.ds-product-card:nth-child(n + 5),
  .ds-products .ds-product-grid > li.ds-product-card:nth-child(n + 5),
  .woocommerce .related.products > ul.products > li.product.ds-product-card:nth-child(n + 5),
  .woocommerce .upsells.products > ul.products > li.product.ds-product-card:nth-child(n + 5) {
    display: none !important;
  }
}

@media (max-width: 900px) {
  .ds-product-grid,
  .woocommerce .related.products > ul.products,
  .woocommerce .upsells.products > ul.products,
  .woocommerce .ds-products ul.products,
  .entry-content .ds-products ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px;
  }

  /* Pack: show all fetched cards again (up to 6). */
  .ds-products ul.products > li.product.ds-product-card:nth-child(n + 5),
  .ds-products ul.products > li.product.ds-product-card:nth-child(n + 6),
  .ds-products ul.products > li.ds-product-card:nth-child(n + 5),
  .ds-products ul.products > li.ds-product-card:nth-child(n + 6),
  .ds-products .ds-product-grid > li.ds-product-card:nth-child(n + 5),
  .ds-products .ds-product-grid > li.ds-product-card:nth-child(n + 6),
  .woocommerce .related.products > ul.products > li.product.ds-product-card:nth-child(n + 5),
  .woocommerce .related.products > ul.products > li.product.ds-product-card:nth-child(n + 6),
  .woocommerce .upsells.products > ul.products > li.product.ds-product-card:nth-child(n + 5),
  .woocommerce .upsells.products > ul.products > li.product.ds-product-card:nth-child(n + 6) {
    display: flex !important;
  }
}

/* Viewport mobile: light floor only — card cqi tokens handle density. */
@media (max-width: 768px) {
  .ds-product-card,
  body.woocommerce ul.products li.product.ds-product-card {
    border-radius: var(--ds-card-radius) !important;
  }
}

@media (max-width: 560px) {
  .ds-product-grid,
  .woocommerce .related.products > ul.products,
  .woocommerce .upsells.products > ul.products,
  .woocommerce .ds-products ul.products,
  .entry-content .ds-products ul.products {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }
}

/*
 * Narrow-card tweaks on descendants (container = the card).
 * Token sizes already fluid via cqi on the card itself.
 */
@container ds-card (max-width: 240px) {
  .ds-product-card__badges {
    top: 6px;
    right: 6px;
    gap: 4px;
    max-width: calc(100% - 72px);
  }

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

  .ds-sale-ribbon {
    width: 64px;
    height: 64px;
  }

  .ds-sale-ribbon__text {
    top: 10px;
    left: -30px;
    width: 96px;
    font-size: 10px;
    padding: 3px 0;
  }

  .ds-product-card__stock {
    left: 6px;
    bottom: 6px;
    font-size: 10px;
    padding: 4px 8px;
  }
}

@container ds-card (max-width: 200px) {
  .ds-product-card__excerpt {
    --ds-excerpt-lines: 1;
    -webkit-line-clamp: 1;
  }

  .ds-product-card__swatches {
    padding-top: 6px;
  }

  .ds-badge-tag--hit {
    font-size: 9px;
  }
}

/* Color-match — same band as related/upsells on single product */
.ds-products--color-match {
  margin-top: 56px;
  clear: both;
  width: 100%;
  padding-top: 0;
  padding-bottom: 0;
}

/* AJAX mount — no layout cost until cards arrive */
.ds-recently-viewed-root[hidden] {
  display: none !important;
}

/* Cart/wishlist interest + recently viewed — full-width bands above footer */
.ds-products--cross-sells,
.ds-products--recently-viewed {
  margin-top: 48px;
  margin-bottom: 24px;
  padding-top: 0;
  padding-bottom: 0;
  width: 100%;
}

.ds-products--cross-sells + .ds-products--recently-viewed {
  margin-top: 8px;
}

.ds-products--color-match .ds-color-match__body.is-loading {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
