/* The product card used everywhere (approved AYRAERYNA mockup): shop, category pages, search, related
   products and the Main page's "New arrivals" grid. Loaded on the Main page and every WooCommerce page.
   Sections: the grid, the card, the flags, the size boxes, name + price, sold out, phones. (The category head,
   filter bar and sale states are added with the shop pages in milestone 4.)
   Fonts: Outfit 400 / 500 / 600 only.
   WooCommerce's own layout stylesheet floats the cards and gives them a percentage width; the grid below
   replaces that, so the card's width, float and margin carry !important (in this one place only).
   The shop grid is scoped to shop/category pages; the Main page's New arrivals grid is set in home.css. */

:root { --ay-photo-ratio: 4 / 5; }

/* ---------------------------------------------------------------- the grid */
body.woocommerce.archive ul.products {
	display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 30px 2px; margin: 0; padding: 2px 0 0; list-style: none; background: #fff;
}
.woocommerce ul.products::before,
.woocommerce ul.products::after { content: none; }

/* ---------------------------------------------------------------- the card */
.woocommerce ul.products li.product,
.woocommerce-page ul.products[class*="columns-"] li.product {
	position: relative; display: flex; flex-direction: column; float: none !important; clear: none !important;
	width: auto !important; min-width: 0; margin: 0 !important; padding: 0 0 22px; background: #fff; list-style: none;
}
.woocommerce ul.products li.product > a.woocommerce-LoopProduct-link {
	display: flex; flex: 1; flex-direction: column; min-width: 0; color: var(--ay-ink); text-decoration: none;
}

/* The photo box: a 4:5 frame, the photo cropped to fit and never stretched. */
.woocommerce ul.products li.product .qav-thumb { position: relative; display: block; overflow: hidden; background: #EDEBE7; }
.woocommerce ul.products li.product .qav-thumb > img {
	display: block; width: 100%; height: auto; margin: 0; aspect-ratio: var(--ay-photo-ratio); object-fit: cover; transition: opacity .35s ease;
}
/* The second photo lies over the first and fades in on hover (computers only: a phone has no hover). */
.woocommerce ul.products li.product .qav-thumb > img.ay-card-b { position: absolute; inset: 0; height: 100%; opacity: 0; }
@media (hover: hover) {
	.woocommerce ul.products li.product:hover .qav-thumb > img.ay-card-b { opacity: 1; }
}

/* ---------------------------------------------------------------- flags: NEW top left (black), -N% top right (red) */
.woocommerce ul.products li.product .qav-thumb .ay-flag,
.woocommerce ul.products li.product .qav-thumb span.onsale {
	position: absolute; top: 0; z-index: 3; min-width: 0; min-height: 0; margin: 0; padding: 4px 9px; border-radius: 0;
	font-size: 11.5px; font-weight: 600; line-height: 1.3; letter-spacing: .05em; text-transform: uppercase; color: #fff;
}
.woocommerce ul.products li.product .qav-thumb .ay-flag--new { left: 0; background: var(--ay-ink); }
.woocommerce ul.products li.product .qav-thumb span.onsale { right: 0; left: auto; background: var(--ay-red); }

/* ---------------------------------------------------------------- size boxes: bottom centre of the photo, decorative */
.woocommerce ul.products li.product .qav-sizes {
	position: absolute; left: 8px; right: 8px; bottom: 10px; z-index: 2; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px;
	margin: 0; padding: 0; list-style: none; pointer-events: none;
}
.woocommerce ul.products li.product .qav-sizes .qav-size {
	margin: 0; padding: 2px 5px; border: 1px solid #ddd; border-radius: 0; background: rgba(224, 224, 224, .8);
	font-size: 10px; font-weight: 600; line-height: 1.4; color: #333;
}

/* ---------------------------------------------------------------- name + price */
.woocommerce ul.products li.product .woocommerce-loop-product__title {
	margin: 12px 0 0 !important; padding: 0 10px; text-align: left; font-family: var(--ay-sans); font-size: 14px; font-weight: 400; line-height: 1.35 !important;
	letter-spacing: .02em; text-transform: uppercase; color: var(--ay-ink);
}
/* Price: the current price first, then the old price struck through and muted (WooCommerce prints them the other way round). */
.woocommerce ul.products li.product .price {
	display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 0; padding: 5px 10px 0;
	font-size: 14px; font-weight: 400; color: var(--ay-ink); font-variant-numeric: tabular-nums;
}
.woocommerce ul.products li.product .price > .woocommerce-Price-amount,
.woocommerce ul.products li.product .price ins { background: none; font-weight: 600; text-decoration: none; color: var(--ay-ink); order: 1; }
.woocommerce ul.products li.product .price ins { color: var(--ay-red); }
.woocommerce ul.products li.product .price del { order: 2; font-size: 13px; opacity: 1; color: var(--ay-muted); }
.woocommerce ul.products li.product .price del .woocommerce-Price-amount { font-weight: 400; }

/* ---------------------------------------------------------------- sold out: dimmed photo, grey label in the middle, no sizes */
.woocommerce ul.products li.product.outofstock .qav-thumb > img { opacity: .5; }
.woocommerce ul.products li.product.outofstock:hover .qav-thumb > img.ay-card-b { opacity: .5; }
.woocommerce ul.products li.product.outofstock .qav-sizes { display: none; }
.woocommerce ul.products li.product .qav-thumb .ay-flag--sold {
	top: 50%; left: 50%; padding: 7px 18px; transform: translate(-50%, -50%); background: #4A4A4A; font-size: 12px; letter-spacing: .12em; pointer-events: none;
}
.woocommerce ul.products li.product.outofstock .woocommerce-loop-product__title,
.woocommerce ul.products li.product.outofstock .price,
.woocommerce ul.products li.product.outofstock .price > .woocommerce-Price-amount { color: var(--ay-muted); }

/* ---------------------------------------------------------------- phones */
@media (max-width: 900px) {
	body.woocommerce.archive ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 2px; }
	.woocommerce ul.products li.product { padding-bottom: 16px; }
	.woocommerce ul.products li.product .qav-sizes { left: 4px; right: 4px; bottom: 6px; gap: 3px; }
	.woocommerce ul.products li.product .qav-sizes .qav-size { padding: 2px 4px; }
	.woocommerce ul.products li.product .qav-thumb .ay-flag { padding: 3px 7px; font-size: 10.5px; }
	.woocommerce ul.products li.product .qav-thumb .ay-flag--sold { padding: 6px 12px; font-size: 11px; }
	.woocommerce ul.products li.product .woocommerce-loop-product__title { padding: 0 8px; font-size: 13px; }
	.woocommerce ul.products li.product .price { padding-inline: 8px; font-size: 13.5px; gap: 2px 8px; }
}
