/**
 * PWA splash — centered stack: truck, title, tagline, loading bar.
 */

html.onduty-pwa-splash-pending,
html.onduty-pwa-splash-pending body {
	background: #eaf4ff;
}

html.onduty-pwa-splash-active body {
	overflow: hidden;
}

.onduty-pwa-splash {
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: none;
	align-items: center;
	justify-content: center;
	background: radial-gradient(circle at 50% 42%, #ffffff 0%, #eaf4ff 58%, #d6ebff 100%);
	opacity: 1;
	transition: opacity 0.45s ease, visibility 0.45s ease;
	-webkit-tap-highlight-color: transparent;
}

html.onduty-pwa-splash-pending .onduty-pwa-splash {
	display: flex;
}

.onduty-pwa-splash.is-exiting {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.onduty-pwa-splash__inner {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: min(100%, var(--od-app-height, 100dvh));
	padding: max(16px, env(safe-area-inset-top, 0px)) 20px max(16px, env(safe-area-inset-bottom, 0px));
	box-sizing: border-box;
}

.onduty-pwa-splash__stack {
	display: flex;
	flex-direction: column;
	align-items: center;
	width: min(100%, 420px);
}

/* 1 — Truck (center of screen, top of stack) */
.onduty-pwa-splash__scene {
	position: relative;
	width: 100%;
	height: min(210px, 28vh);
	min-height: 170px;
	flex: 0 0 auto;
}

.onduty-pwa-splash__glow {
	position: absolute;
	top: 55%;
	left: 50%;
	width: min(250px, 70vw);
	height: min(250px, 70vw);
	transform: translate(-50%, -50%);
	border-radius: 50%;
	background: radial-gradient(circle, rgba(0, 122, 255, 0.16) 0%, rgba(0, 122, 255, 0) 72%);
	animation: onduty-splash-glow 2.8s ease-in-out infinite;
	pointer-events: none;
}

.onduty-pwa-splash__road {
	position: absolute;
	left: -6%;
	right: -6%;
	bottom: 26px;
	height: 14px;
	background: #2b2b2b;
	border-radius: 999px;
	box-shadow: 0 6px 18px rgba(0, 17, 86, 0.12);
	overflow: hidden;
}

.onduty-pwa-splash__road::before {
	content: "";
	position: absolute;
	inset: 5px 0;
	background: repeating-linear-gradient(
		90deg,
		#ffffff 0 18px,
		transparent 18px 34px
	);
	opacity: 0.85;
	animation: onduty-splash-road 0.55s linear infinite;
}

.onduty-pwa-splash__track {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 18px;
	height: 92px;
	overflow: visible;
	pointer-events: none;
}

.onduty-pwa-splash__truck {
	position: absolute;
	bottom: 0;
	left: -140px;
	width: min(128px, 34vw);
	height: auto;
	filter: drop-shadow(0 10px 18px rgba(0, 17, 86, 0.16));
	animation: onduty-splash-truck-drive 2.35s cubic-bezier(0.22, 0.85, 0.24, 1) forwards;
	will-change: left, transform;
}

/* 2 — On Duty GmbH */
.onduty-pwa-splash__brand,
.onduty-pwa-splash__tagline {
	margin: 0;
	padding: 0;
	width: 100%;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	text-align: center;
	color: #000000 !important;
	-webkit-text-fill-color: #000000;
	font-synthesis: weight;
	-webkit-font-smoothing: antialiased;
}

.onduty-pwa-splash__brand {
	margin-top: 0.35rem;
	font-size: clamp(1.45rem, 5.2vw, 1.9rem);
	font-weight: 800;
	line-height: 1.15;
	letter-spacing: 0.01em;
	opacity: 0;
	transform: translateY(14px);
	animation: onduty-splash-brand 2.35s ease forwards;
}

/* 3 — Join the fleet */
.onduty-pwa-splash__tagline {
	margin-top: 0.4rem;
	font-size: clamp(1rem, 3.4vw, 1.12rem);
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: 0.02em;
	opacity: 0;
	transform: translateY(10px);
	animation: onduty-splash-tagline 2.35s ease forwards;
}

/* 4 — Loading bar (directly below tagline) */
.onduty-pwa-splash__progress {
	position: relative;
	width: min(200px, 58vw);
	height: 5px;
	margin-top: 1rem;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.12);
	overflow: hidden;
	opacity: 0;
	animation: onduty-splash-progress-wrap 2.35s ease forwards;
}

.onduty-pwa-splash__progress-bar {
	display: block;
	width: 0;
	height: 100%;
	border-radius: inherit;
	background: #000000;
	animation: onduty-splash-progress 2.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes onduty-splash-truck-drive {
	0% {
		left: -140px;
		transform: translateY(0) scale(0.94);
		opacity: 0;
	}
	12% {
		opacity: 1;
	}
	48% {
		left: calc(50% - 64px);
		transform: translateY(-2px) scale(1);
	}
	58% {
		left: calc(50% - 64px);
		transform: translateY(0) scale(1);
	}
	100% {
		left: calc(100% + 24px);
		transform: translateY(-1px) scale(0.98);
		opacity: 1;
	}
}

@keyframes onduty-splash-brand {
	0%,
	52% {
		opacity: 0;
		transform: translateY(14px);
	}
	68%,
	100% {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes onduty-splash-tagline {
	0%,
	58% {
		opacity: 0;
		transform: translateY(10px);
	}
	74%,
	100% {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes onduty-splash-progress-wrap {
	0%,
	64% {
		opacity: 0;
	}
	78%,
	100% {
		opacity: 1;
	}
}

@keyframes onduty-splash-road {
	from {
		transform: translateX(0);
	}
	to {
		transform: translateX(-34px);
	}
}

@keyframes onduty-splash-glow {
	0%,
	100% {
		opacity: 0.55;
		transform: translate(-50%, -50%) scale(0.96);
	}
	50% {
		opacity: 1;
		transform: translate(-50%, -50%) scale(1.04);
	}
}

@keyframes onduty-splash-progress {
	from {
		width: 0;
	}
	to {
		width: 100%;
	}
}

.onduty-pwa-splash--reduced .onduty-pwa-splash__truck,
.onduty-pwa-splash--reduced .onduty-pwa-splash__brand,
.onduty-pwa-splash--reduced .onduty-pwa-splash__tagline,
.onduty-pwa-splash--reduced .onduty-pwa-splash__progress,
.onduty-pwa-splash--reduced .onduty-pwa-splash__progress-bar,
.onduty-pwa-splash--reduced .onduty-pwa-splash__road::before,
.onduty-pwa-splash--reduced .onduty-pwa-splash__glow {
	animation: none;
}

.onduty-pwa-splash--reduced .onduty-pwa-splash__truck {
	left: calc(50% - 64px);
	opacity: 1;
}

.onduty-pwa-splash--reduced .onduty-pwa-splash__brand,
.onduty-pwa-splash--reduced .onduty-pwa-splash__tagline,
.onduty-pwa-splash--reduced .onduty-pwa-splash__progress {
	opacity: 1;
	transform: none;
}

.onduty-pwa-splash--reduced .onduty-pwa-splash__progress-bar {
	width: 100%;
}

.onduty-pwa-splash__tagline .od-i18n[hidden] {
	display: none !important;
}

html[data-onduty-lang="en"] .onduty-pwa-splash__tagline .od-i18n[data-lang="de"],
html:not([data-onduty-lang="en"]) .onduty-pwa-splash__tagline .od-i18n[data-lang="en"] {
	display: none !important;
}
