/* =========================================================================
   METROPARK — страница приветствия
   Видео-фон · выбор языка · шарики-бренды (из админки)
   ========================================================================= */

:root {
	--wl-ink: #06121c;
	--wl-blue: #1b8fd8;
	--wl-white: #ffffff;
	--wl-ball: clamp(62px, 7.4vw, 112px);   /* диаметр шарика (9 в ряд) */
	--wl-gap: clamp(10px, 1.6vw, 26px);
	--wl-float: clamp(14px, 2.6vh, 34px);   /* высота подпрыгивания */
	--wl-ease: cubic-bezier(.22, .61, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
	margin: 0;
	height: 100%;
	background: var(--wl-ink);
	color: var(--wl-white);
	font-family: "Montserrat", "Segoe UI", Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
}
body.wl { overflow: hidden; }

/* ---------- Фон ---------- */
.wl-bg {
	position: fixed; inset: 0; z-index: 0; overflow: hidden;
	/* фирменный фон, пока видео грузится или если оно отключено */
	background:
		radial-gradient(1200px 700px at 50% 38%, rgba(27,143,216,.30), transparent 70%),
		radial-gradient(900px 500px at 80% 90%, rgba(226,26,32,.14), transparent 70%),
		linear-gradient(180deg, #0a2236 0%, var(--wl-ink) 100%);
}
.wl-bg__video {
	position: absolute; inset: 0;
	opacity: 0; transition: opacity 1.6s var(--wl-ease);
}
.wl-bg__video.is-playing { opacity: 1; }
/* «cover» для iframe 16:9: всегда заполняет экран без полей */
.wl-bg__video iframe {
	position: absolute; top: 50%; left: 50%;
	width: max(100vw, 177.78vh);
	height: max(100vh, 56.25vw);
	transform: translate(-50%, -50%) scale(1.06);
	border: 0; pointer-events: none;
}
/* затемнение: сверху и снизу плотнее — текст и шарики читаются на любом кадре */
.wl-bg__shade {
	position: absolute; inset: 0;
	background:
		linear-gradient(180deg, rgba(6,18,28,.78) 0%, rgba(6,18,28,.28) 30%, rgba(6,18,28,.18) 55%, rgba(6,18,28,.82) 100%),
		radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,.55) 100%);
}
/* тонкая сетка — наследник старой «setka», но деликатнее */
.wl-bg__grid {
	position: absolute; inset: 0; opacity: .22; mix-blend-mode: overlay;
	background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.5) 0 1px, transparent 1px 4px);
}

/* ---------- Загрузчик ---------- */
.wl-loader {
	position: fixed; inset: 0; z-index: 30;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
	background: var(--wl-ink);
	transition: opacity .9s var(--wl-ease), visibility .9s;
}
.wl-loader__logo { width: min(320px, 62vw); height: auto; animation: wl-breathe 2.4s ease-in-out infinite; }
.wl-loader__bar {
	width: min(220px, 50vw); height: 2px; border-radius: 2px; overflow: hidden; position: relative;
	background: rgba(255,255,255,.12);
}
.wl-loader__bar::after {
	content: ""; position: absolute; inset: 0; width: 40%;
	background: linear-gradient(90deg, transparent, var(--wl-blue), transparent);
	animation: wl-scan 1.3s ease-in-out infinite;
}
body:not(.is-loading) .wl-loader { opacity: 0; visibility: hidden; }

/* ---------- Содержимое ---------- */
.wl-main {
	position: relative; z-index: 10;
	min-height: 100%; height: 100dvh;
	display: flex; flex-direction: column; align-items: center;
	padding: max(3.5vh, env(safe-area-inset-top)) 16px max(2vh, env(safe-area-inset-bottom));
	text-align: center;
}

.wl-head { margin-top: clamp(8px, 4vh, 48px); }
.wl-logo {
	position: relative; display: inline-block; margin: 0; line-height: 0;
	animation: wl-logo-in 1.6s var(--wl-ease) .15s both;
}
/* ореол за логотипом */
.wl-logo::before {
	content: ""; position: absolute; inset: -55% -18%; z-index: -1; pointer-events: none;
	background:
		radial-gradient(ellipse at center, rgba(120,200,255,.32) 0%, rgba(27,143,216,.14) 38%, transparent 68%);
	filter: blur(6px);
	animation: wl-halo 6s ease-in-out infinite;
}
.wl-logo img {
	position: relative; display: block;
	width: clamp(220px, 34vw, 500px); height: auto;
	/* светлый контур + голубое свечение + глубокая тень: буквы отделяются от любого кадра видео */
	filter:
		drop-shadow(0 0 1px rgba(255,255,255,.95))
		drop-shadow(0 0 1px rgba(255,255,255,.6))
		drop-shadow(0 0 14px rgba(110,195,255,.55))
		drop-shadow(0 10px 28px rgba(0,0,0,.65));
}
/* блик по буквам: маска = сам логотип, поэтому свет идёт строго по форме */
.wl-logo::after {
	content: ""; position: absolute; inset: 0; pointer-events: none;
	background: linear-gradient(105deg, transparent 38%, rgba(255,255,255,.0) 42%, rgba(255,255,255,.85) 50%, rgba(255,255,255,0) 58%, transparent 62%) no-repeat;
	background-size: 260% 100%; background-position: 160% 0;
	-webkit-mask: url(../images/welcome/logo.png) center / 100% 100% no-repeat;
	mask: url(../images/welcome/logo.png) center / 100% 100% no-repeat;
	mix-blend-mode: screen;
	animation: wl-shine 7s ease-in-out 2.2s infinite;
}
.wl-tagline {
	margin: clamp(10px, 1.8vh, 20px) 0 0;
	display: flex; flex-wrap: wrap; justify-content: center; gap: .35em .9em;
	font-weight: 300; font-size: clamp(10px, 1.05vw, 14px);
	letter-spacing: .28em; text-transform: uppercase;
	color: rgba(255,255,255,.78);
	text-shadow: 0 1px 8px rgba(0,0,0,.6);
}
.wl-tagline i { font-style: normal; color: var(--wl-blue); }

/* ---------- Языки ---------- */
.wl-lang {
	margin-top: clamp(18px, 5vh, 56px);
	display: flex; gap: clamp(10px, 1.6vw, 22px); flex-wrap: wrap; justify-content: center;
}
.wl-lang__item {
	--h: 0px;
	display: flex; flex-direction: column; align-items: center; gap: 4px;
	min-width: clamp(96px, 10vw, 148px);
	padding: clamp(12px, 1.6vh, 18px) clamp(16px, 2vw, 28px);
	border-radius: 18px;
	color: var(--wl-white); text-decoration: none;
	background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.05));
	border: 1px solid rgba(255,255,255,.28);
	box-shadow: 0 10px 30px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.25);
	-webkit-backdrop-filter: blur(10px) saturate(140%);
	backdrop-filter: blur(10px) saturate(140%);
	transform: translateY(var(--h));
	transition: transform .35s var(--wl-ease), background .35s, border-color .35s, box-shadow .35s;
}
.wl-lang__code { font-weight: 600; font-size: clamp(22px, 2.6vw, 38px); letter-spacing: .08em; line-height: 1; }
.wl-lang__name { font-weight: 300; font-size: clamp(10px, .85vw, 12px); letter-spacing: .18em; text-transform: uppercase; opacity: .8; }
.wl-lang__item:hover, .wl-lang__item:focus-visible {
	--h: -4px;
	background: linear-gradient(180deg, rgba(27,143,216,.55), rgba(27,143,216,.25));
	border-color: rgba(255,255,255,.6);
	box-shadow: 0 16px 40px rgba(27,143,216,.35), inset 0 1px 0 rgba(255,255,255,.35);
	outline: none;
}
.wl-lang__item:focus-visible { box-shadow: 0 0 0 3px #fff, 0 16px 40px rgba(27,143,216,.45); }

/* ---------- Шарики ---------- */
.wl-balls { width: 100%; padding-top: calc(var(--wl-float) + 8px); }
.wl-balls__list {
	list-style: none; margin: 0 auto; padding: 0;
	display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end;
	gap: calc(var(--wl-gap) * 1.6) var(--wl-gap);
	max-width: 1360px;
}
.wl-ball {
	position: relative; width: var(--wl-ball); height: calc(var(--wl-ball) + var(--wl-float) + 26px);
	display: flex; align-items: flex-end; justify-content: center;
	/* появление снизу по очереди */
	animation: wl-rise .9s var(--wl-ease) both;
	animation-delay: calc(.6s + var(--i) * 90ms);
}
/* тень на «полу» — сжимается, когда шарик взлетает */
.wl-ball::after {
	content: ""; position: absolute; bottom: 4px; left: 50%;
	width: 70%; height: 10px; border-radius: 50%;
	background: radial-gradient(closest-side, rgba(0,0,0,.55), transparent);
	transform: translateX(-50%);
	animation: wl-shadow 2.6s ease-in-out infinite;
}
.wl-ball--even::after { animation-delay: -1.3s; }

.wl-ball__link {
	position: relative; display: block; width: 100%;
	margin-bottom: 14px;
	text-decoration: none; color: inherit;
	/* подпрыгивание: соседние шарики — в противофазе (как в оригинале) */
	animation: wl-float 2.6s ease-in-out infinite;
}
.wl-ball--even .wl-ball__link { animation-delay: -1.3s; }

.wl-ball__face {
	--ring: color-mix(in oklab, var(--c) 62%, #000);
	position: relative; display: flex; align-items: center; justify-content: center;
	width: var(--wl-ball); height: var(--wl-ball); border-radius: 50%;
	/* объём: свет сверху-слева, тень снизу-справа, цвет бренда */
	background:
		radial-gradient(circle at 50% 58%, var(--c) 52%, color-mix(in oklab, var(--c) 78%, #000) 100%);
	box-shadow:
		inset 0 0 0 calc(var(--wl-ball) * .045) var(--ring),
		inset -8px -12px 22px rgba(0,0,0,.18),
		0 0 22px 2px rgba(255,255,255,.35),
		0 14px 26px rgba(0,0,0,.35);
}
@supports not (background: color-mix(in oklab, red, blue)) {
	.wl-ball__face { --ring: rgba(0,0,0,.25); background: var(--c); }
}
/* блик стекла */
.wl-ball__face::before {
	content: ""; position: absolute; inset: 5% 30% 66% 16%; border-radius: 50%;
	background: radial-gradient(ellipse at 40% 40%, rgba(255,255,255,.7), rgba(255,255,255,0) 72%);
	transform: rotate(-18deg); pointer-events: none; z-index: 2;
}
/* отражение снизу */
.wl-ball__face::after {
	content: ""; position: absolute; inset: 70% 26% 7% 26%; border-radius: 50%;
	background: radial-gradient(ellipse, rgba(255,255,255,.28), transparent 70%);
	pointer-events: none; z-index: 2;
}
.wl-ball__face img {
	position: relative; z-index: 1;
	max-width: 74%; max-height: 74%; width: auto; height: auto;
	border-radius: 10%;               /* логотипы на своей квадратной подложке — мягче */
	user-select: none; -webkit-user-drag: none;
}

.wl-ball__name {
	position: absolute; left: 50%; top: calc(100% + 10px);
	transform: translate(-50%, -6px);
	white-space: nowrap; pointer-events: none;
	font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase;
	padding: 5px 10px; border-radius: 999px;
	background: rgba(6,18,28,.72); border: 1px solid rgba(255,255,255,.2);
	-webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
	opacity: 0; transition: opacity .3s, transform .3s var(--wl-ease);
	z-index: 3;
}

/* наведение / фокус: шарик замирает, увеличивается и светится */
.wl-ball__link:hover, .wl-ball__link:focus-visible { animation-play-state: paused; outline: none; }
.wl-ball:has(.wl-ball__link:hover)::after, .wl-ball:has(.wl-ball__link:focus-visible)::after { animation-play-state: paused; }
.wl-ball__link:hover .wl-ball__face, .wl-ball__link:focus-visible .wl-ball__face {
	transform: scale(1.14);
	box-shadow:
		inset 0 0 0 calc(var(--wl-ball) * .045) var(--ring),
		inset -8px -12px 22px rgba(0,0,0,.14),
		0 0 0 4px rgba(255,255,255,.55),
		0 0 38px 8px color-mix(in oklab, var(--c) 70%, #fff),
		0 18px 32px rgba(0,0,0,.4);
}
.wl-ball__link:hover .wl-ball__name, .wl-ball__link:focus-visible .wl-ball__name { opacity: 1; transform: translate(-50%, 0); }

/* смена магазина в шарике: «лопается» и появляется новый */
.wl-ball__face { scale: 1; opacity: 1; transition: transform .45s var(--wl-ease), box-shadow .45s var(--wl-ease), scale .38s cubic-bezier(.34,1.56,.64,1), opacity .3s; }
.wl-ball.is-out .wl-ball__face { scale: .2; opacity: 0; transition: scale .32s cubic-bezier(.5,0,.75,0), opacity .28s; }
.wl-ball.is-out .wl-ball__name { opacity: 0; }

/* ---------- Подсказка «листайте вниз» ---------- */
.wl-enter {
	margin-top: auto; margin-bottom: clamp(4px, 1.5vh, 16px);
	display: inline-flex; flex-direction: column; align-items: center; gap: 8px;
	color: rgba(255,255,255,.82); text-decoration: none;
	font-size: 10px; font-weight: 500; letter-spacing: .26em; text-transform: uppercase;
	text-shadow: 0 1px 8px rgba(0,0,0,.6);
	animation: wl-fade 1.1s var(--wl-ease) 1.4s both;
	transition: color .3s, transform .3s var(--wl-ease);
}
.wl-enter:hover, .wl-enter:focus-visible { color: #fff; transform: translateY(3px); outline: none; }
.wl-enter__mouse {
	position: relative; width: 24px; height: 38px; border-radius: 14px;
	border: 2px solid currentColor; opacity: .9;
}
.wl-enter__wheel {
	position: absolute; left: 50%; top: 7px; width: 3px; height: 7px; margin-left: -1.5px;
	border-radius: 2px; background: currentColor;
	animation: wl-wheel 1.8s ease-in-out infinite;
}
.wl-enter__chev { animation: wl-chev 1.8s ease-in-out infinite; }
@media (max-height: 640px) { .wl-enter__label { display: none; } .wl-enter__mouse { height: 30px; } }

/* ---------- Переход на главную ---------- */
.wl-curtain {
	position: fixed; inset: 0; z-index: 40; pointer-events: none;
	background: radial-gradient(ellipse at 50% 45%, #0b2236 0%, var(--wl-ink) 70%);
	opacity: 0; transition: opacity .75s cubic-bezier(.6,0,.4,1) .25s;
}
.wl-bg { transition: transform 1.1s cubic-bezier(.6,0,.2,1), filter 1.1s; }
.wl-head, .wl-lang, .wl-enter { transition: transform .8s cubic-bezier(.6,0,.4,1), opacity .6s, filter .8s; }
body.is-leaving .wl-curtain { opacity: 1; }
body.is-leaving .wl-bg { transform: scale(1.14); filter: brightness(.45) blur(2px); }
body.is-leaving .wl-head { transform: translateY(-40px) scale(.94); opacity: 0; filter: blur(6px); }
body.is-leaving .wl-lang { transform: translateY(-26px); opacity: 0; filter: blur(4px); transition-delay: .05s; }
body.is-leaving .wl-enter { transform: translateY(30px); opacity: 0; }
/* шарики улетают вверх по очереди */
body.is-leaving .wl-ball {
	animation: wl-fly .85s cubic-bezier(.55,0,.3,1) forwards;
	animation-delay: calc(var(--i) * 45ms);
}
body.is-leaving .wl-ball::after { opacity: 0; transition: opacity .3s; }
/* выбранный шарик: не улетает — увеличивается и вспыхивает, потом растворяется в шторке */
body.is-leaving .wl-ball.is-chosen { animation: wl-chosen 1s cubic-bezier(.3,0,.2,1) forwards; z-index: 50; }
body.is-leaving .wl-ball.is-chosen .wl-ball__link { animation-play-state: paused; }
body.is-leaving .wl-ball.is-chosen .wl-ball__face {
	box-shadow: inset 0 0 0 calc(var(--wl-ball) * .045) var(--ring), 0 0 0 6px rgba(255,255,255,.8), 0 0 80px 24px color-mix(in oklab, var(--c) 70%, #fff);
}
body.is-leaving .wl-ball.is-chosen .wl-ball__name { opacity: 1; transform: translate(-50%, 0); }
body.is-leaving .wl-pause { opacity: 0; }

/* ---------- Кнопка паузы видео ---------- */
.wl-pause {
	position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 20;
	width: 38px; height: 38px; border-radius: 50%;
	display: grid; place-items: center; cursor: pointer;
	color: #fff; background: rgba(6,18,28,.55); border: 1px solid rgba(255,255,255,.3);
	-webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
	opacity: .65; transition: opacity .3s;
}
.wl-pause:hover, .wl-pause:focus-visible { opacity: 1; outline: none; box-shadow: 0 0 0 2px #fff; }
.wl-pause[hidden] { display: none; }
.wl-pause svg { fill: currentColor; }
.wl-pause .wl-pause__play { display: none; }
.wl-pause[aria-pressed="true"] .wl-pause__p { display: none; }
.wl-pause[aria-pressed="true"] .wl-pause__play { display: block; }

/* ---------- Появление шапки ---------- */
.wl-head, .wl-lang { animation: wl-fade 1.1s var(--wl-ease) both; }
.wl-head { animation-delay: .25s; }
.wl-lang { animation-delay: .45s; }

/* ---------- Анимации ---------- */
@keyframes wl-float  { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(calc(var(--wl-float) * -1)); } }
@keyframes wl-shadow { 0%, 100% { transform: translateX(-50%) scale(1); opacity: .9; } 50% { transform: translateX(-50%) scale(.62); opacity: .45; } }
@keyframes wl-rise   { from { opacity: 0; transform: translateY(60px) scale(.7); } to { opacity: 1; transform: none; } }
@keyframes wl-fade   { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes wl-breathe { 0%, 100% { opacity: .55; transform: scale(.98); } 50% { opacity: 1; transform: scale(1); } }
@keyframes wl-logo-in { from { opacity: 0; transform: scale(.94); filter: blur(8px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes wl-halo  { 0%, 100% { opacity: .75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes wl-shine { 0% { background-position: 160% 0; } 22%, 100% { background-position: -60% 0; } }
@keyframes wl-wheel { 0% { opacity: 0; transform: translateY(-2px); } 30% { opacity: 1; } 70% { opacity: 1; transform: translateY(10px); } 100% { opacity: 0; transform: translateY(12px); } }
@keyframes wl-chev  { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(5px); opacity: 1; } }
@keyframes wl-chosen { 0% { transform: none; } 45% { transform: translateY(-14vh) scale(1.9); opacity: 1; } 100% { transform: translateY(-18vh) scale(2.4); opacity: 0; } }
@keyframes wl-fly   { 0% { transform: none; opacity: 1; } 100% { transform: translateY(-62vh) scale(.55); opacity: 0; } }
@keyframes wl-scan   { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* ---------- Адаптив ---------- */
@media (max-width: 640px) {
	:root { --wl-float: 12px; }
	.wl-tagline { letter-spacing: .16em; flex-direction: column; gap: .5em; }
	.wl-tagline i, .wl-tagline span:nth-of-type(3) { display: none; }
	/* 9 шариков — ровная сетка 3×3 */
	:root { --wl-ball: min(23vw, 96px); --wl-gap: 7vw; }
	.wl-balls__list { max-width: calc(var(--wl-ball) * 3 + var(--wl-gap) * 2 + 2px); }
	.wl-lang__item { min-width: 84px; border-radius: 14px; }
}
@media (max-height: 560px) and (min-width: 641px) {
	:root { --wl-ball: clamp(56px, 13vh, 90px); --wl-float: 10px; }
	.wl-tagline { display: none; }
}

/* ---------- Меньше движения (настройка ОС) ---------- */
@media (prefers-reduced-motion: reduce) {
	.wl-ball__link, .wl-ball::after, .wl-loader__logo, .wl-loader__bar::after, .wl-logo::before, .wl-logo::after { animation: none; }
	.wl-logo { animation-duration: .01s; animation-delay: 0s; }
	.wl-enter__wheel, .wl-enter__chev { animation: none; }
	body.is-leaving .wl-ball { animation-duration: .01s; }
	.wl-bg, .wl-head, .wl-lang { transition-duration: .01s; }
	.wl-ball, .wl-head, .wl-lang { animation-duration: .01s; animation-delay: 0s; }
	.wl-ball__face, .wl-lang__item { transition: none; }
}
