/*
 * Hero section (sections/hero.php).
 *
 * Desktop numbers are Figma px at 1440: Home 64:33 (photo + wave), Parties 64:381
 * (photo, no wave), What's On 64:466 (no photo), Find us 64:548 (--compact).
 * --u is one Figma px at the current width (1px at 1440 and up, less on smaller
 * screens), so the photo, the gaps and the decorations keep the design's proportions.
 * Waves are full width and scale with it; their offsets are in % of the width.
 *
 * Layers, bottom to top: big circle · photo · wave · small circles + flowers · text.
 */
.pe-hero {
	--u: calc(min(100cqw, 90rem) / 1440);

	container-type: inline-size;
	isolation: isolate;
	overflow: clip;
	padding-block: 0;
}

.pe-hero__inner {
	display: grid;
	/* Text | photo 738 (+16 to the column edge, as in Figma). */
	grid-template-columns: minmax(0, 1fr) calc(754 * var(--u));
	column-gap: calc(4 * var(--u));
	align-items: start;
	padding-top: calc(4 * var(--u));
}

.pe-hero__text {
	position: relative;
	z-index: 4;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: max(1rem, calc(29 * var(--u)));
	padding-top: calc(87 * var(--u));
}

.pe-hero__text > * {
	margin: 0;
}

.pe-hero__eyebrow {
	margin-bottom: 0;
}

.pe-hero__title {
	margin: 0;
}

.pe-hero__intro {
	font-size: var(--pe-text-intro); /* 27.24px at 1440 */
	line-height: 1.45;
}

.pe-hero__buttons {
	/* Full width of the text column, so a button's min-width: min(…, 100%) can never
	   be wider than the column. */
	align-self: stretch;
	margin-top: 0;
}

.pe-hero__media {
	position: relative;
	z-index: 1;
}

.pe-hero__photo {
	width: calc(738 * var(--u));
	/* 350px corners on a 738 × 674 photo. */
	border-radius: 47.43% 47.43% 0 0 / 51.93% 51.93% 0 0;
}

/* "Photo focus" field: keep the left or right of a wide photo in view when the arch
   crops it (Facilities 64:234 keeps the right). Centre is the default. */
.pe-hero__photo--focus-left > img { object-position: left center; }
.pe-hero__photo--focus-right > img { object-position: right center; }
/* Top: for a tall photo, e.g. the entrance on Find Us keeps its sign in view. */
.pe-hero__photo--focus-top > img { object-position: center top; }

/* The wave runs across the foot of the photo (173px of overlap at 1440) and ends the
   section, with 30px of cream under it as in Figma (Home and Facilities heroes are
   784px tall). The photo sits at the bottom of the row and the text keeps clear of the
   wave, so when the text is the taller column (smaller screens) the wave still meets
   the photo.
   Why 173px: along the photo, the wave's top edge dips at most 163px below the wave's
   top (Figma units) and the solid wave ends at least 182px down, so a photo bottom at
   173px is always hidden behind the wave. Keep the photo and the wave scaling together
   (both use --u / % of the width) or the flat bottom of the photo shows. */
.pe-hero--wave:not(.pe-hero--compact) {
	padding-bottom: calc(30 * var(--u));
}

.pe-hero--wave .pe-hero__text {
	padding-bottom: calc(173 * var(--u) + 1rem);
}

.pe-hero--wave .pe-hero__media {
	align-self: end;
}

/* The photo's shadow stops at its bottom edge. The wave is see-through under its
   ribbons, so a shadow falling below the photo would show as a grey smudge there. */
.pe-hero--wave:not(.pe-hero--compact) .pe-hero__photo {
	clip-path: inset(-4rem -4rem 0 -4rem);
}

.pe-hero__wave {
	position: relative;
	z-index: 2;
	margin-top: -12.014%;
}

/* ---------- Decorations: flowers and circles (Home 64:33) ---------- */
.pe-hero__circle,
.pe-hero__flower,
.pe-hero__balloons {
	position: absolute;
	z-index: 3;
}

/* Centred on the 1440 frame: left = 50% + (x − 720)u. */
.pe-hero__flower--yellow {
	top: calc(34.5 * var(--u));
	left: calc(50% - 186.13 * var(--u));
	width: calc(72.64 * var(--u));
	z-index: 4;
}

.pe-hero__circle--left {
	top: calc(267 * var(--u));
	left: calc(50% - 702 * var(--u));
	width: calc(133 * var(--u));
}

.pe-hero__circle--right {
	top: calc(78 * var(--u));
	left: calc(50% + 598 * var(--u));
	width: calc(91 * var(--u));
}

/* These two sit on the wave, so they are measured from the bottom of the section
   (which includes the 30px of cream under the wave). */
.pe-hero__flower--lilac {
	bottom: calc(212.2 * var(--u));
	left: calc(50% - 259 * var(--u));
	width: calc(70.82 * var(--u));
}

.pe-hero__circle--big {
	z-index: 0;
	right: calc(-54 * var(--u));
	bottom: calc(60 * var(--u));
	width: calc(253 * var(--u));
}

/* ---------- Characters and sticker ("Show the characters", "Sticker text") ----------
   All three are placed in % of the photo column, so they keep their spot at every
   screen size and in every hero layout. */

/* One character lives BEHIND the photo (z-index -1 inside .pe-hero__media) and leans
   out from its right edge every few seconds: peekaboo. Sized by height, so the bear and
   the girl (whose picture is wider because of her balloon) come out the same size. */
.pe-hero__behind {
	position: absolute;
	top: 30%;
	left: 86%;
	z-index: -1;
	width: auto;
	height: 46%;
	rotate: 9deg;
	transform-origin: 0 100%;
}

/* How the hidden one moves (the 4th word of the page's row in pe_hero_mascots()).
   translate -80% is fully behind the photo, 0 is fully out. */

/* peekaboo: leans out, stays a while, hides again. */
.pe-hero__behind--peekaboo { animation: pe-hero-peekaboo 8s ease-in-out 1s infinite both; }

@keyframes pe-hero-peekaboo {
	0%, 6% { translate: -80% 0; }
	16% { translate: 4% 0; }
	20%, 72% { translate: 0 0; }
	82%, 100% { translate: -80% 0; }
}

/* double: two quick peeks, then a longer look. */
.pe-hero__behind--double { animation: pe-hero-double 9s ease-in-out 1s infinite both; }

@keyframes pe-hero-double {
	0%, 5% { translate: -80% 0; }
	11% { translate: -25% 0; }
	17%, 24% { translate: -80% 0; }
	30% { translate: -25% 0; }
	36%, 42% { translate: -80% 0; }
	52% { translate: 4% 0; }
	56%, 82% { translate: 0 0; }
	90%, 100% { translate: -80% 0; }
}

/* shy: creeps half way out, slowly, and tilts its head. */
.pe-hero__behind--shy { animation: pe-hero-shy 10s ease-in-out 1s infinite both; }

@keyframes pe-hero-shy {
	0%, 8% { translate: -80% 0; rotate: 9deg; }
	35%, 50% { translate: -30% 0; rotate: 14deg; }
	62%, 78% { translate: -8% 0; rotate: 6deg; }
	92%, 100% { translate: -80% 0; rotate: 9deg; }
}

/* The other stands in front of the photo's bottom-left corner. With a wave along the
   bottom its feet are tucked behind the wave, as if standing in the hills. The right
   edge is pinned (not the left), so a wide picture grows away from the photo. */
.pe-hero__front {
	position: absolute;
	right: 77%;
	bottom: 4%;
	z-index: 2;
	width: auto;
	height: 40%;
}

.pe-hero--wave .pe-hero__front {
	bottom: 12%;
}

/* How the front one moves (the 3rd word of the page's row in pe_hero_mascots()). */
.pe-hero__front {
	transform-origin: 50% 100%;
}

/* bob: gentle breathing (pe-bob is in assets/css/play.css). */
.pe-hero__front--bob { animation: pe-bob 4.5s ease-in-out infinite; }

/* jump: stands still, then a happy hop every few seconds. */
.pe-hero__front--jump { animation: pe-hero-jump 4.5s ease-in-out 1.5s infinite; }

@keyframes pe-hero-jump {
	0%, 72%, 100% { translate: 0 0; scale: 1 1; }
	76% { translate: 0 0; scale: 1.06 0.92; }
	86% { translate: 0 -9%; scale: 0.97 1.04; }
	94% { translate: 0 0; scale: 1.04 0.95; }
}

/* sway: rocks from side to side on its feet. */
.pe-hero__front--sway { animation: pe-hero-sway 3.6s ease-in-out infinite; }

@keyframes pe-hero-sway {
	0%, 100% { rotate: -5deg; }
	50% { rotate: 5deg; }
}

/* ---------- Peekaboo video ("Peekaboo video" field) ----------
   "In place of the photo": the arch frame holds the video instead of a photo. The video
   is 81% of the arch's width, centred, a little below the top so the crown and the cloud
   clear the arch's round shoulders. With a wave, the feet end up behind the hills. */
.pe-hero__photo--video {
	background: var(--pe-video-bg);
}

.pe-hero__photo--video > .pe-hero__video {
	position: absolute;
	top: 9%;
	left: 9.5%;
	width: 81%;
	/* Fade the left, right and bottom edges into the frame (see play.css). */
	-webkit-mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent), linear-gradient(to top, transparent, #000 7%);
	mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent), linear-gradient(to top, transparent, #000 7%);
	-webkit-mask-composite: source-in;
	mask-composite: intersect;
}

/* "In the corner of the photo": a round frame at the photo's bottom-left corner, where
   the standing character would be. The video is zoomed a little so the two fill it. */
.pe-hero__live {
	position: absolute;
	right: 72%;
	bottom: 6%;
	z-index: 2;
	width: 38%;
	aspect-ratio: 1;
	overflow: hidden;
	border: 0.375rem solid #fffaf0;
	border-radius: 50%;
	background: var(--pe-video-bg);
	box-shadow: 0 0 0 1.5px var(--pe-beige), var(--pe-shadow-lift);
}

.pe-hero--wave .pe-hero__live {
	bottom: 14%;
}

.pe-hero__live > .pe-hero__video {
	position: absolute;
	top: 9%;
	left: 4%;
	width: 92%;
}

/* The sticker overlaps the photo's top-left shoulder, where the arch curves away. */
.pe-hero__sticker {
	position: absolute;
	top: 1%;
	left: -1%;
	z-index: 3;
	/* A little bigger than the first version, so the offer stands out (client, Nov 2026).
	   13.3cqw keeps it the same share of the photo as the screen gets narrower. */
	--pe-sticker-size: clamp(6.5rem, 13.3cqw, 12rem);
}

/* Over the video the sticker hangs further out, so it never covers a face. */
.pe-hero--video-photo .pe-hero__sticker {
	top: 2%; /* not above the photo's top: the section would cut it off there */
	left: -9%;
}

/* …which puts it where the yellow flower is, so the flower goes behind it. */
.pe-hero--video-photo .pe-hero__flower--yellow {
	z-index: 0;
}

/* ---------- Photo without a wave (Parties 64:381) ---------- */
.pe-hero--image:not(.pe-hero--wave) .pe-hero__inner {
	/* Text 585 | 85 | photo 600. */
	grid-template-columns: minmax(0, 1fr) calc(600 * var(--u));
	column-gap: calc(85 * var(--u));
	align-items: center;
	padding-block: max(2.5rem, calc(90 * var(--u)));
}

.pe-hero--image:not(.pe-hero--wave) .pe-hero__text {
	gap: max(1rem, calc(28 * var(--u)));
	padding-top: 0;
}

.pe-hero--image:not(.pe-hero--wave) .pe-hero__media {
	/* The balloons rise 40px above the photo. */
	padding-top: calc(40 * var(--u));
}

.pe-hero--image:not(.pe-hero--wave) .pe-hero__photo {
	width: 100%;
	aspect-ratio: 600 / 470;
	border-radius: 999px 999px 0 0;
	box-shadow: none;
}

/* "Enquire about a party" is the big 365 × 76 button here. */
.pe-hero--image:not(.pe-hero--wave) .pe-hero__buttons .pe-button {
	min-width: min(22.8125rem, 100%);
	min-height: 4.77rem;
}

.pe-hero:not(.pe-hero--wave) .pe-hero__title {
	line-height: 1.07; /* 75 / 70 */
}

/* Balloons over the photo's top-right corner. */
.pe-hero__media .pe-hero__balloons {
	top: 0;
	left: 85%;
	width: 16.59%; /* 99.5 of 600 */
}

/* Balloons on a hero without a photo: top right. */
.pe-hero--text-only .pe-hero__balloons {
	top: max(1rem, calc(40 * var(--u)));
	right: calc(50% - 640 * var(--u));
	width: max(4rem, calc(100 * var(--u)));
}

/* ---------- No photo (What's On 64:466): a centred heading ---------- */
.pe-hero--text-only .pe-hero__inner {
	display: block;
	padding-block: max(3.5rem, calc(135 * var(--u)));
	text-align: center;
}

.pe-hero--text-only .pe-hero__text {
	align-items: center;
	gap: max(1rem, calc(24 * var(--u)));
	padding-top: 0;
}

.pe-hero--text-only .pe-hero__buttons {
	justify-content: center;
}

.pe-hero--text-only .pe-hero__flower--yellow {
	top: calc(65 * var(--u));
	left: calc(50% + 530 * var(--u));
	width: max(2.5rem, calc(76.27 * var(--u)));
}

.pe-hero--text-only .pe-hero__flower--lilac {
	top: calc(280 * var(--u));
	bottom: auto;
	left: calc(50% - 650 * var(--u));
	width: max(2.75rem, calc(84.98 * var(--u)));
}

/* ---------- Compact (Find us 64:548, Book 64:746): photo stands on the wave ---------- */
.pe-hero--compact.pe-hero--image .pe-hero__inner {
	/* Text 540 | 62 | photo 668. */
	grid-template-columns: minmax(0, 1fr) calc(668 * var(--u));
	column-gap: calc(62 * var(--u));
	align-items: center;
	padding-top: calc(64 * var(--u));
	padding-bottom: 0;
}

.pe-hero--compact .pe-hero__text {
	gap: max(1rem, calc(24 * var(--u)));
	padding-block: 0;
}

.pe-hero--compact .pe-hero__media {
	padding-top: 0;
}

.pe-hero--compact .pe-hero__photo {
	width: 100%;
	aspect-ratio: 668 / 580;
	border-radius: 999px 999px 0 0;
	box-shadow: 10px 4px 20px rgb(0 0 0 / 0.25);
}

.pe-hero--compact .pe-hero__wave {
	margin-top: 0;
}

/* "Book a visit" is a wider, slightly lower pill here: 285 × 64. */
.pe-hero--compact .pe-hero__buttons .pe-button {
	min-width: min(17.8125rem, 100%);
	min-height: 4rem;
}

/* pe-hero--short (Book a visit 64:746): the same photo, 50px shorter. */
.pe-hero--compact.pe-hero--short .pe-hero__photo {
	aspect-ratio: 668 / 530;
}

/* ---------- Smaller laptops and tablets: smaller photo and buttons ---------- */
@media (max-width: 1199px) {
	.pe-hero__inner {
		grid-template-columns: minmax(0, 1fr) calc(616 * var(--u));
	}

	.pe-hero__photo {
		width: calc(600 * var(--u));
	}

	.pe-hero__buttons {
		gap: 0.875rem;
	}

	/* Three classes, so this also beats the Parties and compact sizes above. */
	.pe-hero .pe-hero__buttons .pe-button {
		min-width: 0;
		min-height: 3.25rem;
		padding-inline: 1.5rem;
		font-size: 1.125rem;
	}
}

/* ---------- Phones: one column, text first, photo under it ---------- */
@media (max-width: 767px) {
	.pe-hero__inner,
	.pe-hero--image:not(.pe-hero--wave) .pe-hero__inner,
	.pe-hero--compact.pe-hero--image .pe-hero__inner {
		grid-template-columns: minmax(0, 1fr);
		row-gap: 2.5rem;
		padding-top: 3rem;
	}

	.pe-hero__text,
	.pe-hero--image:not(.pe-hero--wave) .pe-hero__text,
	.pe-hero--wave .pe-hero__text {
		gap: 1.25rem;
		padding-block: 0;
	}

	.pe-hero__photo {
		width: 100%;
	}

	/* The photo is as wide as the screen here: the one behind peeks in from the screen's
	   right edge and the one in front moves in a little and is smaller. */
	.pe-hero__front {
		right: auto;
		left: -3%;
		height: 34%;
	}

	.pe-hero__sticker,
	.pe-hero--video-photo .pe-hero__sticker {
		top: -4%; /* there is room above the photo on phones */
		left: auto;
		right: -1%;
	}

	.pe-hero__live {
		right: auto;
		left: -2%;
		width: 34%;
	}

	.pe-hero__flower--yellow {
		top: 1rem;
		right: var(--pe-gutter);
		left: auto;
		width: 2.75rem;
	}

	.pe-hero__circle--left {
		top: 8.5rem;
		left: -2.25rem;
		width: 5rem;
	}

	.pe-hero__circle--right {
		display: none;
	}

	.pe-hero__flower--lilac {
		width: 2.25rem;
	}

	.pe-hero--text-only .pe-hero__flower--yellow {
		top: 1.25rem;
		right: 1.25rem;
		left: auto;
		width: 2.5rem;
	}

	.pe-hero--text-only .pe-hero__flower--lilac {
		top: auto;
		bottom: 1.25rem;
		left: 1.25rem;
		width: 2.5rem;
	}
}
