/* =========================================================
   FEATURE: SHOP / CATEGORY / RELATED-PRODUCTS CARD REDESIGN
   Astra renders each card as a flex column (.product) containing
   a fixed-height thumbnail wrap and a *plain block* summary wrap
   (category + title + price + button). Because the summary wrap
   isn't itself a flex column, its height simply follows however
   many lines the title wraps to -- so a one-line title and a
   two-line title in the same row leave their price/button sitting
   at two different heights, even though the outer card is already
   stretched to match its row (CSS Grid's default per-row stretch).
   That's the "not aligned" gap: this makes the summary wrap a flex
   column too and pins the button to its bottom, so every button in
   a row lands on the same baseline regardless of title length.

   Only enqueued when Settings > Digiskyward > Shop Archive Redesign
   is switched on.
   ========================================================= */

.woocommerce ul.products li.product {
  border: 1px solid var(--bbpb-border-soft) !important;
  border-radius: calc(var(--bbpb-radius) * 2) !important;
  overflow: hidden;
  background: #FFFFFF;
  transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}

.woocommerce ul.products li.product:hover {
  border-color: var(--bbpb-border) !important;
  box-shadow: 0 12px 28px rgba(9, 9, 9, 0.08);
  transform: translateY(-2px);
}

.woocommerce ul.products li.product .astra-shop-thumbnail-wrap {
  border-bottom: 1px solid var(--bbpb-border-soft);
}

.woocommerce ul.products li.product .astra-shop-thumbnail-wrap img {
  transition: transform .45s ease;
}

.woocommerce ul.products li.product:hover .astra-shop-thumbnail-wrap img {
  transform: scale(1.035);
}

/* The fix: summary wrap becomes a flex column filling whatever
   height the grid gave this card, so `margin-top: auto` on the
   button (below) can push it to a shared baseline. */
.woocommerce ul.products li.product .astra-shop-summary-wrap {
  display: flex !important;
  flex-direction: column;
  align-items: flex-start;
  flex: 1 1 auto;
  gap: 6px;
  padding: 14px 16px 16px !important;
}

.woocommerce ul.products li.product .ast-woo-product-category {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--bbpb-muted);
}

.woocommerce ul.products li.product .ast-loop-product__link {
  text-decoration: none !important;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
  font-family: "Inter", sans-serif;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--bbpb-black-soft);
  margin: 0 !important;

  /* Two-line clamp keeps every card's title block the same
     maximum height regardless of how long the product name is --
     the flex column + margin-top: auto below does the rest. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

/* A "[short]...[/short]" segment in a product title (see Settings >
   Digiskyward > Title Highlight) renders as this small tag instead
   of running on as part of the title -- e.g. "BBG Adventure Riding
   Jacket [short]With Chest Guard[/short]" shows "With Chest Guard"
   as its own compact label under the name, rather than wrapping the
   whole title onto an uneven second line. display:block + width:
   max-content starts it on its own line without stretching the
   whole card width the way a plain block element would. */
.bbpb-title-highlight {
  display: block;
  width: max-content;
  max-width: 100%;
  margin-top: 2px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(226, 28, 33, .08);
  color: var(--bbpb-red);
  font-family: "Inter", sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  line-height: 1.5;
  white-space: normal;
}

.woocommerce ul.products li.product .price {
  font-family: "Inter", sans-serif;
  font-weight: 800;
  color: var(--bbpb-black);
  margin: 2px 0 0 !important;
}

.woocommerce ul.products li.product .price ins {
  text-decoration: none;
}

.woocommerce ul.products li.product .price del {
  opacity: .55;
  font-weight: 500;
}

/* Pins the button to the bottom of the now-flex summary wrap,
   regardless of how tall the title/category/price block above it
   ends up being -- this is what actually fixes the alignment.
   Matches on the plain `.button` class rather than requiring
   `.add_to_cart_button` specifically: a product that isn't directly
   purchasable from the loop (e.g. an out-of-stock variable product)
   still renders its "choose options" link as `.button`, just without
   that extra class -- and it needs the identical treatment, or that
   one card's button goes right back to being unaligned and
   default-cased. */
.woocommerce ul.products li.product .astra-shop-summary-wrap > a.button {
  margin-top: auto !important;
  text-transform: uppercase !important;
}

/* Screen-reader-only helper text WooCommerce prints after a
   variable product's button ("This product has multiple variants...")
   -- still announced correctly to assistive tech, just not part of
   visual flow inside the now-flex summary wrap. */
.woocommerce ul.products li.product .astra-shop-summary-wrap > .screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 480px) {
  .woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-size: 13.5px;
  }
}
