/* =====================================================================
   Shared Product Card (`.product-card`) — SINGLE SOURCE OF TRUTH
   ---------------------------------------------------------------------
   ONE card, used by EVERY product grid across the site:
     • Product list  (.pl-page)        → default  §6.4  (borderless, 44 round cart)
     • Home / Trending (.home-page)     → default  §6.4
     • Wishlist      (.wl-page)         → default + __remove (corner X)
     • Account home  (.ac-page)         → default (image + title + price only)

   This file is the ONLY place product-card styling lives. The four pages
   above share it; each page only sets its OWN grid column count (see the
   per-page CSS) and any genuinely page-specific layout. Changing a card
   rule means changing it HERE, once.

   Naming follows BEM (block__element--modifier) so page-level overrides can
   target sub-elements precisely without !important wars.

   Dependencies: `--o-*` tokens (global, base-tokens.css). No Bootstrap
   classes, no hardcoded colors, no `--cr-*` tokens.

   Canonical DOM (every page):
     <div class="product-card-grid">
       <article class="product-card">
         <a class="product-card__link" href="…">
           <div class="product-card__img"><img …></div>
         </a>
         <button class="product-card__remove" aria-label="…">×</button>   <!-- optional: wishlist -->
         <div class="product-card__info">
           <a class="product-card__title" href="…">Name</a>                <!-- or <div> when whole card is the link -->
           <div class="product-card__row">
             <div class="product-card__price">
               <span class="product-card__price-cur">$x</span>
               <span class="product-card__price-orig">$y</span>            <!-- optional: struck-through original -->
             </div>
             <div class="product-card__action">                            <!-- optional: wishlist -->
               <button class="product-card__cart">cart</button>
             </div>
           </div>
         </div>
       </article>
     </div>

   The grid container's column count is set per page (this file only
   defines the grid BASE: display:grid + default gap).
   ===================================================================== */

/* ---------- grid container base ---------- */
.product-card-grid {
  display: grid;
  gap: 16px;
}

/* ---------- card shell (§6.4 canonical: borderless white card, 07-17 site-wide) ---------- */
.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  margin: 0;                            /* grid gap owns vertical rhythm */
  min-width: 0;                         /* allow shrink below content min-size (was .pl-card) */
  padding: 8px;                         /* frame the image */
  background: var(--o-card);
  border: none;                         /* 07-17 全站卡片决策：无边框,仅白底+软阴影界定 */
  border-radius: var(--o-radius-sm);
  box-shadow: 0 0 20px rgba(13, 17, 23, .07);   /* soft ambient */
  text-decoration: none;
  color: var(--o-ink);                  /* self-contained: don't inherit ancestor color */
  overflow: hidden;                     /* clip the scaled image */
  transition: box-shadow .3s ease;
  animation: productCardFadeUp .4s cubic-bezier(.22, .61, .36, 1) both;
}
.product-card:hover {
  box-shadow: 0 0 24px rgba(13, 17, 23, .13);
}

/* ---------- image ---------- */
.product-card__img {
  width: 100%;
  aspect-ratio: 1 / 0.85;
  border-radius: var(--o-radius-sm);
  overflow: hidden;
  background: var(--o-card);            /* §6.16 self-contained white */
  display: block;
}
.product-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .25s ease;
}
.product-card:hover .product-card__img img { transform: scale(1.03); }          /* §6.4 */
.product-card__link {
  display: block;
  text-decoration: none;
  color: inherit;
}

/* ---------- corner remove (X) — wishlist only ---------- */
.product-card__remove {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .85);
  color: var(--o-ink-3);
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity .18s ease, background-color .2s ease, color .2s ease, transform .12s ease;
}
.product-card__remove:hover { background: var(--o-card); color: var(--o-danger); }
.product-card__remove:active { transform: scale(.92); }
.product-card:hover .product-card__remove { opacity: 1; }

/* ---------- info block: title + price/action row ---------- */
.product-card__info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 10px 4px;
  background: var(--o-card);
  width: 100%;
}
.product-card__title {
  font: 600 14px/1.33 var(--o-font-display);
  color: var(--o-accent-ink);
  text-decoration: none;
  margin: 0;
  min-height: 38px;                     /* ≥2 lines aligned */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color .15s ease;
}
a.product-card__title:hover { color: var(--o-accent); }

/* price + action row */
.product-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
}
.product-card__price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}
.product-card__price-cur {
  font: 700 18px var(--o-font-display);  /* §6.4: 18px display 700 accent */
  color: var(--o-accent);
  white-space: nowrap;
}
.product-card__price-orig {
  font: 400 12px var(--o-font-body);     /* §6.4: struck-through original */
  color: var(--o-ink-3);
  text-decoration: line-through;
  white-space: nowrap;
}

/* ---------- action bar (optional; wishlist uses it) ---------- */
.product-card__action {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 4px;
}
.product-card__cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;                          /* §6.4: 44×44 round icon button */
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--o-ink-2);
  cursor: pointer;
  transition: color .2s ease, background-color .2s ease, transform .12s ease;
}
.product-card__cart:hover {
  color: var(--o-accent);
  border-color: var(--o-accent);
}

.product-card__cart svg { width: 22px; height: 22px; display: block; stroke: currentColor; }

/* ---------- empty state of a grid ---------- */
.product-card-empty {
  font-size: 13px;
  color: var(--o-ink-3);
  padding: 8px 2px;
}

/* ---------- entrance animation ---------- */
@keyframes productCardFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =====================================================================
   MOBILE (<=991px) — §6.4 compliant, --o-* tokens only
   Borderless white card, 18px current price. The default cart stays 44×44
   round (icon right-aligned per §6.4.2); the square variant keeps its 40px.
   ===================================================================== */
@media (max-width: 991px) {
  .product-card { padding: 6px; }                 /* tighter frame on touch */
  .product-card__info { padding: 8px 8px 4px; gap: 4px; }
  .product-card__title { font-size: 14px; min-height: 38px; }
  .product-card__row { gap: 8px; margin-top: 2px; padding-right: 34px; }   /* reserve just the 44px corner FAB + 4px gutter */
  .product-card__price { gap: 6px; flex: 1 1 auto; min-width: 0; white-space: nowrap; }   /* full width; both prices stay on ONE line */
  .product-card__price-cur { font-size: 15px; }
  .product-card__price-orig { font-size: 12px; }
  .product-card__remove { opacity: 1; }           /* always visible on touch */
  /* default cart: 44 round FAB pinned to the card's bottom-right corner (§6.4) */
  .product-card__cart {
    position: absolute;
    right: 0px;
    bottom: 0%;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
  }
  .product-card__cart svg { width: 22px; height: 22px; }
}

/* =====================================================================
   REDUCED MOTION
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  .product-card { animation: none; }
  .product-card:hover .product-card__img img { transform: none; }
}
