/* ==========================================================================
   Back-to-top button — printed once by ahan_print_style_once('totop').
   A round link, either inside the floating contact column (no modifier) or alone in a corner (--solo).
   Every value comes from the --totop-* tokens (tokens.css); hover/press and the «show after N px» reveal live in motion.css.
   ========================================================================== */

.ahan-totop {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--totop-size);
	height: var(--totop-size);
	border-radius: 50%;
	background: var(--totop-bg);
	box-shadow: var(--shadow);
	color: var(--totop-color);
	text-decoration: none;
	pointer-events: auto; /* the floating column itself ignores the pointer */
}

.ahan-totop:hover,
.ahan-totop:focus-visible {
	background: var(--totop-bg-hover);
	color: var(--totop-color);
}

.ahan-totop:focus-visible {
	outline: medium solid currentcolor;
	outline-offset: calc(var(--totop-size) * -0.1);
}

.ahan-totop--soft {
	border-radius: var(--totop-radius-soft);
}

.ahan-totop--square {
	border-radius: var(--totop-radius-square);
}

.ahan-totop__icon {
	width: var(--totop-icon);
	height: var(--totop-icon);
	rotate: var(--totop-icon-rotate);
}

/* Label: an absolute pill beside the button, towards the inside of the page. Physical sides on purpose (the corners are physical). */
.ahan-totop__text {
	position: absolute;
	inset-block: 0;
	right: calc(100% + var(--totop-text-gap));
	display: flex;
	align-items: center;
	padding-inline: var(--totop-text-pad);
	border-radius: var(--totop-radius-pill);
	background: var(--totop-bg);
	box-shadow: var(--shadow);
	font-size: var(--totop-fs);
	font-weight: var(--fw-medium);
	line-height: 1;
	white-space: nowrap;
}

.ahan-totop:hover .ahan-totop__text,
.ahan-totop:focus-visible .ahan-totop__text {
	background: var(--totop-bg-hover);
}

.ahan-totop--soft .ahan-totop__text {
	border-radius: var(--totop-radius-soft);
}

.ahan-totop--square .ahan-totop__text {
	border-radius: var(--totop-radius-square);
}

/* Alone in a corner. */
.ahan-totop--solo {
	position: fixed;
	bottom: var(--totop-bottom);
	z-index: var(--totop-z);
}

.ahan-totop--left {
	left: var(--totop-side);
}

.ahan-totop--right {
	right: var(--totop-side);
}

.ahan-totop--left .ahan-totop__text {
	right: auto;
	left: calc(100% + var(--totop-text-gap));
}

@media (max-width: 767px) {
	.ahan-totop--solo {
		bottom: var(--totop-bottom-mobile);
	}

	.ahan-totop--left {
		left: var(--totop-side-mobile);
	}

	.ahan-totop--right {
		right: var(--totop-side-mobile);
	}

	/* The label is hidden on mobile unless the setting asks for it (--text-m). */
	.ahan-totop:not(.ahan-totop--text-m) .ahan-totop__text {
		display: none;
	}
}

/* Under an open off-canvas panel. */
body:has(.ahan-offcanvas.is-open) .ahan-totop {
	display: none;
}

@media print {
	.ahan-totop--solo {
		display: none;
	}
}
