/**
 * Burnigan Core 1.3 — Shop + Product Cards
 * Authoritative last-loaded presentation for catalogue cards.
 * WooCommerce still owns add-to-cart, View Cart and product navigation.
 */

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag,
  body.home
) {
  --burnigan-card-image: #ecece8;
  --burnigan-card-muted: #777770;
  --burnigan-card-line: rgba(8, 8, 8, .14);
  --burnigan-card-strong-line: rgba(8, 8, 8, .24);
}

/* ---------- Catalogue toolbar ---------- */
:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) .woocommerce-result-count {
  margin: 9px 0 26px !important;
  color: var(--burnigan-card-muted) !important;
  font-size: 9px !important;
  font-weight: 900 !important;
  letter-spacing: .15em !important;
  line-height: 46px !important;
  text-transform: uppercase !important;
}

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) .woocommerce-ordering {
  margin: 9px 0 26px !important;
}

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) .woocommerce-ordering select {
  min-width: 228px !important;
  min-height: 46px !important;
  padding: 0 40px 0 14px !important;
  border: 1px solid var(--burnigan-card-line) !important;
  border-radius: 0 !important;
  background-color: #fff !important;
  color: var(--burnigan-ink) !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  letter-spacing: .06em !important;
  text-transform: uppercase !important;
}

/* ---------- Grid ---------- */
:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) ul.products,
body.home .woocommerce ul.products {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 54px 22px !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) ul.products::before,
:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) ul.products::after,
body.home .woocommerce ul.products::before,
body.home .woocommerce ul.products::after {
  display: none !important;
  content: none !important;
}

/* ---------- Card ---------- */
:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) ul.products > li.product,
body.home .woocommerce ul.products > li.product {
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  text-align: left !important;
  transform: translateY(0) !important;
  transition: transform var(--burnigan-medium) var(--burnigan-ease) !important;
}

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) ul.products > li.product a,
body.home .woocommerce ul.products > li.product a {
  text-decoration: none !important;
}

/* ---------- Image frame ---------- */
:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) ul.products > li.product :is(.ct-media-container, figure),
body.home .woocommerce ul.products > li.product :is(.ct-media-container, figure) {
  position: relative !important;
  width: 100% !important;
  margin: 0 0 15px !important;
  overflow: hidden !important;
  border: 1px solid rgba(8, 8, 8, .055) !important;
  background: var(--burnigan-card-image) !important;
}

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) ul.products > li.product img,
body.home .woocommerce ul.products > li.product img {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 4 / 5 !important;
  margin: 0 0 15px !important;
  border-radius: 0 !important;
  background: var(--burnigan-card-image) !important;
  object-fit: cover !important;
  object-position: center !important;
  transform: scale(1) !important;
  transition: transform .48s var(--burnigan-ease), opacity .28s ease !important;
}

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) ul.products > li.product .ct-media-container img,
body.home .woocommerce ul.products > li.product .ct-media-container img {
  margin: 0 !important;
}

/* Secondary image: crossfade on precise hover devices only. */
:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) ul.products > li.product .burnigan-secondary-image,
body.home .woocommerce ul.products > li.product .burnigan-secondary-image {
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  left: 0 !important;
  z-index: 2 !important;
  display: block !important;
  aspect-ratio: 4 / 5 !important;
  overflow: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  background: var(--burnigan-card-image) !important;
  transition: opacity .28s ease, visibility 0s linear .28s !important;
}

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) ul.products > li.product .burnigan-secondary-image img,
body.home .woocommerce ul.products > li.product .burnigan-secondary-image img {
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  object-fit: cover !important;
  transform: scale(1.008) !important;
}

/* ---------- Badges ---------- */
:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) .burnigan-card-badges,
body.home .woocommerce .burnigan-card-badges {
  position: absolute !important;
  top: 11px !important;
  left: 11px !important;
  z-index: 7 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 5px !important;
  pointer-events: none !important;
}

.burnigan-card-badge {
  display: inline-flex !important;
  min-height: 24px !important;
  padding: 0 8px !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid rgba(255,255,255,.72) !important;
  background: rgba(255,255,255,.94) !important;
  color: var(--burnigan-ink) !important;
  font-size: 7.5px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  letter-spacing: .13em !important;
  text-transform: uppercase !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.burnigan-card-badge--soldout {
  border-color: var(--burnigan-ink) !important;
  background: var(--burnigan-ink) !important;
  color: #fff !important;
}

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) ul.products > li.product .onsale,
body.home .woocommerce ul.products > li.product .onsale {
  top: 11px !important;
  right: 11px !important;
  left: auto !important;
  z-index: 7 !important;
  min-width: 0 !important;
  min-height: 24px !important;
  padding: 0 8px !important;
  border: 1px solid var(--burnigan-ink) !important;
  border-radius: 0 !important;
  background: var(--burnigan-ink) !important;
  color: #fff !important;
  font-size: 7.5px !important;
  font-weight: 900 !important;
  line-height: 24px !important;
  letter-spacing: .13em !important;
  text-transform: uppercase !important;
}

/* ---------- Text hierarchy ---------- */
:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) .burnigan-card-category,
body.home .woocommerce .burnigan-card-category {
  display: block !important;
  margin: 0 0 6px !important;
  color: var(--burnigan-card-muted) !important;
  font-size: 8px !important;
  font-weight: 900 !important;
  line-height: 1.2 !important;
  letter-spacing: .15em !important;
  text-transform: uppercase !important;
}

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) ul.products > li.product .woocommerce-loop-product__title,
body.home .woocommerce ul.products > li.product .woocommerce-loop-product__title {
  display: -webkit-box !important;
  min-height: 2.64em !important;
  margin: 0 0 7px !important;
  padding: 0 !important;
  overflow: hidden !important;
  color: var(--burnigan-ink) !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  line-height: 1.32 !important;
  letter-spacing: -.015em !important;
  text-transform: uppercase !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
}

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) ul.products > li.product .price,
body.home .woocommerce ul.products > li.product .price {
  display: flex !important;
  min-height: 20px !important;
  margin: 0 0 14px !important;
  align-items: baseline !important;
  flex-wrap: wrap !important;
  gap: 7px !important;
  color: var(--burnigan-ink) !important;
  font-size: 13px !important;
  font-weight: 850 !important;
  line-height: 1.3 !important;
}

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) ul.products > li.product .price del,
body.home .woocommerce ul.products > li.product .price del {
  color: var(--burnigan-card-muted) !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  opacity: .65 !important;
}

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) ul.products > li.product .price ins,
body.home .woocommerce ul.products > li.product .price ins {
  color: var(--burnigan-ink) !important;
  text-decoration: none !important;
}

/* ---------- Actions ---------- */
:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) ul.products > li.product :is(.button, .added_to_cart),
body.home .woocommerce ul.products > li.product :is(.button, .added_to_cart) {
  position: relative !important;
  z-index: 5 !important;
  display: inline-flex !important;
  width: 100% !important;
  min-height: 44px !important;
  margin: auto 0 0 !important;
  padding: 0 12px !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid var(--burnigan-ink) !important;
  border-radius: 0 !important;
  background: var(--burnigan-ink) !important;
  color: #fff !important;
  font-size: 8px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  letter-spacing: .13em !important;
  text-align: center !important;
  text-transform: uppercase !important;
  box-sizing: border-box !important;
  transition: background-color var(--burnigan-fast) ease, color var(--burnigan-fast) ease, transform var(--burnigan-fast) ease !important;
}

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) ul.products > li.product .button::after,
body.home .woocommerce ul.products > li.product .button::after {
  content: "→" !important;
  margin-left: 8px !important;
  font-size: 11px !important;
  line-height: 1 !important;
  transform: translateX(0) !important;
  transition: transform var(--burnigan-fast) ease !important;
}

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) ul.products > li.product .added_to_cart,
body.home .woocommerce ul.products > li.product .added_to_cart {
  min-height: 40px !important;
  margin-top: 7px !important;
  background: transparent !important;
  color: var(--burnigan-ink) !important;
}

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) ul.products > li.product .added_to_cart::after,
body.home .woocommerce ul.products > li.product .added_to_cart::after {
  content: "↗" !important;
  margin-left: 7px !important;
  font-size: 10px !important;
}

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) ul.products > li.product .button.loading,
body.home .woocommerce ul.products > li.product .button.loading {
  opacity: .62 !important;
  pointer-events: none !important;
}

/* ---------- Hover / pointer refinement ---------- */
@media (hover:hover) and (pointer:fine) {
  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) ul.products > li.product:hover,
  body.home .woocommerce ul.products > li.product:hover {
    transform: translateY(-3px) !important;
  }

  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) ul.products > li.product:hover .burnigan-secondary-image,
  body.home .woocommerce ul.products > li.product:hover .burnigan-secondary-image {
    opacity: 1 !important;
    visibility: visible !important;
    transition-delay: 0s !important;
  }

  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) ul.products > li.product:hover .burnigan-secondary-image img,
  body.home .woocommerce ul.products > li.product:hover .burnigan-secondary-image img {
    transform: scale(1.022) !important;
  }

  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) ul.products > li.product :is(.button,.added_to_cart):hover,
  body.home .woocommerce ul.products > li.product :is(.button,.added_to_cart):hover {
    background: #fff !important;
    color: var(--burnigan-ink) !important;
    transform: translateY(-1px) !important;
  }

  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) ul.products > li.product .button:hover::after,
  body.home .woocommerce ul.products > li.product .button:hover::after {
    transform: translateX(3px) !important;
  }
}

/* ---------- Pagination ---------- */
:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) nav.woocommerce-pagination {
  margin-top: 68px !important;
}

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) nav.woocommerce-pagination ul {
  display: flex !important;
  gap: 6px !important;
  border: 0 !important;
}

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) nav.woocommerce-pagination li {
  border: 0 !important;
}

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) nav.woocommerce-pagination :is(a,span) {
  display: grid !important;
  width: 42px !important;
  height: 42px !important;
  place-items: center !important;
  border: 1px solid var(--burnigan-card-line) !important;
  background: #fff !important;
  color: var(--burnigan-ink) !important;
  font-size: 10px !important;
  font-weight: 900 !important;
}

:is(
  body.woocommerce-shop,
  body.post-type-archive-product,
  body.tax-product_cat,
  body.tax-product_tag
) nav.woocommerce-pagination .current {
  border-color: var(--burnigan-ink) !important;
  background: var(--burnigan-ink) !important;
  color: #fff !important;
}

/* Keep tiny catalogues visually balanced. */
@media (min-width: 901px) {
  @supports selector(ul:has(li)) {
    :is(
      body.woocommerce-shop,
      body.post-type-archive-product,
      body.tax-product_cat,
      body.tax-product_tag
    ) ul.products:has(> li.product:only-child) {
      grid-template-columns: minmax(260px, 330px) !important;
      justify-content: start !important;
    }

    :is(
      body.woocommerce-shop,
      body.post-type-archive-product,
      body.tax-product_cat,
      body.tax-product_tag
    ) ul.products:has(> li.product:nth-child(2):last-child) {
      grid-template-columns: repeat(2, minmax(260px, 330px)) !important;
      justify-content: start !important;
    }
  }
}

/* ---------- Tablet ---------- */
@media (max-width: 1080px) {
  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) ul.products,
  body.home .woocommerce ul.products {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 44px 18px !important;
  }
}

/* ---------- Mobile: deliberately simpler, no hover-image payload in view ---------- */
@media (max-width: 767px) {
  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) .woocommerce-result-count,
  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) .woocommerce-ordering {
    width: 100% !important;
    float: none !important;
  }

  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) .woocommerce-result-count {
    margin: 0 0 10px !important;
    line-height: 1.3 !important;
  }

  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) .woocommerce-ordering {
    margin: 0 0 22px !important;
  }

  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) .woocommerce-ordering select {
    width: 100% !important;
    min-width: 0 !important;
  }

  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) ul.products,
  body.home .woocommerce ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 30px 9px !important;
  }

  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) ul.products > li.product,
  body.home .woocommerce ul.products > li.product {
    transform: none !important;
  }

  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) ul.products > li.product .burnigan-secondary-image,
  body.home .woocommerce ul.products > li.product .burnigan-secondary-image {
    display: none !important;
  }

  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) ul.products > li.product img,
  body.home .woocommerce ul.products > li.product img {
    margin-bottom: 10px !important;
  }

  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) .burnigan-card-category,
  body.home .woocommerce .burnigan-card-category {
    margin-bottom: 4px !important;
    font-size: 6.8px !important;
    letter-spacing: .12em !important;
  }

  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) ul.products > li.product .woocommerce-loop-product__title,
  body.home .woocommerce ul.products > li.product .woocommerce-loop-product__title {
    min-height: 2.7em !important;
    margin-bottom: 5px !important;
    font-size: 10px !important;
    line-height: 1.35 !important;
  }

  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) ul.products > li.product .price,
  body.home .woocommerce ul.products > li.product .price {
    min-height: 17px !important;
    margin-bottom: 9px !important;
    font-size: 10.5px !important;
  }

  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) ul.products > li.product :is(.button,.added_to_cart),
  body.home .woocommerce ul.products > li.product :is(.button,.added_to_cart) {
    min-height: 39px !important;
    padding: 0 6px !important;
    font-size: 7px !important;
    letter-spacing: .09em !important;
  }

  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) .burnigan-card-badges,
  body.home .woocommerce .burnigan-card-badges {
    top: 7px !important;
    left: 7px !important;
  }

  .burnigan-card-badge,
  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) ul.products > li.product .onsale,
  body.home .woocommerce ul.products > li.product .onsale {
    min-height: 20px !important;
    padding: 0 6px !important;
    font-size: 6.5px !important;
    line-height: 20px !important;
  }

  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) ul.products > li.product .onsale,
  body.home .woocommerce ul.products > li.product .onsale {
    top: 7px !important;
    right: 7px !important;
  }
}

@media (max-width: 370px) {
  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag
  ) ul.products,
  body.home .woocommerce ul.products {
    column-gap: 7px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag,
    body.home
  ) ul.products > li.product,
  :is(
    body.woocommerce-shop,
    body.post-type-archive-product,
    body.tax-product_cat,
    body.tax-product_tag,
    body.home
  ) ul.products > li.product * {
    transition: none !important;
  }
}
