/**
 * Card product loop.
 *
 * For operators who sell with photographs. The photo sits at the start of
 * the row at a fixed square, the text and the price column stay exactly
 * where the default loop puts them, so a menu mixing both loops still reads
 * as one sheet. Depends on css/foodmaster-tokens.css.
 */

.wf-template-wrapper.wf-template-card-grid,
.wf-template-wrapper.wf-template-card {
	width: 100%;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	column-gap: calc(var(--fm-m) * 4);
	row-gap: 0;
	padding: 0;
	margin: 0;
	background: transparent;
}

.wf-template-wrapper.wf-template-card-grid.wf-template-columns-1,
.wf-template-wrapper.wf-template-card.wf-template-columns-1 { grid-template-columns: minmax(0, 1fr); }
.wf-template-wrapper.wf-template-card-grid.wf-template-columns-2,
.wf-template-wrapper.wf-template-card.wf-template-columns-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wf-template-wrapper.wf-template-card-grid.wf-template-columns-3,
.wf-template-wrapper.wf-template-card.wf-template-columns-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wf-template-wrapper.wf-template-card-grid.wf-template-columns-4,
.wf-template-wrapper.wf-template-card.wf-template-columns-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.wf-template-wrapper.wf-template-card-grid .wf-template-products,
.wf-template-wrapper.wf-template-card .wf-template-products {
	margin: 0;
	padding: 0;
	list-style: none;
	display: contents;
}

@container (max-width: 720px) {
	.wf-template-wrapper.wf-template-card-grid,
	.wf-template-wrapper.wf-template-card,
	.wf-template-wrapper.wf-template-card-grid.wf-template-columns-2,
	.wf-template-wrapper.wf-template-card.wf-template-columns-2,
	.wf-template-wrapper.wf-template-card-grid.wf-template-columns-3,
	.wf-template-wrapper.wf-template-card.wf-template-columns-3,
	.wf-template-wrapper.wf-template-card-grid.wf-template-columns-4,
	.wf-template-wrapper.wf-template-card.wf-template-columns-4 {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Row with a photo */
.wf-template-wrapper.wf-template-card-grid .wf-template-product,
.wf-template-wrapper.wf-template-card .wf-template-product {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	column-gap: calc(var(--fm-m) * 2);
	align-items: start;
	margin: 0;
	padding: calc(var(--fm-m) * 2) 0;
	list-style: none;
	border-bottom: var(--fm-rule);
	color: var(--fm-black);
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-image,
.wf-template-wrapper.wf-template-card .wf-template-product .product-image {
	width: calc(var(--fm-m) * 14);
	height: calc(var(--fm-m) * 14);
	flex-shrink: 0;
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-image img,
.wf-template-wrapper.wf-template-card .wf-template-product .product-image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: var(--fm-radius);
	outline: 1px solid var(--fm-n2);
	outline-offset: -1px;
	background: var(--fm-n1);
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product .card-content,
.wf-template-wrapper.wf-template-card .wf-template-product .card-content {
	display: flex;
	flex-direction: column;
	min-width: 0;
	min-height: calc(var(--fm-m) * 14);
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-title,
.wf-template-wrapper.wf-template-card .wf-template-product .product-title {
	min-width: 0;
	overflow-wrap: break-word;
	word-break: normal;
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-title > span,
.wf-template-wrapper.wf-template-card .wf-template-product .product-title > span {
	display: inline;
	font-family: var(--fm-font-display);
	font-weight: var(--fm-display-weight);
	font-size: 22px;
	line-height: 1;
	color: var(--fm-black);
	transition: color var(--fm-fast) var(--fm-ease);
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product:hover .product-title > span,
.wf-template-wrapper.wf-template-card .wf-template-product:hover .product-title > span {
	color: var(--fm-ink);
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-short-descr,
.wf-template-wrapper.wf-template-card .wf-template-product .product-short-descr {
	margin-top: 4px;
	max-width: 56ch;
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-short-descr span,
.wf-template-wrapper.wf-template-card .wf-template-product .product-short-descr span {
	display: block;
	font-size: 14px;
	line-height: 1.35;
	color: var(--fm-n6);
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-short-descr p,
.wf-template-wrapper.wf-template-card .wf-template-product .product-short-descr p {
	margin: 0;
}


/* Tags: the flyer's chips. Deal on yellow stock (the second ink), sold out outlined. */
.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-title > .product-tag,
.wf-template-wrapper .wf-template-product .product-tag {
	display: inline-block;
	vertical-align: middle;
	margin-inline-start: var(--fm-m);
	padding: 3px 6px 2px;
	border: var(--fm-tag-border);
	border-radius: var(--fm-tag-radius);
	font-family: var(--fm-font-body);
	font-weight: 700;
	font-size: 11px;
	letter-spacing: calc(0.06em * var(--fm-tracking));
	line-height: 1;
	text-transform: var(--fm-tag-caps);
	color: var(--fm-black);
	background: var(--fm-paper);
	white-space: nowrap;
	position: relative;
	top: -2px;
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-title > .product-tag--deal,
.wf-template-wrapper .wf-template-product .product-tag--deal {
	background: var(--fm-ink-2);
	color: var(--fm-on-ink-2);
	border-color: var(--fm-tag-deal-border, var(--fm-black));
}

/* Price and control sit on the row's baseline */
.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-footer,
.wf-template-wrapper.wf-template-card .wf-template-product .product-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: calc(var(--fm-m) * 2);
	margin-top: auto;
	padding-top: var(--fm-m);
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-price,
.wf-template-wrapper.wf-template-card .wf-template-product .product-price {
	font-family: var(--fm-font-display);
	font-weight: var(--fm-display-weight);
	font-size: 22px;
	line-height: 1;
	color: var(--fm-price-ink);
	font-variant-numeric: tabular-nums lining-nums;
	white-space: nowrap;
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-price .woocommerce-Price-amount,
.wf-template-wrapper.wf-template-card .wf-template-product .product-price .woocommerce-Price-amount,
.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-price .woocommerce-Price-currencySymbol,
.wf-template-wrapper.wf-template-card .wf-template-product .product-price .woocommerce-Price-currencySymbol {
	color: inherit;
	font-weight: inherit;
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-price ins,
.wf-template-wrapper.wf-template-card .wf-template-product .product-price ins {
	text-decoration: none;
	color: var(--fm-price-ink);
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-price del,
.wf-template-wrapper.wf-template-card .wf-template-product .product-price del {
	margin-inline-end: var(--fm-m);
	font-family: var(--fm-font-body);
	font-weight: 500;
	font-size: 13px;
	color: var(--fm-n6);
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-button .cart,
.wf-template-wrapper.wf-template-card .wf-template-product .product-button .cart {
	margin: 0;
	display: flex;
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-button .button,
.wf-template-wrapper.wf-template-card .wf-template-product .product-button .button,
.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-button button,
.wf-template-wrapper.wf-template-card .wf-template-product .product-button button {
	appearance: none;
	-webkit-appearance: none;
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: calc(var(--fm-m) * 4);
	height: calc(var(--fm-m) * 4);
	margin: 0;
	padding: 0;
	background: var(--fm-paper);
	border: 1.5px solid var(--fm-black);
	border-radius: var(--fm-radius);
	box-shadow: none;
	color: var(--fm-black);
	font: inherit;
	line-height: 1;
	text-decoration: none;
	overflow: hidden;
	cursor: pointer;
	transition: background var(--fm-fast) var(--fm-ease), border-color var(--fm-fast) var(--fm-ease), color var(--fm-fast) var(--fm-ease);
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-button .button::before,
.wf-template-wrapper.wf-template-card .wf-template-product .product-button .button::before,
.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-button .button::after,
.wf-template-wrapper.wf-template-card .wf-template-product .product-button .button::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 14px;
	height: 2px;
	background: currentColor;
	transform: translate(-50%, -50%);
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-button .button::after,
.wf-template-wrapper.wf-template-card .wf-template-product .product-button .button::after {
	transform: translate(-50%, -50%) rotate(90deg);
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-button .button:hover,
.wf-template-wrapper.wf-template-card .wf-template-product .product-button .button:hover,
.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-button button:hover,
.wf-template-wrapper.wf-template-card .wf-template-product .product-button button:hover {
	background: var(--fm-ink);
	border-color: var(--fm-ink);
	color: var(--fm-on-ink);
	text-decoration: none;
	transform: none;
	box-shadow: none;
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-button .button:focus-visible,
.wf-template-wrapper.wf-template-card .wf-template-product .product-button .button:focus-visible {
	box-shadow: var(--fm-focus);
	outline: none;
}

/* Unavailable */
.wf-template-wrapper.wf-template-card-grid .wf-template-product.unavailable,
.wf-template-wrapper.wf-template-card .wf-template-product.unavailable {
	pointer-events: none;
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product.unavailable .product-title > span,
.wf-template-wrapper.wf-template-card .wf-template-product.unavailable .product-title > span,
.wf-template-wrapper.wf-template-card-grid .wf-template-product.unavailable .product-price,
.wf-template-wrapper.wf-template-card .wf-template-product.unavailable .product-price {
	color: var(--fm-n6);
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product.unavailable .product-price,
.wf-template-wrapper.wf-template-card .wf-template-product.unavailable .product-price {
	text-decoration: line-through;
	text-decoration-thickness: 2px;
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product.unavailable .product-button,
.wf-template-wrapper.wf-template-card .wf-template-product.unavailable .product-button {
	visibility: hidden;
}

.wf-template-wrapper.wf-template-card-grid .wf-template-product.unavailable .product-image img,
.wf-template-wrapper.wf-template-card .wf-template-product.unavailable .product-image img {
	filter: grayscale(1);
	opacity: 0.6;
}

/* Phones */
@media screen and (max-width: 768px) {
	.wf-template-wrapper.wf-template-card-grid,
	.wf-template-wrapper.wf-template-card,
	.wf-template-wrapper.wf-template-card-grid.wf-template-columns-2,
	.wf-template-wrapper.wf-template-card.wf-template-columns-2,
	.wf-template-wrapper.wf-template-card-grid.wf-template-columns-3,
	.wf-template-wrapper.wf-template-card.wf-template-columns-3,
	.wf-template-wrapper.wf-template-card-grid.wf-template-columns-4,
	.wf-template-wrapper.wf-template-card.wf-template-columns-4 {
		grid-template-columns: minmax(0, 1fr);
	}

	.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-image,
	.wf-template-wrapper.wf-template-card .wf-template-product .product-image {
		width: calc(var(--fm-m) * 11);
		height: calc(var(--fm-m) * 11);
	}

	.wf-template-wrapper.wf-template-card-grid .wf-template-product .card-content,
	.wf-template-wrapper.wf-template-card .wf-template-product .card-content {
		min-height: calc(var(--fm-m) * 11);
	}

	.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-title > span,
	.wf-template-wrapper.wf-template-card .wf-template-product .product-title > span,
	.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-price,
	.wf-template-wrapper.wf-template-card .wf-template-product .product-price {
		font-size: 20px;
	}
}

@media (min-width: 769px) and (max-width: 1100px) {
	.wf-template-wrapper.wf-template-card-grid.wf-template-columns-3,
	.wf-template-wrapper.wf-template-card.wf-template-columns-3,
	.wf-template-wrapper.wf-template-card-grid.wf-template-columns-4,
	.wf-template-wrapper.wf-template-card.wf-template-columns-4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (prefers-reduced-motion: reduce) {
	.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-title > span,
	.wf-template-wrapper.wf-template-card .wf-template-product .product-title > span,
	.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-button .button,
	.wf-template-wrapper.wf-template-card .wf-template-product .product-button .button {
		transition: none;
	}
}

@media print {
	.wf-template-wrapper.wf-template-card-grid .wf-template-product,
	.wf-template-wrapper.wf-template-card .wf-template-product {
		break-inside: avoid;
	}

	.wf-template-wrapper.wf-template-card-grid .wf-template-product .product-button,
	.wf-template-wrapper.wf-template-card .wf-template-product .product-button {
		display: none;
	}
}

/* Long names and lines hyphenate in the page's language instead of breaking mid-word */
.wf-template-wrapper .wf-template-product .product-title,
.wf-template-wrapper .wf-template-product .product-short-descr {
	hyphens: auto;
	overflow-wrap: anywhere;
}

/* The add acknowledges itself: one pop when the row records an add */
.wf-template-wrapper .wf-template-product .product-button .button.added {
	animation: fm-add-pop var(--fm-base) var(--fm-ease) both;
}

@keyframes fm-add-pop {
	0% { transform: scale(1); }
	45% { transform: scale(1.14); }
	100% { transform: scale(1); }
}

/* WooCommerce's "View cart" link after an add is the bar's job */
.wf-template-wrapper .wf-template-product .product-button a.added_to_cart {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	.wf-template-wrapper .wf-template-product .product-button .button.added {
		animation: none;
	}
}
