/*
 * Shop page - supplemental styles for pieces the compiled Tailwind build
 * (dist/style.css) doesn't cover yet: sidebar layout, checkboxes, range
 * slider, star ratings, toggle switches, badges, wishlist button, list view.
 * Uses the site's existing design tokens (see :root in dist/style.css).
 *
 * Also holds .lm-page-blobs / .lm-card, shared across shop/cart/account
 * pages since this file is always loaded alongside cart.css/account.css.
 */

/*
 * Decorative background blobs — pages built without a hero photo (cart,
 * account) still need *something* with color variation behind the glass
 * cards (bg-card/55 + backdrop-blur), or the cards read as flat, same-tone
 * panels. Soft, blurred, on-brand color fields, similar in spirit to the
 * (currently unused) .hero-bg blobs in style.css.
 */
.lm-page-blobs {
	position: absolute;
	inset: 0;
	z-index: -1;
	overflow: hidden;
	pointer-events: none;
}
.lm-blob {
	position: absolute;
	border-radius: 9999px;
	filter: blur(90px);
	animation: lm-blob-drift 20s ease-in-out infinite;
}
.lm-blob--a {
	top: -8rem;
	left: -6rem;
	width: 26rem;
	height: 26rem;
	background: var(--accent);
	opacity: 0.3;
}
.lm-blob--b {
	top: 8rem;
	right: -9rem;
	width: 22rem;
	height: 22rem;
	background: var(--sale, var(--destructive));
	opacity: 0.18;
	animation-delay: -7s;
}
.lm-blob--c {
	bottom: -10rem;
	left: 22%;
	width: 24rem;
	height: 24rem;
	background: var(--primary);
	opacity: 0.12;
	animation-delay: -13s;
}
@keyframes lm-blob-drift {
	0%, 100% {
		transform: translate(0, 0) scale(1);
	}
	50% {
		transform: translate(24px, -22px) scale(1.06);
	}
}

.lm-layout {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.5rem;
}
@media (min-width: 1024px) {
	.lm-layout {
		grid-template-columns: 260px 1fr;
	}
}

.lm-sidebar {
	display: none;
}
@media (min-width: 1024px) {
	.lm-sidebar {
		display: block;
		position: sticky;
		top: 1.5rem;
		align-self: start;
	}
}
.lm-layout:has(#lm-filter-toggle:checked) .lm-sidebar {
	display: block;
	position: fixed;
	inset: 0;
	z-index: 60;
	overflow-y: auto;
	background: var(--background);
	padding: 1.5rem 1rem;
}
@media (min-width: 1024px) {
	.lm-layout:has(#lm-filter-toggle:checked) .lm-sidebar {
		position: sticky;
		top: 1.5rem;
		inset: auto;
		background: none;
		padding: 0;
	}
}

.lm-filter-toggle {
	display: inline-flex;
}
@media (min-width: 1024px) {
	.lm-filter-toggle {
		display: none;
	}
}

.lm-sidebar-close {
	display: none;
	margin-bottom: 1.5rem;
}
.lm-layout:has(#lm-filter-toggle:checked) .lm-sidebar-close {
	display: inline-flex;
}
@media (min-width: 1024px) {
	.lm-sidebar-close {
		display: none !important;
	}
}

.lm-filter-group + .lm-filter-group {
	margin-top: 2rem;
	border-top: 1px solid var(--border);
	padding-top: 1.5rem;
}

.lm-check-row {
	display: flex;
	width: 100%;
	align-items: center;
	gap: 0.75rem;
	text-align: left;
	font-size: 0.875rem;
	color: var(--muted-foreground);
	transition: color 0.15s;
	background: none;
	border: 0;
	cursor: pointer;
	padding: 0;
}
.lm-check-row:hover {
	color: var(--foreground);
}
.lm-check-row + .lm-check-row {
	margin-top: 0.625rem;
}
/*
 * The sidebar lists the top-level categories and unfolds the branch being
 * viewed (see linfasy_shop_cat_rows in archive-product.php), so a row carries
 * its depth and indents itself. The list is capped rather than allowed to run
 * past the filters below it.
 */
.lm-check-row {
	padding-left: calc(var(--lm-cat-depth, 0) * 0.85rem);
}
.lm-cat-list {
	max-height: 22rem;
	overflow-y: auto;
	padding-right: 0.25rem;
}
.lm-check-box {
	display: grid;
	place-items: center;
	width: 1rem;
	height: 1rem;
	border-radius: 0.25rem;
	border: 1px solid var(--border);
	flex-shrink: 0;
}
.lm-check-row.is-active {
	color: var(--foreground);
}
.lm-check-row.is-active .lm-check-box {
	background: var(--primary);
	border-color: var(--primary);
}
.lm-check-box svg {
	width: 0.65rem;
	height: 0.65rem;
	color: var(--primary-foreground);
	opacity: 0;
}
.lm-check-row.is-active .lm-check-box svg {
	opacity: 1;
}
.lm-check-count {
	margin-left: auto;
	font-size: 0.7rem;
}
/*
 * Top-level categories in black so they stand apart from their
 * subcategories, which stay in the muted tone (Salvatore).
 */
.lm-check-row--top,
.lm-check-row--top:hover {
	color: #000;
	font-weight: 500;
}

.lm-range {
	width: 100%;
	margin-top: 1rem;
	accent-color: var(--primary);
}
.lm-range-labels {
	margin-top: 0.5rem;
	display: flex;
	justify-content: space-between;
	font-size: 0.7rem;
	color: var(--muted-foreground);
}
.lm-range-labels strong {
	color: var(--foreground);
	font-weight: 400;
}

.lm-stars {
	display: inline-flex;
	align-items: center;
	gap: 0.125rem;
}
.lm-star {
	width: 0.75rem;
	height: 0.75rem;
}
.lm-star.is-filled {
	fill: var(--accent);
	color: var(--accent);
}
.lm-star.is-empty {
	color: var(--border);
}

.lm-switch-row {
	display: flex;
	width: 100%;
	align-items: center;
	justify-content: space-between;
	font-size: 0.875rem;
	color: var(--muted-foreground);
	background: none;
	border: 0;
	cursor: pointer;
	padding: 0;
	text-align: left;
}
.lm-switch-row:hover {
	color: var(--foreground);
}
.lm-switch-row + .lm-switch-row {
	margin-top: 0.75rem;
}
.lm-switch {
	position: relative;
	height: 1.25rem;
	width: 2.25rem;
	border-radius: 9999px;
	background: var(--border);
	transition: background-color 0.15s;
	flex-shrink: 0;
}
.lm-switch::after {
	content: "";
	position: absolute;
	top: 0.125rem;
	left: 0.125rem;
	height: 1rem;
	width: 1rem;
	border-radius: 9999px;
	background: var(--card);
	transition: left 0.15s;
}
.lm-switch-row.is-active .lm-switch {
	background: var(--primary);
}
.lm-switch-row.is-active .lm-switch::after {
	left: 1.125rem;
}

.lm-search {
	display: flex;
	min-width: 220px;
	flex: 1 1 auto;
	align-items: center;
	gap: 0.5rem;
}
.lm-search input {
	width: 100%;
	background: transparent;
	font-size: 0.875rem;
	border: 0;
	color: var(--foreground);
}
.lm-search input::placeholder {
	color: var(--muted-foreground);
}
.lm-search input:focus {
	outline: none;
}
.lm-search button {
	display: flex;
	color: var(--muted-foreground);
	background: none;
	border: 0;
	cursor: pointer;
	padding: 0;
	flex-shrink: 0;
}

.lm-select-wrap {
	position: relative;
}
.lm-select {
	appearance: none;
	padding-right: 2rem;
	padding-left: 1rem;
}
.lm-select:focus {
	outline: none;
}
.lm-select-wrap svg {
	pointer-events: none;
	position: absolute;
	right: 0.75rem;
	top: 50%;
	transform: translateY(-50%);
	color: var(--muted-foreground);
}

.lm-view-toggle {
	display: flex;
	align-items: center;
	gap: 0.25rem;
}
.lm-view-btn {
	display: grid;
	height: 2rem;
	width: 2rem;
	place-items: center;
	border-radius: 9999px;
	color: var(--muted-foreground);
	background: none;
	border: 0;
	cursor: pointer;
	transition: background-color 0.15s, color 0.15s;
	text-decoration: none;
}
.lm-view-btn.is-active {
	background: var(--primary);
	color: var(--primary-foreground);
}

.lm-products {
	margin-top: 1.25rem;
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.25rem;
}
@media (min-width: 640px) {
	.lm-products {
		grid-template-columns: repeat(2, 1fr);
	}
}
@media (min-width: 1280px) {
	.lm-products {
		grid-template-columns: repeat(3, 1fr);
	}
}
.lm-products.is-list {
	grid-template-columns: 1fr;
}

.lm-card {
	position: relative;
	display: flex;
	flex-direction: column;
}
.lm-products.is-list .lm-card {
	flex-direction: row;
	gap: 1.25rem;
}
.lm-products.is-list .lm-card-media {
	width: 11rem;
	flex-shrink: 0;
}
.lm-products.is-list .lm-card-media img {
	height: 100%;
}
.lm-products.is-list .lm-card-body {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
}

.lm-card-media {
	position: relative;
	overflow: hidden;
	border-radius: 0.75rem;
}
.lm-card-media img {
	aspect-ratio: 4 / 5;
	width: 100%;
	object-fit: cover;
	transition: transform 0.7s;
	display: block;
}
.lm-card:hover .lm-card-media img {
	transform: scale(1.05);
}
.lm-card-media--placeholder {
	aspect-ratio: 4 / 5;
	width: 100%;
	background: var(--secondary);
}

.lm-card-badges {
	position: absolute;
	left: 0.75rem;
	top: 0.75rem;
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
	z-index: 1;
}
.lm-badge {
	border-radius: 9999px;
	padding: 0.25rem 0.625rem;
	font-size: 0.6rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}
.lm-badge--sale {
	background: var(--sale);
	color: var(--sale-foreground);
}
.lm-badge--new {
	background: var(--card);
	color: var(--foreground);
}
.lm-badge--oos {
	background: var(--muted);
	color: var(--muted-foreground);
}

.lm-wish {
	position: absolute;
	right: 0.75rem;
	top: 0.75rem;
	z-index: 1;
	display: grid;
	height: 2rem;
	width: 2rem;
	place-items: center;
	border-radius: 9999px;
	background: var(--card);
	opacity: 0.85;
	color: var(--muted-foreground);
	border: 0;
	cursor: pointer;
	transition: color 0.15s;
}
.lm-wish:hover {
	color: var(--foreground);
}
.lm-wish.is-active {
	color: var(--sale);
}
.lm-wish.is-active svg {
	fill: var(--sale);
}
.lm-wish:disabled {
	cursor: wait;
	opacity: 0.6;
}

.lm-layout--full {
	grid-template-columns: 1fr !important;
}

/*
 * Grid cards already share a row height, but the body was a plain block, so a
 * card with a short title kept its spare space *below* the button and every
 * "Aggiungi al carrello" landed at a different height - "i riquadri non sono
 * allineati tra di loro; il tasto aggiungi al carrello e piu sotto o piu
 * sopra" (Salvatore). Growing the body and pushing the price down with an auto
 * margin puts that spare space above the price instead, so the price row and
 * the button line up across the row however the title wraps.
 */
.lm-card-body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
}

.lm-card-brand {
	margin-top: 1rem;
	font-size: 0.62rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--muted-foreground);
}
.lm-card-title {
	margin-top: 0.25rem;
	font-family: var(--font-display);
	font-weight: 500;
	font-size: 1.125rem;
	line-height: 1.3;
	color: var(--foreground);
}
.lm-card-title a {
	color: inherit;
	text-decoration: none;
}
.lm-card-rating {
	margin-top: 0.5rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.68rem;
	color: var(--muted-foreground);
}
.lm-card-price {
	margin-top: auto;
	padding-top: 0.75rem;
	display: flex;
	align-items: baseline;
	gap: 0.5rem;
}
.lm-card-price .now {
	font-size: 1rem;
	color: var(--foreground);
}
.lm-card-price .was {
	font-size: 0.75rem;
	color: var(--muted-foreground);
	text-decoration: line-through;
}
.lm-card-cart {
	padding-top: 1rem;
}
.lm-card-cart .button,
.lm-card-cart .added_to_cart {
	display: block;
	width: 100%;
	text-align: center;
	border-radius: 9999px;
	background: var(--primary);
	color: var(--primary-foreground);
	padding: 0.625rem 0;
	font-size: 0.68rem;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	transition: opacity 0.15s;
	border: 0;
	cursor: pointer;
	text-decoration: none;
}
.lm-card-cart .button:hover {
	opacity: 0.9;
}
.lm-card-cart .button.disabled {
	background: var(--muted);
	color: var(--muted-foreground);
	cursor: not-allowed;
	opacity: 1;
}
.lm-card-cart .added_to_cart {
	margin-top: 0.5rem;
	background: none;
	border: 1px solid var(--border);
	color: var(--foreground);
}

.lm-page-nav[aria-disabled="true"] {
	opacity: 0.4;
	pointer-events: none;
}

/*
 * WooCommerce notices (wc_print_notices output) — used on cart, account,
 * checkout. Unstyled by default since woocommerce-general.css is dequeued.
 */
.woocommerce-message,
.woocommerce-error,
.woocommerce-info {
	list-style: none;
	margin: 0 0 1.25rem;
	padding: 0.875rem 1.25rem;
	border-radius: 1rem;
	font-size: 0.85rem;
	line-height: 1.5;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
}
.woocommerce-error li {
	list-style: none;
}
.woocommerce-message {
	margin-top: 1rem;
	background: color-mix(in oklab, var(--primary) 10%, var(--card));
	color: var(--foreground);
	border: 1px solid color-mix(in oklab, var(--primary) 25%, transparent);
}
.woocommerce-info {
	background: var(--secondary);
	color: var(--foreground);
	border: 1px solid var(--border);
}
.woocommerce-error {
	background: color-mix(in oklab, var(--destructive) 8%, var(--card));
	color: var(--destructive);
	border: 1px solid color-mix(in oklab, var(--destructive) 25%, transparent);
}
.woocommerce-message a.button,
.woocommerce-info a.button,
.woocommerce-error a.button,
.woocommerce-message a.wc-forward,
.woocommerce-info a.wc-forward {
	flex-shrink: 0;
	border-radius: 9999px;
	background: var(--primary);
	color: var(--primary-foreground);
	padding: 0.5rem 1.125rem;
	font-size: 0.65rem;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	text-decoration: none;
}
.woocommerce-message a.button:hover,
.woocommerce-info a.button:hover,
.woocommerce-error a.button:hover,
.woocommerce-message a.wc-forward:hover,
.woocommerce-info a.wc-forward:hover {
	opacity: 0.9;
}

/*
 * AJAX filters (assets/js/shop-filters.js): the loader shown while the next
 * view of the shop is fetched - a drop of sap ("linfa") filling up in the
 * brand's amber, over a frosted veil of the page.
 */
.lm-loader {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	background: color-mix(in oklch, var(--background) 62%, transparent);
	-webkit-backdrop-filter: blur(10px) saturate(1.15);
	backdrop-filter: blur(10px) saturate(1.15);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}
.lm-loader.is-visible {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transition: opacity 0.25s ease, visibility 0s;
}
.lm-loader__bar {
	position: absolute;
	top: 0;
	left: 0;
	height: 2px;
	width: 100%;
	transform-origin: 0 50%;
	transform: scaleX(0);
	background: linear-gradient(90deg, transparent, var(--accent) 30%, var(--primary) 70%, transparent);
}
.lm-loader.is-visible .lm-loader__bar {
	animation: lm-bar 1.6s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
.lm-loader__stage {
	position: relative;
	display: grid;
	place-items: center;
	width: 9.5rem;
	height: 9.5rem;
	transform: translateY(12px) scale(0.92);
	transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.lm-loader.is-visible .lm-loader__stage {
	transform: none;
}
.lm-loader__glow {
	position: absolute;
	inset: 12%;
	border-radius: 50%;
	background: radial-gradient(circle, color-mix(in oklch, var(--accent) 45%, transparent), transparent 70%);
	filter: blur(6px);
	animation: lm-breathe 2.4s ease-in-out infinite;
}
.lm-loader__orbit {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 1px dashed color-mix(in oklch, var(--primary) 22%, transparent);
	animation: lm-spin 3.2s linear infinite;
}
.lm-loader__orbit i {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 7px;
	height: 7px;
	margin: -3.5px;
	border-radius: 50%;
	background: var(--accent);
	box-shadow: 0 0 10px color-mix(in oklch, var(--accent) 80%, transparent);
	transform: rotate(0deg) translateX(4.75rem);
}
.lm-loader__orbit i:nth-child(2) {
	width: 5px;
	height: 5px;
	margin: -2.5px;
	opacity: 0.7;
	transform: rotate(120deg) translateX(4.75rem);
}
.lm-loader__orbit i:nth-child(3) {
	width: 4px;
	height: 4px;
	margin: -2px;
	opacity: 0.45;
	transform: rotate(240deg) translateX(4.75rem);
}
.lm-loader__drop {
	position: relative;
	width: 4.1rem;
	height: auto;
	overflow: visible;
	filter: drop-shadow(0 14px 18px color-mix(in oklch, var(--primary) 28%, transparent));
	animation: lm-float 2.4s ease-in-out infinite;
}
.lm-loader__glass {
	fill: var(--card);
}
.lm-sap-top {
	stop-color: var(--accent);
}
.lm-sap-bottom {
	stop-color: var(--primary);
}
.lm-loader__fill {
	transform: translateY(78px);
	animation: lm-fill 1.8s cubic-bezier(0.45, 0, 0.25, 1) infinite alternate;
}
.lm-loader__wave {
	fill: url(#lm-sap);
	animation: lm-wave 1.1s linear infinite;
}
.lm-loader__wave--back {
	fill: var(--accent);
	opacity: 0.4;
	animation-duration: 1.7s;
	animation-direction: reverse;
}
.lm-loader__outline {
	fill: none;
	stroke: var(--primary);
	stroke-width: 1.6;
}
.lm-loader__shine {
	fill: none;
	stroke: var(--primary-foreground);
	stroke-width: 2.4;
	stroke-linecap: round;
	opacity: 0.75;
}
.lm-loader__word {
	margin-top: 0.4rem;
	font-family: var(--font-display);
	font-size: 0.8rem;
	font-weight: 500;
	letter-spacing: 0.55em;
	/* letter-spacing trails the last letter; pull it back to stay centred */
	margin-right: -0.55em;
	text-transform: uppercase;
	color: transparent;
	background: linear-gradient(100deg, var(--primary) 0%, var(--primary) 38%, var(--accent) 50%, var(--primary) 62%, var(--primary) 100%);
	background-size: 250% 100%;
	-webkit-background-clip: text;
	background-clip: text;
	animation: lm-shimmer 1.8s ease-in-out infinite;
}
.lm-loader__hint {
	font-size: 0.6rem;
	letter-spacing: 0.25em;
	text-transform: uppercase;
	color: var(--muted-foreground);
}
.lm-loader__hint span {
	animation: lm-dot 1.2s ease-in-out infinite;
}
.lm-loader__hint span:nth-child(2) {
	animation-delay: 0.2s;
}
.lm-loader__hint span:nth-child(3) {
	animation-delay: 0.4s;
}

/* Fresh results rise in, card by card. */
#lm-shop.lm-enter .lm-card {
	animation: lm-card-in 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
	animation-delay: calc(var(--lm-i, 0) * 45ms);
}

@keyframes lm-bar {
	0% { transform: scaleX(0); transform-origin: 0 50%; }
	50% { transform: scaleX(1); transform-origin: 0 50%; }
	50.1% { transform-origin: 100% 50%; }
	100% { transform: scaleX(0); transform-origin: 100% 50%; }
}
@keyframes lm-fill {
	from { transform: translateY(78px); }
	to { transform: translateY(14px); }
}
@keyframes lm-wave {
	from { transform: translateX(0); }
	to { transform: translateX(-64px); }
}
@keyframes lm-spin {
	to { transform: rotate(360deg); }
}
@keyframes lm-float {
	0%, 100% { transform: translateY(-3px); }
	50% { transform: translateY(3px); }
}
@keyframes lm-breathe {
	0%, 100% { transform: scale(0.85); opacity: 0.6; }
	50% { transform: scale(1.1); opacity: 1; }
}
@keyframes lm-shimmer {
	from { background-position: 100% 0; }
	to { background-position: 0 0; }
}
@keyframes lm-dot {
	0%, 100% { opacity: 0.2; }
	50% { opacity: 1; }
}
@keyframes lm-card-in {
	from { opacity: 0; transform: translateY(14px) scale(0.98); }
	to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.lm-loader__orbit,
	.lm-loader__drop,
	.lm-loader__glow,
	.lm-loader__wave,
	.lm-loader__word,
	.lm-loader__hint span,
	.lm-loader.is-visible .lm-loader__bar,
	#lm-shop.lm-enter .lm-card {
		animation: none;
	}
	.lm-loader__fill {
		animation: none;
		transform: translateY(40px);
	}
	.lm-loader__stage {
		transition: none;
	}
}
