/*
 * Thanksgiving Turkey Flyover
 *
 * Fixed, click-through, out of flow (CLS 0). Hidden until JS adds .ttf-flying plus one
 * .ttf-path-* class. All motion sits inside prefers-reduced-motion: no-preference.
 * Turkey mark only (no wordmark), 147px square (89.5px on phones): the turkey drawn 1.25x larger
 * than it was inside the 378px lockup in 1.0.0.
 * Paths are viewport pixels in four width tiers (~1440, 1700+, 2300+, phone <768px).
 */

#ttf-turkey-container {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 147px;
	height: 147px;
	margin: 0;
	padding: 0;
	z-index: 999999;
	pointer-events: none;
	contain: layout style;
	/* Stacked white halos form a sticker outline so the turkey reads on dark pages;
	   the soft shadow lifts it on light ones. */
	filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff) drop-shadow(0 0 1.5px #fff) drop-shadow(0 3px 5px rgba(0, 0, 0, 0.3));
}

#ttf-turkey-container svg {
	display: block;
	overflow: visible;
}

@keyframes ttf-fly {
	from { offset-distance: 0%; }
	to   { offset-distance: 100%; }
}

@keyframes ttf-bob {
	0%, 100% { transform: translateY(0) rotate(0deg); }
	50%      { transform: translateY(-2px) rotate(-1deg); }
}

@keyframes ttf-flutter {
	0%, 100% { transform: rotate(-3.5deg); }
	50%      { transform: rotate(3.5deg); }
}

@media (prefers-reduced-motion: no-preference) {

	#ttf-turkey-container.ttf-flying {
		display: block;
		offset-distance: 0%;
		offset-rotate: auto;
		animation: ttf-fly var(--ttf-duration, 7.5s) cubic-bezier(0.25, 0.1, 0.25, 1) 1 forwards;
	}

	/* A: low left climbing to upper right. */
	#ttf-turkey-container.ttf-path-a {
		offset-path: path("M -300 720 C 150 760 500 600 760 470 S 1300 250 1740 220");
	}
	/* B: high left gliding down to the lower right. */
	#ttf-turkey-container.ttf-path-b {
		offset-path: path("M -300 200 C 200 140 650 250 960 420 S 1450 640 1740 600");
	}
	/* C: a gentle wave across the upper screen. */
	#ttf-turkey-container.ttf-path-c {
		offset-path: path("M -300 300 C 100 180 450 180 720 300 S 1300 420 1740 300");
	}

	.ttf-bird {
		transform-box: view-box;
		transform-origin: 16.9px 20px;
		animation: ttf-bob 0.8s ease-in-out infinite;
	}
	.ttf-feather {
		transform-box: view-box;
		transform-origin: 16.9px 20px;
		animation: ttf-flutter 0.6s ease-in-out infinite;
	}
}

@media (prefers-reduced-motion: no-preference) and (min-width: 1700px) {

	/* A: low left climbing to upper right. */
	#ttf-turkey-container.ttf-path-a {
		offset-path: path("M -300 720 C 256 760 688 600 1009 470 S 1676 250 2220 220");
	}
	/* B: high left gliding down to the lower right. */
	#ttf-turkey-container.ttf-path-b {
		offset-path: path("M -300 200 C 318 140 874 250 1256 420 S 1862 640 2220 600");
	}
	/* C: a gentle wave across the upper screen. */
	#ttf-turkey-container.ttf-path-c {
		offset-path: path("M -300 300 C 194 180 626 180 960 300 S 1676 420 2220 300");
	}
}

@media (prefers-reduced-motion: no-preference) and (min-width: 2300px) {

	/* A: low left climbing to upper right. */
	#ttf-turkey-container.ttf-path-a {
		offset-path: path("M -300 720 C 397 760 939 600 1342 470 S 2178 250 2860 220");
	}
	/* B: high left gliding down to the lower right. */
	#ttf-turkey-container.ttf-path-b {
		offset-path: path("M -300 200 C 475 140 1172 250 1652 420 S 2411 640 2860 600");
	}
	/* C: a gentle wave across the upper screen. */
	#ttf-turkey-container.ttf-path-c {
		offset-path: path("M -300 300 C 320 180 862 180 1280 300 S 2178 420 2860 300");
	}
}

@media (prefers-reduced-motion: no-preference) and (max-width: 767px) {

	#ttf-turkey-container {
		width: 89.5px;
		height: 89.5px;
	}

	#ttf-turkey-container.ttf-path-a {
		offset-path: path("M -260 640 C -100 670, 100 580, 215 500 S 450 390, 690 360");
	}
	#ttf-turkey-container.ttf-path-b {
		offset-path: path("M -260 240 C -100 200, 100 260, 215 340 S 450 470, 690 450");
	}
	#ttf-turkey-container.ttf-path-c {
		offset-path: path("M -260 300 C -100 230, 60 230, 215 300 S 450 360, 690 290");
	}
}
