/*
 * PunjabiLibas — Shared Product Card
 * Single source of truth for every product grid: homepage sections
 * (New Arrivals, Bestsellers, budget tiers, Palazzo, Dupattas — see
 * pl_render_product_card() in functions.php), the shop/category/tag
 * archives, and the single-product page's related-products grid
 * (both rendered via woocommerce/content-product.php).
 * Loaded sitewide since products can appear on any of those pages.
 */

/* This stylesheet doesn't assume any other page-scoped file is
   loaded alongside it, so it carries its own copy of these tokens —
   same values used throughout the theme. */
:root {
  --plm-deep:       #1C0A00;
  --plm-maroon:     #6B1E1E;
  --plm-gold:       #C49A3C;
  --plm-cream:      #FAF6F0;
  --plm-warm-white: #FFFDF9;
  --plm-warm-gray:  #F0EBE3;
  --plm-text-muted: #6B5E55;
  --plm-border:     rgba(196,154,60,0.2);
  --plm-r:          6px;
  --plm-r-lg:       12px;
}

.pcard {
  background: var(--plm-warm-white);
  border-radius: var(--plm-r-lg);
  overflow: hidden;
  border: 1px solid var(--plm-border);
  transition: transform .2s, box-shadow .2s;
  height: 100%;
  display: flex;
  flex-direction: column;
  /* Query container for the "no room for Save tag" rule below — keyed
     off the card's own rendered width, so it self-adjusts in every
     context (budget-tier tight cards, narrow mobile grids, etc.)
     without needing a breakpoint hardcoded per section. */
  container-type: inline-size;
}
.pcard:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(28,10,0,0.1);
}

/* ── Image ─────────────────────────────────────────────── */
.pcard-img {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--plm-warm-gray);
  overflow: hidden;
}
.pcard-img-el {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: transform .4s;
}
.pcard:hover .pcard-img-el { transform: scale(1.04); }
.pcard-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--plm-text-muted);
  font-size: 13px;
  font-family: var(--pl-font-body);
}
.pcard-img-placeholder svg { width: 36px; height: 36px; opacity: .2; }

.pcard-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--plm-maroon);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  letter-spacing: .02em;
  font-family: var(--pl-font-body);
}
.pcard-badge-new { background: var(--plm-deep) !important; }
.pcard-badge-low { background: #8A3A1A !important; }

/* Real "added within 45 days" tag — right corner, opposite the
   sale/low-stock badge so both can show at once without overlapping. */
.pcard-badge-corner-right {
  left: auto;
  right: 12px;
  background: var(--plm-gold) !important;
  color: var(--plm-deep) !important;
}

.pcard-overlay-link {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* ── Body ──────────────────────────────────────────────── */
.pcard-body {
  padding: 10px 16px 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
/* Category/fabric label hidden per redesign — kept in markup (not
   deleted) in case it's wanted back later. */
.pcard-fabric { display: none; }
.pcard-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--plm-deep);
  margin-bottom: 6px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: var(--pl-font-body);
}
.pcard-name a {
  color: var(--plm-deep) !important;
  text-decoration: none !important;
}
.pcard-name a:hover { color: var(--plm-maroon) !important; }

.pcard-price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap; /* Save tag drops to its own line first if the row is tight */
}
/* Readable sans-serif (same 'DM Sans' body font used on the checkout
   page) instead of the decorative Cormorant Garamond serif — the
   serif was hard to read at this size, especially with the ₹ symbol. */
.pcard-price .current {
  font-family: var(--pl-font-body);
  font-size: 18px;
  font-weight: 700;
  color: var(--plm-maroon);
}
.pcard-price .original {
  font-size: 13px;
  color: var(--plm-text-muted);
  text-decoration: line-through;
  font-family: var(--pl-font-body);
}
.pcard-price .saving {
  font-size: 11px;
  background: rgba(107,30,30,0.08);
  color: var(--plm-maroon);
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 600;
  font-family: var(--pl-font-body);
}
/* If even its own line doesn't have room (very narrow card — tight
   grids like the budget-tier section, or 2-up mobile), drop the Save
   tag entirely rather than let it crowd/overflow the price row. */
@container (max-width: 150px) {
  .pcard-price .saving { display: none; }
}

/* Override WC price output inside .current */
.pcard-price .current .woocommerce-Price-amount {
  font-family: var(--pl-font-body) !important;
  font-size: 18px !important;
  color: var(--plm-maroon) !important;
  font-weight: 700 !important;
}

/* ── Footer: single full-width CTA ────────────────────────── */
.pcard-footer { margin-top: auto; }
.pcard-footer .btn-buynow {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  padding: 14px 16px !important;
  border-radius: var(--plm-r-lg) !important;
  font-size: 15px !important;
  font-weight: 700 !important;
}
/* Fallback CTA for products Buy Now can't handle (variable / out of
   stock / not purchasable) — same footprint as the button above. */
.pcard-view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--plm-r-lg);
  font-size: 15px;
  font-weight: 600;
  background: var(--plm-cream);
  color: var(--plm-maroon);
  border: 1.5px solid var(--plm-border);
  text-decoration: none;
  transition: all .2s;
  font-family: var(--pl-font-body);
}
.pcard-view-btn:hover {
  background: var(--plm-maroon);
  color: #fff;
  border-color: var(--plm-maroon);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 480px) {
  .pcard { border-radius: 8px; }
  .pcard-body { padding: 8px 10px 12px; }
  .pcard-price { margin-bottom: 8px; gap: 5px; }
  .pcard-price .current,
  .pcard-price .current .woocommerce-Price-amount { font-size: 15px !important; }
  .pcard-price .original { font-size: 11px; }
  .pcard-price .saving { font-size: 9px; padding: 2px 7px; }
  .pcard-badge { font-size: 9px; padding: 3px 9px; }
  .pcard-footer .btn-buynow,
  .pcard-view-btn { font-size: 12px; padding: 11px 12px; }
}
@media (min-width: 768px) {
  .pcard-body { padding: 12px 14px 16px; }
}
@media (min-width: 1024px) {
  .pcard-body { padding: 12px 16px 18px; }
}
