/**
 * Анимации сайта (задание 179). Скрипт: assets/js/reveal.js. Значения — токены theme.json (custom.motion).
 *
 * Всё скрыто/сдвинуто только под .lv-anim (его ставит скрипт; без JS, при prefers-reduced-motion: reduce
 * и в редакторе класса нет — всё видно сразу). Двигаем свойствами translate/scale, не transform: они не
 * перебивают собственные transform блоков (сдвиг фона hero, hover карточек). Раскладку не трогаем — CLS нет.
 */

/* ── Секции и карточки: появление при прокрутке, один раз ── */
.lv-anim .lv-reveal {
	opacity: 0;
	translate: 0 var(--wp--custom--motion--abstand);
	transition:
		opacity var(--wp--custom--motion--dauer) var(--wp--custom--motion--ease) var(--lv-d, 0ms),
		translate var(--wp--custom--motion--dauer) var(--wp--custom--motion--ease) var(--lv-d, 0ms);
}
.lv-anim .lv-reveal.is-in {
	opacity: 1;
	translate: 0 0;
}

/* ── Hero: вход по очереди (заголовок → подзаголовок → кнопка), фон медленно приближается ── */
@keyframes lv-hero-auf {
	from { opacity: 0; translate: 0 var(--wp--custom--motion--abstand); }
	to   { opacity: 1; translate: 0 0; }
}
@keyframes lv-hero-zoom {
	from { scale: 1.06; }
	to   { scale: 1; }
}
@keyframes lv-pfeil-ein {
	from { opacity: 0; }
	to   { opacity: 1; }
}
@keyframes lv-pfeil-wippe {
	0%, 100% { translate: 0 0; }
	50%      { translate: 0 0.25rem; }
}

/* Фон/фото hero: картинку не прячем (LCP), только scale 1.06 → 1 */
.lv-anim :is(.hero-cover__bg, .levent-start__foto img, .bio-hero__media img, .gp-tp__photo, .single-post .wp-block-post-featured-image img) {
	animation: lv-hero-zoom var(--wp--custom--motion--hero-zoom) var(--wp--custom--motion--ease) both;
}

/* Ступени: 1 — адрес/метка, 2 — заголовок, 3 — подзаголовок, 4 — кнопка/поиск. Шаг — токен stufe. */
.lv-anim :is(.bio-hero__places, .bio-hero__label) {
	animation: lv-hero-auf var(--wp--custom--motion--hero-dauer) var(--wp--custom--motion--ease) 0ms both;
}
.lv-anim :is(.hero-cover__title, .levent-start__titel, .bio-hero__name) {
	animation: lv-hero-auf var(--wp--custom--motion--hero-dauer) var(--wp--custom--motion--ease) calc(var(--wp--custom--motion--stufe) * 2) both;
}
.lv-anim :is(.hero-cover__subtitle, .levent-start__lead, .bio-hero__job, .bio-hero__bio) {
	animation: lv-hero-auf var(--wp--custom--motion--hero-dauer) var(--wp--custom--motion--ease) calc(var(--wp--custom--motion--stufe) * 4) both;
}
.lv-anim :is(.hero-cover .wp-block-buttons, .hero-cover .standortsuche, .levent-start .standortsuche, .bio-hero__btn, .hero-cover__cols) {
	animation: lv-hero-auf var(--wp--custom--motion--hero-dauer) var(--wp--custom--motion--ease) calc(var(--wp--custom--motion--stufe) * 6) both;
}
/* :has() — отдельными правилами: старый браузер отбросит только их, а не весь список выше */
.lv-anim .gp-tp:has(h1) .gp-tp__title {
	animation: lv-hero-auf var(--wp--custom--motion--hero-dauer) var(--wp--custom--motion--ease) calc(var(--wp--custom--motion--stufe) * 2) both;
}
.lv-anim .gp-tp:has(h1) :is(.gp-tp__lead, .gp-tp__body) {
	animation: lv-hero-auf var(--wp--custom--motion--hero-dauer) var(--wp--custom--motion--ease) calc(var(--wp--custom--motion--stufe) * 4) both;
}
.lv-anim .gp-tp:has(h1) .gp-tp__btn {
	animation: lv-hero-auf var(--wp--custom--motion--hero-dauer) var(--wp--custom--motion--ease) calc(var(--wp--custom--motion--stufe) * 6) both;
}

/* ── Стрелка «вниз» внизу hero (её добавляет скрипт) ── */
.lv-pfeil {
	position: absolute;
	z-index: 3;
	bottom: var(--wp--preset--spacing--r-16);
	left: 50%;
	box-sizing: border-box;
	width: 2.75rem; /* зона нажатия 44 */
	height: 2.75rem;
	margin: 0 0 0 -1.375rem;
	padding: 0;
	border: 1px solid var(--wp--preset--color--line-soft);
	border-radius: 50%;
	background: color-mix(in srgb, var(--wp--preset--color--bg-soft) 88%, transparent);
	cursor: pointer;
	animation:
		lv-pfeil-ein var(--wp--custom--motion--dauer) var(--wp--custom--motion--ease) 1s both,
		lv-pfeil-wippe 1.6s ease-in-out 1.8s 3;
	transition: opacity var(--wp--custom--transition--base), visibility 0s linear 0s, background-color var(--wp--custom--transition--base);
}
.lv-pfeil::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0.625rem;
	height: 0.625rem;
	border-right: 2px solid var(--wp--preset--color--contrast);
	border-bottom: 2px solid var(--wp--preset--color--contrast);
	transform: translate(-50%, -70%) rotate(45deg);
}
.lv-pfeil:hover { background: var(--wp--preset--color--bg-soft); }
.lv-pfeil:focus-visible {
	outline: 2px solid var(--wp--preset--color--contrast);
	outline-offset: 2px;
}
.lv-pfeil.is-weg {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

/* Без движения: ничего не прячем и не двигаем (скрипт при этом класс .lv-anim и не ставит — запасной слой) */
@media (prefers-reduced-motion: reduce) {
	.lv-anim .lv-reveal,
	.lv-anim .lv-reveal.is-in {
		opacity: 1;
		translate: none;
		transition: none;
	}
	.lv-anim *,
	.lv-pfeil {
		animation: none !important;
	}
}
