/*
 * BD Product Card Fix
 * Fixes category contrast and add-to-cart overflow on WooCommerce product cards.
 */

:root {
  --bd-card-blue: #062763;
  --bd-card-blue-dark: #031844;
  --bd-card-gold: #d8ab44;
  --bd-card-cream: #fffaf0;
  --bd-card-white: #ffffff;
  --bd-card-text: #1d1430;
  --bd-card-muted: #5f536d;
  --bd-card-line: rgba(216, 171, 68, 0.32);
}

/* Product grid containers */
html body.woocommerce ul.products,
html body ul.products,
html body .woocommerce ul.products,
html body .wc-block-grid__products,
html body .wc-block-product-template,
html body .bd-product-grid,
html body .bd-product-strip {
  align-items: stretch !important;
}

/* Product card wrapper: WooCommerce classic + block + custom BD card */
html body.woocommerce ul.products li.product,
html body ul.products li.product,
html body .woocommerce ul.products li.product,
html body .wc-block-grid__product,
html body .wc-block-product,
html body .bd-product-card {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  min-height: 100% !important;
  overflow: hidden !important;
  position: relative !important;
  background: #ffffff !important;
  border: 1px solid var(--bd-card-line) !important;
  border-radius: 24px !important;
  box-shadow: 0 12px 30px rgba(3, 24, 68, 0.08) !important;
}

/* Image containment */
html body.woocommerce ul.products li.product img,
html body ul.products li.product img,
html body .woocommerce ul.products li.product img,
html body .wc-block-grid__product img,
html body .wc-block-product img,
html body .bd-product-card img {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: cover !important;
  border-radius: 18px !important;
}

/* Product body/content grows so button can pin to bottom */
html body.woocommerce ul.products li.product .bd-product-body,
html body ul.products li.product .bd-product-body,
html body .woocommerce ul.products li.product .bd-product-body,
html body .bd-product-card .bd-product-body,
html body .wc-block-grid__product .wc-block-grid__product-title,
html body .wc-block-product .wp-block-post-title {
  min-width: 0 !important;
}

/* Category text visibility fix */
html body.woocommerce ul.products li.product .product-category,
html body.woocommerce ul.products li.product .woocommerce-loop-category__title,
html body.woocommerce ul.products li.product .posted_in,
html body.woocommerce ul.products li.product .cat,
html body.woocommerce ul.products li.product .product-cat,
html body.woocommerce ul.products li.product .product_meta,
html body.woocommerce ul.products li.product .product_meta a,
html body ul.products li.product .product-category,
html body ul.products li.product .woocommerce-loop-category__title,
html body ul.products li.product .posted_in,
html body ul.products li.product .cat,
html body ul.products li.product .product-cat,
html body .wc-block-grid__product .wc-block-grid__product-category,
html body .wc-block-grid__product .wc-block-grid__product-category a,
html body .wc-block-product .taxonomy-product_cat,
html body .wc-block-product .taxonomy-product_cat a,
html body .bd-product-card .product-category,
html body .bd-product-card .product-cat,
html body .bd-product-card .posted_in,
html body .bd-product-card .cat {
  color: var(--bd-card-blue) !important;
  background: transparent !important;
  opacity: 1 !important;
  visibility: visible !important;
  font-weight: 800 !important;
  text-shadow: none !important;
}

/* If category appears as a badge/chip */
html body.woocommerce ul.products li.product .product-category a,
html body ul.products li.product .product-category a,
html body .bd-product-card .product-category a,
html body .bd-product-card .product-cat a,
html body .bd-product-card .posted_in a {
  color: var(--bd-card-blue) !important;
  text-decoration: none !important;
}

/* Titles: readable and controlled height */
html body.woocommerce ul.products li.product .woocommerce-loop-product__title,
html body ul.products li.product .woocommerce-loop-product__title,
html body .woocommerce ul.products li.product .woocommerce-loop-product__title,
html body .wc-block-grid__product-title,
html body .wc-block-grid__product-title a,
html body .wc-block-product .wp-block-post-title,
html body .wc-block-product .wp-block-post-title a,
html body .bd-product-card h3,
html body .bd-product-card h3 a {
  color: var(--bd-card-blue) !important;
  min-height: 2.35em !important;
  line-height: 1.18 !important;
  font-weight: 900 !important;
  text-decoration: none !important;
  margin-bottom: 0.45rem !important;
}

/* Prices */
html body.woocommerce ul.products li.product .price,
html body ul.products li.product .price,
html body .woocommerce ul.products li.product .price,
html body .wc-block-grid__product-price,
html body .wc-block-components-product-price,
html body .bd-product-price {
  color: var(--bd-card-text) !important;
  font-weight: 900 !important;
  margin-bottom: 0.65rem !important;
}

/* Classic WooCommerce card internal layout */
html body.woocommerce ul.products li.product,
html body ul.products li.product,
html body .woocommerce ul.products li.product {
  padding: 0.9rem !important;
}

html body.woocommerce ul.products li.product > a.woocommerce-LoopProduct-link,
html body ul.products li.product > a.woocommerce-LoopProduct-link,
html body .woocommerce ul.products li.product > a.woocommerce-LoopProduct-link {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  text-decoration: none !important;
}

/* Button pinned inside the card */
html body.woocommerce ul.products li.product .button,
html body ul.products li.product .button,
html body .woocommerce ul.products li.product .button,
html body .wc-block-grid__product .wp-block-button,
html body .wc-block-grid__product .wp-block-button__link,
html body .wc-block-product .wp-block-button,
html body .wc-block-product .wp-block-button__link,
html body .bd-product-card .bd-product-button,
html body .bd-product-card .button {
  margin-top: auto !important;
  align-self: center !important;
  max-width: 100% !important;
}

/* Direct button styling */
html body.woocommerce ul.products li.product a.button,
html body ul.products li.product a.button,
html body .woocommerce ul.products li.product a.button,
html body .bd-product-card .bd-product-button,
html body .bd-product-card .button,
html body .wc-block-grid__product .wp-block-button__link,
html body .wc-block-product .wp-block-button__link {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 38px !important;
  width: auto !important;
  max-width: calc(100% - 0.5rem) !important;
  padding: 0.66rem 0.95rem !important;
  border: 1px solid var(--bd-card-gold) !important;
  border-radius: 999px !important;
  background: var(--bd-card-blue) !important;
  color: #ffffff !important;
  font-size: 0.82rem !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  text-align: center !important;
  text-decoration: none !important;
  white-space: normal !important;
  box-shadow: 0 10px 22px rgba(3, 24, 68, 0.16) !important;
  transform: none !important;
}

/* Hover */
html body.woocommerce ul.products li.product a.button:hover,
html body ul.products li.product a.button:hover,
html body .woocommerce ul.products li.product a.button:hover,
html body .bd-product-card .bd-product-button:hover,
html body .bd-product-card .button:hover,
html body .wc-block-grid__product .wp-block-button__link:hover,
html body .wc-block-product .wp-block-button__link:hover {
  background: var(--bd-card-blue-dark) !important;
  border-color: var(--bd-card-gold) !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
}

/* Custom BD card body is always flex */
html body .bd-product-card .bd-product-body {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  align-items: center !important;
  text-align: center !important;
  min-height: 0 !important;
  padding-bottom: 1rem !important;
}

/* Block cards: reduce overflow risk */
html body .wc-block-grid__product,
html body .wc-block-product {
  padding: 0.85rem !important;
}

html body .wc-block-grid__product > *,
html body .wc-block-product > * {
  max-width: 100% !important;
}

/* Prevent button clipping on small cards */
html body.woocommerce ul.products li.product,
html body ul.products li.product,
html body .woocommerce ul.products li.product,
html body .wc-block-grid__product,
html body .wc-block-product,
html body .bd-product-card {
  padding-bottom: 1rem !important;
}

/* Mobile */
@media (max-width: 720px) {
  html body.woocommerce ul.products,
  html body ul.products,
  html body .woocommerce ul.products,
  html body .wc-block-grid__products,
  html body .wc-block-product-template,
  html body .bd-product-grid,
  html body .bd-product-strip {
    gap: 1rem !important;
  }

  html body.woocommerce ul.products li.product .woocommerce-loop-product__title,
  html body ul.products li.product .woocommerce-loop-product__title,
  html body .woocommerce ul.products li.product .woocommerce-loop-product__title,
  html body .wc-block-grid__product-title,
  html body .wc-block-product .wp-block-post-title,
  html body .bd-product-card h3 {
    min-height: auto !important;
  }
}

/* BD PRODUCT TITLE SIZE FIX — keep bold, stop oversized clipping */

html body.woocommerce ul.products li.product .woocommerce-loop-product__title,
html body ul.products li.product .woocommerce-loop-product__title,
html body .woocommerce ul.products li.product .woocommerce-loop-product__title,
html body .wc-block-grid__product-title,
html body .wc-block-grid__product-title a,
html body .wc-block-product .wp-block-post-title,
html body .wc-block-product .wp-block-post-title a,
html body .bd-product-card h3,
html body .bd-product-card h3 a,
html body .bd-product-card .bd-product-body h3,
html body .bd-product-card .bd-product-body h3 a {
  font-size: clamp(1.85rem, 2.7vw, 3.4rem) !important;
  line-height: 0.96 !important;
  letter-spacing: -0.065em !important;
  font-weight: 950 !important;
  color: #062763 !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  display: block !important;
  text-wrap: balance !important;
  word-break: normal !important;
  overflow-wrap: anywhere !important;
  margin: 0.7rem 0 0.45rem !important;
}

/* Stop parent containers clipping large titles */
html body.woocommerce ul.products li.product,
html body ul.products li.product,
html body .woocommerce ul.products li.product,
html body .wc-block-grid__product,
html body .wc-block-product,
html body .bd-product-card,
html body .bd-product-card .bd-product-body {
  overflow: hidden !important;
}

/* Give title section enough room without taking over the whole card */
html body .bd-product-card .bd-product-body {
  justify-content: flex-end !important;
  gap: 0.45rem !important;
}

/* Product price stays readable below title */
html body.woocommerce ul.products li.product .price,
html body ul.products li.product .price,
html body .woocommerce ul.products li.product .price,
html body .wc-block-grid__product-price,
html body .wc-block-components-product-price,
html body .bd-product-price {
  font-size: clamp(1rem, 1.15vw, 1.28rem) !important;
  line-height: 1.1 !important;
  margin-top: 0.25rem !important;
  margin-bottom: 0.65rem !important;
}

/* Keep button pinned and visible */
html body.woocommerce ul.products li.product a.button,
html body ul.products li.product a.button,
html body .woocommerce ul.products li.product a.button,
html body .bd-product-card .bd-product-button,
html body .bd-product-card .button,
html body .wc-block-grid__product .wp-block-button__link,
html body .wc-block-product .wp-block-button__link {
  margin-top: auto !important;
  position: relative !important;
  z-index: 3 !important;
}

/* Smaller cards / tablets */
@media (max-width: 1100px) {
  html body.woocommerce ul.products li.product .woocommerce-loop-product__title,
  html body ul.products li.product .woocommerce-loop-product__title,
  html body .woocommerce ul.products li.product .woocommerce-loop-product__title,
  html body .wc-block-grid__product-title,
  html body .wc-block-grid__product-title a,
  html body .wc-block-product .wp-block-post-title,
  html body .wc-block-product .wp-block-post-title a,
  html body .bd-product-card h3,
  html body .bd-product-card h3 a,
  html body .bd-product-card .bd-product-body h3,
  html body .bd-product-card .bd-product-body h3 a {
    font-size: clamp(1.55rem, 3.2vw, 2.65rem) !important;
    line-height: 0.98 !important;
  }
}

/* Mobile */
@media (max-width: 720px) {
  html body.woocommerce ul.products li.product .woocommerce-loop-product__title,
  html body ul.products li.product .woocommerce-loop-product__title,
  html body .woocommerce ul.products li.product .woocommerce-loop-product__title,
  html body .wc-block-grid__product-title,
  html body .wc-block-grid__product-title a,
  html body .wc-block-product .wp-block-post-title,
  html body .wc-block-product .wp-block-post-title a,
  html body .bd-product-card h3,
  html body .bd-product-card h3 a,
  html body .bd-product-card .bd-product-body h3,
  html body .bd-product-card .bd-product-body h3 a {
    font-size: clamp(1.7rem, 8vw, 2.6rem) !important;
    line-height: 1 !important;
    letter-spacing: -0.055em !important;
  }
}

/* BD PRODUCT TITLE SMALLER AGAIN — final compact pass */

html body.woocommerce ul.products li.product .woocommerce-loop-product__title,
html body ul.products li.product .woocommerce-loop-product__title,
html body .woocommerce ul.products li.product .woocommerce-loop-product__title,
html body .wc-block-grid__product-title,
html body .wc-block-grid__product-title a,
html body .wc-block-product .wp-block-post-title,
html body .wc-block-product .wp-block-post-title a,
html body .bd-product-card h3,
html body .bd-product-card h3 a,
html body .bd-product-card .bd-product-body h3,
html body .bd-product-card .bd-product-body h3 a {
  font-size: clamp(1.35rem, 1.65vw, 2.05rem) !important;
  line-height: 0.98 !important;
  letter-spacing: -0.045em !important;
  font-weight: 950 !important;
  color: #062763 !important;
  margin: 0.55rem 0 0.28rem !important;
  min-height: 0 !important;
  max-height: 2.1em !important;
  overflow: hidden !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  text-wrap: balance !important;
  word-break: normal !important;
  overflow-wrap: anywhere !important;
}

/* Give the card lower text area more controlled spacing */
html body .bd-product-card .bd-product-body {
  gap: 0.28rem !important;
  padding-top: 0.55rem !important;
  padding-bottom: 0.85rem !important;
}

/* Price tighter and safely below title */
html body.woocommerce ul.products li.product .price,
html body ul.products li.product .price,
html body .woocommerce ul.products li.product .price,
html body .wc-block-grid__product-price,
html body .wc-block-components-product-price,
html body .bd-product-price {
  font-size: clamp(0.95rem, 1vw, 1.15rem) !important;
  line-height: 1.05 !important;
  margin-top: 0.12rem !important;
  margin-bottom: 0.5rem !important;
  color: #1d1430 !important;
}

/* Keep button inside and stop overlap */
html body.woocommerce ul.products li.product a.button,
html body ul.products li.product a.button,
html body .woocommerce ul.products li.product a.button,
html body .bd-product-card .bd-product-button,
html body .bd-product-card .button,
html body .wc-block-grid__product .wp-block-button__link,
html body .wc-block-product .wp-block-button__link {
  margin-top: 0.35rem !important;
  min-height: 36px !important;
  padding: 0.58rem 0.9rem !important;
  font-size: 0.78rem !important;
}

/* Medium screens */
@media (max-width: 1100px) {
  html body.woocommerce ul.products li.product .woocommerce-loop-product__title,
  html body ul.products li.product .woocommerce-loop-product__title,
  html body .woocommerce ul.products li.product .woocommerce-loop-product__title,
  html body .wc-block-grid__product-title,
  html body .wc-block-grid__product-title a,
  html body .wc-block-product .wp-block-post-title,
  html body .wc-block-product .wp-block-post-title a,
  html body .bd-product-card h3,
  html body .bd-product-card h3 a,
  html body .bd-product-card .bd-product-body h3,
  html body .bd-product-card .bd-product-body h3 a {
    font-size: clamp(1.2rem, 2.2vw, 1.75rem) !important;
    line-height: 1 !important;
  }
}

/* Mobile */
@media (max-width: 720px) {
  html body.woocommerce ul.products li.product .woocommerce-loop-product__title,
  html body ul.products li.product .woocommerce-loop-product__title,
  html body .woocommerce ul.products li.product .woocommerce-loop-product__title,
  html body .wc-block-grid__product-title,
  html body .wc-block-grid__product-title a,
  html body .wc-block-product .wp-block-post-title,
  html body .wc-block-product .wp-block-post-title a,
  html body .bd-product-card h3,
  html body .bd-product-card h3 a,
  html body .bd-product-card .bd-product-body h3,
  html body .bd-product-card .bd-product-body h3 a {
    font-size: clamp(1.25rem, 6vw, 1.8rem) !important;
    line-height: 1.02 !important;
    letter-spacing: -0.04em !important;
  }
}
