/* product card styles - home page grid, shop page, product detail page */

/* 4 cards per row normally, 2 on tablet, 1 on phone */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2.5rem 2rem;
}

@media (max-width: 1000px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .product-grid {
    grid-template-columns: 1fr;
  }
}

.product-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-6px);
}

.product-card img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

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

.product-card .body {
  padding: 1.1rem 1.2rem 1.3rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* gap under the badge before the product name.
   without align-self the badge stretches full width -- .body is a flex
   column and flex items stretch by default. this keeps it a small pill */
.product-card .badge {
  align-self: flex-start;
  margin-bottom: .6rem;
}

.product-card h3 {
  margin-bottom: .2rem;
  font-size: 1.05rem;
}

.product-card .origin {
  font-size: .8rem;
  color: var(--color-text-muted);
  margin-bottom: .5rem;
}

.product-card .price {
  font-weight: 700;
  color: var(--color-primary);
  margin: .4rem 0;
}

.product-card .stars {
  color: var(--color-primary);
  letter-spacing: 1px;
  font-size: .9rem;
}

.product-card .cta-row {
  margin-top: auto;
  display: flex;
  gap: .5rem;
}

/* rounded label like "COFFEE"/"TEA"/order status. using --color-primary
   not --color-accent here bc accent can be really light in some themes
   and then white text on it is unreadable */
.badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .25rem .6rem;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
}

/* whole card is a link so text would go blue/purple without this */
.card-link {
  color: inherit;
}

/* search/filter bar at top of shop page */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  align-items: end;
  margin-bottom: 2rem;
  padding: 1.25rem;
}

.filter-bar .form-row {
  margin-bottom: 0;
  min-width: 160px;
  flex: 1;
}

/* form-row that shouldn't stretch, like the Apply button's row */
.filter-bar .form-row-auto {
  flex: 0;
}

/* two 160px fields side by side is too cramped on a small phone (search
   box placeholder gets cut off), so just stack them full width */
@media (max-width: 560px) {
  .filter-bar .form-row,
  .filter-bar .form-row-auto {
    flex-basis: 100%;
  }
}

/* product detail page (product.php) */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: start;
}

.product-detail img {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* the Home / Shop / Product Name trail above the title */
.breadcrumb {
  font-size: .85rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

/* big price that updates live next to the size/grind options */
.price-live {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-primary);
}

/* narrow qty field */
.qty-field {
  max-width: 140px;
}

.option-group {
  margin-bottom: 1rem;
}

.option-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.option-pill {
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: .45rem 1rem;
  font-size: .88rem;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--color-surface);
}

.option-pill.selected,
.option-pill:hover {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}

/* customer reviews list */
.review-item {
  margin-bottom: 1rem;
}

.review-text {
  margin-top: .4rem;
}

/* capitalizes order status instead of ALL CAPS, e.g. shipped -> Shipped */
.badge-capitalize {
  text-transform: capitalize;
}

@media (max-width: 860px) {
  .product-detail {
    grid-template-columns: 1fr;
  }
}
