/* Product card: shared by shop grids, home rails and related products. */

/* Product grids (listings, related/upsells, [products] shortcodes). Overrides WooCommerce float layout. */
ul.products:not(.lv-rail__track) {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--livhy-grid-gap);
	margin: 0 0 var(--livhy-space-8);
	padding: 0;
	list-style: none;
}

ul.products:not(.lv-rail__track)::before,
ul.products:not(.lv-rail__track)::after {
	display: none;
}

/* Outranks WooCommerce's ".woocommerce ul.products[class*=columns-] li.product" (0,4,2) widths and floats. */
body ul.products > li.product.lv-card.lv-card {
	width: auto;
	float: none;
	clear: none;
	margin: 0;
	padding: 0;
}

@media (min-width: 768px) {
	ul.products:not(.lv-rail__track) {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 1024px) {
	ul.products:not(.lv-rail__track) {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	ul.products.columns-2:not(.lv-rail__track) {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	ul.products.columns-3:not(.lv-rail__track),
	.lv-shop ul.products:not(.lv-rail__track) {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	ul.products.columns-5:not(.lv-rail__track) {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}

	ul.products.columns-6:not(.lv-rail__track) {
		grid-template-columns: repeat(6, minmax(0, 1fr));
	}
}

@media (min-width: 1280px) {
	.lv-shop ul.products:not(.lv-rail__track) {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.lv-card {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	margin: 0;
	overflow: hidden;
	border: 1px solid var(--livhy-border);
	border-radius: var(--livhy-radius-lg);
	background: var(--livhy-surface);
	list-style: none;
	container-type: inline-size;
	transition: box-shadow var(--livhy-dur) ease, transform var(--livhy-dur) var(--livhy-ease);
}

@media (hover: hover) and (pointer: fine) {
	.lv-card:hover {
		box-shadow: var(--livhy-shadow-md);
		transform: translateY(-2px);
	}
}

.lv-card__media {
	position: relative;
	aspect-ratio: var(--livhy-card-ratio);
	overflow: hidden;
	background: var(--livhy-cream);
}

.lv-card .lv-card__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 50% 20%;
	transition: opacity var(--livhy-dur) ease, transform 600ms var(--livhy-ease);
}

/* Hover image: not displayed (so never downloaded, being lazy) on touch screens. */
.lv-card .lv-card__img--alt {
	display: none;
	opacity: 0;
}

@media (hover: hover) and (pointer: fine) {
	.lv-card .lv-card__img--alt {
		display: block;
	}

	.lv-card:hover .lv-card__img--alt {
		opacity: 1;
	}

	.lv-card:hover .lv-card__img:only-of-type {
		transform: scale(1.03);
	}
}

.lv-card__badges {
	position: absolute;
	top: var(--livhy-space-2);
	left: var(--livhy-space-2);
	z-index: 2;
	display: flex;
	flex-wrap: wrap;
	gap: var(--livhy-space-1);
	pointer-events: none;
}

.lv-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: var(--livhy-space-1);
	padding: var(--livhy-space-3);
}

.lv-card__title {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	font-size: var(--livhy-fs-small);
	font-weight: var(--livhy-fw-medium);
	line-height: 1.35;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.lv-card__link {
	color: var(--livhy-text);
	text-decoration: none;
}

/* Whole-card click target from the title link; interactive children sit above it. */
.lv-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.lv-card__link:focus-visible {
	outline: none;
}

.lv-card:has(.lv-card__link:focus-visible) {
	outline: 2px solid var(--livhy-focus);
	outline-offset: 2px;
}

.lv-card__price {
	color: var(--livhy-text);
	font-size: 0.9375rem;
	font-weight: var(--livhy-fw-semibold);
}

.lv-card__price del {
	margin-right: var(--livhy-space-1);
	color: var(--livhy-muted);
	font-size: var(--livhy-fs-caption);
	font-weight: var(--livhy-fw-regular);
}

.lv-card__price ins {
	text-decoration: none;
}

.lv-card__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--livhy-space-2);
	margin-top: auto;
	padding-top: var(--livhy-space-2);
}

.lv-card__cta {
	position: relative;
	z-index: 2;
}

.lv-card .added_to_cart {
	display: none;
}

/* Narrow cards (2-column phones): stack swatches above a full-width button. */
@container (max-width: 15rem) {
	.lv-card__foot {
		flex-direction: column;
		align-items: stretch;
	}

	.lv-card__cta {
		width: 100%;
	}
}

/* Very narrow cards (compact rails): stack badges so they clear the wishlist heart. */
@container (max-width: 12rem) {
	.lv-card__badges {
		flex-direction: column;
		align-items: flex-start;
	}
}

.lv-card--compact {
	border: 0;
	background: transparent;
}

.lv-card--compact .lv-card__media {
	border-radius: var(--livhy-radius-lg);
}

.lv-card--compact .lv-card__body {
	padding: var(--livhy-space-2) 0 0;
}

@media (hover: hover) and (pointer: fine) {
	.lv-card--compact:hover {
		box-shadow: none;
	}
}

/* TI Wishlist button restyled as a heart on the card image. */
.lv-card__wishlist {
	position: absolute;
	top: var(--livhy-space-2);
	right: var(--livhy-space-2);
	z-index: 3;
}

.lv-card__wishlist .tinv-wraper.tinv-wishlist {
	margin: 0;
	padding: 0;
	font-size: 0;
}

.lv-card__wishlist .tinv-wishlist-clear,
.lv-card__wishlist .tinvwl-tooltip,
.lv-card__wishlist .tinvwl_add_to_wishlist-text,
.lv-card__wishlist .tinvwl_already_on_wishlist-text {
	display: none !important;
}

.lv-card__wishlist .tinv-wishlist .tinvwl_add_to_wishlist_button {
	display: grid !important;
	place-items: center;
	width: 2.25rem;
	height: 2.25rem;
	margin: 0 !important;
	padding: 0 !important;
	border-radius: 50%;
	background: var(--livhy-surface) !important;
	box-shadow: var(--livhy-shadow-sm);
	color: var(--livhy-text) !important;
	cursor: pointer;
	transition: transform var(--livhy-dur-fast) ease, color var(--livhy-dur-fast) ease;
}

.lv-card__wishlist .tinv-wishlist .tinvwl_add_to_wishlist_button::before {
	content: "" !important;
	display: block;
	width: 1.125rem;
	height: 1.125rem;
	margin: 0 !important;
	background: currentColor;
	font-family: inherit !important;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.lv-card__wishlist .tinv-wishlist .tinvwl_add_to_wishlist_button:hover {
	color: var(--livhy-primary) !important;
	transform: scale(1.08);
}

.lv-card__wishlist .tinv-wishlist .tinvwl_add_to_wishlist_button.tinvwl-product-in-list {
	color: var(--livhy-primary) !important;
}

.lv-card__wishlist .tinv-wishlist .tinvwl_add_to_wishlist_button.tinvwl-product-in-list::before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z'/%3E%3C/svg%3E");
}

.lv-card__wishlist .tinv-wishlist .tinvwl_add_to_wishlist_button.tinvwl-product-in-list::after,
.lv-card__wishlist .tinv-wishlist .tinvwl_add_to_wishlist_button::after {
	display: none !important;
}

@media (min-width: 768px) {
	.lv-card__body {
		padding: var(--livhy-space-3) var(--livhy-space-4) var(--livhy-space-4);
	}
}

/* Quick-add sheet (variable products) */
.lv-quick-add__product {
	display: flex;
	align-items: center;
	gap: var(--livhy-space-4);
	margin-bottom: var(--livhy-space-5);
}

.lv-quick-add .lv-quick-add__image {
	flex-shrink: 0;
	width: 5rem;
	height: 5rem;
	border-radius: var(--livhy-radius-md);
	background: var(--livhy-cream);
	object-fit: cover;
	object-position: center 20%;
}

.lv-quick-add__summary {
	min-width: 0;
}

.lv-quick-add__name {
	margin: 0 0 var(--livhy-space-1);
	font-weight: var(--livhy-fw-semibold);
	line-height: 1.35;
}

.lv-quick-add__price {
	font-weight: var(--livhy-fw-semibold);
}

.lv-quick-add__price del {
	margin-right: var(--livhy-space-1);
	color: var(--livhy-muted);
	font-size: var(--livhy-fs-small);
	font-weight: var(--livhy-fw-regular);
}

.lv-quick-add__price ins {
	text-decoration: none;
}

.lv-qa-attr {
	min-width: 0;
	margin: 0 0 var(--livhy-space-5);
	padding: 0;
	border: 0;
}

.lv-qa-attr__legend {
	display: flex;
	gap: var(--livhy-space-2);
	margin-bottom: var(--livhy-space-3);
	padding: 0;
	font-size: var(--livhy-fs-small);
	font-weight: var(--livhy-fw-semibold);
}

.lv-qa-attr__chosen {
	color: var(--livhy-muted);
	font-weight: var(--livhy-fw-regular);
}

.lv-qa-attr__options {
	display: flex;
	flex-wrap: wrap;
	gap: var(--livhy-space-2);
}

.lv-qa-swatch {
	position: relative;
	display: inline-grid;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	cursor: pointer;
}

.lv-qa-swatch__input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.lv-qa-swatch .lv-qa-swatch__dot {
	width: 2rem;
	height: 2rem;
	transition: box-shadow var(--livhy-dur-fast) ease;
}

.lv-qa-swatch__input:checked + .lv-qa-swatch__dot {
	box-shadow: inset 0 0 0 1px rgb(23 23 23 / 0.15), 0 0 0 2px var(--livhy-surface), 0 0 0 4px var(--livhy-primary);
}

.lv-qa-swatch__input:focus-visible + .lv-qa-swatch__dot {
	outline: 2px solid var(--livhy-focus);
	outline-offset: 5px;
}

.lv-qa-swatch.is-unavailable {
	opacity: 0.35;
	cursor: not-allowed;
}

.lv-qa-swatch.is-unavailable .lv-qa-swatch__input {
	cursor: not-allowed;
}

.lv-qa-swatch.is-unavailable .lv-qa-swatch__dot {
	background-image: linear-gradient(to top right, transparent calc(50% - 1px), var(--livhy-text) calc(50% - 1px), var(--livhy-text) calc(50% + 1px), transparent calc(50% + 1px));
}

.lv-qa-swatch.is-conflict .lv-qa-swatch__dot {
	opacity: 0.45;
}

.lv-chip.is-conflict .lv-chip__label {
	border-style: dashed;
	color: var(--livhy-muted);
}

.lv-quick-add__status {
	min-height: 1.25rem;
	margin: 0;
	color: var(--livhy-muted);
	font-size: var(--livhy-fs-small);
}

.lv-quick-add__details {
	justify-self: center;
	color: var(--livhy-text);
	font-size: var(--livhy-fs-small);
	font-weight: var(--livhy-fw-medium);
	text-underline-offset: 3px;
}

.lv-quick-add.is-loading .lv-quick-add__options {
	min-height: 8rem;
	border-radius: var(--livhy-radius-md);
	background: linear-gradient(90deg, var(--livhy-cream) 25%, var(--livhy-surface) 50%, var(--livhy-cream) 75%) 0 0 / 200% 100%;
	animation: lv-shimmer 1.2s linear infinite;
}

@keyframes lv-shimmer {
	to {
		background-position: -200% 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.lv-quick-add.is-loading .lv-quick-add__options {
		animation: none;
	}
}
