/* products — the home page's block. */

/* ---------- A product's card (_product_card.twig) — was the card_product component's; after the block's own, as it was linked. ---------- */
/* _product_card — one product as a card. The photo runs the card's width at its top; the name, the price and
   «Add to cart» below, the cart at the card's bottom in every card of a row. The whole card is the title's
   link, stretched over it; the cart button stands above that link. The card's line and shadow are the
   design's (body.cards-* sets --card-border, --card-bg, --card-shadow). */

.card--product {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: 0 0 1.2rem;
  overflow: hidden;
  background: var(--card-bg, var(--surface));
  border: var(--card-border, 1px solid var(--line));
  border-radius: var(--radius);
  box-shadow: var(--card-shadow, none);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.card--product:hover { transform: translateY(-2px); border-color: var(--card-hover-line, var(--mark, var(--primary))); box-shadow: var(--card-hover-shadow, var(--card-shadow, none)); }
.card--product > :not(.card__media) { margin-inline: 1.3rem; }

.card--product .card__media { display: block; aspect-ratio: 4 / 3; background: var(--plate); overflow: hidden; margin-bottom: .6rem; }
.card--product .card__media img { width: 100%; height: 100%; object-fit: cover; }
.card--product.is-sold-out .card__media img { opacity: .55; }

.card--product .card__title { font-size: 1.05rem; line-height: 1.3; margin-block: 0; }
.card--product .card__link { color: inherit; }
.card--product .card__link::after { content: ""; position: absolute; inset: 0; }
.card--product:has(.card__link:focus-visible) { outline: 2px solid var(--mark, var(--primary)); outline-offset: 2px; }
.card--product .card__link:focus-visible { outline: none; }

.card--product .card__stock { font-size: .82rem; color: var(--muted); }
.card--product .card__stock--out_of_stock, .card--product .card__stock--pre_order { color: var(--warning, var(--muted)); }

/* Its price line and its «Add to cart» — the card's own (they were the price and buy_form components). */
.price-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem; color: var(--ink); }
.price-line .price { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.price-line .price-was { color: var(--muted); font-size: .9rem; }
.price-line .price-off { color: var(--mark, var(--primary)); font-size: .82rem; font-weight: 700; }
.price-line .price-from, .price-line .price-unit { color: var(--muted); font-size: .9rem; }
.price-line .price-ask { color: var(--muted); }

.buy--card { position: relative; z-index: 1; margin-top: auto; }

.buy-form { display: flex; align-items: center; gap: .8rem; }

.buy-qty {
  width: 74px;
  height: 48px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
}

.buy-qty:focus { outline: none; border-color: var(--mark, var(--primary)); }

/* ---------- The block's looks: cards (a grid, the card above), rows, list ---------- */

/* cards — how many in a row (the grid's own; on a tablet two, on a phone one). */
.products--cards.products--columns-2 .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.products--cards.products--columns-3 .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.products--cards.products--columns-4 .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) { .products--cards.products--columns-3 .cards, .products--cards.products--columns-4 .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .products--cards .cards { grid-template-columns: 1fr; } .products--cards.products--columns-2 .cards, .products--cards.products--columns-3 .cards, .products--cards.products--columns-4 .cards { grid-template-columns: 1fr; } }
