/* ==========================================================================
   Back to top (global; button injected by assets/js/back-to-top.js)
   Same blue / hover shade / focus ring as the primary "Получить расчёт"
   buttons. Hidden ↔ visible fades with opacity + a 10px rise.
   ========================================================================== */

.av-to-top {
	position: fixed;
	right: 16px;
	bottom: max(16px, env(safe-area-inset-bottom));
	z-index: 90; /* under the sticky header (100) */
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background-color: var(--av-primary);
	color: #fff;
	box-shadow: 0 6px 16px rgba(11, 31, 51, 0.18);
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px);
	/* Lift above the footer legal row (set by the script); separate from
	   transform and not transitioned, so it tracks the scroll exactly. */
	translate: 0 calc(var(--av-to-top-lift, 0px) * -1);
	transition:
		opacity 0.25s ease,
		transform 0.25s ease,
		visibility 0s linear 0.25s,
		background-color 0.2s ease,
		box-shadow 0.2s ease;
}

.av-to-top.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	transition:
		opacity 0.25s ease,
		transform 0.25s ease,
		visibility 0s linear 0s,
		background-color 0.2s ease,
		box-shadow 0.2s ease;
}

.av-to-top__icon {
	display: block;
	transition: transform 0.2s ease;
}

.av-to-top:hover,
.av-to-top:focus-visible {
	background-color: var(--av-primary-hover);
	box-shadow: 0 8px 20px rgba(11, 31, 51, 0.22);
}

.av-to-top:hover .av-to-top__icon {
	transform: translateY(-2px);
}

.av-to-top:focus-visible {
	outline: 2px solid var(--av-primary);
	outline-offset: 3px;
}

@media (min-width: 600px) {
	.av-to-top {
		right: 30px;
		bottom: 30px;
		width: 48px;
		height: 48px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.av-to-top,
	.av-to-top.is-visible,
	.av-to-top__icon {
		transition: none;
	}

	.av-to-top {
		transform: none;
	}

	.av-to-top:hover .av-to-top__icon {
		transform: none;
	}
}

@media print {
	.av-to-top {
		display: none;
	}
}
