/* ==========================================================================
   Lunara — motion layer (front end only).
   .lun-motion        set in <head> when the visitor allows motion (CSS-only intros)
   .lun-motion-ready  set by motion.js once scroll effects are running
   Without either class, every element keeps its normal, fully visible state.
   One easing for everything: a long, soft "expo out".
   ========================================================================== */

:root {
	--lun-ease: cubic-bezier(0.16, 1, 0.3, 1);
	--lun-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

/* ---------- Hero intro (CSS only, starts before first paint) ---------- */
.lun-motion .lun-w {
	display: inline-block;
	overflow: hidden;
	vertical-align: top;
	padding-block: 0.06em;
	margin-block: -0.06em;
}
.lun-motion .lun-w > span {
	display: inline-block;
	animation: lun-word 1.1s var(--lun-ease) calc(0.15s + var(--i, 0) * 75ms) both;
}
.lun-motion .lun-hero .lun-lead,
.lun-motion .lun-page-hero .lun-lead,
.lun-motion .lun-page-hero .lun-kicker {
	animation: lun-fade-up 1s var(--lun-ease) 0.6s both;
}
.lun-motion .lun-page-hero .lun-kicker { animation-delay: 0.05s; }
.lun-motion .lun-hero .wp-block-buttons { animation: lun-fade-up 1s var(--lun-ease) 0.78s both; }
.lun-motion .lun-hero::after { animation: lun-dome 1.6s var(--lun-ease) 0.1s both; }
.lun-motion .lun-hero__product img { animation: lun-rise 1.5s var(--lun-ease) 0.45s both; }

@keyframes lun-word {
	from { transform: translate3d(0, 110%, 0); }
	to { transform: none; }
}
@keyframes lun-fade-up {
	from { opacity: 0; transform: translate3d(0, 24px, 0); }
	to { opacity: 1; transform: none; }
}
@keyframes lun-dome {
	from { transform: translateX(-50%) translateY(55%) scaleX(0.82); }
	to { transform: translateX(-50%); }
}
@keyframes lun-rise {
	from { opacity: 0; transform: translate3d(0, 60px, 0) rotate(-4deg) scale(0.96); }
	to { opacity: 1; transform: none; }
}

/* ---------- Header: fixed, frosted once scrolled, hides on scroll down ---------- */
.lun-motion-ready .wp-site-blocks > .wp-block-template-part:first-child {
	position: fixed;
	transition: transform 0.5s var(--lun-ease);
}
.admin-bar.lun-motion-ready .wp-site-blocks > .wp-block-template-part:first-child { top: 32px; }
@media (max-width: 782px) {
	.admin-bar.lun-motion-ready .wp-site-blocks > .wp-block-template-part:first-child { top: 46px; }
}
.lun-header-away .wp-site-blocks > .wp-block-template-part:first-child { transform: translate3d(0, -110%, 0); }

.lun-motion-ready .lun-header {
	position: relative;
	isolation: isolate;
	transition: padding 0.45s var(--lun-ease);
}
.lun-motion-ready .lun-header::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: rgba(0, 42, 94, 0.78);
	-webkit-backdrop-filter: saturate(180%) blur(20px);
	backdrop-filter: saturate(180%) blur(20px);
	box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.08), 0 10px 30px rgba(0, 20, 50, 0.18);
	opacity: 0;
	transition: opacity 0.3s ease;
	pointer-events: none;
}
.lun-scrolled .lun-header { padding-block: 0.65rem; }
.lun-scrolled .lun-header::before { opacity: 1; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	.lun-motion-ready .lun-header::before { background: rgba(0, 42, 94, 0.96); }
}
.lun-motion-ready .lun-header__logo img { transition: width 0.45s var(--lun-ease); }
.lun-scrolled .lun-header__logo img { width: clamp(84px, 8vw, 104px) !important; }

/* ---------- Reveal on enter ---------- */
.lun-motion-ready .lun-r {
	opacity: 0;
	transform: translate3d(0, 20px, 0);
	transition:
		opacity 0.7s var(--lun-ease) var(--lun-d, 0ms),
		transform 0.9s var(--lun-ease) var(--lun-d, 0ms);
}
.lun-motion-ready .lun-r.is-in { opacity: 1; transform: none; }

/* Feature sparkles pop in after their row. */
.lun-motion-ready .lun-feature.lun-r::before {
	transform: scale(0.2) rotate(-120deg);
	opacity: 0;
	transition:
		transform 0.9s var(--lun-ease) calc(var(--lun-d, 0ms) + 0.25s),
		opacity 0.4s ease calc(var(--lun-d, 0ms) + 0.25s);
}
.lun-motion-ready .lun-feature.lun-r.is-in::before { transform: none; opacity: 1; }

/* ---------- Scroll-linked (--p is 0 → 1) ---------- */
/* Hero: copy drifts up and fades, the melon floats towards you. */
.lun-motion-ready .lun-hero__copy {
	transform: translate3d(0, calc(var(--p, 0) * -80px), 0);
	opacity: calc(1 - var(--p, 0) * 1.6);
}
.lun-motion-ready .lun-hero__product {
	transform: translate3d(0, calc(var(--p, 0) * -120px), 0) scale(calc(1 + var(--p, 0) * 0.1)) rotate(calc(var(--p, 0) * 4deg));
	transform-origin: 50% 80%;
}
.lun-motion-ready .lun-page-hero > * {
	transform: translate3d(0, calc(var(--p, 0) * -50px), 0);
	opacity: calc(1 - var(--p, 0) * 1.2);
}

/* Field photograph: slow parallax inside its frame. */
.lun-motion-ready .lun-photo > .wp-block-image { overflow: hidden; }
.lun-motion-ready .lun-photo > .wp-block-image img {
	transform: translate3d(0, calc((var(--p, 0.5) - 0.5) * -14%), 0) scale(1.16);
	will-change: transform;
}

/* Retail bin floats gently. */
.lun-motion-ready .lun-cta__image img {
	transform: translate3d(0, calc((var(--p, 0.5) - 0.5) * -60px), 0) rotate(calc((var(--p, 0.5) - 0.5) * -3deg));
}

/* Benefits: a teal "rind" rail fills as you read down the list. */
@media (min-width: 782px) {
	.lun-motion-ready .lun-benefits__grid > .wp-block-column:last-child { position: relative; }
	.lun-motion-ready .lun-benefits__grid > .wp-block-column:last-child::before,
	.lun-motion-ready .lun-benefits__grid > .wp-block-column:last-child::after {
		content: "";
		position: absolute;
		top: 0;
		bottom: 0;
		left: clamp(-3rem, -3vw, -1.5rem);
		width: 3px;
		border-radius: 3px;
		background: var(--lun-line);
	}
	.lun-motion-ready .lun-benefits__grid > .wp-block-column:last-child::after {
		background: linear-gradient(var(--lun-teal), var(--lun-teal) 85%, var(--lun-gold));
		transform-origin: top;
		transform: scaleY(clamp(0, calc((var(--p, 0) - 0.22) / 0.5), 1));
	}
}

/* ---------- Galaxy zoom (pinned scene) ---------- */
.lun-motion-ready .lun-zoom {
	height: 340vh;
	padding: 0 !important;
}
.lun-motion-ready .lun-zoom__stage {
	position: sticky;
	top: 0;
	height: 100vh;
	height: 100svh;
	display: grid;
	place-items: center;
	overflow: hidden;
	gap: 0;
}
/* Deep-space layer that takes over when the rind fills the screen. */
.lun-motion-ready .lun-zoom__stage::before {
	content: "";
	position: absolute;
	inset: -10%;
	background:
		url("../img/sparkle-gold.svg") 18% 30% / 26px no-repeat,
		url("../img/sparkle-gold.svg") 82% 24% / 18px no-repeat,
		url("../img/sparkle-white.svg") 74% 70% / 14px no-repeat,
		url("../img/star-header.png") center 10% / min(2400px, 200vw) auto no-repeat,
		radial-gradient(1.5px 1.5px at 20% 30%, var(--lun-gold) 50%, transparent 51%) 0 0 / 180px 180px,
		radial-gradient(1px 1px at 70% 60%, #fff 50%, transparent 51%) 0 0 / 120px 120px,
		radial-gradient(2px 2px at 40% 80%, var(--lun-gold) 50%, transparent 51%) 0 0 / 260px 260px,
		radial-gradient(1px 1px at 85% 15%, rgba(255, 255, 255, 0.8) 50%, transparent 51%) 0 0 / 90px 90px,
		radial-gradient(ellipse at 50% 60%, #0a3a78 0%, var(--lun-deep) 70%);
	opacity: var(--fade, 0);
	transform: scale(calc(1.35 - var(--fade, 0) * 0.35));
	pointer-events: none;
}
.lun-motion-ready .lun-zoom__img {
	grid-area: 1 / 1;
	width: min(84vw, 920px);
	max-width: none !important;
	transform: scale(var(--zoom, 1));
	transform-origin: 16% 56%;
	opacity: calc(1 - var(--fade, 0));
	will-change: transform, opacity;
	position: relative;
	z-index: 1;
}
.lun-motion-ready .lun-zoom__lines {
	grid-area: 1 / 1;
	align-self: stretch;
	display: grid;
	position: relative;
	z-index: 2;
	width: 100%;
	height: 100%;
	align-items: end;
	padding: 0 1.25rem clamp(3rem, 12vh, 7rem);
}
/* The last line lands centre stage, large, once the sky has taken over. */
.lun-motion-ready .lun-zoom__line:last-child {
	align-self: center;
	font-size: var(--wp--preset--font-size--display);
	max-width: 12ch;
	justify-self: center;
	transform: translate3d(0, 36px, 0) scale(0.94);
}
.lun-motion-ready .lun-zoom__line:last-child.is-on { transform: none; }
.lun-motion-ready .lun-zoom__line {
	grid-area: 1 / 1;
	margin: 0 !important;
	opacity: 0;
	transform: translate3d(0, 36px, 0);
	transition: opacity 0.7s var(--lun-ease), transform 0.9s var(--lun-ease);
	text-shadow: 0 2px 30px rgba(0, 20, 50, 0.6);
}
.lun-motion-ready .lun-zoom__line.is-on { opacity: 1; transform: none; }
.lun-motion-ready .lun-zoom__line.is-past { opacity: 0; transform: translate3d(0, -12px, 0); transition-duration: 0.35s; }

/* ---------- Page transitions (same-origin navigations) ---------- */
@media (prefers-reduced-motion: no-preference) {
	@view-transition { navigation: auto; }
	::view-transition-old(root) { animation: 0.22s ease-in both lun-vt-out; }
	::view-transition-new(root) { animation: 0.28s ease-out both lun-vt-in; }
}
@keyframes lun-vt-out { to { opacity: 0; } }
@keyframes lun-vt-in { from { opacity: 0; } }

/* ---------- Mobile tuning ---------- */
@media (max-width: 781px) {
	.lun-motion-ready .lun-zoom { height: 280vh; }
	.lun-motion-ready .lun-zoom__img { width: 104vw; }
	.lun-motion-ready .lun-hero__product { transform: translate3d(0, calc(var(--p, 0) * -60px), 0); }
}
