/* ==========================================================================
   Block: Hero Banner (acf/hero-banner)

   Values come in as unitless CSS vars from render.php:
     --hb-base-d / --hb-base-m        base width (px) – the width at which font
                                      sizes are exact; on desktop also the
                                      default max-width
     --hb-heading-d / --hb-heading-m  heading font size (px) at base width
     --hb-desc-d / --hb-desc-m        description font size (px) at base width
     --hb-mt-* / --hb-mb-*            top / bottom margin (with px unit)
     --hb-maxw-d                      desktop max width (any unit); unset =
                                      base width
     --hb-maxw-m                      mobile max width (any unit); unset =
                                      full width
     --hb-text-d / --hb-text-m        heading + description max width (any
                                      unit); unset = 55% desktop, 100% mobile
     --hb-pl-* / --hb-pr-*            left / right padding (any unit): space
                                      around the banner; the card, image and
                                      font scaling use the width inside it.
                                      Desktop padding only applies while the
                                      container is narrower than max width +
                                      both paddings; wider = centred, no
                                      padding (see --hb-pl-eff below)
   Below the base width, fonts scale with the banner (container query units)
   so the layout keeps the same proportions as the design. Above it (wide
   phones / tablets on the mobile layout) fonts stay at their set size.
   ========================================================================== */

.reelzappy-hero-banner {
	--hb-base: var(--hb-base-d);
	--hb-heading: var(--hb-heading-d);
	--hb-desc: var(--hb-desc-d);
	--hb-border: var(--color-card-border, #F8F503);
	--hb-pl: var(--hb-pl-d, 0px);
	--hb-pr: var(--hb-pr-d, 0px);
	--hb-maxw: var(--hb-maxw-d, calc(var(--hb-base-d) * 1px));

	/*
	 * Desktop padding is "all or nothing": the full value while the container
	 * (100% = its width, in both padding and max-width) is narrower than
	 * max width + left + right padding, 0 once it's wider. The difference is
	 * multiplied by 1000 so clamp() snaps between the two ends.
	 */
	--hb-pl-eff: clamp(0px, (var(--hb-maxw) + var(--hb-pl) + var(--hb-pr) - 100%) * 1000, var(--hb-pl));
	--hb-pr-eff: clamp(0px, (var(--hb-maxw) + var(--hb-pl) + var(--hb-pr) - 100%) * 1000, var(--hb-pr));

	box-sizing: border-box;
	container-type: inline-size; /* cqi = width inside the padding = the card. */
	width: 100%;
	max-width: calc(var(--hb-maxw) + var(--hb-pl-eff) + var(--hb-pr-eff));
	padding-inline: var(--hb-pl-eff) var(--hb-pr-eff);
	margin-inline: auto;
	margin-block: var(--hb-mt-d, 0) var(--hb-mb-d, 32px);
}

.reelzappy-hero-banner__inner {
	position: relative;
	overflow: hidden;
	border: 1px solid var(--hb-border);
	border-radius: var(--hb-radius, 20px);
	background-color: var(--color-global-background, #141414);
	isolation: isolate;
}

.reelzappy-hero-banner--no-image .reelzappy-hero-banner__inner {
	min-height: 200px;
}

.reelzappy-hero-banner__media,
.reelzappy-hero-banner__image {
	display: block;
	width: 100%;
	height: auto;
}

/* Gradient overlay: sits between the image and the text.
   Each breakpoint is independent; unset = no gradient at that size. */
.reelzappy-hero-banner .reelzappy-hero-banner__overlay {
	position: absolute;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	background: var(--hb-gradient-d, none);
}

.reelzappy-hero-banner__content {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: flex-start;
	gap: 0.5em;
	padding: 0 6.5cqi;
	text-align: left;
}

.reelzappy-hero-banner--no-image .reelzappy-hero-banner__content {
	position: relative;
	min-height: inherit;
	padding-block: 32px;
}

.reelzappy-hero-banner__heading {
	max-width: var(--hb-text-d, 55%);
	margin: 0;
	font-family: var(--font-family-heading, 'Archivo Black', sans-serif);
	font-weight: 400;
	font-size: min(calc(var(--hb-heading) * 1px), calc(var(--hb-heading) / var(--hb-base) * 100cqi));
	line-height: 1.1;
	letter-spacing: 0.01em;
	text-transform: uppercase;
	color: var(--color-page-title, #F8F503);
	text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

.reelzappy-hero-banner__description {
	max-width: var(--hb-text-d, 55%);
	margin: 0;
	font-family: var(--font-family-subheading, 'Archivo', sans-serif);
	font-weight: 400;
	font-size: max(12px, min(calc(var(--hb-desc) * 1px), calc(var(--hb-desc) / var(--hb-base) * 100cqi)));
	line-height: 1.4;
	color: var(--color-text, #F5F5FA);
	text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

/* Inline HTML inside heading / description. */
.reelzappy-hero-banner .reelzappy-hero-banner__heading a,
.reelzappy-hero-banner .reelzappy-hero-banner__description a {
	color: var(--color-link, #F8F503);
	text-decoration: underline;
}

.reelzappy-hero-banner .reelzappy-hero-banner__heading mark,
.reelzappy-hero-banner .reelzappy-hero-banner__description mark {
	background: none;
	color: var(--color-page-title, #F8F503);
}

/* Mobile: square-ish card, text bottom-centred over the image.
 *
 * Default breakpoint: mobile up to 768px, desktop from 769px. A banner with a
 * custom "Desktop Starts At" value gets data-hb-bp="N", and block.php copies
 * the block between the mobile:start / mobile:end markers for it, with
 * :not([data-hb-bp]) -> [data-hb-bp="N"] and 768px -> N-1. Keep the markers,
 * the "(max-width: 768px)" query and the :not([data-hb-bp]) scopes exactly.
 * The scopes sit inside :where() so specificity is unchanged.
 */
/* mobile:start */
@media (max-width: 768px) {
	.reelzappy-hero-banner:where(:not([data-hb-bp])) {
		--hb-base: var(--hb-base-m);
		--hb-heading: var(--hb-heading-m);
		--hb-desc: var(--hb-desc-m);
		--hb-pl: var(--hb-pl-m, 0px);
		--hb-pr: var(--hb-pr-m, 0px);

		/* Mobile max width (unset = full width) plus the always-on mobile padding. */
		max-width: calc(var(--hb-maxw-m, 100%) + var(--hb-pl) + var(--hb-pr));
		padding-inline: var(--hb-pl) var(--hb-pr); /* Mobile padding always applies. */
		margin-block: var(--hb-mt-m, 0) var(--hb-mb-m, 32px);
	}

	.reelzappy-hero-banner:where(:not([data-hb-bp])) .reelzappy-hero-banner__overlay {
		background: var(--hb-gradient-m, none);
	}

	:where(.reelzappy-hero-banner:not([data-hb-bp])) .reelzappy-hero-banner__content {
		justify-content: flex-end;
		align-items: center;
		gap: 0.35em;
		padding: 0 6cqi 7cqi;
		text-align: center;
	}

	:where(.reelzappy-hero-banner:not([data-hb-bp])) .reelzappy-hero-banner__heading,
	:where(.reelzappy-hero-banner:not([data-hb-bp])) .reelzappy-hero-banner__description {
		max-width: var(--hb-text-m, 100%);
	}
}
/* mobile:end */

/* Editor-only empty state. */
.reelzappy-hero-banner--empty {
	max-width: 100%;
}

.reelzappy-hero-banner .reelzappy-hero-banner__placeholder {
	padding: 24px;
	border: 1px dashed currentColor;
	border-radius: 12px;
	text-align: center;
	opacity: 0.7;
}
