/**
 * Ahway ambient nature layer.
 * Lightweight CSS birds plus an opt-in sound control.
 */

.ahway-ambient-birds {
	position: absolute;
	inset: 0;
	z-index: 2;
	overflow: hidden;
	pointer-events: none;
	contain: strict;
	opacity: 1;
	transition: opacity 0.45s ease;
}

.ahway-ambient-birds.is-outside-hero {
	opacity: 0;
}

.ahway-ambient-bird {
	--bird-color: rgba(245, 222, 174, 0.86);
	--bird-duration: 24s;
	--bird-delay: 0s;
	--bird-scale: 1;
	--bird-top: 22%;
	--bird-drift: 30px;
	--bird-return-drift: -14px;
	position: absolute;
	top: var(--bird-top);
	left: -90px;
	width: 46px;
	height: 24px;
	color: var(--bird-color);
	opacity: 0;
	filter: drop-shadow(0 4px 6px rgba(6, 29, 21, 0.16));
	animation: ahwayBirdFlight var(--bird-duration) linear var(--bird-delay) infinite;
	will-change: transform, opacity;
}

.ahway-ambient-bird.is-reverse {
	right: -90px;
	left: auto;
	animation-name: ahwayBirdFlightReverse;
}

.ahway-ambient-bird::before,
.ahway-ambient-bird::after {
	content: "";
	position: absolute;
	top: 8px;
	width: 25px;
	height: 13px;
	border-top: 3px solid currentColor;
	border-radius: 52% 52% 0 0;
	animation: ahwayBirdWing 0.58s ease-in-out infinite alternate;
}

.ahway-ambient-bird::before {
	right: 50%;
	transform-origin: 100% 40%;
	transform: rotate(11deg);
}

.ahway-ambient-bird::after {
	left: 50%;
	transform-origin: 0 40%;
	transform: rotate(-11deg);
	animation-direction: alternate-reverse;
}

.ahway-ambient-birds.is-paused .ahway-ambient-bird,
.ahway-ambient-birds.is-paused .ahway-ambient-bird::before,
.ahway-ambient-birds.is-paused .ahway-ambient-bird::after {
	animation-play-state: paused !important;
}

/* A calm camera drift keeps the home hero landscape feeling alive. */
body.ahway-theme .ahway-ch01-video {
	transform-origin: 50% 48%;
	animation: ahwayHeroLandscapeDrift 20s ease-in-out infinite alternate;
}

.ahway-nature-sound {
	position: absolute;
	left: 20px;
	bottom: 20px;
	z-index: 15;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 46px;
	padding: 0 14px 0 9px;
	border: 1px solid rgba(25, 68, 52, 0.14);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.94);
	color: #194434;
	box-shadow: 0 14px 38px rgba(8, 35, 25, 0.15);
	font-family: inherit;
	font-size: 10px;
	font-weight: 800;
	cursor: pointer;
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	transition: transform 0.3s ease, background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.ahway-nature-sound.is-outside-hero {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(8px);
}

.ahway-nature-sound:hover {
	transform: translateY(-3px);
}

.ahway-nature-sound__icon {
	position: relative;
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: #f3ead7;
	color: #a98242;
	font-size: 12px;
	transition: background 0.3s ease, color 0.3s ease;
}

.ahway-nature-sound__icon::before,
.ahway-nature-sound__icon::after {
	content: "";
	position: absolute;
	inset: -4px;
	border: 1px solid rgba(196, 164, 97, 0.42);
	border-radius: 50%;
	opacity: 0;
}

.ahway-nature-sound[aria-pressed="true"] {
	border-color: rgba(196, 164, 97, 0.42);
	background: rgba(25, 68, 52, 0.96);
	color: #fff;
}

.ahway-nature-sound[aria-pressed="true"] .ahway-nature-sound__icon {
	background: #c4a461;
	color: #fff;
}

.ahway-nature-sound[aria-pressed="true"] .ahway-nature-sound__icon::before {
	animation: ahwaySoundPulse 1.8s ease-out infinite;
}

.ahway-nature-sound[aria-pressed="true"] .ahway-nature-sound__icon::after {
	animation: ahwaySoundPulse 1.8s 0.55s ease-out infinite;
}

@keyframes ahwayBirdFlight {
	0% { opacity: 0; transform: translate3d(-90px, 0, 0) scale(var(--bird-scale)); }
	8%, 86% { opacity: 0.82; }
	48% { transform: translate3d(52vw, var(--bird-drift), 0) scale(var(--bird-scale)); }
	100% { opacity: 0; transform: translate3d(calc(100vw + 180px), var(--bird-return-drift), 0) scale(var(--bird-scale)); }
}

@keyframes ahwayBirdFlightReverse {
	0% { opacity: 0; transform: translate3d(90px, 0, 0) scale(var(--bird-scale)); }
	8%, 86% { opacity: 0.72; }
	48% { transform: translate3d(-52vw, var(--bird-drift), 0) scale(var(--bird-scale)); }
	100% { opacity: 0; transform: translate3d(calc(-100vw - 180px), var(--bird-return-drift), 0) scale(var(--bird-scale)); }
}

@keyframes ahwayBirdWing {
	from { transform: rotate(16deg) scaleY(0.82); }
	to { transform: rotate(-8deg) scaleY(1.12); }
}

@keyframes ahwaySoundPulse {
	0% { opacity: 0.75; transform: scale(0.82); }
	100% { opacity: 0; transform: scale(1.55); }
}

@keyframes ahwayHeroLandscapeDrift {
	0% {
		transform: scale(1.04) translate3d(-0.8%, 0.4%, 0);
	}
	48% {
		transform: scale(1.075) translate3d(0.6%, -0.6%, 0);
	}
	100% {
		transform: scale(1.1) translate3d(-0.25%, -1%, 0);
	}
}

@media (max-width: 720px) {
	body.ahway-theme .ahway-ch01-video {
		animation-duration: 24s;
	}

	.ahway-ambient-bird {
		width: 36px;
		height: 20px;
	}

	.ahway-ambient-bird::before,
	.ahway-ambient-bird::after {
		width: 20px;
		height: 10px;
		border-top-width: 2px;
	}

	.ahway-nature-sound {
		left: 12px;
		bottom: 12px;
		min-height: 42px;
		padding: 0 11px 0 7px;
		font-size: 9px;
	}

	.ahway-nature-sound__icon {
		width: 29px;
		height: 29px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ahway-ambient-birds {
		display: none !important;
	}

	.ahway-nature-sound,
	.ahway-nature-sound__icon,
	.ahway-nature-sound__icon::before,
	.ahway-nature-sound__icon::after {
		animation: none !important;
		transition: none !important;
	}

	body.ahway-theme .ahway-ch01-video {
		animation: none !important;
		transform: scale(1.03) !important;
	}
}
