/**
 * Mobile-first responsive behavior and regression guards.
 * Breakpoint 921px matches the live Astra configuration.
 */

body.ilg-active #page,
body.ilg-active #content,
body.ilg-active .site-content,
body.ilg-active .site-main,
body.ilg-active article,
body.ilg-active .entry-content,
body.ilg-active .woocommerce,
body.ilg-active .wc-block-components-main,
body.ilg-active .wc-block-components-sidebar {
	min-width: 0;
	max-width: 100%;
}

@media (min-width: 360px) {
	body.ilg-active .woocommerce ul.products,
	body.ilg-active.woocommerce ul.products,
	body.ilg-active.woocommerce-page ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 768px) {
	body.ilg-active .woocommerce ul.products,
	body.ilg-active.woocommerce ul.products,
	body.ilg-active.woocommerce-page ul.products {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 922px) {
	body.ilg-active #ast-desktop-header {
		display: block !important;
	}

	body.ilg-active #ast-mobile-header {
		display: none !important;
	}

	body.ilg-active.single-product div.product .woocommerce-product-gallery,
	body.ilg-active.single-product div.product .summary {
		min-width: 0;
	}

	body.ilg-active.woocommerce-account .woocommerce-MyAccount-navigation {
		width: 100% !important;
	}

	body.ilg-active.woocommerce-account .woocommerce-MyAccount-content {
		width: 100% !important;
	}
}

@media (max-width: 1100px) and (min-width: 922px) {
	body.ilg-active #ast-desktop-header .main-header-menu > .menu-item > .menu-link {
		padding-inline: 10px !important;
		font-size: 0.88rem;
	}

	body.ilg-active #masthead img.ilg-logo__image {
		height: 62px !important;
		max-width: 102px !important;
	}
}

@media (max-width: 921px) {
	body.ilg-active,
	body.ilg-active #page,
	body.ilg-active #content,
	body.ilg-active .site-content {
		width: 100%;
		max-width: 100%;
		overflow-x: clip;
	}

	body.ilg-active #ast-desktop-header {
		display: none !important;
	}

	body.ilg-active #ast-mobile-header {
		display: block !important;
	}

	body.ilg-active #masthead .site-primary-header-wrap {
		width: calc(100% - var(--ilg-gutter-mobile) - var(--ilg-gutter-mobile)) !important;
		min-height: var(--ilg-header-height-mobile) !important;
		margin: 8px auto !important;
		padding: 0 10px !important;
		border-radius: var(--ilg-radius) !important;
	}

	body.ilg-active #masthead img.ilg-logo__image {
		width: auto !important;
		height: 54px !important;
		max-width: 82px !important;
	}

	body.ilg-active #ast-mobile-header .site-header-primary-section-left {
		flex: 1 1 auto;
		min-width: 0;
	}

	body.ilg-active #ast-mobile-header .site-header-primary-section-right {
		flex: 0 0 auto;
		gap: 6px;
	}

	body.ilg-active #ast-mobile-header [data-section="section-header-mobile-trigger"] {
		position: relative;
		z-index: 3;
		display: flex !important;
		align-items: center;
		gap: 6px;
		min-width: 0;
		isolation: isolate;
		pointer-events: auto !important;
	}

	body.ilg-active #ast-mobile-header .ilg-mobile-store-actions {
		position: relative;
		z-index: 2;
		display: inline-flex;
		align-items: center;
		gap: 6px;
		min-width: 0;
		pointer-events: auto !important;
	}

	body.ilg-active #ast-mobile-header .ilg-mobile-store-actions :where(.ast-site-header-cart, .ast-header-account-wrap) {
		display: inline-flex !important;
		align-items: center;
		margin: 0 !important;
	}

	body.ilg-active #ast-mobile-header :where(
		.ast-site-header-cart .cart-container,
		.ast-header-account-link,
		.menu-toggle
	) {
		z-index: 2;
		width: 42px !important;
		height: 42px !important;
		min-width: 42px !important;
		min-height: 42px !important;
		border-radius: 11px !important;
		cursor: pointer;
		touch-action: manipulation;
		pointer-events: auto !important;
	}

	/* Astra disables the mobile cart anchor when its flyout mode is active.
	 * This header uses the real cart URL, so the whole 42px target must remain tappable. */
	body.ilg-active #ast-mobile-header .ilg-mobile-store-actions .ast-site-header-cart-li > a.cart-container {
		pointer-events: auto !important;
	}

	body.ilg-active #ast-mobile-header :where(
		.ast-site-header-cart .cart-container,
		.ast-header-account-link,
		.menu-toggle
	) :where(svg, path, circle, span, i) {
		pointer-events: none !important;
	}

	body.ilg-active #ast-mobile-header .ast-mobile-header-content {
		width: calc(100% - var(--ilg-gutter-mobile) - var(--ilg-gutter-mobile)) !important;
		max-width: var(--ilg-container);
		margin: 0 auto 10px !important;
		padding: 8px !important;
		border: 1px solid var(--ilg-border-orange) !important;
		border-radius: var(--ilg-radius-lg) !important;
		background: radial-gradient(circle at 100% 100%, rgba(255, 106, 0, 0.1), transparent 36%), linear-gradient(145deg, var(--ilg-panel), var(--ilg-black)) !important;
		box-shadow: var(--ilg-shadow) !important;
		overflow: hidden;
	}

	body.ilg-active #ast-mobile-header .ast-mobile-header-content :where(
		.ast-builder-menu-1,
		.ast-main-header-bar-alignment,
		.main-header-bar-navigation,
		.main-navigation,
		.main-header-menu
	) {
		width: 100% !important;
		margin: 0 !important;
		padding: 0 !important;
		border: 0 !important;
		background: transparent !important;
	}

	body.ilg-active #ast-mobile-header .ast-mobile-header-content .main-header-menu > .menu-item {
		width: 100%;
		margin: 0 0 6px !important;
		border: 0 !important;
		background: transparent !important;
	}

	body.ilg-active #ast-mobile-header .ast-mobile-header-content .main-header-menu > .menu-item:last-child {
		margin-bottom: 0 !important;
	}

	html body.ilg-active #ast-mobile-header .ast-mobile-header-content ul.main-header-menu > li.menu-item > a.menu-link {
		display: flex !important;
		align-items: center;
		width: 100% !important;
		min-height: 52px !important;
		padding: 0 18px !important;
		border: 1px solid var(--ilg-border-orange) !important;
		border-radius: var(--ilg-radius-sm) !important;
		background: var(--ilg-black) !important;
		color: var(--ilg-white) !important;
		font-weight: 750 !important;
		letter-spacing: 0.08em;
		text-transform: uppercase;
		box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025) !important;
	}

	html body.ilg-active #ast-mobile-header .ast-mobile-header-content ul.main-header-menu > li.menu-item:is(.current-menu-item, .current_page_item) > a.menu-link,
	html body.ilg-active #ast-mobile-header .ast-mobile-header-content ul.main-header-menu > li.menu-item > a.menu-link:hover {
		border-color: var(--ilg-border-orange-active) !important;
		background: var(--ilg-black) !important;
		color: var(--ilg-orange-light) !important;
	}

	html body.ilg-active #ast-mobile-header .main-header-menu .menu-link::before,
	html body.ilg-active #ast-mobile-header .main-header-menu .menu-link::after {
		content: none !important;
		display: none !important;
		border: 0 !important;
	}

	/* Contain every real page layout without suppressing content. */
	body.ilg-active .site-content > .ast-container,
	body.ilg-active .site-content .ast-container {
		width: min(calc(100% - var(--ilg-gutter-mobile) - var(--ilg-gutter-mobile)), var(--ilg-container));
		max-width: var(--ilg-container);
		padding-inline: 0 !important;
	}

	body.ilg-active :where(.wp-block-columns, .wp-block-buttons, .il-field-row, .il-contact-grid, .il-contact-cards) {
		min-width: 0;
		max-width: 100%;
		flex-wrap: wrap !important;
	}

	body.ilg-active :where(input, select, textarea) {
		font-size: 16px !important;
	}

	body.ilg-active.home .ilh-hero__content {
		width: calc(100% - 18px) !important;
		padding: 24px 14px 20px !important;
		border-radius: 24px !important;
	}

	body.ilg-active.home :where(.ilh-section-head, .ilh-products-intro) {
		padding-left: 13px !important;
	}

	body.ilg-active.home :where(.ilh-category-card, .ilh-benefit-card) {
		border-radius: var(--ilg-radius) !important;
	}

	/* Single product stacking. */
	body.ilg-active.single-product div.product,
	body.ilg-active.single-product div.product .woocommerce-product-gallery,
	body.ilg-active.single-product div.product .summary,
	body.ilg-active.single-product div.product .woocommerce-tabs,
	body.ilg-active.single-product div.product .related.products,
	body.ilg-active.single-product div.product .up-sells {
		float: none !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
	}

	body.ilg-active.single-product div.product .summary {
		margin-top: var(--ilg-space-5) !important;
	}

	body.ilg-active.single-product :where(form.cart, form.variations_form, table.variations, table.variations tbody, table.variations tr) {
		width: 100% !important;
		max-width: 100% !important;
	}

	body.ilg-active.single-product table.variations :where(th, td) {
		display: block !important;
		width: 100% !important;
		padding-inline: 0 !important;
		text-align: left !important;
	}

	body.ilg-active.single-product :where(table.variations select, .il-guide-trigger, form.cart .single_add_to_cart_button) {
		width: 100% !important;
		max-width: 100% !important;
		min-height: 50px;
	}

	body.ilg-active.single-product form.cart .quantity {
		display: flex !important;
		width: 100% !important;
		margin: 0 0 10px !important;
	}

	body.ilg-active.single-product form.cart .quantity .qty {
		width: 100% !important;
	}

	/* Classic checkout remains the real WooCommerce form, in one column. */
	body.ilg-active.woocommerce-checkout :where(
		form.checkout,
		.col2-set,
		.col-1,
		.col-2,
		#order_review,
		.woocommerce-checkout-review-order
	) {
		float: none !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
	}

	body.ilg-active.woocommerce-checkout :where(.form-row, .form-row-first, .form-row-last) {
		float: none !important;
		width: 100% !important;
		margin-right: 0 !important;
	}

	body.ilg-active.woocommerce-checkout table.shop_table {
		table-layout: fixed;
	}

	body.ilg-active.woocommerce-checkout table.shop_table :where(th, td) {
		padding: 12px 8px !important;
		overflow-wrap: break-word;
	}

	body.ilg-active.woocommerce-checkout :where(#place_order, .wc-block-components-checkout-place-order-button) {
		width: 100% !important;
		min-height: 58px !important;
	}

	/* WooCommerce Blocks collapse without changing their React state. */
	body.ilg-active :where(
		.wc-block-cart,
		.wc-block-checkout,
		.wc-block-cart__main,
		.wc-block-cart__sidebar,
		.wc-block-checkout__main,
		.wc-block-checkout__sidebar
	) {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
	}

	body.ilg-active :where(.wc-block-cart, .wc-block-checkout) {
		display: block !important;
	}

	body.ilg-active :where(.wc-block-cart__sidebar, .wc-block-checkout__sidebar) {
		margin-top: var(--ilg-space-5) !important;
		padding: 18px !important;
	}

	body.ilg-active :where(.wc-block-cart__submit-button, .wc-block-components-checkout-place-order-button) {
		width: 100%;
		min-height: 58px !important;
	}

	/* My Account columns. */
	body.ilg-active.woocommerce-account :where(.woocommerce-MyAccount-navigation, .woocommerce-MyAccount-content) {
		float: none !important;
		width: 100% !important;
		max-width: 100%;
	}

	body.ilg-active.woocommerce-account .woocommerce-MyAccount-content {
		margin-top: 0;
	}

	/* Footer uses one spacing model on every page. */
	body.ilg-active #colophon .site-primary-footer-wrap {
		min-height: 0;
		padding-block: 30px !important;
	}

	body.ilg-active #colophon .ast-builder-footer-grid-columns {
		gap: 22px !important;
		text-align: center;
	}

	body.ilg-active #colophon :where(.footer-navigation .menu, .widget_nav_menu .menu) {
		display: flex !important;
		flex-wrap: wrap;
		justify-content: center;
		gap: 10px 20px;
		margin: 0;
	}
}

@media (max-width: 414px) {
	body.ilg-active .woocommerce ul.products li.product {
		padding: 7px 7px 12px !important;
		border-radius: 15px !important;
	}

	body.ilg-active .woocommerce ul.products li.product .woocommerce-loop-product__title {
		font-size: 0.82rem !important;
	}

	body.ilg-active .woocommerce ul.products li.product :where(.button, .added_to_cart) {
		min-height: 44px;
		padding: 9px 7px;
		font-size: 0.76rem;
	}
}

@media (max-width: 359px) {
	body.ilg-active #masthead .site-primary-header-wrap {
		padding-inline: 8px !important;
	}

	body.ilg-active #masthead img.ilg-logo__image {
		height: 48px !important;
		max-width: 72px !important;
	}

	body.ilg-active #ast-mobile-header [data-section="section-header-mobile-trigger"],
	body.ilg-active #ast-mobile-header .ilg-mobile-store-actions {
		gap: 4px;
	}

	body.ilg-active #ast-mobile-header :where(
		.ast-site-header-cart .cart-container,
		.ast-header-account-link,
		.menu-toggle
	) {
		width: 38px !important;
		height: 38px !important;
		min-width: 38px !important;
		min-height: 38px !important;
	}

	body.ilg-active .woocommerce ul.products,
	body.ilg-active.woocommerce ul.products,
	body.ilg-active.woocommerce-page ul.products {
		grid-template-columns: minmax(0, 1fr);
	}


}

@media (prefers-reduced-motion: reduce) {
	body.ilg-active *,
	body.ilg-active *::before,
	body.ilg-active *::after {
		scroll-behavior: auto !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}
