/*
 * Brandably Header Hero Section Shell — component styles.
 *
 * Scoped strictly to .brandably-section-shell. Does NOT redefine the grid,
 * gutters, breakpoints, or global heading scale (those live in grid.css).
 * Reuses existing Brandably tokens: --grid-wide-width, --brandably-section-spacing,
 * --brandably-content-width, --brandably-color-*, and the existing button system.
 */

.wp-block-brandably-header-hero {
	/* Render above the site background; the section owns its full-bleed band. */
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: none;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding-top: var(--brandably-section-spacing, 3.6em);
	padding-bottom: var(--brandably-section-spacing, 3.6em);
	background-color: color-mix(
		in srgb,
		var(--brandably-section-shell-bg, var(--brandably-color-dark, #1f242c))
			var(--brandably-section-shell-bg-alpha, 100%),
		transparent
	);
}

/* Brand gradient fill (behind image, under overlay).
   Painted on .__background::after (not the section ::before) so it sits in the
   same layer tree as the image/overlay. Section ::before sits behind the full-
   bleed .__background sibling and is easy to “lose” visually.
   Specificity must beat each fork’s `.wp-block-brandably-*` root color-mix
   (those stylesheets load after this file). */
.brandably-section-shell.brandably-section-shell--bg-fill-gradient {
	background-color: transparent;
}

.brandably-section-shell.brandably-section-shell--bg-fill-gradient .brandably-section-shell__background {
	/* Keep fill/image/overlay in one stacking context so ::after (fill) stays visible. */
	isolation: isolate;
}

.brandably-section-shell.brandably-section-shell--bg-fill-gradient .brandably-section-shell__background::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background-image: var(--brandably-section-shell-bg-gradient, none);
	background-repeat: no-repeat;
	background-size: cover;
	opacity: var(--brandably-section-shell-bg-fill-opacity, 1);
}

/* Full-bleed background layer. Absolute so it never affects height.
   Image is painted on ::before so image opacity never dims the overlay child. */
.brandably-section-shell__background {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 0;
	background: transparent;
}

.brandably-section-shell__background::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 0;
	background-image: var(--brandably-shell-bg-image, none);
	background-size: cover;
	background-position: var(--brandably-shell-bg-position, 50% 50%);
	background-repeat: no-repeat;
	background-attachment: var(--brandably-shell-bg-attachment, scroll);
	opacity: var(--brandably-shell-bg-image-opacity, 1);
}

/* Fixed attachment is desktop/laptop only — mobile browsers often ignore it
   and it can cause jank, so force scroll below the shell tablet breakpoint. */
@media screen and (max-width: 839px) {
	.brandably-section-shell__background::before {
		background-attachment: scroll;
	}
}

/* Independent overlay layer above the image.
   Colour comes from the Brandably palette via --brandably-shell-overlay-color
   (a core preset variable that tracks the customizer palette); strength and
   direction come from the primitive alpha/angle custom properties emitted by
   the renderer. The overlay-type class picks the shape (solid/linear/radial).
   colour-mix applies the chosen colour at the given strength. */
.brandably-section-shell__overlay {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1;
	background: transparent;
	pointer-events: none;
}

/* Solid — a single flat overlay at the start strength. */
.brandably-section-shell--overlay-type-solid .brandably-section-shell__overlay {
	background: color-mix(
		in srgb,
		var(--brandably-shell-overlay-color) var(--brandably-shell-overlay-start-alpha, 70%),
		transparent
	);
}

/* Linear gradient along the chosen direction (angle). */
.brandably-section-shell--overlay-type-linear .brandably-section-shell__overlay {
	background: linear-gradient(
		var(--brandably-shell-overlay-angle, 90deg),
		color-mix(
			in srgb,
			var(--brandably-shell-overlay-color) var(--brandably-shell-overlay-start-alpha, 70%),
			transparent
		) 0%,
		color-mix(
			in srgb,
			var(--brandably-shell-overlay-color) var(--brandably-shell-overlay-end-alpha, 20%),
			transparent
		) 100%
	);
}

/* Radial gradient — elliptic, centred. */
.brandably-section-shell--overlay-type-radial .brandably-section-shell__overlay {
	background: radial-gradient(
		ellipse at center,
		color-mix(
			in srgb,
			var(--brandably-shell-overlay-color) var(--brandably-shell-overlay-start-alpha, 70%),
			transparent
		) 0%,
		color-mix(
			in srgb,
			var(--brandably-shell-overlay-color) var(--brandably-shell-overlay-end-alpha, 20%),
			transparent
		) 70%
	);
}

/* Content stack stays above the background + overlay.
   Content well: Site max (or shell container width) + .inner side padding;
   child .row fills the well. */
.brandably-section-shell__content-wrap {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: var(--brandably-section-shell-container-width, var(--grid-wide-width, 1440px));
	margin-left: auto;
	margin-right: auto;
	box-sizing: border-box;
}

.brandably-section-shell__content-wrap > .row,
.brandably-section-shell__content-wrap > .row.brandably-row--wide,
.brandably-section-shell__content-wrap > .row.brandably-row--medium,
.brandably-section-shell__content-wrap > .row.brandably-row--narrow {
	max-width: none;
	width: 100%;
	margin-left: 0;
	margin-right: 0;
}

@media screen and (min-width: 840px) {
	.brandably-section-shell--layout-content-center .brandably-section-shell__content {
		grid-column: 3 / span 8;
		text-align: center;
		align-items: center;
		margin-inline: auto;
	}
	.brandably-section-shell--layout-content-center .brandably-section-shell__actions {
		justify-content: center;
	}
	.brandably-section-shell--layout-content-right .brandably-section-shell__content {
		grid-column: 5 / span 8;
		text-align: right;
		align-items: flex-end;
	}
	.brandably-section-shell--layout-content-right .brandably-section-shell__actions {
		justify-content: flex-end;
	}
}

/* Small screens: keep the centred 2/8/2 content centred. The single-column
   grid already stacks it full-width (col-* collapses to 1 / -1 below 840px),
   so only the centring alignment needs to carry over. */
@media screen and (max-width: 839px) {
	.brandably-section-shell--layout-content-center .brandably-section-shell__content {
		text-align: center;
		align-items: center;
		margin-inline: auto;
	}
	.brandably-section-shell--layout-content-center .brandably-section-shell__actions {
		justify-content: center;
	}
	.brandably-section-shell--layout-content-right .brandably-section-shell__content {
		text-align: left;
		align-items: flex-start;
	}
	.brandably-section-shell--layout-content-right .brandably-section-shell__actions {
		justify-content: flex-start;
	}
	/*
	 * Viewport on small screens: keep equal air above/below the copy.
	 * Uses --brandably-hero-content-pad-mobile (~70% of section spacing,
	 * min 1.75rem) — not the old 0.75rem–2em crush.
	 * First-in-main also adds chrome-clear via utilities.css.
	 */
	.brandably-section-shell--height-viewport {
		padding-top: var(--brandably-hero-content-pad-mobile, 1.75rem);
		padding-bottom: var(--brandably-hero-content-pad-mobile, 1.75rem);
	}
}

/* ==========================================================================
   Height modes — min-height ONLY (never fixed height / no clipping).
   Fluid clamp(rem, vh, rem): clear steps on phones, grow on tall screens.
   ========================================================================== */

/* Content: natural height + existing Brandably section spacing (no extra). */
.brandably-section-shell--height-content {
	min-height: 0;
}

.brandably-section-shell--height-compact {
	min-height: clamp(18rem, 30vh, 22rem);
}

.brandably-section-shell--height-standard {
	min-height: clamp(26rem, 50vh, 38rem);
}

.brandably-section-shell--height-hero {
	min-height: clamp(34rem, 70vh, 50rem);
}

/* Viewport: at least the dynamic available browser viewport height.
   Content may always grow the section (min-height, expandable). */
.brandably-section-shell--height-viewport {
	min-height: 100svh;
}

/* Fallback for browsers without svh: treat as vh then have svh win. */
@supports not ( min-height: 100svh ) {
	.brandably-section-shell--height-viewport {
		min-height: 100vh;
	}
}

/* ==========================================================================
   Main content stack (eyebrow -> title -> excerpt -> actions).
   ========================================================================== */

.brandably-section-shell__content {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	text-align: left;
}

.brandably-section-shell__eyebrow {
	margin: 0 0 1.6rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wp--preset--color--accent, var(--brandably-color-accent, #ffcb50));
}

.brandably-section-shell__title {
	margin-top: 0;
	max-width: 100%;
	overflow-wrap: break-word;
	line-height: 1.1;
	/* Optional text outline (width/colour set inline per instance).
	   paint-order keeps the fill on top so the glyph stays readable. */
	-webkit-text-stroke-width: var(--brandably-title-outline-width, 0);
	-webkit-text-stroke-color: var(--brandably-title-outline-color, transparent);
	paint-order: stroke fill;
}

/*
 * Title size picker (H1–H6 + Hero XL/XXL).
 * Fluid clamps match grid / Gutenberg presets: Customizer px = desktop max,
 * ~55% floor on small screens. Beats element h1–h6 tag rules.
 */
.brandably-section-shell__title.has-h6-font-size {
	font-size: var(--wp--preset--font-size--h-6, var(--wp--preset--font-size--h6, clamp(max(1rem, calc(var(--brandably-size-h6, 20px) * 0.55)), calc(0.2rem + 1.5vw), var(--brandably-size-h6, 20px)))) !important;
}
.brandably-section-shell__title.has-h5-font-size {
	font-size: var(--wp--preset--font-size--h-5, var(--wp--preset--font-size--h5, clamp(max(1.125rem, calc(var(--brandably-size-h5, 26px) * 0.55)), calc(0.25rem + 2vw), var(--brandably-size-h5, 26px)))) !important;
}
.brandably-section-shell__title.has-h4-font-size {
	font-size: var(--wp--preset--font-size--h-4, var(--wp--preset--font-size--h4, clamp(max(1.25rem, calc(var(--brandably-size-h4, 32px) * 0.55)), calc(0.25rem + 2.5vw), var(--brandably-size-h4, 32px)))) !important;
}
.brandably-section-shell__title.has-h3-font-size {
	font-size: var(--wp--preset--font-size--h-3, var(--wp--preset--font-size--h3, clamp(max(1.5rem, calc(var(--brandably-size-h3, 36px) * 0.55)), calc(0.3rem + 2.8vw), var(--brandably-size-h3, 36px)))) !important;
}
.brandably-section-shell__title.has-h2-font-size {
	font-size: var(--wp--preset--font-size--h-2, var(--wp--preset--font-size--h2, clamp(max(1.75rem, calc(var(--brandably-size-h2, 40px) * 0.55)), calc(0.35rem + 3.2vw), var(--brandably-size-h2, 40px)))) !important;
}
.brandably-section-shell__title.has-h1-font-size {
	font-size: var(--wp--preset--font-size--h-1, var(--wp--preset--font-size--h1, clamp(max(2rem, calc(var(--brandably-size-h1, 60px) * 0.55)), calc(0.35rem + 4.8vw), var(--brandably-size-h1, 60px)))) !important;
}
.brandably-section-shell__title.has-hero-xl-font-size {
	font-size: var(--wp--preset--font-size--hero-xl, clamp(max(2.5rem, calc(var(--brandably-size-hero-xl, 80px) * 0.5)), calc(0.85rem + 5.2vw), var(--brandably-size-hero-xl, 80px))) !important;
}
.brandably-section-shell__title.has-hero-xxl-font-size {
	font-size: var(--wp--preset--font-size--hero-xxl, clamp(max(3rem, calc(var(--brandably-size-hero-xxl, 96px) * 0.5)), calc(1rem + 6vw), var(--brandably-size-hero-xxl, 96px))) !important;
}

/* Controlled Brandably-approved title shadow treatments only. The alpha is
   driven by --brandably-title-shadow-strength (set inline per instance only
   when the user customises it). When absent it falls back to 55%, the exact
   alpha of the original rgba(...,0.55) presets, so existing blocks are
   unchanged. Offsets and blur stay fixed per preset. */
.brandably-section-shell__title--shadow-dark {
	text-shadow: 0 2px 20px color-mix(
		in srgb,
		rgba(0, 0, 0, 1) var(--brandably-title-shadow-strength, 55%),
		transparent
	);
}

.brandably-section-shell__title--shadow-light {
	text-shadow: 0 1px 10px color-mix(
		in srgb,
		rgba(255, 255, 255, 1) var(--brandably-title-shadow-strength, 55%),
		transparent
	);
}

.brandably-section-shell__title--shadow-none {
	text-shadow: none;
}

/* Optional title entrance animation. Purely additive: the default
   --effect-none class matches nothing, so existing blocks stay static.
   Mirrors the theme's established soft-enter idiom and is gated off for
   users who prefer reduced motion. Travel distance is applied via
   --brandably-title-effect-from-y (inline), falling back to 32px. */
@keyframes brandably-section-shell-title-enter {
	from {
		opacity: 0;
		transform: translate3d(0, var(--brandably-title-effect-from-y, 0px), 0);
	}
	to {
		opacity: 1;
		transform: translate3d(0, 0, 0);
	}
}

.brandably-section-shell__title--effect-fade-in,
.brandably-section-shell__title--effect-fade-up,
.brandably-section-shell__title--effect-fade-down {
	animation-name: brandably-section-shell-title-enter;
	animation-duration: 700ms;
	animation-timing-function: var(
		--brandably-title-effect-easing,
		cubic-bezier(0.16, 1, 0.3, 1)
	);
	animation-iteration-count: 1;
	animation-fill-mode: both;
}

.brandably-section-shell__title--effect-fade-up {
	/* Default travel; instances override --brandably-title-effect-from-y inline. */
	--brandably-title-effect-from-y: 32px;
}

.brandably-section-shell__title--effect-fade-down {
	--brandably-title-effect-from-y: -32px;
}

@media (prefers-reduced-motion: reduce) {
	.brandably-section-shell__title--effect-fade-in,
	.brandably-section-shell__title--effect-fade-up,
	.brandably-section-shell__title--effect-fade-down {
		animation: none;
		opacity: 1;
	}
}

/* Readable maximum measure for long excerpt text.
   Colour + opacity via --brandably-excerpt-color / --brandably-excerpt-color-alpha
   (inline style). Attribute selector + !important beats core .has-*-color so the
   0–100 opacity control maps exactly. */
.brandably-section-shell__excerpt {
	margin: 1.6rem 0 0;
	max-width: var(--brandably-content-width, 720px);
	overflow-wrap: break-word;
	font-weight: var(--brandably-excerpt-font-weight, inherit);
}

.brandably-section-shell__excerpt[style*="--brandably-excerpt-color"] {
	color: color-mix(
		in srgb,
		var(--brandably-excerpt-color) var(--brandably-excerpt-color-alpha, 100%),
		transparent
	) !important;
}

/* Flex stack: do not add title margin on top of the eyebrow’s own gap. */
.brandably-section-shell__eyebrow ~ .brandably-section-shell__title {
	margin-top: 0;
}

/* Action area reuses the existing Brandably button system (.site-main scope). */
.brandably-section-shell__actions {
	display: flex;
	margin-top: 1.6rem;
	flex-wrap: wrap;
	gap: 1em;
}

/* ==========================================================================
   Editorial / full-width layouts keep an inner text measure.
   ========================================================================== */

.brandably-section-shell--layout-content-center .brandably-section-shell__content {
	max-width: var(--brandably-content-width, 720px);
}

/* ==========================================================================
   Nested Content Customiser (inside Split 6/6, Split + band, etc.)
   Lives here so it loads with the parent hero stylesheet — CC’s own style
   handle is easy to miss / stick on a static ?ver=1.0.0 browser cache.
   ========================================================================== */

/* Do not inherit parent hero bg / overlay paint tokens. */
.brandably-section-shell .wp-block-brandably-content-customiser {
	--brandably-section-shell-bg: transparent;
	--brandably-section-shell-bg-alpha: 0%;
	--brandably-section-shell-bg-gradient: none;
	--brandably-section-shell-bg-fill-opacity: 0;
	--brandably-shell-bg-image: none;
	--brandably-shell-bg-image-opacity: 0;
	--brandably-shell-overlay-color: transparent;
	--brandably-shell-overlay-start-alpha: 0%;
	--brandably-shell-overlay-end-alpha: 0%;
}

/* Content (natural): theme gutter when nested in a hero shell. */
.brandably-section-shell .wp-block-brandably-content-customiser.brandably-section-shell--height-content {
	padding-top: var(--grid-side-padding, 1.6em);
	padding-bottom: var(--grid-side-padding, 1.6em);
}

/*
 * Parent hero .inner already owns the page gutter. Nested Customiser must not
 * add a second horizontal inset (!important beats global .inner + editor mirrors).
 */
.brandably-section-shell .wp-block-brandably-content-customiser .inner,
.brandably-section-shell .wp-block-brandably-content-customiser .brandably-section-shell__content-wrap {
	padding-left: 0 !important;
	padding-right: 0 !important;
}
