/*
 * Mobile sticky checkout CTA for the classic WooCommerce cart shortcode.
 *
 * Loaded only on classic cart pages and kept non-render-blocking. The original
 * proceed-to-checkout button remains in place; this mirrored CTA appears only
 * when that original button is outside the mobile viewport.
 */

body.rir-theme-classic-cart .rir-theme-classic-cart-sticky-checkout {
	display: none;
}

@media (max-width: 760px) {
	body.rir-theme-classic-cart .rir-theme-classic-cart-sticky-checkout {
		position: fixed;
		z-index: 999;
		right: 0;
		bottom: 0;
		left: 0;
		display: block;
		box-sizing: border-box;
		padding: 10px max(14px, env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-right));
		border-top: 1px solid var(--rir-theme-border);
		background: rgba(255, 255, 255, 0.98);
		box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.14);
		opacity: 0;
		pointer-events: none;
		transform: translate3d(0, 110%, 0);
		transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
		visibility: hidden;
		contain: layout paint style;
	}

	body.rir-theme-classic-cart .rir-theme-classic-cart-sticky-checkout[hidden] {
		display: none;
	}

	body.rir-theme-classic-cart .rir-theme-classic-cart-sticky-checkout.rir-theme-classic-cart-sticky-checkout--visible {
		opacity: 1;
		pointer-events: auto;
		transform: translate3d(0, 0, 0);
		visibility: visible;
	}

	body.rir-theme-classic-cart .rir-theme-classic-cart-sticky-checkout {
		--rir-theme-sticky-checkout-background: #239add;
		--rir-theme-sticky-checkout-background-hover: #1e3b66;
	}

	body.rir-theme-classic-cart.woocommerce-cart .rir-theme-classic-cart-sticky-checkout .rir-theme-classic-cart-sticky-checkout__button.button.checkout-button,
	body.rir-theme-classic-cart.woocommerce-cart .rir-theme-classic-cart-sticky-checkout a.button.checkout-button.rir-theme-classic-cart-sticky-checkout__button,
	body.rir-theme-classic-cart .rir-theme-classic-cart-sticky-checkout .rir-theme-classic-cart-sticky-checkout__button.button.checkout-button,
	body.rir-theme-classic-cart .rir-theme-classic-cart-sticky-checkout a.button.checkout-button.rir-theme-classic-cart-sticky-checkout__button {
		display: inline-flex;
		width: 100%;
		min-height: 54px;
		align-items: center;
		justify-content: center;
		gap: 0.45em;
		margin: 0;
		border-color: transparent;
		border-radius: 4px !important;
		background: #239add;
		background-color: #239add;
		background: var(--rir-theme-sticky-checkout-background);
		background-color: var(--rir-theme-sticky-checkout-background);
		color: #fff;
		font-size: clamp(15.5px, calc(var(--rir-theme-button-font-size, 14px) + 1.25px), 17px);
		font-weight: var(--rir-theme-button-font-weight, 800);
		letter-spacing: -0.01em;
		line-height: 1.18;
		text-align: center;
		text-decoration: none;
		white-space: normal;
		box-shadow: 0 10px 24px rgba(35, 154, 221, 0.22);
		transform: none;
		transition: background-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
	}

	body.rir-theme-classic-cart.woocommerce-cart .rir-theme-classic-cart-sticky-checkout .rir-theme-classic-cart-sticky-checkout__button.button.checkout-button::after,
	body.rir-theme-classic-cart.woocommerce-cart .rir-theme-classic-cart-sticky-checkout a.button.checkout-button.rir-theme-classic-cart-sticky-checkout__button::after,
	body.rir-theme-classic-cart .rir-theme-classic-cart-sticky-checkout .rir-theme-classic-cart-sticky-checkout__button.button.checkout-button::after,
	body.rir-theme-classic-cart .rir-theme-classic-cart-sticky-checkout a.button.checkout-button.rir-theme-classic-cart-sticky-checkout__button::after {
		content: "\2192";
		display: inline-block;
		flex: 0 0 auto;
		font: inherit;
		line-height: 1;
		text-decoration: none;
	}

	body.rir-theme-classic-cart.woocommerce-cart .rir-theme-classic-cart-sticky-checkout .rir-theme-classic-cart-sticky-checkout__button.button.checkout-button:hover,
	body.rir-theme-classic-cart.woocommerce-cart .rir-theme-classic-cart-sticky-checkout .rir-theme-classic-cart-sticky-checkout__button.button.checkout-button:focus-visible,
	body.rir-theme-classic-cart.woocommerce-cart .rir-theme-classic-cart-sticky-checkout a.button.checkout-button.rir-theme-classic-cart-sticky-checkout__button:hover,
	body.rir-theme-classic-cart.woocommerce-cart .rir-theme-classic-cart-sticky-checkout a.button.checkout-button.rir-theme-classic-cart-sticky-checkout__button:focus-visible,
	body.rir-theme-classic-cart .rir-theme-classic-cart-sticky-checkout .rir-theme-classic-cart-sticky-checkout__button.button.checkout-button:hover,
	body.rir-theme-classic-cart .rir-theme-classic-cart-sticky-checkout .rir-theme-classic-cart-sticky-checkout__button.button.checkout-button:focus-visible,
	body.rir-theme-classic-cart .rir-theme-classic-cart-sticky-checkout a.button.checkout-button.rir-theme-classic-cart-sticky-checkout__button:hover,
	body.rir-theme-classic-cart .rir-theme-classic-cart-sticky-checkout a.button.checkout-button.rir-theme-classic-cart-sticky-checkout__button:focus-visible {
		background: #1e3b66;
		background-color: #1e3b66;
		background: var(--rir-theme-sticky-checkout-background-hover);
		background-color: var(--rir-theme-sticky-checkout-background-hover);
		color: #fff;
		box-shadow: 0 14px 30px rgba(30, 59, 102, 0.24);
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	body.rir-theme-classic-cart .rir-theme-classic-cart-sticky-checkout,
	body.rir-theme-classic-cart .rir-theme-classic-cart-sticky-checkout__button,
	body.rir-theme-classic-cart .rir-theme-classic-cart-sticky-checkout a.checkout-button {
		transition: none;
	}
}
