/* =========================================================================
   Bloom shop — the loop product card (shared by shop / category / search).
   Hand-drawn scrapbook look: inked outline + offset shadow, marker titles,
   pill "Add to cart". Loaded after Woo's own woocommerce.css so equal-
   specificity rules win by source order (see inc/woocommerce.php, prio 20).
   ========================================================================= */

/* Gotcha #1 — WooCommerce adds clearfix ::before/::after to ul.products; in a
   CSS grid they become grid items and shove every card one cell to the right.
   Kill them with matching specificity. */
.woocommerce ul.products::before,
.woocommerce ul.products::after,
ul.products::before,
ul.products::after { content: none !important; display: none !important; }

.woocommerce ul.products,
ul.products {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin: 0 0 2.5rem;
  padding: 0;
  list-style: none;
}
@media (max-width: 900px) { .woocommerce ul.products, ul.products { grid-template-columns: repeat(2, 1fr); gap: 20px; } }
@media (max-width: 560px) { .woocommerce ul.products, ul.products { grid-template-columns: 1fr; } }

/* Card */
.woocommerce ul.products li.product,
ul.products li.product {
  width: auto !important;     /* override Woo's inline float widths */
  margin: 0 !important;
  float: none !important;
  display: flex;
  flex-direction: column;
  background: var(--bloom-card-bg);
  border: 2.5px solid var(--bloom-forest);
  border-radius: var(--bloom-radius);
  box-shadow: var(--bloom-shadow);
  padding: 14px 14px 18px;
  text-align: center;
  position: relative;
  transition: transform .15s ease, box-shadow .15s ease;
}
.woocommerce ul.products li.product:hover {
  transform: translate(-2px, -2px);
  box-shadow: 9px 9px 0 rgba(0, 73, 44, .18);
}

/* Thumbnail (the PDF preview) */
.woocommerce ul.products li.product a img,
ul.products li.product a img {
  margin: 0 0 12px;
  border-radius: 12px;
  border: 1.5px solid var(--bloom-mist);
  background: var(--bloom-paper);
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: top center;
}

/* Title */
.woocommerce ul.products li.product .woocommerce-loop-product__title,
ul.products li.product .woocommerce-loop-product__title {
  font-family: var(--bloom-font-marker);
  color: var(--bloom-forest);
  font-size: 1.02rem;
  line-height: 1.15;
  padding: 0 2px;
  margin: 0 0 6px;
}

/* Price — gotcha #3: margin-top:auto pins the price+button block to the bottom,
   and a fixed margin-bottom guarantees a gap even when a 2-line title fills the
   card, so the price never jams against the button. */
.woocommerce ul.products li.product .price,
ul.products li.product .price {
  margin: auto 0 12px;
  color: var(--bloom-green-d);
  font-family: var(--bloom-font-hand);
  font-weight: 700;
  font-size: 1.3rem;
}
.woocommerce ul.products li.product .price del { opacity: .5; font-weight: 400; margin-right: .35em; }
.woocommerce ul.products li.product .price ins { text-decoration: none; }
.woocommerce ul.products li.product .price .woocommerce-Price-amount bdi { white-space: nowrap; }

/* Add to cart pill */
.woocommerce ul.products li.product .button,
ul.products li.product .button {
  align-self: center;
  font-family: var(--bloom-font-marker);
  font-size: .98rem;
  letter-spacing: .3px;
  color: #fff;
  background: var(--bloom-green);
  border: 2.5px solid var(--bloom-forest);
  border-radius: 999px;
  padding: 9px 22px;
  box-shadow: 3px 3px 0 rgba(0, 73, 44, .25);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.woocommerce ul.products li.product .button:hover {
  background: var(--bloom-green-d);
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 rgba(0, 73, 44, .3);
}
.woocommerce ul.products li.product .added_to_cart {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--bloom-font-hand);
  color: var(--bloom-forest);
  text-decoration: underline;
}

/* Out-of-stock / loading states keep the brand colour, not Woo's grey */
.woocommerce ul.products li.product .button.loading { opacity: .75; }

/* -------------------------------------------------------------------------
   WooCommerce Blocks product grid (`wc-block-grid`) — used by the "New in
   store" block on the empty-cart page (and any New/Featured Products block).
   This is different markup from the classic `ul.products li.product` loop, so
   mirror the hand-drawn card here too. Selectors scoped tightly enough to win
   over WooCommerce's default block CSS by specificity.
   ---------------------------------------------------------------------- */
.wc-block-grid .wc-block-grid__products {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (max-width: 900px) { .wc-block-grid .wc-block-grid__products { grid-template-columns: repeat(2, 1fr); gap: 20px; } }
@media (max-width: 560px) { .wc-block-grid .wc-block-grid__products { grid-template-columns: 1fr; } }

.wc-block-grid .wc-block-grid__products > .wc-block-grid__product {
  /* Beat WooCommerce's `flex: 1 0 25%` so each card fills its grid track. */
  width: auto;
  max-width: none;
  min-width: 0;
  flex: none;
  justify-self: stretch;
}
.wc-block-grid .wc-block-grid__product {
  display: flex;
  flex-direction: column;
  text-align: center;
  background: var(--bloom-card-bg);
  border: 2.5px solid var(--bloom-forest);
  border-radius: var(--bloom-radius);
  box-shadow: var(--bloom-shadow);
  padding: 14px 14px 18px;
  margin: 0;
  transition: transform .15s ease, box-shadow .15s ease;
}
.wc-block-grid .wc-block-grid__product:hover {
  transform: translate(-2px, -2px);
  box-shadow: 9px 9px 0 rgba(0, 73, 44, .18);
}
/* Phones: cards go full-width single-column, so give them more breathing room
   inside, plus a side gutter so they don't touch the screen edges. */
@media (max-width: 560px) {
  .wc-block-grid .wc-block-grid__products { padding-inline: 16px; box-sizing: border-box; }
  .wc-block-grid .wc-block-grid__product { padding: 24px 24px 28px; }
}
.wc-block-grid .wc-block-grid__product-link { text-decoration: none; display: block; }
.wc-block-grid .wc-block-grid__product-image img {
  margin: 0 0 12px;
  border-radius: 12px;
  border: 1.5px solid var(--bloom-mist);
  background: var(--bloom-paper);
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: top center;
}
.wc-block-grid .wc-block-grid__product-title {
  font-family: var(--bloom-font-marker);
  color: var(--bloom-forest);
  font-size: 1.02rem;
  line-height: 1.15;
  margin: 0 0 6px;
}
.wc-block-grid .wc-block-grid__product-price {
  margin: auto 0 12px;
  color: var(--bloom-green-d);
  font-family: var(--bloom-font-hand);
  font-weight: 700;
  font-size: 1.3rem;
}
.wc-block-grid .wc-block-grid__product-add-to-cart { margin-top: auto; }
.wc-block-grid .wc-block-grid__product-add-to-cart .wp-block-button__link {
  display: inline-block;
  font-family: var(--bloom-font-marker);
  font-size: .98rem;
  letter-spacing: .3px;
  color: #fff;
  background: var(--bloom-green);
  border: 2.5px solid var(--bloom-forest);
  border-radius: 999px;
  padding: 9px 22px;
  box-shadow: 3px 3px 0 rgba(0, 73, 44, .25);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.wc-block-grid .wc-block-grid__product-add-to-cart .wp-block-button__link:hover {
  background: var(--bloom-green-d);
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 rgba(0, 73, 44, .3);
}
