/* =========================================================
   Zambezi Hero Slider — front end
   Mirrors the reference .hero: full-bleed background image,
   opacity crossfade between slides, staged copy entrance.

   Sizing is CONTAINER relative (cqi / @container), not
   viewport relative. The block therefore looks correct at
   full width, inside a constrained column, in a sidebar and
   in the editor canvas — not just at one screen size.
   ========================================================= */

.zcu-hero {
	position: relative;
	display: flex;
	align-items: center;
	overflow: hidden;
	background-color: var(--zcu-background-alt, #f6f4ed);
	min-height: var(--zcu-hero-min-desktop, 100svh);

	/* Container-relative gutter: shrinks with the block, not the screen. */
	--zcu-hero-gutter: clamp(20px, 5cqi, 80px);

	/* .zcu-block already sets container-type; naming it lets nested
	   containers query this one specifically. */
	container-name: zcu-hero;
}

.zcu-hero__viewport {
	position: relative;
	display: grid;
	width: 100%;
	/* Carry the section's min-height down so slides can fill it. */
	min-height: inherit;
}

/* All slides stack in one grid cell so the section height is driven by the
   tallest slide — no fixed height, so long copy is never clipped. */
.zcu-hero__slide {
	position: relative;
	grid-area: 1 / 1;
	display: flex;
	width: 100%;
	min-height: inherit;
	opacity: 0;
	visibility: hidden;
	transition:
		opacity 0.7s var(--zcu-ease-soft, cubic-bezier(0.4, 0, 0.2, 1)),
		visibility 0s linear 0.7s;
}

.zcu-hero__slide.is-active {
	opacity: 1;
	visibility: visible;
	transition:
		opacity 0.7s var(--zcu-ease-soft, cubic-bezier(0.4, 0, 0.2, 1)),
		visibility 0s;
	z-index: 1;
}

.zcu-hero__slide.is-valign-top {
	align-items: flex-start;
}

.zcu-hero__slide.is-valign-center {
	align-items: center;
}

.zcu-hero__slide.is-valign-bottom {
	align-items: flex-end;
}

/* ---------- media ---------- */

.zcu-hero__media {
	position: absolute;
	inset: 0;
	z-index: 0;
	overflow: hidden;
}

.zcu-hero__picture,
.zcu-hero__media img {
	display: block;
	width: 100%;
	height: 100%;
}

.zcu-hero__media img {
	object-fit: cover;
	/* Wide containers favour the right of the frame, matching the reference
	   hero. Narrow containers centre it — see the container queries below. */
	object-position: center right;
}

.zcu-hero__overlay {
	position: absolute;
	inset: 0;
	display: block;
	pointer-events: none;
}

/* ---------- copy ---------- */

.zcu-hero__inner {
	position: relative;
	z-index: 2;
	width: 100%;
	max-width: var(--zcu-hero-content, var(--zcu-content-width, 1280px));
	margin-inline: auto;
	padding-inline: var(--zcu-hero-gutter);
	padding-block: clamp(72px, 9cqi, 128px) clamp(56px, 7cqi, 96px);
}

.zcu-hero__copy {
	/* Never wider than the space actually available. */
	max-width: min(100%, clamp(300px, 52cqi, 620px));
}

.zcu-hero__slide.is-align-center .zcu-hero__copy {
	max-width: min(100%, 760px);
	margin-inline: auto;
	text-align: center;
}

.zcu-hero__slide.is-align-center .zcu-hero__divider,
.zcu-hero__slide.is-align-center .zcu-hero__actions {
	justify-content: center;
	margin-inline: auto;
}

.zcu-hero__slide.is-align-right .zcu-hero__copy {
	margin-inline-start: auto;
	text-align: right;
}

.zcu-hero__slide.is-align-right .zcu-hero__actions {
	justify-content: flex-end;
}

/* Text schemes. Only the hero's own text is coloured — nothing global. */
.zcu-hero__slide.is-scheme-dark .zcu-hero__copy {
	color: var(--zcu-foreground, #1b2113);
}

.zcu-hero__slide.is-scheme-light .zcu-hero__copy {
	color: #ffffff;
}

.zcu-hero__slide.is-scheme-light .zcu-hero__text {
	color: rgba(255, 255, 255, 0.88);
}

.zcu-hero__eyebrow {
	margin: 0 0 clamp(12px, 2cqi, 22px);
	font-size: clamp(11px, 1.1cqi, 14px);
	font-weight: 700;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--zcu-accent-alt, #c44b1c);
}

.zcu-hero__slide.is-scheme-light .zcu-hero__eyebrow {
	color: var(--zcu-accent, #f6a91a);
}

.zcu-hero__heading {
	margin: 0;
	/* Scales with the block's own width, so it can never outgrow its column. */
	font-size: clamp(28px, 5.2cqi, 66px);
	line-height: 1.04;
	letter-spacing: -0.01em;
	text-wrap: balance;
}

.zcu-hero__divider {
	width: 64px;
	height: 2px;
	margin: clamp(16px, 3cqi, 30px) 0 clamp(14px, 2.6cqi, 26px);
	background: currentColor;
	opacity: 0.25;
}

.zcu-hero__slide.is-align-center .zcu-hero__divider {
	margin-inline: auto;
}

.zcu-hero__text {
	max-width: 48ch;
	margin: 0;
	font-size: clamp(15px, 1.6cqi, 19px);
	line-height: 1.6;
	text-wrap: pretty;
	color: var(--zcu-muted, #6a715c);
}

.zcu-hero__slide.is-align-center .zcu-hero__text {
	margin-inline: auto;
}

.zcu-hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	margin-top: clamp(22px, 3.6cqi, 36px);
}

/* ---------- buttons ---------- */

.zcu-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.65em;
	padding: 16px 30px;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	border: 2px solid transparent;
	border-radius: var(--zcu-radius-pill, 100px);
	transition:
		transform 0.35s var(--zcu-ease, cubic-bezier(0.22, 1, 0.36, 1)),
		background-color 0.3s,
		color 0.3s,
		border-color 0.3s;
}

.zcu-btn--primary {
	color: var(--zcu-background, #fff);
	background-color: var(--zcu-accent-contrast, #263018);
}

.zcu-btn--primary:hover,
.zcu-btn--primary:focus-visible {
	color: var(--zcu-accent-contrast, #263018);
	background-color: var(--zcu-accent, #f6a91a);
}

.zcu-btn--secondary {
	color: currentColor;
	background-color: transparent;
	border-color: currentColor;
}

.zcu-btn--secondary:hover,
.zcu-btn--secondary:focus-visible {
	color: var(--zcu-accent-contrast, #263018);
	background-color: var(--zcu-accent, #f6a91a);
	border-color: var(--zcu-accent, #f6a91a);
}

.zcu-btn:hover {
	transform: translateY(-2px);
}

/* ---------- controls ---------- */

.zcu-hero__arrow {
	position: absolute;
	top: 50%;
	z-index: 4;
	transform: translateY(-50%);
}

.zcu-hero__arrow--prev {
	left: clamp(10px, 2.2cqi, 30px);
}

.zcu-hero__arrow--next {
	right: clamp(10px, 2.2cqi, 30px);
}

.zcu-hero__arrow:hover {
	transform: translateY(-50%) scale(1.06);
}

.zcu-hero__dots {
	position: absolute;
	bottom: clamp(16px, 3cqi, 30px);
	left: var(--zcu-hero-gutter);
	z-index: 4;
}

/* Play / pause toggle. */
.zcu-hero__toggle {
	position: absolute;
	right: var(--zcu-hero-gutter);
	bottom: clamp(16px, 3cqi, 30px);
	z-index: 4;
	width: 42px;
	height: 42px;
}

.zcu-hero__toggle svg {
	width: 16px;
	height: 16px;
}

.zcu-hero__toggle .zcu-icon-play,
.zcu-hero__toggle.is-paused .zcu-icon-pause {
	display: none;
}

.zcu-hero__toggle.is-paused .zcu-icon-play {
	display: block;
}

/* ---------- staged copy entrance ---------- */

.zcu-hero__slide.is-active .zcu-hero__eyebrow,
.zcu-hero__slide.is-active .zcu-hero__heading,
.zcu-hero__slide.is-active .zcu-hero__divider,
.zcu-hero__slide.is-active .zcu-hero__text,
.zcu-hero__slide.is-active .zcu-hero__actions {
	animation: zcu-hero-in 0.9s var(--zcu-ease, cubic-bezier(0.22, 1, 0.36, 1)) both;
}

.zcu-hero__slide.is-active .zcu-hero__heading {
	animation-delay: 0.08s;
}

.zcu-hero__slide.is-active .zcu-hero__divider {
	animation-delay: 0.16s;
}

.zcu-hero__slide.is-active .zcu-hero__text {
	animation-delay: 0.28s;
}

.zcu-hero__slide.is-active .zcu-hero__actions {
	animation-delay: 0.42s;
}

@keyframes zcu-hero-in {
	from {
		opacity: 0;
		transform: translateY(30px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

/* =========================================================
   Container queries — respond to the BLOCK's width
   ========================================================= */

/*
 * Minimum heights use media queries, not container queries. A container query
 * can only match descendants of its container, and .zcu-hero IS the container —
 * so a @container rule targeting .zcu-hero itself would never apply. These
 * values are viewport-relative by nature (svh/vh), so the viewport is also the
 * correct thing to ask.
 */
@media (max-width: 1024px) {
	.zcu-hero {
		min-height: var(--zcu-hero-min-tablet, 70vh);
	}
}

@media (max-width: 782px) {
	.zcu-hero {
		min-height: var(--zcu-hero-min-mobile, 560px);
	}
}

/*
 * Narrow: the copy stacks above the image rather than sitting on top of it.
 *
 * On a phone, text over a photograph is the hardest thing to keep legible —
 * the subject moves behind the words at every crop. Stacking gives the copy a
 * clean background and lets the image be seen whole, and it is what the
 * reference site does at this width too.
 */
@container zcu-hero (max-width: 782px) {
	/*
	 * The mobile minimum height still applies as a floor; stacked content is
	 * normally taller than it, so it rarely does anything, but an author who
	 * sets a large value still gets it.
	 */
	.zcu-hero__slide {
		flex-direction: column;
	}

	/* Media leaves the absolute layer and becomes a normal block below the copy. */
	.zcu-hero__media {
		position: relative;
		inset: auto;
		order: 2;
		width: 100%;
	}

	.zcu-hero__picture,
	.zcu-hero__media img {
		height: auto;
	}

	.zcu-hero__media img {
		aspect-ratio: 4 / 3;
		object-position: center;
	}

	.zcu-hero__inner {
		order: 1;
		padding-block: clamp(88px, 22vw, 110px) clamp(20px, 6vw, 32px);
	}

	/* Centred copy on mobile. */
	.zcu-hero__copy,
	.zcu-hero__slide.is-align-right .zcu-hero__copy,
	.zcu-hero__slide.is-align-center .zcu-hero__copy {
		max-width: 100%;
		margin-inline: auto;
		text-align: center;
	}

	.zcu-hero__copy::before,
	.zcu-hero__divider,
	.zcu-hero__text {
		margin-inline: auto;
	}

	.zcu-hero__actions,
	.zcu-hero__slide.is-align-right .zcu-hero__actions,
	.zcu-hero__slide.is-align-center .zcu-hero__actions {
		justify-content: center;
	}

	/* Arrows would sit on the copy at this width; swipe and dots remain. */
	.zcu-hero__arrow {
		display: none;
	}

	/* Controls move over the image, which is now the bottom of the section. */
	.zcu-hero__dots {
		left: 50%;
		transform: translateX(-50%);
	}

	.zcu-hero__toggle {
		right: 16px;
		bottom: 16px;
	}
}

/* Very narrow: stack the buttons rather than let them overflow. */
@container zcu-hero (max-width: 420px) {
	.zcu-hero__actions {
		flex-direction: column;
		align-items: stretch;
	}

	.zcu-btn {
		justify-content: center;
		padding: 14px 22px;
	}

	.zcu-hero__toggle {
		width: 38px;
		height: 38px;
	}
}

/*
 * Fallback for engines without container query support: without it the
 * clamp() minimums apply, which is safe but small on large screens. This
 * restores viewport-based scaling for those engines only.
 */
@supports not (container-type: inline-size) {
	.zcu-hero__heading {
		font-size: clamp(28px, 4.6vw, 66px);
	}

	.zcu-hero__text {
		font-size: clamp(15px, 1.35vw, 19px);
	}

	@media (max-width: 782px) {
		.zcu-hero {
			min-height: var(--zcu-hero-min-mobile, 560px);
		}

		.zcu-hero__arrow {
			display: none;
		}

		.zcu-hero__media img {
			object-position: center;
		}
	}
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
	.zcu-hero__slide,
	.zcu-hero__slide.is-active .zcu-hero__eyebrow,
	.zcu-hero__slide.is-active .zcu-hero__heading,
	.zcu-hero__slide.is-active .zcu-hero__divider,
	.zcu-hero__slide.is-active .zcu-hero__text,
	.zcu-hero__slide.is-active .zcu-hero__actions {
		animation: none;
		transition: none;
	}

	.zcu-btn:hover {
		transform: none;
	}
}
