/* 3DBull 1.0.0-beta.2.6
 * Late-loaded catalogue layout layer (shop-home aware in beta.2.5).
 * It intentionally does not depend on body.woocommerce-shop because 3dbull.de
 * exposes the catalogue at the site root and WordPress/WooCommerce body classes
 * can vary with front-page/shop configuration.
 */

body .woocommerce ul.products.bull-layout-categories,
body .woocommerce ul.products.bull-layout-categories {
  display: grid !important;
  grid-template-columns: repeat(var(--bull-home-cat-cols-desktop, 2), minmax(0, 1fr)) !important;
  gap: 28px 32px !important;
  width: 100% !important;
  clear: both !important;
}

body .woocommerce ul.products.bull-layout-products,
body .woocommerce ul.products.bull-layout-products {
  display: grid !important;
  grid-template-columns: repeat(var(--bull-home-prod-cols-desktop, 4), minmax(0, 1fr)) !important;
  gap: 22px !important;
  width: 100% !important;
  clear: both !important;
}

/* CSS-only fallback before/without JS classification on current browsers. */
body .woocommerce ul.products:has(> li.product-category) {
  grid-template-columns: repeat(var(--bull-home-cat-cols-desktop, 2), minmax(0, 1fr)) !important;
}
body .woocommerce ul.products:not(:has(> li.product-category)) {
  grid-template-columns: repeat(var(--bull-home-prod-cols-desktop, 4), minmax(0, 1fr)) !important;
}

/* Finished category art must never be forced into the square product crop. */
body .woocommerce ul.products li.product-category a img {
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  object-position: center !important;
}
body .woocommerce ul.products li.product-category mark.count {
  padding: 0 !important;
  background: transparent !important;
  color: var(--bull-primary, #d64532) !important;
  font-size: .82em !important;
  font-weight: 800 !important;
}

/* Strong but quiet transition between categories and the actual catalogue. */
.bull-shop-layout-separator {
  position: relative;
  display: block !important;
  width: 100% !important;
  height: 1px;
  clear: both;
  margin: 58px 0 42px !important;
  background: #dedede;
}
.bull-shop-layout-separator::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -2px;
  width: 96px;
  height: 4px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: var(--bull-primary, #d64532);
}

/* Product cards: one clear primary action; quick view is a subordinate text action. */
body .woocommerce ul.products.bull-layout-products li.product {
  display: flex !important;
  flex-direction: column !important;
  min-width: 0;
}
body .woocommerce ul.products.bull-layout-products li.product .bull-primary-product-action {
  width: 100% !important;
  margin-top: auto !important;
}
body .woocommerce ul.products.bull-layout-products li.product .bull-quickview-action,
body .woocommerce ul.products.bull-layout-products li.product .bull-quickview-action {
  display: inline-flex !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  align-self: center !important;
  justify-content: center !important;
  margin: 2px auto 0 !important;
  padding: 4px 8px !important;
  border: 0 !important;
  border-radius: 4px !important;
  background: transparent !important;
  color: #606770 !important;
  box-shadow: none !important;
  font-size: .82rem !important;
  font-weight: 650 !important;
  line-height: 1.25 !important;
  text-decoration: underline !important;
  text-underline-offset: 2px;
}


.bull-quickview-icon {
  width: 14px;
  height: 14px;
  margin-right: 5px;
  flex: 0 0 auto;
}
body .woocommerce ul.products.bull-layout-products li.product .bull-quickview-action:hover,
body .woocommerce ul.products.bull-layout-products li.product .bull-quickview-action:focus-visible {
  background: transparent !important;
  color: var(--bull-primary, #d64532) !important;
  text-decoration-thickness: 2px !important;
}

@media (max-width: 1024px) {
  body .woocommerce ul.products.bull-layout-categories,
  body .woocommerce ul.products:has(> li.product-category) {
    grid-template-columns: repeat(var(--bull-home-cat-cols-tablet, 2), minmax(0, 1fr)) !important;
  }
  body .woocommerce ul.products.bull-layout-products,
  body .woocommerce ul.products:not(:has(> li.product-category)) {
    grid-template-columns: repeat(var(--bull-home-prod-cols-tablet, 2), minmax(0, 1fr)) !important;
  }
}

@media (max-width: 700px) {
  body .woocommerce ul.products.bull-layout-categories,
  body .woocommerce ul.products:has(> li.product-category) {
    grid-template-columns: repeat(var(--bull-home-cat-cols-mobile, 1), minmax(0, 1fr)) !important;
    gap: 18px !important;
  }
  body .woocommerce ul.products.bull-layout-products,
  body .woocommerce ul.products:not(:has(> li.product-category)) {
    grid-template-columns: repeat(var(--bull-home-prod-cols-mobile, 2), minmax(0, 1fr)) !important;
    gap: 12px !important;
  }
  .bull-shop-layout-separator { margin: 38px 0 28px !important; }
}


/* beta.2.6: product-card action hierarchy must also work on shortcode pages such as /sale/. */
body .woocommerce ul.products.bull-layout-products li.product {
  display: flex !important;
  flex-direction: column !important;
}
body .woocommerce ul.products.bull-layout-products li.product .bull-primary-product-action {
  width: 100% !important;
  margin-top: auto !important;
}
body .woocommerce ul.products.bull-layout-products li.product .bull-quickview-action {
  display: inline-flex !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  align-self: center !important;
  justify-content: center !important;
  margin: 2px auto 0 !important;
  padding: 4px 8px !important;
  border: 0 !important;
  border-radius: 4px !important;
  background: transparent !important;
  color: #606770 !important;
  box-shadow: none !important;
  font-size: .82rem !important;
  font-weight: 650 !important;
  line-height: 1.25 !important;
  text-decoration: underline !important;
  text-underline-offset: 2px;
}
body .woocommerce ul.products.bull-layout-products li.product .bull-quickview-action:hover,
body .woocommerce ul.products.bull-layout-products li.product .bull-quickview-action:focus-visible {
  background: transparent !important;
  color: var(--bull-primary, #d64532) !important;
}

/* The module is the single source of truth for homepage categories. */
body.bull-home-categories-disabled .bull-home-categories,
body.bull-home-categories-disabled ul.products.bull-layout-categories,
body.bull-home-categories-disabled ul.products:has(> li.product-category) {
  display: none !important;
}
.bull-home-native-categories ul.products {
  margin: 0 !important;
}
.bull-home-native-categories ul.products li.product-category img {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: auto !important;
  object-fit: contain !important;
}
.bull-hide-category-count mark.count { display: none !important; }

body.bull-home-categories-enabled [data-bull-home-section="pagecontent"] ul.products:has(> li.product-category),
body.bull-home-categories-enabled .bull-home-products ul.products:has(> li.product-category):not(.bull-home-native-categories ul.products),
body.bull-home-categories-enabled ul.products[data-bull-duplicate-categories="1"] {
  display: none !important;
}

/* beta.2.7: quick view must stay secondary in every WooCommerce product loop,
   including related products, cross-sells, Sale shortcodes and product pages. */
body .woocommerce ul.products li.product .bull-quickview-action,
body .woocommerce-page ul.products li.product .bull-quickview-action,
body ul.products li.product .bull-quickview-action {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 3px auto 0 !important;
  padding: 4px 8px !important;
  border: 0 !important;
  border-radius: 4px !important;
  background: transparent !important;
  color: #606770 !important;
  box-shadow: none !important;
  font-size: .82rem !important;
  font-weight: 650 !important;
  line-height: 1.25 !important;
  text-decoration: underline !important;
  text-underline-offset: 2px !important;
}
body .woocommerce ul.products li.product .bull-quickview-action:hover,
body .woocommerce ul.products li.product .bull-quickview-action:focus-visible,
body .woocommerce-page ul.products li.product .bull-quickview-action:hover,
body .woocommerce-page ul.products li.product .bull-quickview-action:focus-visible,
body ul.products li.product .bull-quickview-action:hover,
body ul.products li.product .bull-quickview-action:focus-visible {
  background: transparent !important;
  color: var(--bull-primary, #d64532) !important;
  box-shadow: none !important;
}

/* A JS fallback is only inserted when the server-rendered Vorteilsleiste is
   unexpectedly missing. It uses the same layout and remains visually identical. */
.bull-trust-strip--fallback {
  background: var(--bull-section-bg, #fff);
  color: var(--bull-section-text, #202124);
}
