/* Cose Theme - product listing page (archive-product.php) */

.plp {
	padding: 0 0 60px;
}

.product-filters {
	display: flex;
	align-items: baseline;
	gap: 80px;
	margin: 60px 0 20px;
	/* Same inset as the header nav/logo, not the 10px the product grid
	   itself uses - the filter row lines up with the menu, not the images. */
	padding: 0 40px;
	text-transform: uppercase;
}

.product-filters__label {
	text-transform: none;
}

.product-filters__list {
	display: flex;
	margin: 0;
	padding: 0;
	list-style: none;
}

.product-filters__list li:not(:last-child)::after {
	content: ",";
	margin-right: 0.4em;
}

.product-filters__list a {
	text-decoration: none;
	color: inherit;
}

.product-filters__list a.is-active {
	font-weight: 500;
}

.product-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px 10px;
	padding: 0 10px;
}

.product-card__image {
	position: relative;
	display: block;
	aspect-ratio: 4 / 5;
	overflow: hidden;
}

/* Desktop: the first row (photo + title + price) fits the window without
   scrolling. The photo keeps its 4:5 shape unless the window is too short
   for it: then its height is capped to what is left under the filters
   (minus the title/price lines and a little air) and the photo is cropped
   top and bottom - it is mostly background there. --plp-grid-top is where
   the grid starts, measured in product-filter.js. */
@media (min-width: 901px) {
	.product-card__image {
		/* Full column width, always: with an automatic width the browser would
		   narrow the box to keep 4:5 under the height cap instead of cropping. */
		width: 100%;
		max-height: max(320px, calc(100vh - var(--plp-grid-top, 190px) - 64px));
	}
}

/* Scoped under .product-card__image: WooCommerce's `.woocommerce-page img { height: auto }`
   (0,1,1) would otherwise beat a lone class and leave the photo at its natural ratio. */
.product-card__image .product-card__image-primary,
.product-card__image .product-card__image-secondary {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.product-card__image .product-card__image-secondary {
	opacity: 0;
	transition: opacity 0.4s ease;
}

.product-card__image:hover .product-card__image-secondary {
	opacity: 1;
}

.product-card__image-placeholder {
	display: block;
	width: 100%;
	height: 100%;
	background: #eee;
}

.product-card__info {
	padding: 12px 0 0 60px;
}

.product-card__row {
	display: flex;
	align-items: baseline;
	gap: 30px;
	text-transform: uppercase;
}

/* 150px between title, price and SOLD OUT - but on narrower cards (smaller
   windows) the gaps shrink so the row never wraps onto a second line. */
.product-card__row.is-soldout {
	gap: clamp(24px, calc((33.333vw - 230px) / 2), 150px);
}

.product-card__price,
.product-card__soldout {
	white-space: nowrap;
}

.product-card__title,
.product-card__title:hover,
.product-card__title:focus {
	font-weight: 500;
	/* Tracking 100 in the layouts. */
	letter-spacing: 0.1em;
	text-decoration: none;
	color: inherit;
}

.product-card__price {
	font-weight: 400;
}


.product-card__row,
.product-card__subtitle {
	line-height: 1.15;
}

.product-card__subtitle {
	margin: 0;
	font-style: italic;
	font-weight: 400;
}

.plp__empty {
	padding: 40px 0;
}

/* Small screens (Mobile/PLP.png): filter row with "Filter" left and the
   categories right-aligned; one column of full-width cards, the info row
   spread title / price / SOLD OUT. */
@media (max-width: 900px) {
	.plp {
		padding: 0 0 150px;
	}

	.product-filters {
		justify-content: space-between;
		gap: 16px;
		margin: 43px 0 18px;
		padding: 0 20px;
	}

	.product-filters__list {
		justify-content: flex-end;
		flex-wrap: wrap;
	}

	.product-grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 45px;
		padding: 0;
	}

	.product-card__info {
		padding: 12px 20px 0;
	}

	.product-card__row,
	.product-card__row.is-soldout {
		display: grid;
		grid-template-columns: 32.5vw 1fr auto;
		gap: 0;
	}

	.product-card__soldout {
		grid-column: 3;
		text-align: right;
	}
}
