/*
 * EMS compact storefront pass (3.63.0)
 *
 * This is a sizing-only layer. It deliberately avoids zoom/scale/viewport
 * tricks and leaves the approved homepage hero positioning untouched.
 */

:root {
	--ems-home-section-heading-size: 30px;
	--ems-home-section-heading-size-mobile: 25px;
	--ems-home-section-subtext-size: 14px;
	--ems-home-section-subtext-size-mobile: 16px;
	--ems-home-section-subtext-line: 1.45;
}

/* Shared typography for regular homepage sections. Hero copy, product cards,
 * controls, and footer typography remain outside these selectors. */
.ems-homepage :is(
	.bd-el-sale > h2,
	.ems-hp-collections h2,
	.bd-el-featured-categories__head > h2,
	.bd-el-section-head > h2,
	.bd-el-buy-ease > h2,
	.bd-el-feedback h2,
	.bd-el-gallery-section .bd-el-title,
	.bd-el-story-hero-text > h2,
	.bd-el-door-content > h2,
	.bd-el-buy-now-header > h2,
	.bd-el-warranty-content > h2,
	.bd-el-buy-with-copy > h2,
	.bd-el-sc-header > h2
) {
	font-size: var(--ems-home-section-heading-size) !important;
	line-height: 1.2 !important;
	font-weight: 900 !important;
	letter-spacing: 0 !important;
}

.ems-homepage :is(
	.bd-el-sale > p,
	.ems-hp-collections p,
	.bd-el-story-hero-text > p,
	.bd-el-door-content > p,
	.bd-el-buy-now-copy > p,
	.bd-el-warranty-content > p,
	.bd-el-buy-with-copy > p,
	.bd-el-sc-header > p,
	.bd-el-ease-card > p,
	.bd-el-buy-card > p
) {
	font-size: var(--ems-home-section-subtext-size) !important;
	line-height: var(--ems-home-section-subtext-line) !important;
	font-weight: 400 !important;
	letter-spacing: 0 !important;
	margin-bottom: 14px !important;
}

.ems-homepage :is(
	.bd-el-sale > p:last-child,
	.ems-hp-collections p:last-child,
	.bd-el-story-hero-text > p:last-child,
	.bd-el-door-content > p:last-child,
	.bd-el-buy-now-copy > p:last-child,
	.bd-el-warranty-content > p:last-child,
	.bd-el-buy-with-copy > p:last-child,
	.bd-el-sc-header > p:last-child,
	.bd-el-ease-card > p:last-child,
	.bd-el-buy-card > p:last-child
) {
	margin-bottom: 0 !important;
}

/* Shared section headings and page shells: modestly tighter, never body copy. */
.ems-homepage .bd-el-section:not(.bd-el-hero):not(.ems-hp-hero-slider) {
	padding-top: clamp(48px, 4.25vw, 64px) !important;
	padding-bottom: clamp(58px, 4.8vw, 68px) !important;
}

.ems-homepage .bd-el-section-head h2,
.ems-homepage .bd-el-section-title,
.ems-homepage .bd-el-featured-categories__title {
	font-size: var(--ems-home-section-heading-size) !important;
	line-height: 1.2 !important;
}

.ems-homepage .bd-el-section-head {
	margin-bottom: clamp(28px, 3vw, 42px) !important;
}

/* The hero's lower position is intentionally not overridden here. */
.ems-homepage .ems-hp-hero-slider .ems-hp-hero__content.bd-el-wrap,
.ems-homepage .bd-el-hero .bd-el-wrap {
	/* Keep the existing responsive padding-top from the hero stylesheet. */
}

/* Archive title band and toolbar. */
@media (min-width: 768px) {
	body.ems-shell-active .ems-shell-primary__inner {
		gap: 24px !important;
	}

	body.ems-shell-active .ems-shell-logo--header img,
	body.ems-shell-active .ems-shell-logo--header .ems-shell-logo__image {
		max-width: 180px !important;
	}

	body.ems-shell-active .ems-shell-search--desktop {
		height: 54px !important;
		grid-template-columns: minmax(220px, 1fr) 180px 54px !important;
	}

	body.ems-shell-active .ems-shell-search--desktop .ems-shell-search__input,
	body.ems-shell-active .ems-shell-search--desktop .ems-shell-search__category,
	body.ems-shell-active .ems-shell-search--desktop .ems-shell-search__submit {
		height: 54px !important;
		min-height: 54px !important;
	}

	body.ems-shell-active .ems-shell-nav-row,
	body.ems-shell-active .ems-shell-nav__list {
		min-height: 54px !important;
	}

	body.ems-catalog-active .wd-page-title {
		height: 220px !important;
		min-height: 220px !important;
	}

	body.ems-catalog-active .wd-page-title .entry-title,
	body.ems-catalog-active .wd-page-title .entry-title.title,
	body.ems-catalog-active .wd-page-title .title {
		font-size: clamp(54px, 4.5vw, 58px) !important;
		line-height: 1.08 !important;
	}

	body.ems-catalog-active .shop-loop-head {
		column-gap: 34px !important;
		padding-top: 30px !important;
		padding-bottom: 54px !important;
	}
}

/* Single-product and information-page display headings. */
.ems-product-page .product_title {
	font-size: clamp(30px, 2.25vw, 31px) !important;
	line-height: 1.22 !important;
}

.ems-product-page .ems-product-section-header h2,
.ems-product-page .ems-product-inquiry h2 {
	font-size: 22px !important;
	line-height: 1.25 !important;
}

.ems-product-page .ems-product-price {
	font-size: clamp(27px, 2.2vw, 30px) !important;
}

.ems-all-equipment__hero {
	padding-top: 52px;
	padding-bottom: 42px;
}

.ems-all-equipment__hero h1 {
	font-size: clamp(52px, 4.5vw, 58px);
	line-height: 1.08;
}

body.ems-reference-page--shipping-policy .entry-header > .entry-title,
body.ems-reference-page--privacy-policy .entry-header > .entry-title,
body.ems-reference-page--track-order .entry-header > .entry-title {
	font-size: 42px;
}

.ems-contact-form-wrap h2 {
	font-size: 31px;
}

/* Shared product card rhythm. */
.product-card__title,
body.ems-catalog-active .wd-products-element .wd-entities-title {
	display: -webkit-box !important;
	margin-top: 14px !important;
	font-size: clamp(15px, 1.17vw, 19px) !important;
	line-height: 1.36 !important;
	overflow: hidden !important;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
}

.product-card__term,
body.ems-catalog-active .wd-products-element .product-card__term {
	margin-top: 11px !important;
	font-size: clamp(13px, 1vw, 16px) !important;
}

.product-card__price,
body.ems-catalog-active .wd-products-element .product-card__price {
	margin-top: 15px !important;
	font-size: clamp(17px, 1.3vw, 21px) !important;
	line-height: 1.3 !important;
}

.product-card__price .ems-price-stack,
.ems-hp-product__price .ems-price-stack {
	gap: 3px 6px !important;
}

/* Keep homepage/shortcode/related grids compact while preserving desktop count. */
.ems-homepage .bd-el-products-grid,
.ems-homepage .ems-hp-product-grid,
.ems-hp-product-grid,
.ems-related-products .products {
	gap: 24px 20px !important;
}

.ems-related-products .product {
	padding-bottom: 10px !important;
}

/* Related carousel cards use the same two-column mobile density as archives. */
.ems-related-carousel__track {
	gap: 16px !important;
}

@media (max-width: 1023px) and (min-width: 768px) {
	.ems-homepage .bd-el-products-grid,
	.ems-homepage .ems-hp-product-grid,
	.ems-hp-product-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
		gap: 22px 16px !important;
	}

	.ems-related-products .products {
		grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
		gap: 18px !important;
	}
}

/* Exactly two product columns throughout the storefront on phone widths. */
@media (max-width: 767px) {
	.ems-homepage .bd-el-products-grid,
	.ems-homepage .ems-hp-product-grid,
	.ems-hp-product-grid,
	body.ems-catalog-active .wd-products-element > .products,
	body.ems-catalog-active .wd-products-element > .products[data-ems-view="grid-3"],
	body.ems-catalog-active .wd-products-element > .products[data-ems-view="grid-4"],
	.ems-related-products .products {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		column-gap: 10px !important;
		row-gap: 26px !important;
	}

	.ems-related-carousel {
		padding-right: 32px !important;
		padding-left: 32px !important;
	}

	.ems-related-carousel__track {
		gap: 10px !important;
	}

	.ems-related-carousel__slide {
		flex-basis: calc((100% - 10px) / 2) !important;
	}

	.product-card__image,
	.ems-hp-product__media,
	body.ems-catalog-active .wd-products-element .wd-product-thumb,
	.ems-related-products .product img,
	.ems-related-products .product .ems-product-placeholder {
		aspect-ratio: 1 / 1 !important;
	}

	.product-card__badge,
	.ems-hp-product__badge {
		top: 6px !important;
		left: 6px !important;
		padding: 6px 7px !important;
		font-size: 11px !important;
		line-height: 1 !important;
	}

	.product-card__title,
	body.ems-catalog-active .wd-products-element .wd-entities-title,
	.ems-related-products .product .woocommerce-loop-product__title {
		display: -webkit-box !important;
		height: 3.9em !important;
		min-height: 3.9em !important;
		margin-top: 10px !important;
		font-size: 14px !important;
		line-height: 1.3 !important;
	}

	.product-card__term,
	body.ems-catalog-active .wd-products-element .product-card__term {
		min-height: 1.3em;
		margin-top: 7px !important;
		font-size: 12px !important;
		line-height: 1.3 !important;
	}

	.product-card__price,
	body.ems-catalog-active .wd-products-element .product-card__price,
	.ems-related-products .product .price {
		margin-top: 9px !important;
		font-size: 17px !important;
		line-height: 1.25 !important;
	}

	/* Keep the all-equipment directory dense without changing its card data. */
	.ems-all-equipment__body {
		padding-top: 42px !important;
		padding-bottom: 72px !important;
	}

	.ems-all-equipment__hero {
		padding-top: 42px !important;
		padding-bottom: 36px !important;
	}

	.ems-all-equipment__hero h1 {
		font-size: 36px !important;
	}

	/* Compact spacing, but keep every normal mobile text field at a readable size. */
	.ems-homepage .bd-el-section:not(.bd-el-hero):not(.ems-hp-hero-slider) {
		padding-top: 38px !important;
		padding-bottom: 52px !important;
	}

	.ems-homepage .bd-el-section-head {
		margin-bottom: 30px !important;
	}

	.ems-homepage .bd-el-section-head h2,
	.ems-homepage .bd-el-section-title,
	.ems-homepage .bd-el-featured-categories__title {
		font-size: var(--ems-home-section-heading-size-mobile) !important;
		line-height: 1.2 !important;
	}

	/* Keep every regular homepage section heading and supporting paragraph on
	 * the same compact, readable mobile scale. Hero copy, cards, controls and
	 * footer typography remain intentionally excluded. */
	.ems-homepage :is(
		.bd-el-sale > h2,
		.ems-hp-collections h2,
		.bd-el-featured-categories__head > h2,
		.bd-el-section-head > h2,
		.bd-el-buy-ease > h2,
		.bd-el-feedback h2,
		.bd-el-gallery-section .bd-el-title,
		.bd-el-story-hero-text > h2,
		.bd-el-door-content > h2,
		.bd-el-buy-now-header > h2,
		.bd-el-warranty-content > h2,
		.bd-el-buy-with-copy > h2,
		.bd-el-sc-header > h2
	) {
		font-size: var(--ems-home-section-heading-size-mobile) !important;
		line-height: 1.2 !important;
	}

	.ems-homepage :is(
		.bd-el-sale > p,
		.ems-hp-collections p,
		.bd-el-story-hero-text > p,
		.bd-el-door-content > p,
		.bd-el-buy-now-copy > p,
		.bd-el-warranty-content > p,
		.bd-el-buy-with-copy > p,
		.bd-el-sc-header > p,
		.bd-el-ease-card > p,
		.bd-el-buy-card > p
	) {
		font-size: var(--ems-home-section-subtext-size-mobile) !important;
		line-height: var(--ems-home-section-subtext-line) !important;
	}

	.ems-product-page .product_title {
		font-size: 26px !important;
		line-height: 1.22 !important;
	}

	body.ems-catalog-active .wd-page-title .entry-title.title {
		font-size: clamp(36px, 9vw, 54px) !important;
		line-height: 1.08 !important;
	}

	.ems-product-page .ems-product-section-header h2,
	.ems-product-page .ems-product-inquiry h2 {
		font-size: 26px !important;
	}

	.ems-reference-page__content h1,
	.ems-reference-page__content h2,
	.ems-reference-page__content h3 {
		line-height: 1.22 !important;
	}

	body.ems-reference-page--shipping-policy .entry-header > .entry-title,
	body.ems-reference-page--privacy-policy .entry-header > .entry-title,
	body.ems-reference-page--track-order .entry-header > .entry-title {
		width: min(100% - 28px, 1100px) !important;
		margin-top: 28px !important;
		font-size: 34px !important;
	}

	.ems-contact-form-wrap {
		margin-top: 52px !important;
		margin-bottom: 62px !important;
	}

	.ems-contact-form-wrap h2 {
		font-size: 30px !important;
		margin-bottom: 30px !important;
	}
}

@media (max-width: 390px) {
	.ems-homepage .bd-el-products-grid,
	.ems-homepage .ems-hp-product-grid,
	.ems-hp-product-grid,
	body.ems-catalog-active .wd-products-element > .products,
	.ems-related-products .products {
		column-gap: 9px !important;
		row-gap: 24px !important;
	}

	.product-card__title,
	body.ems-catalog-active .wd-products-element .wd-entities-title,
	.ems-related-products .product .woocommerce-loop-product__title {
		font-size: 13.5px !important;
	}

	.product-card__price,
	body.ems-catalog-active .wd-products-element .product-card__price,
	.ems-related-products .product .price {
		font-size: 16px !important;
	}
}

/* Product archive names must remain fully readable on phones.  The compact
 * three-line box can cut a fourth line through its glyphs before the category
 * label, so archive cards use their natural title height instead. */
@media (max-width: 767px) {
	body.archive.ems-catalog-active .product-card__title,
	body.archive.ems-catalog-active .wd-products-element .wd-entities-title,
	body.archive.ems-catalog-active.woocommerce-uses-block-theme
		.wc-block-product-template > .wc-block-product > .wp-block-post-title {
		display: block !important;
		height: auto !important;
		min-height: 0 !important;
		max-height: none !important;
		overflow: visible !important;
		-webkit-box-orient: initial !important;
		-webkit-line-clamp: unset !important;
		line-clamp: unset !important;
	}
}
