/**
 * Joov — sticky add-to-cart bar.
 *
 * Everything is scoped to .joov-satc, which exists only on the product page and
 * only in markup this module's script builds, so nothing here can reach the rest
 * of the site. Tokens are the site's own (ACSS + Etch), not new values.
 */

.joov-satc {
	position: fixed;
	inset-block-end: 0;
	inset-inline: 0;
	/* Under the lightbox (99999) and under the cookie banner, over page content. */
	z-index: 40;
	border-block-start: 1px solid var(--neutral-light, #e5e5e5);
	background-color: var(--white, #fff);
	box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
	transform: translateY(100%);
	transition: transform 200ms ease;
	/* Home indicator on iOS. */
	padding-block-end: env(safe-area-inset-bottom, 0);
}

.joov-satc--in {
	transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
	.joov-satc {
		transition: none;
	}
}

.joov-satc__inner {
	display: flex;
	gap: 0.875rem;
	align-items: center;
	inline-size: min(100% - 2rem, var(--width-max, 1280px));
	margin-inline: auto;
	padding-block: 0.625rem;
}

.joov-satc__thumb {
	flex: 0 0 auto;
	inline-size: 3rem;
	block-size: 3rem;
	border-radius: 3px;
	object-fit: cover;
}

.joov-satc__meta {
	display: flex;
	flex-direction: column;
	/* The one flexible item: options and button keep their size, the name truncates. */
	min-inline-size: 0;
	flex: 1 1 auto;
}

.joov-satc__title {
	overflow: hidden;
	color: var(--text-dark);
	font-family: var(--heading-font-family);
	font-size: var(--text-s);
	font-style: italic;
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.2;
	text-overflow: ellipsis;
	text-transform: uppercase;
	white-space: nowrap;
}

.joov-satc__price {
	color: var(--text-dark);
	font-family: var(--heading-font-family);
	font-size: var(--text-s);
	font-weight: 800;
	line-height: 1.3;
	white-space: nowrap;
}

/* Woo's price markup arrives with its own tags; flatten what it brings. */
.joov-satc__price del {
	margin-inline-end: 0.375rem;
	color: var(--text-dark-muted, #6b6b6b);
	font-weight: 500;
}

.joov-satc__price ins {
	text-decoration: none;
}

.joov-satc__price p,
.joov-satc__price .price {
	display: inline;
	margin: 0;
	font-size: inherit;
}

/* The subscription block travels inside Woo's price markup and is far too tall
   for a bar; the form is where that choice is made. */
.joov-satc__price .wcsatt-options-wrapper,
.joov-satc__price .subscription-details,
.joov-satc__price small {
	display: none;
}

.joov-satc__controls {
	display: flex;
	gap: 0.5rem;
	align-items: stretch;
	flex: 0 1 auto;
	min-inline-size: 0;
}

/* Chrome for the select is the site's select component (joov-select.css); only
   the width it may take inside the bar is decided here. */
.joov-satc__select:is(select) {
	min-block-size: 2.75rem;
	max-inline-size: 11rem;
	padding-block: 0.5rem;
	border: 2px solid var(--neutral-light, #e5e5e5);
	border-radius: 3px;
	background-color: var(--white, #fff);
	color: var(--text-dark);
	font-family: inherit;
	font-size: var(--text-xs);
	line-height: 1.3;
}

/* The PDP stepper, at bar scale. The component's own rules (borders, the flat
   inner input, disabled states) come from the product template; these only shrink
   it from the 3.375rem buy-box size to something that fits a 2.75rem row. */
.joov-satc__qty .pdp-qty__btn {
	inline-size: 2.25rem;
	min-block-size: 2.75rem;
	font-size: var(--text-s);
}

.joov-satc__qty input[type="number"] {
	/* Frame, centring and spin-button reset come from the component in
	   joov-pdp.css; only the bar's compact sizing is set here. */
	inline-size: 2.25rem;
	min-block-size: 2.75rem;
	font-size: var(--text-s);
}

.joov-satc__qty,
.joov-satc__select {
	/* One row height across dropdown, stepper and button. */
	min-block-size: 2.75rem;
}

.joov-satc__btn {
	min-block-size: 2.75rem;
	padding-inline: var(--space-m, 1.5rem);
	border: 0;
	border-radius: 3px;
	background-color: var(--primary);
	color: var(--white, #fff);
	font-family: inherit;
	font-size: var(--text-s);
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 150ms ease;
}

.joov-satc__btn:hover {
	background-color: var(--text-dark);
}

.joov-satc__btn:disabled {
	background-color: var(--neutral-light, #e5e5e5);
	color: var(--text-dark-muted, #6b6b6b);
	cursor: not-allowed;
}

/* Phones: the name and price stack on the left, the button takes the rest. The
   thumbnail goes — 3rem of image is not worth the width on a 360px screen. */
@media (width < 700px) {
	.joov-satc__inner {
		inline-size: calc(100% - 1.5rem);
		gap: 0.625rem;
		padding-block: 0.5rem;
	}

	.joov-satc__thumb {
		display: none;
	}

	.joov-satc__select:is(select) {
		max-inline-size: 8rem;
	}

	/* No room for a stepper beside a dropdown and a button on a 390px screen, so
	   quantity stays the form's job — but a simple product has no dropdown and
	   keeps its stepper. */
	.joov-satc--has-options .joov-satc__qty {
		display: none;
	}

	.joov-satc__btn {
		padding-inline: 1rem;
	}
}

/* --- subscription price line ---------------------------------------------
   Subscribe & Save changes what the customer pays, so the bar shows that price
   and the renewal cadence next to it rather than the one-time hero price. */
.joov-satc__priceline {
	display: flex;
	align-items: baseline;
	gap: 0.375rem;
	flex-wrap: wrap;
}

.joov-satc__note {
	font-size: var(--text-xs, 0.75rem);
	color: var(--neutral-600, #666);
	text-transform: lowercase;
	white-space: nowrap;
}

.joov-satc__price--sub {
	color: var(--primary);
}
