/**
 * BestBikeBrands vertical-density pass.
 *
 * The live theme intentionally uses generous white space. These rules retain
 * that character while removing the stacked page, article, and module padding
 * that made the header ad and first useful content feel disconnected.
 */
body.bbbp-density {
	--bbbp-page-gap: clamp(28px, 2.8vw, 42px);
	--bbbp-page-gap-bottom: clamp(42px, 4vw, 62px);
	--bbbp-panel-pad-y: clamp(34px, 3.5vw, 50px);
}

/* Keep the leaderboard close to the page it supports without changing its
 * approved dimensions or reserving less space while it loads. */
body.bbbp-density .bbbp-ad-slot--desktop-header {
	margin-top: 24px;
	margin-bottom: 16px;
}

body.bbbp-density .bbbp-ad-slot--desktop-header .bbbp-ad-label {
	margin-bottom: 4px;
}

body.bbbp-density .bbbp-ad-slot--desktop-sidebar {
	margin-bottom: 20px;
}

body.bbbp-density .bbbp-ad-bottom-band {
	padding-top: 20px;
	padding-bottom: 24px;
}

/* Astra's site-content inset, container inset, and primary-column margin can
 * all stack after the leaderboard. Remove those outer layers only when the
 * managed desktop header is actually present, then add one intentional gap. */
@media (min-width: 1024px) {
	body.bbbp-density.bbbp-has-desktop-header .site-content {
		margin-top: 0 !important;
		padding-top: 0 !important;
	}

	body.bbbp-density.bbbp-has-desktop-header .site-content > .ast-container {
		margin-top: 0 !important;
		padding-top: 0 !important;
	}

	body.bbbp-density.bbbp-has-desktop-header #primary,
	body.bbbp-density.bbbp-has-desktop-header #secondary {
		margin-top: 22px !important;
		margin-bottom: var(--bbbp-page-gap-bottom) !important;
		padding-top: 0 !important;
	}

	/* Let the sidebar rail begin slightly below the content panel so its label
	 * and creative do not feel pinned to the top edge. */
	body.bbbp-density.bbbp-has-desktop-header #secondary {
		padding-top: 14px !important;
	}

	body.bbbp-density.bbbp-has-desktop-header .site-main {
		margin-top: 0 !important;
		padding-top: 0 !important;
	}

	body.bbbp-density.bbbp-has-desktop-header .site-main > .ast-article-single:first-child {
		margin-top: 0 !important;
	}

	body.bbbp-density.ast-separate-container:not(.bbbp-has-desktop-header) #primary,
	body.bbbp-density.ast-separate-container:not(.bbbp-has-desktop-header) #secondary {
		margin-top: var(--bbbp-page-gap) !important;
		margin-bottom: var(--bbbp-page-gap-bottom) !important;
	}

	body.bbbp-density.ast-separate-container .ast-article-single {
		padding-top: var(--bbbp-panel-pad-y) !important;
		padding-bottom: var(--bbbp-panel-pad-y) !important;
	}

	/* The custom homepage hero owns its own internal padding. Do not add a
	 * second article-level inset around it. */
	body.bbbp-density.home.ast-separate-container .ast-article-single {
		padding-top: 0 !important;
		padding-bottom: 0 !important;
	}
}

@media (min-width: 768px) and (max-width: 1023px) {
	body.bbbp-density.ast-separate-container #primary,
	body.bbbp-density.ast-separate-container #secondary {
		margin-top: 30px !important;
		margin-bottom: 44px !important;
	}

	body.bbbp-density.ast-separate-container .ast-article-single {
		padding-top: 36px !important;
		padding-bottom: 40px !important;
	}

	body.bbbp-density.home.ast-separate-container .ast-article-single {
		padding-top: 0 !important;
		padding-bottom: 0 !important;
	}
}

/* Homepage sections previously combined a large outer page gap with large
 * component padding. The selectors cover the established child-theme names
 * without touching ordinary Gutenberg sections. */
body.bbbp-density.home .bbb-home-hero,
body.bbbp-density.home .bbb-hero,
body.bbbp-density.home .entry-content > section:first-child[class*="hero"] {
	padding-top: clamp(50px, 5vw, 74px) !important;
	padding-bottom: clamp(50px, 5vw, 74px) !important;
}

body.bbbp-density.home .bbb-home-section--brands,
body.bbbp-density.home .bbb-home-section--editorial {
	padding-top: clamp(40px, 4.5vw, 62px) !important;
	padding-bottom: clamp(40px, 4.5vw, 62px) !important;
}

body.bbbp-density.home .bbbp-home-tools {
	padding-top: clamp(40px, 4.5vw, 52px) !important;
	padding-bottom: clamp(40px, 4.5vw, 52px) !important;
}

body.bbbp-density.home .bbbp-support-home {
	margin-top: clamp(34px, 4.5vw, 54px);
	padding: clamp(22px, 3vw, 32px);
}

/* Brand profiles and discovery modules retain a clear section break, but no
 * longer spend roughly a full viewport row on two adjacent separators. */
body.bbbp-density .bbbp-profile {
	margin-top: clamp(40px, 5vw, 60px);
	padding-top: clamp(28px, 3.6vw, 42px);
}

body.bbbp-density .bbbp-profile__header {
	padding-bottom: 28px;
}

body.bbbp-density .bbbp-profile__section {
	padding-top: 28px;
	padding-bottom: 28px;
}

body.bbbp-density .bbbp-related {
	margin-top: clamp(40px, 5vw, 60px);
	padding-top: clamp(28px, 3.6vw, 42px);
}

body.bbbp-density .bbbp-related__header {
	margin-bottom: 24px;
}

body.bbbp-density .bbbp-support-wrap {
	margin-top: clamp(38px, 5vw, 58px);
	padding-top: clamp(28px, 3.5vw, 40px);
}

body.bbbp-density .bbbp-directory-compare {
	margin-bottom: 26px;
}

/* Standalone tools use their own full-width shells rather than Astra article
 * panels, so they receive a matching but independent vertical rhythm. */
body.bbbp-density .bbbp-explorer-shell {
	padding-top: clamp(28px, 4vw, 52px);
	padding-bottom: clamp(52px, 6vw, 78px);
}

body.bbbp-density .bbbp-compare-main {
	padding-top: clamp(34px, 4.5vw, 60px);
	padding-bottom: clamp(56px, 6vw, 82px);
}

body.bbbp-density .bbbp-tools-shell {
	padding-top: 30px;
	padding-bottom: 64px;
}

body.bbbp-density .bbbp-tool__header {
	padding-top: 34px;
	padding-bottom: 30px;
}

@media (max-width: 767px) {
	body.bbbp-density {
		--bbbp-page-gap: 20px;
		--bbbp-page-gap-bottom: 34px;
	}

	body.bbbp-density.ast-separate-container #primary,
	body.bbbp-density.ast-separate-container #secondary {
		margin-top: var(--bbbp-page-gap) !important;
		margin-bottom: var(--bbbp-page-gap-bottom) !important;
	}

	body.bbbp-density.ast-separate-container .ast-article-single {
		padding-top: 28px !important;
		padding-bottom: 34px !important;
	}

	body.bbbp-density.home.ast-separate-container .ast-article-single {
		padding-top: 0 !important;
		padding-bottom: 0 !important;
	}

	body.bbbp-density.home .bbb-home-hero,
	body.bbbp-density.home .bbb-hero,
	body.bbbp-density.home .entry-content > section:first-child[class*="hero"] {
		padding-top: 40px !important;
		padding-bottom: 44px !important;
	}

	body.bbbp-density.home .bbb-home-section--brands,
	body.bbbp-density.home .bbb-home-section--editorial,
	body.bbbp-density.home .bbbp-home-tools {
		padding-top: 36px !important;
		padding-bottom: 36px !important;
	}

	body.bbbp-density .bbbp-profile,
	body.bbbp-density .bbbp-related,
	body.bbbp-density .bbbp-support-wrap {
		margin-top: 36px;
		padding-top: 28px;
	}

	body.bbbp-density .bbbp-profile__header,
	body.bbbp-density .bbbp-profile__section {
		padding-top: 24px;
		padding-bottom: 24px;
	}

	body.bbbp-density .bbbp-tools-shell {
		padding-top: 22px;
		padding-bottom: 44px;
	}
}
