/*
 * Back-to-top FAB — bottom-right scroll action, paired with the call FAB on the left.
 */

.afc-back-to-top {
	position: fixed;
	inset-block-end: calc(var(--afc-space-lg) + env(safe-area-inset-bottom, 0px));
	inset-inline-end: calc(var(--afc-space-lg) + env(safe-area-inset-right, 0px));
	z-index: var(--afc-z-floating-fab);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	inline-size: var(--afc-floating-fab-size);
	block-size: var(--afc-floating-fab-size);
	border: 0;
	border-radius: 50%;
	background: var(--afc-color-brand-navy);
	color: var(--afc-white);
	box-shadow:
		0 10px 24px rgba(7, 13, 32, 0.28),
		0 2px 6px rgba(7, 13, 32, 0.16);
	cursor: pointer;
	opacity: 0;
	transform: translateY(12px) scale(0.92);
	pointer-events: none;
	transition:
		opacity var(--afc-duration-fast) var(--afc-ease-standard),
		transform var(--afc-duration-fast) var(--afc-ease-standard),
		background-color var(--afc-duration-fast) var(--afc-ease-standard),
		box-shadow var(--afc-duration-fast) var(--afc-ease-standard);
}

.afc-back-to-top:not([hidden]) {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.afc-back-to-top:hover {
	background: var(--afc-color-brand-navy-dark);
	color: var(--afc-white);
	transform: translateY(-2px) scale(1.04);
	box-shadow:
		0 14px 28px rgba(7, 13, 32, 0.32),
		0 4px 10px rgba(7, 13, 32, 0.18);
}

.afc-back-to-top:active {
	transform: translateY(0) scale(0.98);
}

.afc-back-to-top:focus-visible {
	outline: var(--afc-focus-ring-width) solid var(--afc-white);
	outline-offset: 3px;
	box-shadow:
		0 0 0 3px var(--afc-color-brand-navy),
		0 10px 24px rgba(7, 13, 32, 0.28);
}

html.afc-js .afc-back-to-top:not([hidden]) {
	animation: afc-back-to-top-enter 480ms var(--afc-ease-entrance) both;
}

@keyframes afc-back-to-top-enter {
	from {
		opacity: 0;
		transform: translateY(16px) scale(0.82);
	}

	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@media (max-width: 899px) {
	.afc-back-to-top {
		inset-block-end: calc(var(--afc-call-bar-height) + var(--afc-space-md) + env(safe-area-inset-bottom, 0px));
	}
}

@media (prefers-reduced-motion: reduce) {
	.afc-back-to-top,
	.afc-back-to-top:not([hidden]) {
		animation: none;
		transition: background-color var(--afc-duration-fast) var(--afc-ease-standard);
	}

	.afc-back-to-top:hover {
		transform: none;
	}
}
