/* ==========================================================================
   Анимированная обложка — только тестовая страница (page-test.php)
   Сцена 1440×789 (как фон главной): cover, прижата вправо, по центру по высоте.
   ========================================================================== */

.hero-anim__desktop {
	display: none;
}

@media (min-width: 768px) {
	.hero-anim__desktop {
		display: block;
		overflow: hidden;
	}

	.hero-anim__scene {
		position: absolute;
		top: 50%;
		right: 0;
		width: max(100cqw, 100cqh * 1440 / 789);
		aspect-ratio: 1440 / 789;
		transform: translateY(-50%);
		container-type: inline-size;
	}

	.hero-anim__landscape {
		position: absolute;
		inset: 0;
		z-index: 2;
		display: block;
		width: 100%;
		height: 100%;
	}

	.hero-anim__layer {
		position: absolute;
		display: block;
		height: auto;
		max-width: none;
		will-change: transform;
	}

	/* Облака — за замком */
	.hero-anim__cloud { z-index: 1; left: 26.458%; width: 47.604%; }
	.hero-anim__cloud--top { top: -4.689%; animation: hero-anim-drift 21s ease-in-out infinite; --dx: 1.1cqw; --dy: 0.25cqw; }
	.hero-anim__cloud--bottom { top: 24.778%; animation: hero-anim-drift 16s ease-in-out -7s infinite; --dx: -1.3cqw; --dy: -0.2cqw; }

	/* Парящие элементы — перед пейзажем */
	.hero-anim__float {
		z-index: 4;
		animation: hero-anim-float var(--t, 7s) ease-in-out var(--d, 0s) infinite;
	}

	.hero-anim__moon   { left: 48.299%; top: 22.18%;  width: 4.167%; --t: 8.8s; --d: -2s;  --dx: 0.1cqw;  --dy: -0.45cqw; --r: -4deg; }
	.hero-anim__bat-1  { left: 26.84%;  top: 28.897%; width: 5.799%; --t: 5.2s; --d: -1s; --dx: 0.65cqw; --dy: -0.86cqw;  --r: 7.2deg; }
	.hero-anim__bat-2  { left: 17.292%; top: 21.926%; width: 6.285%; --t: 6.4s;  --d: -4s;  --dx: -0.58cqw; --dy: 0.72cqw;   --r: -5.76deg; }
	.hero-anim__bat-3  { left: 87.153%; top: 15.97%;  width: 8.16%;  --t: 5.8s; --d: -3s; --dx: -0.72cqw; --dy: -0.65cqw; --r: 5.76deg; }
	.hero-anim__bat-4  { left: 78.715%; top: 30.101%; width: 6.91%;  --t: 7.2s;  --d: -6s;  --dx: 0.58cqw;  --dy: 0.79cqw;  --r: -7.2deg; }
	.hero-anim__star-1 { left: 69.444%; top: 16.825%; width: 4.167%; --t: 7.6s; --d: -2s; --dx: 0;      --dy: -0.3cqw;  --r: 8deg; }
	.hero-anim__star-2 { left: 26.319%; top: 12.104%; width: 2.639%; --t: 5.6s;  --d: -5s;  --dx: 0.1cqw;  --dy: 0.3cqw;   --r: -10deg; }
	.hero-anim__star-3 { left: 95.278%; top: 29.848%; width: 2.639%; --t: 6.8s; --d: -1s; --dx: -0.1cqw; --dy: -0.25cqw; --r: 10deg; }
	.hero-anim__star-4 { left: 2.934%; top: 13.308%; width: 2.604%; --t: 8s; --d: -3s;  --dx: 0.1cqw;  --dy: 0.3cqw;   --r: -8deg; }
	.hero-anim__star-5 { left: 37.17%; top: 21.831%; width: 1.979%; --t: 4.8s;  --d: -2s;  --dx: 0;      --dy: -0.25cqw; --r: 12deg; }
	.hero-anim__star-6 { left: 81.389%; top: 16.16%; width: 1.528%; --t: 6s; --d: -4s; --dx: 0;      --dy: 0.2cqw;   --r: -12deg; }

	.hero-anim__star-1, .hero-anim__star-2, .hero-anim__star-3,
	.hero-anim__star-4, .hero-anim__star-5, .hero-anim__star-6 {
		animation-name: hero-anim-star;
	}

	/* Палец скелета — манит, вращаясь вокруг сустава */
	.hero-anim__finger {
		z-index: 3;
		left: 79.826%;
		top: 58.745%;
		width: 0.694%;
		transform-origin: 42.21% 86.29%;
		animation: hero-anim-beckon 2.6s ease-in-out infinite;
	}

	.hero-anim__cough {
		display: block;
		z-index: 3;
		left: 89.174%;
		top: 52.608%;
		font-size: 1.6958cqw;
		transform: translate(-50%, -50%) rotate(-19.9deg);
	}
}

/* Мобильная версия: палец на картинке скелета */
.hero-anim__photo {
	line-height: 0;
}

.hero-anim__photo picture {
	display: block;
}

.hero-anim__photo .hero-anim__mob-finger {
	position: absolute;
	left: 2.876%;
	top: 21.906%;
	width: 3.137%;
	max-width: none;
	max-height: none;
	height: auto;
	transform-origin: 41.48% 91.3%;
	animation: hero-anim-beckon 2.6s ease-in-out infinite;
}

@keyframes hero-anim-float {
	0%, 100% { transform: translate(0, 0) rotate(0deg); }
	50% { transform: translate(var(--dx, 0), var(--dy, 0)) rotate(var(--r, 0deg)); }
}

@keyframes hero-anim-star {
	0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
	50% { transform: translate(var(--dx, 0), var(--dy, 0)) rotate(var(--r, 0deg)) scale(0.9); opacity: 0.7; }
}

@keyframes hero-anim-drift {
	0%, 100% { transform: translate(0, 0); }
	50% { transform: translate(var(--dx, 0), var(--dy, 0)); }
}

@keyframes hero-anim-beckon {
	0%, 100% { transform: rotate(0deg); }
	30% { transform: rotate(-10deg); }
	75% { transform: rotate(13deg); }
}

/* Спокойный режим (главная): двигаются облака, летучие мыши и палец */
.hero-anim--calm .hero-anim__moon,
.hero-anim--calm .hero-anim__star-1,
.hero-anim--calm .hero-anim__star-2,
.hero-anim--calm .hero-anim__star-3,
.hero-anim--calm .hero-anim__star-4,
.hero-anim--calm .hero-anim__star-5,
.hero-anim--calm .hero-anim__star-6 {
	animation: none;
}

@media (prefers-reduced-motion: reduce) {
	.hero-anim__layer,
	.hero-anim__photo .hero-anim__mob-finger {
		animation: none;
	}
}
