/**
 * Floating Back to Top — Frontend styles.
 */

.fbt-button {
	--fbt-size: 48px;
	--fbt-offset-b: 24px;
	--fbt-offset-s: 24px;
	--fbt-bg: #111;
	--fbt-icon: #fff;
	--fbt-hover-bg: #000;
	--fbt-hover-icon: #fff;
	--fbt-opacity: 0.9;

	position: fixed;
	z-index: 9998;
	width: var(--fbt-size);
	height: var(--fbt-size);
	padding: 0;
	margin: 0;
	border: 0;
	background: var(--fbt-bg);
	color: var(--fbt-icon);
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.25s ease, transform 0.25s ease, background-color 0.2s ease, color 0.2s ease;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
}

.fbt-button:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

.fbt-button svg {
	width: 55%;
	height: 55%;
	display: block;
}

.fbt-button:hover {
	background: var(--fbt-hover-bg);
	color: var(--fbt-hover-icon);
}

/* ── Visible state ─────────────────────────────────────── */

.fbt-button.is-visible {
	opacity: var(--fbt-opacity);
	visibility: visible;
	pointer-events: auto;
}

.fbt-button.is-visible:hover {
	opacity: 1;
}

/* ── Position ──────────────────────────────────────────────
 * Centering is done via `left: calc(50% - …)` and NOT via
 * `transform: translateX(-50%)` on purpose. Many themes (Themify
 * included) attach a `transform` to `button:hover` for a lift/scale
 * effect — that override would otherwise wipe our centering transform
 * and the button would jump sideways on hover. With the math-based
 * centering, `transform` stays free for animation states and theme
 * hover effects without side effects on the resting position.
 */

.fbt-pos-bottom-right  { right: var(--fbt-offset-s);  bottom: var(--fbt-offset-b); }
.fbt-pos-bottom-left   { left:  var(--fbt-offset-s);  bottom: var(--fbt-offset-b); }
.fbt-pos-bottom-center { left: calc(50% - var(--fbt-size) / 2); bottom: var(--fbt-offset-b); }

/* ── Shape ─────────────────────────────────────────────── */

.fbt-shape-circle  { border-radius: 50%; }
.fbt-shape-rounded { border-radius: 12px; }
.fbt-shape-square  { border-radius: 0; }

/* ── Animations ────────────────────────────────────────── */

.fbt-anim-fade  { /* default — opacity-only */ }

.fbt-anim-slide          { transform: translateY(20px); }
.fbt-anim-slide.is-visible { transform: translateY(0); }

.fbt-anim-scale          { transform: scale(0.7); }
.fbt-anim-scale.is-visible { transform: scale(1); }

.fbt-anim-none {
	transition: background-color 0.2s ease, color 0.2s ease;
}

/* ── Mobile ────────────────────────────────────────────── */

@media (max-width: 767px) {
	.fbt-hide-mobile { display: none !important; }
}

/* ── Reduced motion ────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	.fbt-button { transition: opacity 0.15s linear, background-color 0.2s ease, color 0.2s ease; }
	.fbt-anim-slide, .fbt-anim-scale { transform: none !important; }
}
