/**
 * Albatross flight (front page only).
 *
 * The bird launches from the site logo, swoops down over the hero and glides
 * off the right edge, then rests before the next flight. A track element moves
 * it horizontally while the bird rises, dips and banks.
 * Loaded together with assets/js/flight.js; skipped when reduced motion is preferred.
 */

.albatross-flight {
	position: fixed;
	inset: 0;
	z-index: 45;
	overflow: hidden;
	pointer-events: none;
}

.albatross-flight__track {
	position: absolute;
	left: var(--albatross-launch-x, 48px);
	top: var(--albatross-launch-y, 40px);
	opacity: 0;
	animation: albatross-track 20s linear 1.2s infinite;
}

.albatross-flight__bird {
	display: block;
	width: clamp(110px, 13vw, 180px);
	max-width: none;
	height: auto;
	translate: -50% -50%;
	transform-origin: 50% 50%;
	filter: drop-shadow(0 10px 14px rgb(0 0 0 / 0.35));
	animation: albatross-soar 20s ease-in-out 1.2s infinite;
	will-change: transform;
}

/* Horizontal travel: slow launch, steady glide, gone by 72%; the rest is a pause off-screen. */
@keyframes albatross-track {
	0% {
		opacity: 0;
		transform: translateX(0);
		animation-timing-function: cubic-bezier(0.55, 0, 0.75, 0.6);
	}

	2% {
		opacity: 1;
	}

	16% {
		transform: translateX(14vw);
	}

	72% {
		opacity: 1;
		transform: translateX(calc(100vw - var(--albatross-launch-x, 48px) + 200px));
	}

	72.01%,
	100% {
		opacity: 0;
		transform: translateX(calc(100vw - var(--albatross-launch-x, 48px) + 200px));
	}
}

/* Vertical swoop, size and banking. Starts tiny inside the logo and grows as it leaves. */
@keyframes albatross-soar {
	0% {
		transform: translateY(0) scale(0.06) rotate(0deg);
	}

	6% {
		transform: translateY(4vh) scale(0.4) rotate(16deg);
	}

	16% {
		transform: translateY(20vh) scale(0.85) rotate(8deg);
	}

	30% {
		transform: translateY(27vh) scale(1) rotate(-2deg);
	}

	44% {
		transform: translateY(15vh) scale(1.04) rotate(-9deg);
	}

	58% {
		transform: translateY(22vh) scale(1) rotate(5deg);
	}

	72%,
	100% {
		transform: translateY(12vh) scale(0.96) rotate(-4deg);
	}
}

/* The logo gives off a brass ripple as the bird takes off. */
.wp-block-site-logo.is-albatross-launching img {
	animation: albatross-launch 1.1s ease-out;
}

@keyframes albatross-launch {
	0% {
		box-shadow: 0 0 0 0 rgb(212 169 90 / 0.65);
		transform: scale(1);
	}

	30% {
		transform: scale(1.06);
	}

	100% {
		box-shadow: 0 0 0 16px rgb(212 169 90 / 0);
		transform: scale(1);
	}
}

@media (prefers-reduced-motion: reduce) {
	.albatross-flight {
		display: none;
	}
}
