/* Фоны и анимации: чередование фонов, горы на стыках секций, свечение, огонь (assets/js/fire.js),
   появление блоков при прокрутке (assets/js/fx.js), узор из точек, зерно.
   Перенесено из демо demo/bg. При «уменьшении движения» анимации выключены (в конце файла). */

:root {
	--fx-white: #ffffff;
	--fx-sand: #ede6db;
	--fx-cream: #f6f2ec;
	--fx-ridge: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 100' preserveAspectRatio='none'%3E%3Cpath d='M0 70L70 52L130 64L210 26L280 56L340 42L430 76L540 18L620 58L680 48L770 80L870 36L940 58L1020 42L1110 78L1210 28L1280 56L1350 44L1410 64L1440 56V100H0Z'/%3E%3C/svg%3E");
	--fx-ridge-back: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 100' preserveAspectRatio='none'%3E%3Cpath d='M0 48L110 18L200 44L320 4L420 40L510 20L640 50L760 14L850 36L960 2L1080 46L1180 20L1300 40L1440 10V100H0Z'/%3E%3C/svg%3E");
	--fx-sky: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 100' preserveAspectRatio='none'%3E%3Cpath d='M0 70L70 52L130 64L210 26L280 56L340 42L430 76L540 18L620 58L680 48L770 80L870 36L940 58L1020 42L1110 78L1210 28L1280 56L1350 44L1410 64L1440 56V0H0Z'/%3E%3C/svg%3E");
	--fx-sky-back: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 100' preserveAspectRatio='none'%3E%3Cpath d='M0 48L110 18L200 44L320 4L420 40L510 20L640 50L760 14L850 36L960 2L1080 46L1180 20L1300 40L1440 10V0H0Z'/%3E%3C/svg%3E");
	--fx-ridge-soft: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 100' preserveAspectRatio='none'%3E%3Cpath d='M0 64C18 62 68 49 110 50C152 51 202 71 250 68C298 65 348 35 400 34C452 33 510 58 560 60C610 62 653 43 700 44C747 45 793 69 840 66C887 63 933 29 980 28C1027 27 1075 56 1120 58C1165 60 1210 42 1250 42C1290 42 1328 59 1360 60C1392 61 1427 50 1440 48V100H0Z'/%3E%3C/svg%3E");
	--fx-ridge-back-soft: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 100' preserveAspectRatio='none'%3E%3Cpath d='M0 36C28 32 112 13 170 14C228 15 288 41 350 40C412 39 477 9 540 8C603 7 670 33 730 34C790 35 842 11 900 12C958 13 1018 38 1080 38C1142 38 1210 11 1270 10C1330 9 1412 27 1440 30V100H0Z'/%3E%3C/svg%3E");
	--fx-sky-soft: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 100' preserveAspectRatio='none'%3E%3Cpath d='M0 64C18 62 68 49 110 50C152 51 202 71 250 68C298 65 348 35 400 34C452 33 510 58 560 60C610 62 653 43 700 44C747 45 793 69 840 66C887 63 933 29 980 28C1027 27 1075 56 1120 58C1165 60 1210 42 1250 42C1290 42 1328 59 1360 60C1392 61 1427 50 1440 48V0H0Z'/%3E%3C/svg%3E");
	--fx-sky-back-soft: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 100' preserveAspectRatio='none'%3E%3Cpath d='M0 36C28 32 112 13 170 14C228 15 288 41 350 40C412 39 477 9 540 8C603 7 670 33 730 34C790 35 842 11 900 12C958 13 1018 38 1080 38C1142 38 1210 11 1270 10C1330 9 1412 27 1440 30V0H0Z'/%3E%3C/svg%3E");
	--fx-ridge: var(--fx-ridge-soft);
	--fx-ridge-back: var(--fx-ridge-back-soft);
	--fx-sky: var(--fx-sky-soft);
	--fx-sky-back: var(--fx-sky-back-soft);
	--fx-hf: clamp(26px, 4vw, 56px); /* высота переднего хребта */
	--fx-hb: clamp(38px, 5.6vw, 84px); /* высота дальнего хребта */
}

.site-main > section { position: relative; isolation: isolate; }
.site-main > section > .container { position: relative; z-index: 2; }

/* ---------- Чередование фонов ---------- */
.hero { background: radial-gradient(120% 90% at 85% 0%, #fbf8f3 0%, transparent 55%), linear-gradient(180deg, #f6f0e7, #efe5d7); }
.hero + .section { background: var(--fx-white); }
.about { background: var(--fx-sand); }
.benefits-wrap { background: var(--fx-white); }
.faq-wrap { background: var(--fx-cream); }
.shop-wrap { position: relative; }
.single-product .site-main,
.post-type-archive-product .site-main { background: linear-gradient(180deg, #f6f0e7 0, var(--fx-cream) 420px); }

/* ---------- Горы на стыках ---------- */
.hero,
.hero + .section,
.section--videos { padding-bottom: calc(clamp(48px, 6vw, 80px) + 32px); }
.hero::after,
.hero + .section::after,
.section--videos::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: -1px;
	left: 0;
	z-index: 1;
	height: var(--fx-hf);
	background: var(--fx-next, var(--bg));
	-webkit-mask: var(--fx-ridge) bottom / 100% 100% no-repeat;
	mask: var(--fx-ridge) bottom / 100% 100% no-repeat;
	pointer-events: none;
}
.hero::before,
.hero + .section::before,
.section--videos::before {
	content: "";
	position: absolute;
	right: 0;
	bottom: -1px;
	left: 0;
	z-index: 1;
	height: var(--fx-hb);
	background: var(--fx-haze, var(--fx-next, var(--bg)));
	opacity: var(--fx-haze-o, .28);
	-webkit-mask: var(--fx-ridge-back) bottom / 100% 100% no-repeat;
	mask: var(--fx-ridge-back) bottom / 100% 100% no-repeat;
	pointer-events: none;
}
.hero { --fx-next: var(--fx-white); padding-bottom: clamp(64px, 9vw, 130px); }
.hero + .section { --fx-next: var(--fx-sand); }
.hero + .section:has(+ .section--videos) { --fx-next: var(--dark); }
.section--videos { --fx-next: var(--fx-sand); }

/* Горы над подвалом: тёмные горы подвала поднимаются в фон страницы.
   Рисуем «небо» над хребтами цветом страницы, поэтому горы не наезжают на содержимое выше. */
.site-footer:not(.site-footer--slim) { position: relative; padding-top: calc(clamp(32px, 4vw, 48px) + var(--fx-hb)); }
.site-footer:not(.site-footer--slim)::before,
.site-footer:not(.site-footer--slim)::after {
	content: "";
	position: absolute;
	top: -1px;
	right: 0;
	left: 0;
	height: var(--fx-hb);
	background: var(--bg);
	pointer-events: none;
}
.site-footer:not(.site-footer--slim)::before {
	-webkit-mask: var(--fx-sky-back) top / 100% 100% no-repeat;
	mask: var(--fx-sky-back) top / 100% 100% no-repeat;
}
.site-footer:not(.site-footer--slim)::after {
	/* дальний хребет — тёплая дымка, а не серый */
	background: linear-gradient(to bottom, var(--bg), color-mix(in srgb, var(--bg) 62%, var(--accent)));
	opacity: .78;
	-webkit-mask: var(--fx-sky) bottom / 100% var(--fx-hf) no-repeat, linear-gradient(#000 0 0) top / 100% calc(var(--fx-hb) - var(--fx-hf) + 1px) no-repeat;
	mask: var(--fx-sky) bottom / 100% var(--fx-hf) no-repeat, linear-gradient(#000 0 0) top / 100% calc(var(--fx-hb) - var(--fx-hf) + 1px) no-repeat;
}

/* Ночной пейзаж в подвале (assets/js/footer-scene.js): холст под содержимым, полоса гор под копирайтом */
.footer-scene {
	position: absolute;
	top: var(--fx-hb);
	right: 0;
	bottom: var(--footer-extra, 0px);
	left: 0;
	z-index: 0;
	overflow: hidden;
	opacity: 0;
	pointer-events: none;
	transition: opacity .8s ease;
}
.footer-scene.is-on { opacity: 1; }
.footer-scene canvas { display: block; width: 100%; height: 100%; }
.site-footer.has-scene:not(.site-footer--slim) { padding-bottom: calc(clamp(150px, 16vw, 240px) + var(--footer-extra, 0px)); }
.site-footer.has-scene > .container { position: relative; z-index: 1; }
.site-footer.has-scene .footer-bottom { border-top-color: rgba(255,255,255,.08); }

/* Дневной пейзаж на первом экране (assets/js/hero-scene.js): холст за содержимым */
.hero-scene { position: absolute; inset: 0; z-index: 0; overflow: hidden; opacity: 0; pointer-events: none; transition: opacity 1s ease; }
.hero-scene.is-on { opacity: 1; }
.hero-scene canvas { display: block; width: 100%; height: 100%; }
.hero.has-scene > .fx-clouds,
.hero.has-scene > .fx-glow-blob { display: none; }

/* Дальний хребет — тёплая дымка, плавный переход */
.hero::before,
.hero + .section::before,
.section--videos::before {
	--fx-haze: linear-gradient(to bottom, color-mix(in srgb, var(--fx-next) 55%, var(--accent)), var(--fx-next) 85%);
	--fx-haze-o: .16;
}

/* ---------- Тёплое свечение ---------- */
.hero,
.section--videos { overflow: hidden; }
.fx-glow-blob {
	position: absolute;
	z-index: 0;
	display: block;
	border-radius: 50%;
	pointer-events: none;
	filter: blur(30px);
}
.hero > .fx-glow-blob { width: 62vw; height: 62vw; max-width: 900px; max-height: 900px; top: -30%; left: -18%; background: radial-gradient(circle, rgb(194 84 27 / .20), rgb(194 84 27 / 0) 62%); animation: fx-drift 16s ease-in-out infinite alternate; }
.hero > .fx-glow-blob + .fx-glow-blob { top: auto; left: auto; right: -20%; bottom: -40%; width: 48vw; height: 48vw; background: radial-gradient(circle, rgb(232 150 60 / .16), rgb(232 150 60 / 0) 62%); animation-duration: 21s; animation-direction: alternate-reverse; }
.section--videos > .fx-glow-blob { left: 50%; bottom: -55%; width: 120vw; height: 70vw; translate: -50% 0; background: radial-gradient(closest-side, rgb(214 98 32 / .2), rgb(214 98 32 / 0)); animation: fx-ember 8s ease-in-out infinite alternate; }
.section--videos > .fx-glow-blob + .fx-glow-blob { display: none; }
@keyframes fx-drift {
	from { transform: translate(0, 0) scale(1); }
	to { transform: translate(8vw, 6vw) scale(1.15); }
}
@keyframes fx-ember {
	0% { opacity: .65; transform: scale(1); }
	40% { opacity: .9; }
	100% { opacity: 1; transform: scale(1.06); }
}

/* ---------- Огонь (Three.js) ---------- */
.fx-fire-canvas { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; }

/* ---------- Зерно ---------- */
body::after {
	content: "";
	position: fixed;
	inset: -50%;
	z-index: 1000;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
	opacity: .07;
	mix-blend-mode: multiply;
	pointer-events: none;
	animation: fx-grain 1s steps(4) infinite;
}
@keyframes fx-grain {
	0% { transform: translate(0, 0); }
	25% { transform: translate(-3%, 2%); }
	50% { transform: translate(2%, -3%); }
	75% { transform: translate(-2%, -1%); }
}

/* ---------- Узор из точек ---------- */
.about::before,
.faq-wrap::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 0;
	background-image: radial-gradient(rgb(165 68 15 / .22) 1.3px, transparent 1.6px);
	background-size: 22px 22px;
	-webkit-mask: radial-gradient(70% 90% at 100% 0%, #000, transparent 70%);
	mask: radial-gradient(70% 90% at 100% 0%, #000, transparent 70%);
	pointer-events: none;
}
.faq-wrap::before {
	-webkit-mask: radial-gradient(60% 80% at 0% 100%, #000, transparent 70%);
	mask: radial-gradient(60% 80% at 0% 100%, #000, transparent 70%);
}

/* ---------- Большая надпись ---------- */
.fx-bigtext-el {
	position: absolute;
	top: 50%;
	left: 0;
	z-index: 0;
	display: block;
	margin-top: -.5em;
	padding-right: .5em;
	background: linear-gradient(90deg, rgb(165 68 15 / 0), rgb(165 68 15 / .07) 25%, rgb(165 68 15 / .07) 75%, rgb(165 68 15 / 0));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	font: 800 clamp(170px, 28vw, 420px)/.9 var(--font-display);
	letter-spacing: -.02em;
	white-space: nowrap;
	pointer-events: none;
	user-select: none;
	will-change: transform;
}
.about { overflow: hidden; }

/* ---------- Появление при прокрутке ---------- */
.fx-r {
	opacity: 0;
	transform: translateY(36px);
	transition: opacity .8s ease, transform .9s cubic-bezier(.2, .75, .2, 1);
	transition-delay: calc(var(--i, 0) * 90ms);
}
.fx-r--left { transform: translateX(-56px); }
.fx-r--right { transform: translateX(56px); }
.fx-r--zoom { transform: scale(.92); }
.fx-r.is-in { opacity: 1; transform: none; }

/* Заголовок первого экрана: слова влетают снизу */
.fx-wm { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .08em; margin-bottom: -.08em; }
.fx-w { display: inline-block; transform: translateY(110%) rotate(4deg); animation: fx-word .9s cubic-bezier(.2, .8, .2, 1) forwards; animation-delay: calc(.15s + var(--i) * 110ms); }
@keyframes fx-word { to { transform: none; } }

/* Остальной текст первого экрана выплывает следом за заголовком */
.hero-copy > :not(.hero-title) { animation: fx-up .9s cubic-bezier(.2, .75, .2, 1) both; }
.hero-copy > :nth-child(2) { animation-delay: .65s; }
.hero-copy > :nth-child(3) { animation-delay: .8s; }
@keyframes fx-up { from { opacity: 0; transform: translateY(28px); } }

/* Фото первого экрана: открывается шторкой */
.hero-photo { animation: fx-curtain 1.2s cubic-bezier(.7, 0, .2, 1) .2s both; }
.hero-photo img { animation: fx-zoom 1.8s cubic-bezier(.2, .7, .2, 1) .2s both; }
@keyframes fx-curtain { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0); } }
@keyframes fx-zoom { from { transform: scale(1.18); } }

/* Карточки товаров чуть приподнимаются под курсором */
ul.products li.product { transition: opacity .8s ease, transform .9s cubic-bezier(.2, .75, .2, 1), box-shadow .3s; }
ul.products li.product.is-in:hover { transform: translateY(-6px); box-shadow: 0 18px 40px rgb(28 26 23 / .12); transition-delay: 0s; }

/* ---------- Облака: еле заметно плывут слева направо под шапкой ---------- */
.fx-clouds { --tile: 1600px; position: absolute; top: 0; right: 0; left: 0; z-index: 0; height: 300px; overflow: hidden; pointer-events: none; -webkit-mask: linear-gradient(#000 35%, transparent); mask: linear-gradient(#000 35%, transparent); }
.fx-clouds i {
	position: absolute;
	top: 0;
	left: calc(var(--tile) * -1);
	width: calc(100% + var(--tile));
	height: 100%;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1600' height='300' viewBox='0 0 1600 300'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.0032 .0085' numOctaves='5' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  3.6 0 0 0 -1.85' result='a'/%3E%3CfeGaussianBlur in='a' stdDeviation='1.5' result='w'/%3E%3CfeOffset in='a' dy='9'/%3E%3CfeGaussianBlur stdDeviation='7' result='o'/%3E%3CfeFlood flood-color='%238f7c64' flood-opacity='.28'/%3E%3CfeComposite in2='o' operator='in' result='s'/%3E%3CfeMerge%3E%3CfeMergeNode in='s'/%3E%3CfeMergeNode in='w'/%3E%3C/feMerge%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E") 0 0 / var(--tile) 100% repeat-x;
	opacity: .9;
	will-change: transform;
	animation: fx-clouds 150s linear infinite;
}
@media (max-width: 560px) { .fx-clouds { --tile: 800px; z-index: 3; height: 68px; -webkit-mask: linear-gradient(#000 25%, transparent); mask: linear-gradient(#000 25%, transparent); } .fx-clouds i { opacity: .8; animation-duration: 110s; } }
@keyframes fx-clouds { to { transform: translate3d(var(--tile), 0, 0); } }


/* ---------- Меньше движения ---------- */
@media (prefers-reduced-motion: reduce) {
	body::after,
	.fx-glow-blob,
	.fx-clouds i,
	.fx-w,
	.hero-copy > *,
	.hero-photo,
	.hero-photo img { animation: none !important; }
	.fx-w { transform: none; }
	.fx-r { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* Текст первого экрана поверх пейзажа: мягкая светлая подложка под словами, чтобы горы не спорили с текстом */
.hero.has-scene .hero-copy { position: relative; isolation: isolate; }
.hero.has-scene .hero-copy::before {
	content: ""; position: absolute; z-index: -1; inset: -12% -18% -14% -22%; pointer-events: none;
	background: radial-gradient(closest-side, rgba(246, 240, 231, .92) 0%, rgba(246, 240, 231, .78) 55%, rgba(246, 240, 231, 0) 100%);
}
.hero.has-scene .hero-text { color: #4a4037; }
