/* ---------------------------------------------------------------------
 * Site-wide "back to top" control (template-parts/global/back-to-top.php).
 * Fixed bottom-right, hidden via the [hidden] attribute until
 * assets/js/back-to-top.js adds .is-visible after ~600px of scroll.
 * z-index sits below the mobile menu (header.css: 100) and the shared
 * Project/ТЗ modal (project-tz-modal.css: 200) so it never sits on top
 * of an open menu or modal.
 * ------------------------------------------------------------------- */

.ark-back-to-top {
	--ark-back-to-top-lift: 0px;
	position: fixed;
	right: 28px;
	bottom: calc(28px + env(safe-area-inset-bottom, 0px) + var(--ark-back-to-top-lift) + var(--cookie-banner-height, 0px));
	z-index: 50;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	color: var(--ark-text-primary);
	background: var(--ark-surface-650);
	border: 1px solid var(--ark-border-titanium);
	border-radius: var(--ark-radius-sm);
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transition: opacity 200ms var(--ark-ease), visibility 200ms var(--ark-ease), border-color 200ms var(--ark-ease), background-color 200ms var(--ark-ease), bottom 200ms var(--ark-ease);
}

.ark-back-to-top.is-visible {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.ark-back-to-top svg {
	width: 20px;
	height: 20px;
}

.ark-back-to-top:hover,
.ark-back-to-top:focus-visible {
	border-color: var(--ark-border-titanium);
	background: color-mix(in srgb, var(--ark-border-titanium) 18%, var(--ark-surface-650));
}

.ark-back-to-top:focus-visible {
	outline: 2px solid var(--ark-border-titanium);
	outline-offset: 2px;
}

@media (max-width: 679px) {
	.ark-back-to-top {
		right: 16px;
		bottom: calc(16px + env(safe-area-inset-bottom, 0px) + var(--ark-back-to-top-lift) + var(--cookie-banner-height, 0px));
		width: 40px;
		height: 40px;
	}

	.ark-back-to-top svg {
		width: 18px;
		height: 18px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ark-back-to-top {
		transition: none;
	}
}
