/**
 * Back-to-top button with animated airplane.
 */

.enigma-back-to-top {
	position: fixed;
	bottom: 32px;
	right: 32px;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var(--e-accent, #26A9E0);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transform: translateY(20px);
	transition: opacity 300ms ease, visibility 300ms ease, transform 300ms ease, background 200ms ease;
	z-index: 999;
	color: #fff;
	box-shadow: 0 4px 12px rgba(38, 169, 224, 0.3);
}

.enigma-back-to-top:hover {
	background: var(--e-accent-hover, #5FC2EA);
	box-shadow: 0 6px 16px rgba(38, 169, 224, 0.4);
}

.enigma-back-to-top:active {
	transform: scale(0.95) translateY(20px);
}

.enigma-back-to-top.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.enigma-back-to-top__plane {
	width: 24px;
	height: 24px;
	display: block;
	animation: enigma-plane-fly 2s ease-in-out infinite;
}

.enigma-back-to-top.is-flying .enigma-back-to-top__plane {
	animation: enigma-plane-takeoff 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes enigma-plane-fly {
	0%, 100% {
		transform: translateY(0px) scale(1);
	}
	50% {
		transform: translateY(-4px) scale(1);
	}
}

@keyframes enigma-plane-takeoff {
	0% {
		opacity: 1;
		transform: translateY(0) scale(1) rotate(0deg);
	}
	25% {
		opacity: 1;
		transform: translateY(-30vh) scale(1.05) rotate(-5deg);
	}
	50% {
		opacity: 1;
		transform: translateY(-60vh) scale(0.95) rotate(0deg);
	}
	75% {
		opacity: 0.7;
		transform: translateY(-90vh) scale(0.85) rotate(3deg);
	}
	100% {
		opacity: 0;
		transform: translateY(-120vh) scale(0.7) rotate(0deg);
	}
}

/* Responsive */
@media (max-width: 768px) {
	.enigma-back-to-top {
		bottom: 20px;
		right: 20px;
		width: 48px;
		height: 48px;
	}

	.enigma-back-to-top__plane {
		width: 20px;
		height: 20px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.enigma-back-to-top,
	.enigma-back-to-top__plane {
		animation: none !important;
		transition: none !important;
	}
}
