/**
 * Sub page hero — full-width shell; band matches hero-stats band; constrained copy + image.
 * Pattern: sub-page-hero
 */

.wp-site-blocks .bnb-sub-page-hero,
.editor-styles-wrapper .bnb-sub-page-hero {
	/* Portion of the fixed-height image that sits below the band (absolute media); grows layout so overflow is not clipped by the next block. */
	--bnb-sub-page-hero-band-height: 670px;
	--bnb-sub-page-hero-image-height: 570px;
	--bnb-sub-page-hero-image-overhang: 160px;

	position: relative;
	margin-top: 0;
	margin-bottom: 0;
	width: 100%;
	max-width: none;
	height: auto;
	min-height: 0;
	padding-bottom: var(--bnb-sub-page-hero-image-overhang);
	box-sizing: border-box;
}

/* Band: fixed height (matches .bnb-hero-stats__band); copy in flow, media absolutely positioned so image can overhang. */
.wp-site-blocks .bnb-sub-page-hero__band,
.editor-styles-wrapper .bnb-sub-page-hero__band {
	position: relative;
	padding-top: 55px !important;
	padding-bottom: 0 !important;
	padding-left: var(--wp--preset--spacing--50);
	padding-right: var(--wp--preset--spacing--50);
	height: var(--bnb-sub-page-hero-band-height, 670px);
	min-height: var(--bnb-sub-page-hero-band-height, 670px);
	max-height: var(--bnb-sub-page-hero-band-height, 670px);
	overflow: visible;
	box-sizing: border-box;
	background-color: var(--wp--preset--color--accent-secondary, #edeef6);
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
}

/*
 * Core .has-global-padding on constrained groups — match hero-stats inner.
 */
.bnb-sub-page-hero__inner,
.wp-site-blocks .bnb-sub-page-hero__inner.has-global-padding,
.editor-styles-wrapper .bnb-sub-page-hero__inner.has-global-padding {
	width: 100%;
	max-width: var(--wp--style--global--wide-size, 1200px);
	margin-left: auto;
	margin-right: auto;
	padding-left: 0 !important;
	padding-right: 0 !important;
}


/* Title/lede above the overlapping image in the band */
.wp-site-blocks .bnb-sub-page-hero__band > .bnb-sub-page-hero__inner,
.editor-styles-wrapper .bnb-sub-page-hero__band > .bnb-sub-page-hero__inner {
	position: relative;
	z-index: 2;
	flex-shrink: 0;
}

/* High specificity so theme.json / core heading & type presets do not override sizes */
.wp-site-blocks .bnb-sub-page-hero h1.bnb-sub-page-hero__title.wp-block-heading,
.editor-styles-wrapper .bnb-sub-page-hero h1.bnb-sub-page-hero__title.wp-block-heading,
.wp-site-blocks .bnb-sub-page-hero .bnb-sub-page-hero__title,
.editor-styles-wrapper .bnb-sub-page-hero .bnb-sub-page-hero__title {
	margin-top: 0 !important;
	margin-bottom: 10px !important;
	font-size: 55px !important;
	font-weight: 700 !important;
	color: #464646 !important;
	line-height: 1.15 !important;
	letter-spacing: -0.02em;
}

.wp-site-blocks .bnb-sub-page-hero p.bnb-sub-page-hero__lede,
.editor-styles-wrapper .bnb-sub-page-hero p.bnb-sub-page-hero__lede,
.wp-site-blocks .bnb-sub-page-hero .bnb-sub-page-hero__lede,
.editor-styles-wrapper .bnb-sub-page-hero .bnb-sub-page-hero__lede {
	margin-top: 0 !important;
	margin-bottom: 0 !important;
	width: 100%;
	max-width: none;
	text-align: center !important;
	font-size: 16px !important;
	color: #464646 !important;
	line-height: 1.55 !important;
}

/* Media: anchored to band bottom, extends below band; out of flow so band stays fixed height */
.wp-site-blocks .bnb-sub-page-hero__media,
.editor-styles-wrapper .bnb-sub-page-hero__media {
	position: absolute;
	left: 0;
	right: 0;
	bottom: calc(-1 * var(--bnb-sub-page-hero-image-overhang, 160px));
	z-index: 1;
	width: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
	background-color: transparent;
	box-sizing: border-box;
}

/* Pull image block 20px closer to copy on wide viewports (tighter gap vs original bottom anchor). */
@media (min-width: 900px) {
	.wp-site-blocks .bnb-sub-page-hero__media,
	.editor-styles-wrapper .bnb-sub-page-hero__media {
		bottom: calc(-1 * var(--bnb-sub-page-hero-image-overhang, 160px) + 20px);
	}
}

.wp-site-blocks .bnb-sub-page-hero__media .bnb-sub-page-hero__inner,
.editor-styles-wrapper .bnb-sub-page-hero__media .bnb-sub-page-hero__inner {
	margin-top: 0;
}

.bnb-sub-page-hero__image {
	margin: 0 !important;
	width: 100% !important;
	max-width: 100% !important;
	overflow: hidden;
	border-radius: clamp(1.5rem, 4vw, 2.75rem);
}

.bnb-sub-page-hero__image img {
	display: block;
	width: 100% !important;
	max-width: 100% !important;
	height: var(--bnb-sub-page-hero-image-height, 570px) !important;
	min-height: var(--bnb-sub-page-hero-image-height, 570px);
	object-fit: cover;
	vertical-align: middle;
	border-radius: inherit;
}

@media (max-width: 899px) {
	.wp-site-blocks .bnb-sub-page-hero,
	.editor-styles-wrapper .bnb-sub-page-hero {
		/* Slightly less vertical hang below the band on narrow viewports */
		--bnb-sub-page-hero-image-overhang: 160px;
	}

	.wp-site-blocks .bnb-sub-page-hero h1.bnb-sub-page-hero__title.wp-block-heading,
	.editor-styles-wrapper .bnb-sub-page-hero h1.bnb-sub-page-hero__title.wp-block-heading,
	.wp-site-blocks .bnb-sub-page-hero .bnb-sub-page-hero__title,
	.editor-styles-wrapper .bnb-sub-page-hero .bnb-sub-page-hero__title {
		font-size: 40px !important;
	}

	.wp-site-blocks .bnb-sub-page-hero__band > .bnb-sub-page-hero__inner,
	.editor-styles-wrapper .bnb-sub-page-hero__band > .bnb-sub-page-hero__inner {
		margin-bottom: 0;
	}

	.wp-site-blocks .bnb-sub-page-hero__media,
	.editor-styles-wrapper .bnb-sub-page-hero__media {
		padding-left: 20px;
		padding-right: 20px;
	}
}

/*
 * Under 500px: copy vs image gap must be done by shifting the absolutely positioned media — margin on
 * .bnb-sub-page-hero__inner does not separate from the image (out-of-flow overlap).
 */
@media (max-width: 499px) {
	.wp-site-blocks .bnb-sub-page-hero,
	.editor-styles-wrapper .bnb-sub-page-hero {
		/* Increase if title + lede still overlap the image on very small screens. */
		--bnb-sub-page-hero-mobile-copy-media-gap: 60px;
		/* Match extra downward shift of media so following content is not covered. */
		padding-bottom: calc(
			var(--bnb-sub-page-hero-image-overhang, 160px) + var(--bnb-sub-page-hero-mobile-copy-media-gap)
		);
	}

	.wp-site-blocks .bnb-sub-page-hero__media,
	.editor-styles-wrapper .bnb-sub-page-hero__media {
		bottom: calc(
			-1 * var(--bnb-sub-page-hero-image-overhang, 160px) - var(--bnb-sub-page-hero-mobile-copy-media-gap)
		);
	}
}
