/**
 * Product loop cards for shop products (woocommerce/content-product-shop.php).
 *
 * Only .yb-shop-card is styled here, so event and accommodation cards are
 * untouched. Loaded after theme.css. Colours come from the Bootstrap
 * variables set in assets/scss/customize/_overrides.scss
 * (--bs-dark, --bs-blue, --bs-success, --bs-light2, --bs-border-color ...).
 * Borders stay square ($border-radius: 0); only the category pill is rounded.
 */

/* Card: a column, so the add to basket row lines up along the bottom
   ---------------------------------------------------------------------- */

ul.products li.product.yb-shop-card {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	text-align: left;
	container-type: inline-size;
}

/* Image: square, white, bordered
   ---------------------------------------------------------------------- */

ul.products li.product.yb-shop-card .yb-shop-card__media {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background-color: var(--bs-white);
	transition: border-color 0.2s ease;
}

ul.products li.product.yb-shop-card .yb-shop-card__media:hover {
	border-color: var(--bs-dark) !important;
}

ul.products li.product.yb-shop-card .yb-shop-card__media img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	/* style.css gives every loop thumbnail a pale blue-grey background; keep these white */
	background-color: var(--bs-white);
	transition: transform 0.4s ease;
}

ul.products li.product.yb-shop-card .yb-shop-card__media:hover img {
	transform: scale(1.03);
}

ul.products li.product.yb-shop-card .onsale {
	top: 0.75rem;
	left: 0.75rem;
	padding: 0.25rem 0.625rem;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.125em;
	text-transform: uppercase;
}

/* Text
   ---------------------------------------------------------------------- */

.yb-shop-card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.5rem;
}

ul.products li.product.yb-shop-card .yb-shop-card__title {
	margin: 0;
	letter-spacing: -0.01em;
}

ul.products li.product.yb-shop-card .yb-shop-card__title a {
	display: inline;
	color: inherit;
}

ul.products li.product.yb-shop-card .yb-shop-card__title a:hover {
	text-decoration: underline;
}

/* "75cl · 12.5% ABV · 2021" */
.yb-shop-card__specs {
	display: flex;
	flex-wrap: wrap;
	color: rgba(var(--bs-dark-rgb), 0.75);
}

.yb-shop-card__specs span + span::before {
	content: "\00b7";
	margin: 0 0.5rem;
	opacity: 0.6;
}

.yb-shop-card__price {
	font-size: 1.25rem;
}

.yb-shop-card__price del {
	font-size: 0.75em;
	font-weight: 400;
	opacity: 0.6;
}

.yb-shop-card__price ins {
	text-decoration: none;
}

/* Bulk discount call to action: a full-width bar, text centred */
ul.products li.product.yb-shop-card .yb-shop-card__bulk {
	display: flex;
	align-self: stretch;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	text-align: center;
	margin: 0;
	padding: 0.375rem 0.75rem;
	font-size: 0.8125rem;
	font-weight: 700;
	color: var(--bs-blue);
	background-color: var(--bs-light2);
	text-decoration: none;
}

ul.products li.product.yb-shop-card a.yb-shop-card__bulk:hover span {
	text-decoration: underline;
}

.yb-shop-card__stock {
	color: var(--bs-danger);
}

/* Quantity and add to basket
   ---------------------------------------------------------------------- */

.yb-shop-card__actions {
	margin-top: auto;
}

.yb-shop-card__form {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
}

.yb-shop-card .yb-shop-card__qty {
	flex: 0 0 auto;
	width: auto;
	min-height: 2.875rem;
	background-color: var(--bs-white);
}

.yb-shop-card .yb-shop-card__qty input.qty {
	flex: 1 1 auto;
	width: 2.5rem !important;
	padding-left: 0;
	padding-right: 0;
	font-weight: 700;
}

.yb-shop-card .yb-shop-card__qty button {
	min-width: 2.25rem;
	padding-left: 0.5rem;
	padding-right: 0.5rem;
	font-size: 1.125rem;
	color: var(--bs-dark);
}

.yb-shop-card__add,
.yb-shop-card__view {
	flex: 1 1 8rem;
	min-height: 2.875rem;
	font-size: 0.8125rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

/* Beats the theme's "ul.products li.product a" colour and display */
ul.products li.product.yb-shop-card .yb-shop-card__view {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	color: var(--bs-btn-color);
}

ul.products li.product.yb-shop-card .yb-shop-card__view:hover,
ul.products li.product.yb-shop-card .yb-shop-card__view:focus-visible {
	color: var(--bs-btn-hover-color);
}

.yb-shop-card__add:hover,
.yb-shop-card__add:focus-visible {
	background-color: rgba(var(--bs-success-rgb), 0.9);
	border-color: rgba(var(--bs-success-rgb), 0.9);
}

/* Narrow cards (two to a row on phones): quantity and button full width */
@container (max-width: 15rem) {
	.yb-shop-card .yb-shop-card__qty,
	.yb-shop-card__add {
		flex-basis: 100%;
	}
}
