/*
 * Sticky add-to-cart bar (inc/sticky-add-to-cart.php).
 *
 * Runs at every viewport width. It used to be gated below 992px, which left
 * desktop with the older bar from assets/js/ashlaser-product.js -- a bar whose
 * button only scrolled and never added to the cart. That bar has been retired;
 * this one is now the only sticky bar on single product pages.
 *
 * Colours come from the :root tokens in assets/css/ashlaser.css; the literal
 * fallbacks exist only so the bar degrades sanely if that stylesheet fails.
 *
 * z-index sits below 102, which is what Shoptimizer gives the side cart
 * (.shoptimizer-mini-cart-wrap) and the mobile nav drawer (.col-full-nav), so
 * the bar can never sit over either of them.
 */

/* Reserved once at init so the bar can never permanently mask the footer. */
body.single-product.ashlaser-satc-active {
	padding-bottom: 84px;
}

.ashlaser-satc {
	align-items: center;
	background: var(--ash-paper, #fffdf9);
	border-top: 1px solid var(--ash-line, #e8dfd4);
	bottom: 0;
	box-shadow: 0 -6px 18px rgba(47, 36, 29, 0.12);
	box-sizing: border-box;
	display: flex;
	gap: 12px;
	justify-content: space-between;
	left: 0;
	padding: 8px 14px;
	padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
	position: fixed;
	right: 0;
	transform: translateY(110%);
	transition: transform 0.22s ease, visibility 0s linear 0.22s;
	visibility: hidden;
	z-index: 99;
}

.ashlaser-satc.is-visible {
	transform: translateY(0);
	transition-delay: 0s;
	visibility: visible;
}

/* Never compete with the side cart or the mobile nav drawer. */
body.drawer-open .ashlaser-satc,
body.mobile-toggled .ashlaser-satc {
	transform: translateY(110%);
	visibility: hidden;
}

.ashlaser-satc__info {
	flex: 1 1 auto;
	min-width: 0;
}

.ashlaser-satc__name {
	color: var(--ash-ink, #2f241d);
	font-size: 13px;
	font-weight: 700;
	line-height: 1.25;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ashlaser-satc__price {
	color: var(--ash-muted, #75685e);
	font-size: 12px;
	line-height: 1.35;
	margin-top: 2px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ashlaser-satc__price.is-total {
	color: var(--ash-bark, #623a25);
	font-weight: 700;
}

.ashlaser-satc__btn {
	background: var(--ash-bark, #623a25);
	border: 0;
	border-radius: 4px;
	color: #fff;
	cursor: pointer;
	flex: 0 0 auto;
	font-family: inherit;
	font-size: 13px;
	font-weight: 800;
	letter-spacing: 0.02em;
	line-height: 1.2;
	max-width: 60%;
	min-height: 44px;
	overflow: hidden;
	padding: 0 18px;
	text-overflow: ellipsis;
	text-transform: uppercase;
	transition: background 0.15s ease;
	white-space: nowrap;
}

.ashlaser-satc__btn:hover {
	background: var(--ash-bark-dark, #4b2b1d);
	color: #fff;
}

.ashlaser-satc__btn:focus-visible {
	outline: 3px solid var(--ash-gold, #d9922f);
	outline-offset: 2px;
}

/* Nothing chosen yet: the button routes to the picker, not to the cart. */
.ashlaser-satc--pending .ashlaser-satc__btn {
	background: var(--ash-copper, #b97938);
}

.ashlaser-satc__btn[disabled] {
	cursor: default;
	opacity: 0.65;
}

/*
 * Desktop: same bar, roomier, with its contents held to the site container
 * width so the product name and the button are not thrown to opposite edges
 * of a wide screen. 1170px matches Shoptimizer's container.
 */
@media (min-width: 992px) {

	body.single-product.ashlaser-satc-active {
		padding-bottom: 76px;
	}

	.ashlaser-satc {
		gap: 24px;
		padding: 10px max(20px, calc((100% - 1170px) / 2));
	}

	.ashlaser-satc__name {
		font-size: 15px;
	}

	.ashlaser-satc__price {
		font-size: 13px;
	}

	.ashlaser-satc__btn {
		font-size: 14px;
		max-width: 46%;
		min-height: 48px;
		padding: 0 32px;
	}
}

@media (prefers-reduced-motion: reduce) {

	.ashlaser-satc,
	.ashlaser-satc__btn {
		transition: none;
	}
}
