/**
 * Med Spa hero: composition, type scale and background (Phase 2A.4 media, 2A.4.1 polish).
 *
 * Loaded only on pages that render the Med Spa hero (inc/hero-media.php), after the
 * editorial-luxury design style, so the global design-style CSS is unchanged. Selectors carry
 * one extra class over the design style's hero rules, so they win without reordering.
 *
 * Background colours are sampled from the hero video (poster frame): the warm ivory on the
 * left of the frame and the peach just inside the blended edge of the media column. The page
 * behind the text therefore continues the video's own backdrop with no visible tone change.
 */

body.studio-has-design-style .studio-hero.studio-hero-luxury {
	/* Sampled from hero-ambient-poster.jpg; see studio/docs/MEDSPA-SITE-CONTENT.md. */
	--sbh-bg-left: #f7eee2;
	--sbh-bg-seam: #f4e6d6;
	background: linear-gradient(to right, var(--sbh-bg-left) 0%, var(--sbh-bg-seam) var(--sbh-seam, 46%), var(--sbh-bg-seam) 100%) !important;
}

/* ---------- 900px and wider: type scale and vertical balance ---------- */
@media (min-width: 900px) {
	body.studio-has-design-style .studio-hero.studio-hero-luxury {
		/* Headline scale: unchanged up to about 1280px, then grows with the viewport. */
		--sbh-h1: clamp(2.25rem, 1.125rem + 2.19vw, 3.5rem);
		/* Where the page colour meets the media column (the text column's width). */
		--sbh-seam: 44%;
	}
	body.studio-has-design-style .studio-hero .studio-hero-text-col {
		/* Centre the text block between the header and the bottom of the hero. */
		justify-content: center !important;
		padding-top: clamp(96px, 7.5vw, 128px) !important;
		padding-bottom: clamp(1.5rem, 2.5vw, 2.75rem) !important;
	}

	/* Type: larger headline, 18-19px lede with a wider measure, larger buttons and trust row. */
	body.studio-has-design-style .studio-hero .sb-hero-title-main {
		font-size: var(--sbh-h1) !important;
	}
	body.studio-has-design-style .studio-hero .sb-hero-title-sub {
		font-size: calc(var(--sbh-h1) * 0.915) !important;
	}
	body.studio-has-design-style .studio-hero .studio-hero-lede {
		font-size: clamp(1rem, 0.55rem + 0.62vw, 1.1875rem) !important;
		line-height: 1.6 !important;
		max-width: 42ch !important;
		margin-top: clamp(28px, 2.4vw, 40px) !important;
	}
	body.studio-has-design-style .studio-hero .studio-hero-ctas {
		margin-top: clamp(28px, 2.4vw, 40px) !important;
		gap: 0.9rem !important;
	}
	body.studio-has-design-style .studio-hero .studio-hero-ctas .wp-block-button__link {
		height: clamp(48px, 1.25vw + 32px, 56px) !important;
		padding: 0 clamp(1.65rem, 1.1rem + 0.7vw, 2.15rem) !important;
		font-size: clamp(0.84rem, 0.6rem + 0.3vw, 0.97rem) !important;
	}
	body.studio-has-design-style .studio-hero .studio-hero-trust-row {
		margin-top: clamp(40px, 3.4vw, 60px) !important;
		max-width: clamp(560px, 30vw + 160px, 700px) !important;
		gap: 0.9rem !important;
	}
	body.studio-has-design-style .studio-hero .sb-trust-item {
		gap: 0.55rem !important;
	}
	body.studio-has-design-style .studio-hero .sb-trust-icon {
		height: clamp(32px, 1.1vw + 18px, 42px) !important;
		max-width: 52px !important;
	}
	body.studio-has-design-style .studio-hero .sb-trust-label {
		font-size: clamp(0.8125rem, 0.62rem + 0.24vw, 0.9375rem) !important;
	}
}

/* ---------- 900-1279px: the 2A.4 layout and framing (the column is too narrow to recompose) ---------- */
@media (min-width: 900px) and (max-width: 1279px) {
	body.studio-has-design-style .studio-hero .studio-hero-media-wrap img,
	body.studio-has-design-style .studio-hero .studio-hero-media-wrap video {
		/* Keeps the face in view and clear of the headline in the tall media column. */
		object-position: 68% 0% !important;
	}
	/* The trust row stays inside the narrow text column; labels may take two lines. */
	body.studio-has-design-style .studio-hero .studio-hero-trust-row {
		max-width: 100% !important;
	}
	body.studio-has-design-style .studio-hero .sb-trust-label {
		white-space: normal !important;
		line-height: 1.3 !important;
	}
}
@media (min-width: 1200px) and (max-width: 1279px) {
	body.studio-has-design-style .studio-hero .studio-hero-media-wrap img,
	body.studio-has-design-style .studio-hero .studio-hero-media-wrap video {
		object-position: 75% 0% !important;
	}
}

/* ---------- 1280px and wider: one composition ---------- */
@media (min-width: 1280px) {
	body.studio-has-design-style .studio-hero.studio-hero-luxury {
		/* Text sits in a centred container on wide screens (1720px), aligned with the page gutter below that. */
		--sbh-pad: max(clamp(2.5rem, 5.8vw, 5.5rem), calc((100vw - 1720px) / 2 + 5.5rem));
		/* Text column: the headline (about 12.9 em wide) plus its gutter, between 44% and 52%. */
		--sbh-text: clamp(44%, calc(var(--sbh-pad) + 12.9 * var(--sbh-h1) + 2rem), 52%);
		--sbh-seam: var(--sbh-text);
		/*
		 * Media size: the 16:9 frame is drawn 50.6vw tall (0.9x of the 1080p source at 1920px,
		 * capped at 1.2x) and never shorter than the hero, then right-aligned. The face (about 670
		 * source pixels from the frame's right edge) then sits at about 64-69% of the viewport, and
		 * the hair stays clear of the right edge and the header actions. The frame starts a little
		 * below the hero top, so the hair clears the header row; its top edge fades into the page
		 * colour (which matches the video backdrop), and it still reaches the bottom of the hero.
		 */
		--sbh-media-top: clamp(16px, 2.5vw, 48px);
		--sbh-media-h: max(calc(100% - var(--sbh-media-top)), min(50.6vw, 1296px));
	}

	body.studio-has-design-style .studio-hero .studio-hero-text-col {
		flex: 0 0 var(--sbh-text) !important;
		max-width: var(--sbh-text) !important;
		padding-left: var(--sbh-pad) !important;
		padding-right: clamp(1rem, 2vw, 2.5rem) !important;
	}
	body.studio-has-design-style .studio-hero .studio-hero-image-col {
		flex: 1 1 auto !important;
		max-width: none !important;
	}
	body.studio-has-design-style .studio-hero .studio-hero-media-wrap {
		overflow: hidden !important;
		/* Same left blend as before, plus a soft top edge where the frame starts. */
		-webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.4) 3%, #000 12%, #000 100%), linear-gradient(to bottom, transparent 0, transparent var(--sbh-media-top), #000 calc(var(--sbh-media-top) + 56px)) !important;
		mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.4) 3%, #000 12%, #000 100%), linear-gradient(to bottom, transparent 0, transparent var(--sbh-media-top), #000 calc(var(--sbh-media-top) + 56px)) !important;
		-webkit-mask-composite: source-in !important;
		mask-composite: intersect !important;
	}
	body.studio-has-design-style .studio-hero .studio-hero-media-wrap .wp-block-image {
		position: absolute !important;
		inset: 0 !important;
	}
	body.studio-has-design-style .studio-hero .studio-hero-media-wrap img,
	body.studio-has-design-style .studio-hero .studio-hero-media-wrap video {
		position: absolute !important;
		top: var(--sbh-media-top) !important;
		right: 0 !important;
		left: auto !important;
		bottom: auto !important;
		height: var(--sbh-media-h) !important;
		min-height: 0 !important;
		width: auto !important;
		max-width: none !important;
		aspect-ratio: 16 / 9 !important;
		object-fit: cover !important;
		object-position: 100% 0% !important;
	}

}

/* ---------- Below 900px: same structure, matching colour, readable labels ---------- */
@media (max-width: 899px) {
	body.studio-has-design-style .studio-hero.studio-hero-luxury {
		/* The text panel continues the bottom of the mobile still. */
		background: linear-gradient(to bottom, var(--sbh-bg-seam) 0%, var(--sbh-bg-left) 100%) !important;
	}
	/*
	 * Phase 2A.5: the mobile still is a 6:5 head-and-shoulders crop of the poster
	 * (hero-ambient-mobile-portrait.jpg) drawn at its own ratio, full width, so the whole head,
	 * hair and shoulders show at every phone and tablet width. Before, a front-facing still was
	 * forced into a 235px band and lost the hair and chin from about 600px up.
	 */
	body.studio-has-design-style .studio-hero .studio-hero-media-wrap img {
		height: auto !important;
		min-height: 0 !important;
		max-height: none !important;
		aspect-ratio: 1056 / 880 !important;
		object-fit: cover !important;
		object-position: 50% 0% !important;
	}
	/*
	 * The image column comes after the text in the markup but shows above it. A two-row grid
	 * reserves the image row (full width at 6:5) from the first paint, so the text never jumps
	 * down when the image column arrives later in a slow, streamed page.
	 */
	body.studio-has-design-style .studio-hero .studio-hero-columns {
		display: grid !important;
		grid-template-columns: 100% !important;
		grid-template-rows: calc(100vw * 880 / 1056) auto !important;
	}
	body.studio-has-design-style .studio-hero .studio-hero-image-col {
		grid-row: 1 !important;
	}
	body.studio-has-design-style .studio-hero .studio-hero-text-col {
		grid-row: 2 !important;
	}
	body.studio-has-design-style .studio-hero .sb-trust-label {
		font-size: 13px !important;
	}
}
