/* ==========================================================================
   CARD: Product Card — Reusable across all product grids
   Variants: default, compact
   States: out-of-stock, ajax added
   ========================================================================== */

/* ------------------------------------------------------------------
   BASE CARD
   Tonal layering: card bg (surface-container-low) →
   image container (surface-container-lowest / white) → image
   ------------------------------------------------------------------ */

.c-product-card {
  display: flex;
  flex-direction: column;
  background-color: var(--color-surface-container-low);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: box-shadow var(--duration-normal) var(--ease-default);
}

.c-product-card:hover {
  box-shadow: var(--shadow-low);
}

/* ------------------------------------------------------------------
   IMAGE AREA
   ------------------------------------------------------------------ */

.c-product-card__image-link {
  display: block;
  text-decoration: none;
  padding: var(--space-3);
}

.c-product-card__image-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background-color: var(--color-surface-container-lowest);
  aspect-ratio: 1 / 1;
}

.c-product-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-default);
}

.c-product-card:hover .c-product-card__image {
  transform: scale(1.03);
}

/* Badge — herb chip inside image */
.c-product-card__badge {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 2;
}

/* Out of stock overlay */
.c-product-card--out-of-stock .c-product-card__image {
  opacity: 0.5;
  filter: grayscale(0.3);
}

.c-product-card__out-label {
  position: absolute;
  bottom: var(--space-3);
  left: var(--space-3);
  z-index: 2;
  padding: var(--space-1) var(--space-3);
  background-color: var(--color-surface-container-highest);
  color: var(--color-on-surface-variant);
  border-radius: var(--radius-sm);
}

/* ------------------------------------------------------------------
   BODY — Title, description, price, cart
   ------------------------------------------------------------------ */

.c-product-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--space-4) var(--space-5) var(--space-5);
}

.c-product-card__title-link {
  text-decoration: none;
}

.c-product-card__title {
  font-family: var(--font-display);
  font-size: var(--text-title-lg);
  font-weight: 400;
  line-height: 1.3;
  color: var(--color-on-surface);
  transition: color var(--duration-fast) var(--ease-default);
}

.c-product-card__title-link:hover .c-product-card__title {
  color: var(--color-primary);
}

.c-product-card__desc {
  margin-top: var(--space-2);
  font-size: var(--text-body-md);
  line-height: var(--text-body-md-lh);
  color: var(--color-on-surface-variant);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ------------------------------------------------------------------
   FOOTER — Price + cart button
   ------------------------------------------------------------------ */

.c-product-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: var(--space-4);
}

.c-product-card__price {
  font-family: var(--font-body);
  font-size: var(--text-title-lg);
  font-weight: 600;
  color: var(--color-on-surface);
}

/* WooCommerce price overrides */
.c-product-card__price del {
  font-size: var(--text-body-md);
  font-weight: 400;
  color: var(--color-on-surface-variant);
  margin-right: var(--space-1);
}

.c-product-card__price ins {
  text-decoration: none;
  color: var(--color-primary);
}

.c-product-card__price .woocommerce-Price-currencySymbol {
  font-weight: 400;
}

/* ------------------------------------------------------------------
   CART BUTTON — Dark green circle
   ------------------------------------------------------------------ */

.c-product-card__cart-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background-color: var(--color-primary);
  color: var(--color-on-primary);
  border-radius: var(--radius-full);
  text-decoration: none;
  cursor: pointer;
  border: none;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  transition:
    background-color var(--duration-fast) var(--ease-default),
    transform var(--duration-fast) var(--ease-spring);
}

.c-product-card__cart-btn:hover {
  background-color: var(--color-primary-container);
  transform: scale(1.06);
}

.c-product-card__cart-btn:active {
  transform: scale(0.95);
}

/* Icon swap for AJAX add to cart */
.c-product-card__cart-check {
  position: absolute;
  opacity: 0;
  transform: scale(0.5);
  transition:
    opacity var(--duration-normal) var(--ease-default),
    transform var(--duration-normal) var(--ease-spring);
}

.c-product-card__cart-btn.added .c-product-card__cart-icon {
  opacity: 0;
  transform: scale(0.5);
}

.c-product-card__cart-btn.added .c-product-card__cart-check {
  opacity: 1;
  transform: scale(1);
}

.c-product-card__cart-btn.added {
  background-color: var(--color-success);
}

/* ------------------------------------------------------------------
   COMPACT VARIANT — Smaller card for dense grids (4-col, sidebar)
   ------------------------------------------------------------------ */

.c-product-card--compact .c-product-card__image-link {
  padding: var(--space-2);
}

.c-product-card--compact .c-product-card__body {
  padding: var(--space-3) var(--space-4) var(--space-4);
}

.c-product-card--compact .c-product-card__title {
  font-size: var(--text-title-md);
}

.c-product-card--compact .c-product-card__price {
  font-size: var(--text-title-md);
}

.c-product-card--compact .c-product-card__cart-btn {
  width: 38px;
  height: 38px;
}

.c-product-card--compact .c-product-card__cart-btn svg {
  width: 18px;
  height: 18px;
}

/* ------------------------------------------------------------------
   RESPONSIVE
   ------------------------------------------------------------------ */

@media (max-width: 768px) {
  .c-product-card__body {
    padding: var(--space-3) var(--space-4) var(--space-4);
  }

  .c-product-card__title {
    font-size: var(--text-title-md);
  }

  .c-product-card__cart-btn {
    width: 40px;
    height: 40px;
  }
}