/*
 * Product grid + product card (woocommerce/content-product.php).
 * The whole card is one link: the title link's ::after is stretched over the card (accessible "block link"
 * pattern: one tab stop, link text = product name). An arrow icon bottom-right fills and nudges on hover /
 * keyboard focus to show the card opens the product. Motion is removed under prefers-reduced-motion (base.css).
 */

.product-grid {
  display: grid;
  gap: var(--space-5);
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 15.5rem), 1fr));
}

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  height: 100%;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base),
    opacity 600ms var(--ease-out);
}

.product-card:hover,
.product-card:focus-within {
  border-color: transparent;
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

/* Keyboard focus ring on the whole card (the link itself has no visible box). */
.product-card:has(.product-card__link:focus-visible) {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.product-card__media {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--radius-lg) - var(--space-2));
  background: var(--color-sand);
}

.product-card__media img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transition: transform 900ms var(--ease-out);
}

.product-card:hover .product-card__media img {
  transform: scale(1.045);
}

.product-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-2);
  padding: 0 var(--space-2) var(--space-1);
}

.product-card__title {
  font-size: var(--font-size-xl);
  line-height: var(--line-height-snug);
}

.product-card__link,
.product-card__link:hover,
.product-card__link:focus-visible {
  color: var(--color-text);
  text-decoration: none;
  outline: none;
}

/* Stretch the link over the card: clicking anywhere opens the product. */
.product-card__link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

/* Anything a plugin prints into the card that must stay clickable sits above the stretched link. */
.product-card .button,
.product-card .added_to_cart {
  position: relative;
  z-index: 2;
}

.product-card__summary {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.product-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

/* "From 95.000 ₫": the word stays small and muted, the amount carries the weight. */
.product-card__price {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.product-card__price .amount {
  color: var(--color-price);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

/* Sale: the old, struck-through price stays muted so only the current price is red. */
.product-card__price del .amount {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-regular);
}

/* Arrow affordance: outlined at rest; filled and nudged right while the card is hovered or focused. */
.product-card__go {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  color: var(--color-primary);
  transition: background-color var(--transition-base), border-color var(--transition-base), color var(--transition-base);
}

.product-card__go svg {
  transition: transform var(--transition-base);
}

.product-card:hover .product-card__go,
.product-card:focus-within .product-card__go {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.product-card:hover .product-card__go svg,
.product-card:focus-within .product-card__go svg {
  transform: translateX(3px);
}
