/**
 * Mobile UX (inc/mobile-ux.php). Phones first: 2 products per row, sticky sort / filter bar,
 * compact header, product page above the fold, tap targets, footer accordion.
 * Desktop is untouched except the unit price and small shared details.
 */

/* ---------- Unit price (all widths) ---------- */
.lv-unit-price {
	display: inline-block;
	margin-left: 4px;
	color: #5b6672;
	font-size: 14px !important;
	font-weight: 400 !important;
	white-space: nowrap;
	vertical-align: baseline;
}

.lv-unit-price .woocommerce-Price-amount,
.lv-unit-price bdi {
	color: inherit !important;
	font-size: inherit !important;
	font-weight: inherit !important;
}

.pp-sticky .lv-unit-price {
	display: none;
}

/* ---------- Footer accordion (phones, js/mobile-ux.js) ---------- */
.lv-mux-acc-btn {
	display: none;
}

@media (max-width: 575.98px) {

	/* ============ Header: compact ============ */
	#top-bar.pt-3 {
		padding-top: 8px !important;
		padding-bottom: 8px !important;
	}

	#top-bar p.top-bar-ad,
	.hux-ticker .top-bar-ad {
		font-size: 13px;
	}

	#masthead.site-header {
		padding-top: 10px !important;
		padding-bottom: 10px !important;
	}

	#masthead img.custom-logo {
		max-width: 118px;
		height: auto;
	}

	/* Header icons: 40 x 40 tap targets, evenly spaced. */
	#masthead .col-6.text-right {
		display: flex;
		align-items: center;
		justify-content: flex-end;
		gap: 2px;
		padding-left: 0;
	}

	#masthead button.open-nav,
	#masthead a.lv-wl-link,
	#masthead a.user-page-link,
	#masthead a.mini-cart-link {
		position: relative;
		display: inline-flex !important;
		align-items: center;
		justify-content: center;
		width: 40px;
		height: 40px;
		margin: 0 !important;
		padding: 0 !important;
	}

	#masthead a.user-page-link img,
	#masthead button.open-nav img,
	#masthead a.mini-cart-link img {
		margin: 0 !important;
	}

	#masthead a.mini-cart-link div#mini-cart-count {
		top: 0;
		right: -2px;
	}

}

@media (max-width: 767.98px) {

	/* ============ Catalogue: 2 products per row ============ */
	.woocommerce ul.products:not(.swiper-wrapper):not(.lvb-prods) {
		display: grid !important;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
		margin: 0 0 20px !important;
		padding: 0;
	}

	.woocommerce ul.products:not(.swiper-wrapper)::before,
	.woocommerce ul.products:not(.swiper-wrapper)::after {
		display: none !important;
	}

	.woocommerce ul.products:not(.swiper-wrapper) li.product {
		display: flex;
		flex-direction: column;
		width: auto !important;
		min-width: 0;
		margin: 0 !important;
		padding: 10px 10px 12px !important;
		float: none !important;
	}

	.woocommerce ul.products:not(.swiper-wrapper) li.product a.woocommerce-LoopProduct-link {
		display: flex;
		flex: 1 1 auto;
		flex-direction: column;
	}

	.woocommerce ul.products:not(.swiper-wrapper) li.product img {
		width: 100% !important;
		height: 120px !important;
		margin: 6px auto 0 !important;
	}

	.woocommerce ul.products:not(.swiper-wrapper) li.product a.woocommerce-LoopProduct-link h2.woocommerce-loop-product__title {
		min-height: calc(3 * 1.3em);
		margin: 10px 0 6px !important;
		font-size: 13.5px;
		line-height: 1.3;
		overflow-wrap: anywhere;
		-webkit-line-clamp: 3;
	}

	.woocommerce ul.products:not(.swiper-wrapper) li.product .price {
		display: block;
		margin-top: auto;
		font-size: 16px !important;
		line-height: 1.3;
	}

	.woocommerce ul.products:not(.swiper-wrapper) li.product .price del {
		display: block;
		font-size: 12.5px !important;
	}

	.woocommerce ul.products:not(.swiper-wrapper) li.product .star-rating {
		margin: 2px 0 4px;
		font-size: 11px;
	}

	.woocommerce ul.products:not(.swiper-wrapper) li.product .button,
	.woocommerce ul.products:not(.swiper-wrapper) li.product a.button.add_to_cart_button,
	.woocommerce ul.products:not(.swiper-wrapper) li.product a.button.product_type_simple {
		display: flex !important;
		align-items: center;
		justify-content: center;
		width: 100%;
		min-height: 40px;
		margin-top: 8px !important;
		padding: 8px 6px !important;
		font-size: 13.5px !important;
		line-height: 1.2 !important;
		text-align: center;
		white-space: normal;
	}

	.woocommerce ul.products:not(.swiper-wrapper) li.product .added_to_cart {
		display: block;
		margin-top: 6px;
		font-size: 13px;
		text-align: center;
	}

	/* Heart: smaller, in the corner, still a 34 px target. */
	.woocommerce ul.products:not(.swiper-wrapper) button.lv-wl-btn--card {
		top: 6px;
		right: 6px;
		width: 34px !important;
		height: 34px !important;
	}

	.woocommerce ul.products:not(.swiper-wrapper) button.lv-wl-btn--card .lv-wl-heart {
		width: 18px;
		height: 18px;
	}

	/* Badges: compact, never under the heart. */
	.woocommerce ul.products:not(.swiper-wrapper) li.product .onsale {
		top: 8px !important;
		left: 8px !important;
		height: 22px !important;
		padding: 0 6px !important;
		font-size: 10.5px !important;
	}

	.woocommerce ul.products:not(.swiper-wrapper) li.product .yith-wcbm-badge {
		transform: scale(.82);
		transform-origin: top right;
	}

}

@media (max-width: 991.98px) {

	/* ============ Catalogue toolbar: sticky sort + filter ============ */
	.lv-cf-bar {
		position: -webkit-sticky;
		position: sticky;
		top: calc(var(--hux-top, 0px) + var(--hux-sticky-h, 64px) - 1px);
		z-index: 900;
		flex-wrap: nowrap;
		gap: 8px;
		margin: 0 -12px 10px !important;
		padding: 8px 12px;
		background: #fff;
		transition: box-shadow .2s ease;
	}

	.lv-cf-bar.is-stuck {
		box-shadow: 0 6px 12px -8px rgba(16, 24, 40, .25);
	}

	.lv-cf-bar form.woocommerce-ordering {
		flex: 1 1 auto;
		min-width: 0;
		margin: 0 !important;
	}

	.lv-cf-bar form.woocommerce-ordering select.orderby {
		width: 100%;
		height: 44px;
		font-size: 15px;
	}

	.lv-cf-bar .lv-cf-open {
		height: 44px;
	}

}

@media (max-width: 575.98px) {

	/* ============ Product page: above the fold ============ */
	.single-product .woocommerce-breadcrumb {
		overflow: hidden;
		margin-top: 4px !important;
		margin-bottom: 8px !important;
		font-size: 13px;
		white-space: nowrap;
		text-overflow: ellipsis;
	}

	.single-product div.product .woocommerce-product-gallery {
		margin-bottom: 8px !important;
	}

	.single-product div.product .woocommerce-product-gallery__image img,
	.single-product div.product .woocommerce-product-gallery img.wp-post-image {
		max-height: 260px;
		object-fit: contain;
	}

	.single-product div.product .product_title {
		font-size: 22px !important;
		line-height: 1.25 !important;
		overflow-wrap: anywhere;
	}

	/* ============ Footer: accordion ============ */
	.lv-mux-acc .lv-mux-acc-btn {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		min-height: 48px;
		margin: 0 !important;
		padding: 0 !important;
		border: 0 !important;
		border-bottom: 1px solid #e6ebf0 !important;
		border-radius: 0 !important;
		background: transparent !important;
		color: #212121 !important;
		font: inherit !important;
		font-size: 17px !important;
		font-weight: 600 !important;
		text-align: left;
		cursor: pointer;
	}

	.lv-mux-acc .lv-mux-acc-btn:focus-visible {
		outline: 2px solid #0f69af;
		outline-offset: 2px;
	}

	.lv-mux-acc .lv-mux-acc-btn::after {
		content: "";
		flex: none;
		width: 22px;
		height: 22px;
		background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f69af' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / 18px no-repeat;
		transition: transform .2s ease;
	}

	.lv-mux-acc .lv-mux-acc-btn[aria-expanded="true"]::after {
		transform: rotate(180deg);
	}

	.lv-mux-acc > .widget-title {
		margin: 0 !important;
	}

	.lv-mux-acc .lv-mux-acc-panel {
		padding: 6px 0 8px;
	}

	.lv-mux-acc .lv-mux-acc-panel[hidden] {
		display: none !important;
	}

	.lv-mux-acc .lv-mux-acc-panel li a {
		display: inline-block;
		padding: 6px 0;
	}

	/* ============ Chat button: smaller on phones ============ */
	.lv-cw button.lv-cw-btn,
	.lv-cw button.lv-cw-btn:hover,
	.lv-cw button.lv-cw-btn:focus,
	.lv-cw button.lv-cw-btn:active {
		min-height: 46px;
		padding: 0 11px !important;
	}

	.lv-cw-btn .lv-cw-ico {
		width: 24px;
		height: 24px;
	}
}

/* ---------- Checkout / cart (all widths) ---------- */

/* Postcode note / link (inc/checkout-postcode.php). */
.lv-pc-note {
	margin: 6px 0 0;
	color: #4b5563;
	font-size: 13px;
	line-height: 1.4;
}

.lv-pc-note__status:empty {
	display: none;
}

.lv-pc-note__status {
	color: #15803d;
	font-weight: 600;
}

.lv-pc-note a.lv-pc-note__link,
.lv-pc-note a.lv-pc-note__link:visited {
	color: #0f69af;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.lv-pc-note a.lv-pc-note__link:hover,
.lv-pc-note a.lv-pc-note__link:focus,
.lv-pc-note a.lv-pc-note__link:active {
	color: #0b5590;
	text-decoration: underline;
}

/* Newsletter block is an exit point in the checkout (audit CO1). */
body.woocommerce-checkout:not(.woocommerce-order-received) #footer-top {
	display: none;
}

@media (max-width: 575.98px) {
	/* Bigger, easier fields on phones (16 px prevents the iOS zoom on focus). */
	.woocommerce-checkout .woocommerce-billing-fields input.input-text,
	.woocommerce-checkout .woocommerce-shipping-fields input.input-text,
	.woocommerce-checkout .woocommerce-additional-fields input.input-text,
	.woocommerce-checkout .woocommerce-additional-fields textarea {
		min-height: 46px;
		font-size: 16px !important;
	}

	body.woocommerce-checkout .lv-cw button.lv-cw-btn {
		bottom: 10px;
		opacity: .92;
	}
}

@media (prefers-reduced-motion: reduce) {
	.lv-mux-acc .lv-mux-acc-btn::after,
	.lv-cf-bar {
		transition: none;
	}
}
