/* Product cards share the same geometry in archives, shortcodes and related lists.
 * WooCommerce's small-screen stylesheet applies width:48% inside our CSS grid.
 * Reset the legacy floated columns, not the grid tracks themselves. */
body.zomu-motion-theme ul.products > li.product.product-card,
body.zomu-motion-theme ul.products[class*="columns-"] > li.product {
  width: 100%;
  min-width: 0;
  max-width: none;
  float: none;
  clear: none;
  margin: 0;
  padding: 0;
}

body.zomu-motion-theme ul.products > li.product .product-card__media {
  width: 100%;
  flex: 0 0 auto;
  aspect-ratio: 1;
  border-radius: 8px;
}

body.zomu-motion-theme ul.products > li.product .product-card__info {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  padding-top: 14px;
  text-align: left;
}

body.zomu-motion-theme ul.products > li.product .woocommerce-loop-product__title,
body.zomu-motion-theme .wc-block-grid__product .wc-block-grid__product-title {
  width: 100%;
  max-width: none;
  min-height: 0;
  padding: 0;
  margin: 0 0 9px;
  color: var(--zomu-header);
  font-family: var(--zomu-sans);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -.015em;
  text-align: left;
  text-transform: none;
  text-wrap: pretty;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

body.zomu-motion-theme ul.products > li.product .star-rating {
  flex: 0 0 auto;
  margin: 0 0 9px;
}

body.zomu-motion-theme ul.products > li.product .price {
  justify-content: flex-start;
  gap: 4px 9px;
  margin: auto 0 0;
  color: var(--zomu-ink);
  font-family: var(--zomu-sans);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

body.zomu-motion-theme ul.products > li.product .price del {
  color: var(--zomu-muted);
  font-size: .84em;
  font-weight: 400;
  opacity: 1;
}

body.zomu-motion-theme ul.products > li.product .price :is(del, ins, .amount) {
  white-space: nowrap;
}

body.zomu-motion-theme ul.products > li.product .onsale {
  top: 10px;
  right: auto;
  left: 10px;
  min-width: 0;
  min-height: 0;
  padding: 7px 9px;
  margin: 0;
  border-radius: 4px;
  color: var(--zomu-white);
  background: var(--zomu-berry);
  font: 650 10px/1.2 var(--zomu-sans);
  letter-spacing: .035em;
  text-transform: uppercase;
}

@media (max-width: 800px) {
  body.zomu-motion-theme .woocommerce ul.products,
  body.zomu-motion-theme.woocommerce ul.products,
  body.zomu-motion-theme .wc-block-grid__products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 30px 14px;
  }

  body.zomu-motion-theme ul.products > li.product .woocommerce-loop-product__title,
  body.zomu-motion-theme .wc-block-grid__product .wc-block-grid__product-title {
    font-size: 15px;
    line-height: 1.45;
  }

  body.zomu-motion-theme ul.products > li.product .product-card__info {
    padding-top: 12px;
  }

  body.zomu-motion-theme ul.products > li.product .price {
    gap: 3px 7px;
    font-size: 15px;
  }

  body.zomu-motion-theme ul.products > li.product .product-card__actions {
    right: 8px;
    bottom: 8px;
    width: 44px;
    height: 44px;
    border-radius: 6px;
    box-shadow: 0 3px 12px rgb(10 34 54 / 12%);
    transition: background-color .2s ease;
  }

  body.zomu-motion-theme ul.products > li.product .product-card__actions .button,
  body.zomu-motion-theme ul.products > li.product:is(:hover, :focus-within) .product-card__actions .button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    gap: 0;
    border: 0;
    border-radius: 6px;
    color: var(--zomu-white);
    background: var(--zomu-forest);
    font-size: 0;
    transform: none;
  }

  body.zomu-motion-theme ul.products > li.product .product-card__actions .button::before {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
  }

  body.zomu-motion-theme ul.products > li.product .product-card__actions .button.loading::before {
    opacity: 0;
  }

  body.zomu-motion-theme ul.products > li.product .product-card__actions .button.loading::after {
    top: 14px;
    right: 14px;
    font-size: 16px;
  }

  /* The native Woo cart link stays visible after AJAX add-to-cart. */
  body.zomu-motion-theme ul.products > li.product .product-card__actions:has(.added_to_cart) {
    width: calc(100% - 16px);
  }

  body.zomu-motion-theme ul.products > li.product .product-card__actions .added_to_cart {
    display: grid;
    width: 100%;
    height: 44px;
    min-height: 44px;
    padding: 8px;
    border: 0;
    border-radius: 6px;
    color: var(--zomu-white);
    background: var(--zomu-forest);
    font: 600 12px/1.2 var(--zomu-sans);
    text-transform: none;
  }

  body.zomu-motion-theme .shop-toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    padding-block: 16px;
    margin-bottom: 24px;
  }

  body.zomu-motion-theme .shop-toolbar .woocommerce-result-count {
    grid-column: 1 / -1;
    width: auto;
    margin: 0;
    color: var(--zomu-muted);
    font-size: 12px;
    font-weight: 450;
    line-height: 1.5;
  }

  body.zomu-motion-theme .shop-toolbar .shop-toolbar__filter {
    min-height: 44px;
    padding: 10px 12px;
    margin: 0;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .025em;
  }

  body.zomu-motion-theme .shop-toolbar .woocommerce-ordering {
    min-width: 0;
    width: 100%;
    margin: 0;
  }

  body.zomu-motion-theme .shop-toolbar .woocommerce-ordering select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 8px 24px 8px 10px;
    border: 1px solid var(--zomu-line);
    border-radius: 6px;
    background-color: var(--zomu-white);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
  }

  body.zomu-motion-theme .shop-toolbar--empty .shop-toolbar__empty-copy {
    grid-column: 1 / -1;
    margin: 0;
  }

  body.zomu-motion-theme .wc-block-grid .wc-block-grid__products > .wc-block-grid__product {
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0;
    border: 0;
  }

  body.zomu-motion-theme .wc-block-grid .wc-block-grid__products {
    display: grid;
  }
}

/* Keep the home page's deliberate swipe rail, but give each card its full track. */
@media (max-width: 600px) {
  body.zomu-motion-theme .product-rail .woocommerce ul.products > li.product {
    width: min(76vw, 320px);
    flex-basis: min(76vw, 320px);
  }

  body.zomu-motion-theme ul.products > li.product .onsale {
    top: 8px;
    left: 8px;
    padding: 6px 7px;
    font-size: 10px;
  }
}

@media (hover: none) {
  /* A touch tap must not hide the main image behind an unavailable hover state. */
  body.zomu-motion-theme ul.products > li.product:hover .product-card__media-link > img:first-of-type {
    opacity: 1;
    transform: none;
  }

  body.zomu-motion-theme ul.products > li.product .product-card__secondary-image {
    opacity: 0;
  }
}

@media (max-width: 359px) {
  body.zomu-motion-theme .woocommerce ul.products,
  body.zomu-motion-theme.woocommerce ul.products,
  body.zomu-motion-theme .wc-block-grid__products {
    grid-template-columns: minmax(0, 1fr);
  }

  body.zomu-motion-theme .shop-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  body.zomu-motion-theme .shop-toolbar .shop-toolbar__filter {
    justify-content: center;
    width: 100%;
  }
}
