/**
 * Кнопка «Наверх» — правый нижний угол.
 */

.back-to-top {
	position: fixed;
	z-index: 9985;
	right: max(1rem, env(safe-area-inset-right));
	bottom: max(1rem, env(safe-area-inset-bottom));
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 3rem;
	height: 3rem;
	padding: 0;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	color: #fff;
	background: linear-gradient(145deg, #008888 0%, var(--slider-teal, #007979) 55%, #006b6b 100%);
	box-shadow:
		0 8px 24px rgba(0, 121, 121, 0.35),
		inset 0 1px 0 rgba(255, 255, 255, 0.2);
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px) scale(0.92);
	pointer-events: none;
	transition:
		opacity 0.28s ease,
		visibility 0.28s ease,
		transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1),
		box-shadow 0.2s ease,
		background 0.2s ease;
}

.back-to-top.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.back-to-top:hover {
	background: linear-gradient(145deg, var(--slider-teal-hover, #009090) 0%, #007979 100%);
	box-shadow: 0 12px 30px rgba(0, 121, 121, 0.42);
	transform: translateY(-2px) scale(1);
}

.back-to-top:active {
	transform: translateY(0) scale(0.96);
}

.back-to-top:focus-visible {
	outline: 2px solid var(--slider-yellow, #f2d06b);
	outline-offset: 3px;
}

.back-to-top i {
	font-size: 1.05rem;
	line-height: 1;
}

body.menu-open .back-to-top {
	opacity: 0 !important;
	visibility: hidden !important;
	pointer-events: none !important;
}

@media (max-width: 480px) {
	.back-to-top {
		width: 2.75rem;
		height: 2.75rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.back-to-top {
		transition: opacity 0.15s ease, visibility 0.15s ease;
	}

	.back-to-top:hover {
		transform: none;
	}
}
