/* Mobile refinements for the storefront, scoped away from checkout and wp-admin. */
@media (max-width: 767px) {
	:root {
		--nsl-mobile-toolbar-height: 55px;
	}

	body {
		padding-bottom: calc(var(--nsl-mobile-toolbar-height) + env(safe-area-inset-bottom, 0px));
	}

	.wd-toolbar {
		box-sizing: border-box;
		height: auto;
		min-height: var(--nsl-mobile-toolbar-height);
		padding: 5px 5px calc(5px + env(safe-area-inset-bottom, 0px));
		align-items: center;
	}

	.wd-toolbar .wd-toolbar-item {
		box-sizing: border-box;
		flex: 1 1 0;
		min-width: 0;
		min-height: 44px;
		height: auto;
		padding: 2px 3px;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		text-align: center;
		font-size: 11px;
		line-height: 1.15;
	}

	.wd-toolbar .wd-toolbar-item > a,
	.wd-toolbar .wd-toolbar-item > button {
		min-width: 44px;
		min-height: 44px;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.wd-toolbar .wd-toolbar-item .wd-tools-icon,
	.wd-toolbar .wd-toolbar-item .wd-tools-icon:before,
	.wd-toolbar .wd-toolbar-item .wd-toolbar-label {
		line-height: 1.15;
	}

	.wd-toolbar .wd-toolbar-item .wd-tools-icon:before {
		font-size: 18px;
	}

	.wd-toolbar .wd-toolbar-label {
		max-width: 100%;
		font-size: 10px;
		white-space: nowrap;
	}

	/* Woodmart otherwise gives the account link only icon width and ellipsizes its label. */
	.wd-toolbar .wd-header-my-account > a {
		width: 100%;
	}

	body.nsl-mobile-keyboard-open .wd-toolbar {
		display: none;
	}

	body.nsl-mobile-keyboard-open {
		padding-bottom: 0;
	}

	body.nsl-mobile-keyboard-open .scrollToTop {
		bottom: 12px;
	}

	.scrollToTop {
		bottom: calc(var(--nsl-mobile-toolbar-height) + 12px + env(safe-area-inset-bottom, 0px));
	}

	/* Keep image geometry stable while lazy-loaded thumbnails arrive. */
	.woocommerce .products .product-grid-item,
	.woocommerce .products .product-wrapper,
	.woocommerce .products .product-element-top {
		min-width: 0;
	}

	.woocommerce .products .product-grid-item .product-wrapper {
		height: 100%;
	}

	.woocommerce .products .product-element-top .product-image-link {
		width: 100%;
		aspect-ratio: 1 / 1;
		background: #fff;
	}

	.woocommerce .products .product-element-top .product-image-link img {
		display: block;
		width: 100%;
		height: 100%;
		object-fit: contain;
		object-position: center;
	}

	/* Woodmart reserves 40px above card titles for desktop hover controls. */
	.woocommerce .products .product-grid-item .product-element-bottom .wd-entities-title,
	.woocommerce .products .product-grid-item .product-element-bottom .woocommerce-loop-product__title {
		padding-block-start: 0;
		margin-block: 0 7px;
		font-size: 14px;
		line-height: 1.35;
		min-height: 3.8em;
	}

	.woocommerce .products .product-grid-item .wd-product-cats {
		display: none;
	}

	.woocommerce .products .product-grid-item .wrap-price {
		min-height: 22px;
		margin: 0;
		align-items: flex-start;
	}

	.woocommerce .products .product-grid-item .price {
		font-size: 14px;
		line-height: 1.4;
	}

	.woocommerce .products .product-grid-item .wd-add-btn {
		padding-block-start: 8px;
	}

	.woocommerce .products .product-grid-item .wd-add-btn a,
	.woocommerce .products .product-grid-item .wd-add-btn button,
	.woocommerce .products .product-grid-item .nsl-card-cta {
		box-sizing: border-box;
		width: 100%;
		min-height: 48px;
		padding: 10px 8px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		font-size: 12px;
		line-height: 1.25;
		white-space: normal;
		text-align: center;
	}

	.woocommerce .wd-shop-tools {
		box-sizing: border-box;
		width: 100%;
		min-width: 0;
		margin-block-end: 14px;
		padding-block-end: 8px;
		flex-wrap: wrap;
		align-items: center;
		row-gap: 8px;
	}

	.woocommerce .wd-shop-tools > * {
		min-width: 0;
	}

	/* Product pages: keep the purchase decision and variation form easy to scan. */
	body.single-product .product_title {
		margin-block: 0 8px;
		font-size: clamp(23px, 6vw, 28px);
		line-height: 1.2;
		letter-spacing: -0.25px;
		text-wrap: pretty;
	}

	body.single-product .summary-inner > .price,
	body.single-product .summary-inner > .woocommerce-variation-price {
		margin-block: 0 12px;
		font-size: 20px;
		line-height: 1.3;
	}

	body.single-product .summary-inner {
		min-width: 0;
		font-size: 15px;
		line-height: 1.5;
	}

	body.single-product .woocommerce-product-gallery,
	body.single-product .woocommerce-product-gallery__wrapper,
	body.single-product .woocommerce-product-gallery__image {
		min-width: 0;
	}

	body.single-product .woocommerce-product-gallery__image img {
		max-width: 100%;
		height: auto;
		object-fit: contain;
	}

	/* Keep tall product photos complete while bringing the purchase details up. */
	body.single-product .woocommerce-product-gallery .product-image-wrap img {
		box-sizing: border-box;
		width: auto;
		max-width: 100%;
		max-height: min(90vw, 42vh, 340px);
		height: auto;
		margin-inline: auto;
		object-fit: contain;
	}

	@supports (height: 100svh) {
		body.single-product .woocommerce-product-gallery .product-image-wrap img {
			max-height: min(90vw, 42svh, 340px);
		}
	}

	body.single-product form.cart .single_add_to_cart_button {
		box-sizing: border-box;
		min-height: 48px;
		font-size: 15px;
		line-height: 1.3;
		white-space: normal;
	}

	body.single-product form.variations_form .variations select {
		box-sizing: border-box;
		min-height: 48px;
		height: auto;
		padding-block: 11px;
		font-size: 16px;
		line-height: 1.35;
	}

	body.single-product .nsl-product-collection.nsl-collection-compact {
		margin-block: 12px;
		font-size: 13px;
	}

	body.single-product .nsl-collection-details summary {
		min-height: 44px;
	}

	/* Made-to-measure controls use the existing quote and validation logic. */
	.nsl-led {
		max-width: 100%;
		margin-block-end: 16px;
		font-size: 15px;
	}

	.nsl-led h2 {
		font-size: clamp(24px, 6vw, 29px);
		line-height: 1.16;
	}

	.nsl-led .nsl-led-intro {
		font-size: 15px;
		line-height: 1.5;
	}

	.nsl-led .nsl-led-label {
		margin-block: 20px 8px;
		font-size: 15px;
		line-height: 1.4;
	}

	.nsl-led select,
	.nsl-led .nsl-led-length select {
		box-sizing: border-box;
		min-height: 48px;
		font-size: 16px;
	}

	.nsl-led .nsl-led-length {
		grid-template-columns: 52px minmax(0, 1fr) 52px;
		gap: 8px;
	}

	.nsl-led .nsl-led-length button {
		width: 52px;
		min-width: 52px;
		min-height: 52px;
		height: 52px;
		font-size: 27px;
		touch-action: manipulation;
	}

	.nsl-led .nsl-led-help,
	.nsl-led .nsl-led-notice,
	.nsl-led .nsl-led-delivery {
		font-size: 14px;
		line-height: 1.5;
	}

	.nsl-led .nsl-led-cable,
	.nsl-led #nsl-led-psu-detail {
		padding: 14px;
		font-size: 14px;
		line-height: 1.5;
	}

	.nsl-led .nsl-led-cable small,
	.nsl-led .nsl-led-psu small {
		font-size: 13px;
		line-height: 1.45;
	}

	.nsl-led .nsl-led-psu {
		min-height: 56px;
		padding-block: 14px;
		gap: 12px;
	}

	.nsl-led .nsl-led-psu input {
		width: 22px;
		min-width: 22px;
		height: 22px;
	}

	.nsl-led .nsl-led-summary {
		padding: 14px;
		margin-block-start: 8px;
	}

	.nsl-led .nsl-led-summary h3 {
		margin-block-end: 12px;
		font-size: 17px;
	}

	.nsl-led .nsl-led-summary dl > div {
		gap: 10px;
		margin-block: 9px;
		font-size: 13px;
		line-height: 1.4;
	}

	.nsl-led .nsl-led-summary dt {
		max-width: 43%;
		font-size: 13px;
	}

	.nsl-led .nsl-led-summary dd {
		max-width: 60%;
		font-size: 13px;
	}

	.nsl-led .nsl-led-total {
		gap: 8px;
		align-items: flex-start;
	}

	.nsl-led .nsl-led-total strong {
		font-size: clamp(24px, 7vw, 30px);
	}

	form.cart:has(.nsl-led) > .quantity {
		min-height: 48px;
		align-items: center;
		margin: 0 0 10px !important;
	}

	form.cart:has(.nsl-led) > .single_add_to_cart_button {
		min-height: 52px;
		font-size: 16px;
	}

	/* Compact footer rhythm without removing its legal/contact sections. */
	.footer-container {
		padding-block: 18px 14px;
	}

	.footer-container .container {
		padding-inline: 12px;
	}

	.footer-container .footer-column {
		box-sizing: border-box;
		margin-block: 0 12px;
		padding-inline: 8px;
	}

	.footer-container .widget-title {
		margin-block: 0 8px;
		font-size: 17px;
		line-height: 1.3;
	}

	.footer-container li a,
	.footer-container .textwidget,
	.footer-container .elementor-icon-list-text {
		font-size: 14px;
		line-height: 1.45;
	}

	.footer-container .elementor-icon-list-item {
		display: flex;
		align-items: flex-start;
		gap: 8px;
	}

	.footer-container .elementor-icon-list-icon {
		flex: 0 0 18px;
		line-height: 1.45;
	}

	#simple-social-icons-2 ul {
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
		justify-content: flex-start;
	}
}

@media (min-width: 768px) and (max-width: 1024px) {
	:root {
		--nsl-mobile-toolbar-height: 55px;
	}

	body {
		padding-bottom: calc(var(--nsl-mobile-toolbar-height) + env(safe-area-inset-bottom, 0px));
	}

	.wd-toolbar {
		box-sizing: border-box;
		height: auto;
		min-height: var(--nsl-mobile-toolbar-height);
		padding-bottom: calc(5px + env(safe-area-inset-bottom, 0px));
		align-items: center;
	}

	.wd-toolbar .wd-toolbar-item {
		min-height: 44px;
	}

	.scrollToTop {
		bottom: calc(var(--nsl-mobile-toolbar-height) + 12px + env(safe-area-inset-bottom, 0px));
	}

	body.nsl-mobile-keyboard-open .wd-toolbar {
		display: none;
	}

	body.nsl-mobile-keyboard-open {
		padding-bottom: 0;
	}

	.woocommerce div.product form.cart .single_add_to_cart_button {
		min-height: 48px;
	}

	.woocommerce div.product form.variations_form .variations select {
		box-sizing: border-box;
		min-height: 48px;
		height: auto;
		padding-block: 11px;
		font-size: 16px;
		line-height: 1.35;
	}
}

@media (max-width: 359px) {
	.woocommerce .products .product-grid-item .product-element-bottom .wd-entities-title,
	.woocommerce .products .product-grid-item .product-element-bottom .woocommerce-loop-product__title {
		font-size: 13px;
	}

	.woocommerce .products .product-grid-item .wd-add-btn a,
	.woocommerce .products .product-grid-item .wd-add-btn button,
	.woocommerce .products .product-grid-item .nsl-card-cta {
		font-size: 11px;
	}
}
