.product-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(200px, 288px));
  gap: 24px;
  margin: 0;
}

.product-card {
  padding: var(--space-4);
  width: 100%;
  background: white;
  border: 1px solid var(--border-primary);
  border-radius: 4px 16px 4px 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.product-card-media {
  position: relative;
  background-color: white;
  padding: var(--space-1);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 158px;
  border-radius: var(--radius-md);
}

.product-card-image {
  object-fit: contain;
  overflow: hidden;
}

.product-card-badge {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  padding: var(--space-2) var(--space-4);
}

.product-card-body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-card-body > form,
.product-card-body > .product-card-cta {
  margin-top: auto;
  padding-top: var(--space-2);
}

/* Title on the right, price on the left */
.product-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  margin-top: var(--space-2);
  margin-bottom: var(--space-2);
}

/* up to 2 lines rather than cutting the size off the end of the title */
.product-card-header .product-card-title {
  white-space: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.product-card-price {
  font-family: var(--font-primary);
  font-weight: var(--font-medium);
  font-size: 16px;
  line-height: 24px;
  letter-spacing: -0.011em;
  text-align: center;
  vertical-align: middle;
  color: var(--text-dark);
  white-space: nowrap;
  flex-shrink: 0;
}

.product-card-price small {
  font-family: var(--font-primary);
  font-weight: var(--font-medium);
  font-size: 11px;
  line-height: 12px;
  letter-spacing: 0.02em;
  text-align: center;
  vertical-align: middle;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.product-card-price-old {
  font-size: 0.9rem;
  font-weight: var(--font-regular);
  color: var(--text-secondary);
  text-decoration: line-through;
  margin-inline-start: var(--space-1);
}

.product-card-title {
  font-family: var(--font-primary);
  font-weight: var(--font-medium);
  font-size: 16px;
  line-height: 24px;
  letter-spacing: -0.011em;
  text-align: right;
  color: var(--text-dark);
  direction: rtl;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-card-description {
  font-family: var(--font-primary);
  font-weight: var(--font-regular);
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0;
  text-align: right;
  color: var(--text-secondary);
  cursor: pointer;
  margin-block: var(--space-2);
  height: 48px; /* 3 lines */
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, black 0%, black 66%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 0%, black 66%, transparent 100%);
  transition: max-height 0.3s ease;
}

.product-card-description.is-expanded {
  max-height: 500px;
  -webkit-mask-image: none;
  mask-image: none;
}

.product-card-cta {
  width: 100%;
  border: none;
  background-color: var(--button);
  color: white;
  font-size: 14px;
  font-weight: var(--font-medium);
  padding-block: 10px;
  border-radius: 2px 16px 2px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  text-decoration: none;
  transition: filter 0.2s ease;
}

.product-card-cta:hover {
  filter: brightness(0.9);
  color: white;
}

.product-card-cta:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* In-cart state: lighter brand surface instead of the solid CTA red, with
   readable text/icon on top of it. Shows "Added" by default, swaps to
   "Remove ×" on hover/focus. */
.product-card-cta.is-in-cart,
.product-card-cta.is-in-cart:hover,
.product-card-cta.is-in-cart:focus-visible {
  background-color: var(--bg-primary);
  color: var(--button);
}

.product-card-cta.is-in-cart svg path {
  fill: var(--button);
}

.product-card-cta .js-add-to-cart-added-label,
.product-card-cta .js-add-to-cart-remove-label {
  display: none;
}

.product-card-cta.is-in-cart .js-add-to-cart-label {
  display: none;
}

.product-card-cta.is-in-cart .js-add-to-cart-added-label {
  display: inline;
}

.product-card-cta.is-in-cart:hover .js-add-to-cart-added-label,
.product-card-cta.is-in-cart:focus-visible .js-add-to-cart-added-label {
  display: none;
}

.product-card-cta.is-in-cart:hover .js-add-to-cart-remove-label,
.product-card-cta.is-in-cart:focus-visible .js-add-to-cart-remove-label {
  display: inline;
}

@media screen and (max-width: 992px) {
  .product-list {
    grid-template-columns: repeat(3, minmax(200px, 288px));
  }
}

@media screen and (max-width: 768px) {
  .product-list {
    grid-template-columns: repeat(2, minmax(164px, 288px));
    gap: 16px;
  }
}

@media screen and (max-width: 576px) {
  /* two equal columns that always fit the screen - the 164px minimum above
     pushed cards off-screen on phones narrower than ~360px */
  .product-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-card {
    padding: 10px;
    border-radius: 2px 10px 2px 10px;
  }

  /* Phones: name centred on its own line(s), price centred under it -
     side by side, a two-word name broke onto two lines next to the price */
  .product-card-header {
    margin-top: 6px;
    flex-direction: column;
    align-items: center;
    gap: 2px;
  }

  .product-card-header .product-card-title {
    width: 100%;
    text-align: center;
  }

  .product-card-title, .product-card-price {
    font-size: 12px;
  }

  .product-card-header .product-card-price {
    color: var(--primary);
    font-weight: var(--font-semibold);
  }

  .product-card-price small{
    font-size: 8px;
    color: var(--primary);
  }

  .product-card-cta {
    font-size: 10px;
    font-weight: var(--font-regular);
    padding-block: 6px;
    border-radius: 2px 10px 2px 10px;
  }

  .product-card-description {
    font-size: 8px;
    line-height: 10px;
    letter-spacing: 0;
    max-height: 30px; /* 3 lines at the 10px line-height */
    margin-block: 6px;
  }

  .product-card-description.is-expanded {
    max-height: 500px;
  }
}