/**
 * Back to top button.
 *
 * One fixed button, printed by footer.php and driven by back-to-top.js.
 * Hidden (and out of the tab order) until the page is scrolled.
 */
.aa-totop {
	position: fixed;
	right: 24px;
	bottom: max(24px, env(safe-area-inset-bottom, 0px));
	z-index: 990; /* above page content, below the sticky header (999). */
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: linear-gradient(135deg, #4f6bf0 0%, #6148e0 45%, #973dd9 100%);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 8px 20px rgba(97, 72, 224, 0.35), 0 2px 6px rgba(1, 0, 8, 0.18);
	opacity: 0;
	visibility: hidden;
	transform: translateY(14px);
	transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s, box-shadow 0.2s ease;
	-webkit-tap-highlight-color: transparent;
}

.aa-totop.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	transition-delay: 0s;
}

.aa-totop:hover {
	transform: translateY(-3px);
	box-shadow: 0 12px 26px rgba(97, 72, 224, 0.45), 0 3px 8px rgba(1, 0, 8, 0.2);
}

.aa-totop:active {
	transform: translateY(0);
}

.aa-totop:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
	box-shadow: 0 0 0 6px #6148e0, 0 8px 20px rgba(97, 72, 224, 0.35);
}

.aa-totop svg {
	display: block;
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.4;
	stroke-linecap: round;
	stroke-linejoin: round;
}

@media (max-width: 640px) {
	.aa-totop {
		right: 16px;
		bottom: max(16px, env(safe-area-inset-bottom, 0px));
		width: 44px;
		height: 44px;
	}

	.aa-totop svg {
		width: 20px;
		height: 20px;
	}

	/* The policy pages already pin a "Back to contents" pill in this corner. */
	.aa-totop.aa-totop--raised {
		bottom: calc(max(16px, env(safe-area-inset-bottom, 0px)) + 56px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.aa-totop,
	.aa-totop.is-visible {
		transition: none;
		transform: none;
	}
}

/* Pages with the Zoho SalesIQ launcher (body.aa-has-chat, inc/zoho-salesiq.php):
   the launcher sits bottom right, so the button stacks just above it. */
.aa-has-chat .aa-totop {
	bottom: calc(92px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 640px) {
	.aa-has-chat .aa-totop {
		bottom: calc(84px + env(safe-area-inset-bottom, 0px));
	}

	.aa-has-chat .aa-totop.aa-totop--raised {
		bottom: calc(84px + 56px + env(safe-area-inset-bottom, 0px));
	}
}
