/* WP Shop Customizer – storefront styles.
 * Colors, radius, gap, sizes and column counts come from CSS variables printed inline
 * from the settings screen (see WPSC_Frontend::inline_css()). */

/* ---------------------------------------------------------------- Product grid */
body.wpsc-active ul.products {
	--wpsc-c: var(--wpsc-cols-d, 4);
	display: grid !important;
	grid-template-columns: repeat(var(--wpsc-c), minmax(0, 1fr));
	gap: var(--wpsc-gap, 24px);
	margin: 0 0 2em !important;
	padding: 0 !important;
	list-style: none;
	clear: both;
}

body.wpsc-active .related ul.products,
body.wpsc-active .upsells ul.products {
	--wpsc-c: var(--wpsc-rel-d, 4);
}

body.wpsc-active .cross-sells ul.products {
	--wpsc-c: 2;
}

/* Category archive: optional own column count for the product grid. */
body.wpsc-active.tax-product_cat ul.products {
	--wpsc-c: var(--wpsc-pcols-d, var(--wpsc-cols-d, 4));
}

/* Grids that only contain category tiles: optional own column count (needs :has()). */
@supports selector(:has(a)) {
	body.wpsc-active ul.products:not(:has(> li.product:not(.product-category))) {
		--wpsc-c: var(--wpsc-ccols-d, var(--wpsc-pcols-d, var(--wpsc-cols-d, 4)));
	}
}

/* WooCommerce clearfix pseudo-elements would become empty grid cells. */
body.wpsc-active ul.products::before,
body.wpsc-active ul.products::after {
	content: none !important;
	display: none !important;
}

@media (max-width: 1024px) {
	body.wpsc-active ul.products,
	body.wpsc-active .related ul.products,
	body.wpsc-active .upsells ul.products {
		--wpsc-c: var(--wpsc-cols-t, 3);
	}

	body.wpsc-active.tax-product_cat ul.products {
		--wpsc-c: var(--wpsc-pcols-t, var(--wpsc-cols-t, 3));
	}

	@supports selector(:has(a)) {
		body.wpsc-active ul.products:not(:has(> li.product:not(.product-category))) {
			--wpsc-c: var(--wpsc-ccols-t, var(--wpsc-pcols-t, var(--wpsc-cols-t, 3)));
		}
	}
}

@media (max-width: 640px) {
	body.wpsc-active ul.products,
	body.wpsc-active .related ul.products,
	body.wpsc-active .upsells ul.products,
	body.wpsc-active .cross-sells ul.products {
		--wpsc-c: var(--wpsc-cols-m, 2);
	}

	body.wpsc-active.tax-product_cat ul.products {
		--wpsc-c: var(--wpsc-pcols-m, var(--wpsc-cols-m, 2));
	}

	@supports selector(:has(a)) {
		body.wpsc-active ul.products:not(:has(> li.product:not(.product-category))) {
			--wpsc-c: var(--wpsc-ccols-m, var(--wpsc-pcols-m, var(--wpsc-cols-m, 2)));
		}
	}
}

/* ------------------------------------------------------------------ Card base */
body.wpsc-active ul.products li.product {
	position: relative;
	display: flex;
	flex-direction: column;
	float: none !important;
	clear: none !important;
	width: auto !important;
	max-width: none !important;
	margin: 0 !important;
	padding: 0;
	text-align: left;
}

body.wpsc-align-center ul.products li.product {
	text-align: center;
}

body.wpsc-active ul.products li.product .woocommerce-LoopProduct-link {
	display: block;
	flex: 1 1 auto;
	color: inherit;
	text-decoration: none;
}

/* Card styles */
body.wpsc-card-boxed ul.products li.product {
	padding: 12px;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.09);
	border-radius: var(--wpsc-radius);
}

body.wpsc-card-shadow ul.products li.product {
	padding: 12px;
	background: #fff;
	border-radius: var(--wpsc-radius);
	box-shadow: 0 2px 14px rgba(0, 0, 0, 0.07);
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

body.wpsc-card-shadow ul.products li.product:hover {
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.13);
	transform: translateY(-3px);
}

/* ------------------------------------------------------------------- Image */
body.wpsc-active .wpsc-thumb {
	display: block;
	position: relative;
	overflow: hidden;
	margin: 0 0 0.6em;
	border-radius: calc(var(--wpsc-radius) * 0.75);
}

body.wpsc-active ul.products li.product .wpsc-thumb img {
	display: block;
	width: 100%;
	height: auto;
	margin: 0 !important;
	aspect-ratio: var(--wpsc-ratio, auto);
	object-fit: cover;
	transition: transform 0.35s ease, opacity 0.3s ease;
}

body.wpsc-hover-zoom ul.products li.product:hover .wpsc-thumb img {
	transform: scale(1.06);
}

body.wpsc-active ul.products li.product .wpsc-thumb img.wpsc-hover-img {
	position: absolute;
	inset: 0;
	height: 100%;
	opacity: 0;
}

body.wpsc-hover-swap ul.products li.product:hover .wpsc-hover-img {
	opacity: 1;
}

/* ------------------------------------------------------------- Card text */
body.wpsc-active ul.products li.product .woocommerce-loop-product__title {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: var(--wpsc-lines, 2);
	overflow: hidden;
	margin: 0.4em 0 0.3em;
	padding: 0;
	font-size: 1rem;
	line-height: 1.35;
	color: var(--wpsc-text);
}

body.wpsc-active .price,
body.wpsc-active .price .amount,
body.wpsc-active .price ins {
	color: var(--wpsc-price);
}

body.wpsc-active .price del,
body.wpsc-active .price del .amount {
	opacity: 0.55;
	color: var(--wpsc-text);
}

.wpsc-cat {
	display: block;
	margin-top: 0.5em;
	font-size: 0.75rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	opacity: 0.65;
}

.wpsc-excerpt {
	margin: 0.2em 0 0.6em;
	font-size: 0.875rem;
	line-height: 1.45;
	opacity: 0.8;
}

/* ------------------------------------------------------------------ Badge */
body.wpsc-active .onsale.wpsc-badge {
	position: absolute;
	top: 10px;
	left: 10px;
	right: auto;
	z-index: 3;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0.45em 0.7em;
	border-radius: calc(var(--wpsc-radius) / 1.5);
	background: var(--wpsc-accent);
	color: #fff;
	font-size: 0.8rem;
	font-weight: 700;
	line-height: 1;
}

body.wpsc-badge-right .onsale.wpsc-badge {
	left: auto;
	right: 10px;
}

/* ========================================================================
 * Buttons
 * 1) colors  2) Buy Now colors  3) shared size (cards)  4) shared size (product page)
 * ====================================================================== */

/* 1) Add to cart colors – only when "Style WooCommerce buttons" is on */
body.wpsc-style-btns ul.products li.product .button:not(.wpsc-buy-now),
body.wpsc-style-btns .single_add_to_cart_button {
	border: 0;
	border-radius: var(--wpsc-radius);
	background: var(--wpsc-btn-bg);
	color: var(--wpsc-btn-text);
	font-weight: 600;
	transition: opacity 0.15s ease;
}

body.wpsc-style-btns ul.products li.product .button:not(.wpsc-buy-now):hover,
body.wpsc-style-btns .single_add_to_cart_button:hover {
	background: var(--wpsc-btn-bg);
	color: var(--wpsc-btn-text);
	opacity: 0.88;
}

/* 2) Buy Now colors */
body.wpsc-active .button.wpsc-buy-now,
body.wpsc-active ul.products li.product .button.wpsc-buy-now {
	border: 0;
	border-radius: var(--wpsc-radius);
	background: var(--wpsc-buy-bg);
	color: var(--wpsc-buy-text);
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

body.wpsc-active .button.wpsc-buy-now:hover,
body.wpsc-active ul.products li.product .button.wpsc-buy-now:hover {
	background: var(--wpsc-buy-bg);
	color: var(--wpsc-buy-text);
	opacity: 0.88;
}

body.wpsc-active .button.wpsc-buy-now.disabled,
body.wpsc-active .button.wpsc-buy-now:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Fallback layout when "Custom button size" is off */
body:not(.wpsc-size-btns) ul.products li.product .button.wpsc-buy-now {
	display: block;
	margin: 0.8em 0 0;
	padding: 0.7em 1.1em;
	text-align: center;
}

body:not(.wpsc-size-btns) .button.wpsc-buy-now--single {
	display: inline-block;
	margin-left: 0.6em;
	padding: 0.7em 1.4em;
}

/* 3) Product cards: every button shares one size */
body.wpsc-size-btns ul.products li.product .button {
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-height: var(--wpsc-cbtn-h, 0px);
	margin: var(--wpsc-btn-gap, 8px) 0 0;
	padding: 0.5em var(--wpsc-cbtn-px, 18px);
	border-radius: var(--wpsc-radius);
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
}

/* "Fit to text" width and alignment */
body.wpsc-size-btns.wpsc-cbtn-auto ul.products li.product .button {
	width: auto;
	align-self: flex-start;
}

body.wpsc-size-btns.wpsc-cbtn-auto.wpsc-cbtn-align-center ul.products li.product .button {
	align-self: center;
}

body.wpsc-size-btns.wpsc-cbtn-auto.wpsc-cbtn-align-right ul.products li.product .button {
	align-self: flex-end;
}

/* Add to cart + Buy Now wrapper (stacked or side by side) */
.wpsc-actions {
	display: flex;
	flex-direction: column;
	gap: var(--wpsc-btn-gap, 8px);
	margin-top: var(--wpsc-btn-gap, 8px);
}

body.wpsc-active ul.products li.product .wpsc-actions .button {
	margin: 0;
}

.wpsc-actions--inline {
	flex-direction: row;
	flex-wrap: wrap;
}

body.wpsc-size-btns ul.products li.product .wpsc-actions--inline .button {
	flex: 1 1 0;
	min-width: 0;
}

body.wpsc-size-btns.wpsc-cbtn-auto ul.products li.product .wpsc-actions--inline .button {
	flex: 0 0 auto;
	align-self: auto;
}

body.wpsc-cbtn-auto.wpsc-cbtn-align-center ul.products li.product .wpsc-actions--inline {
	justify-content: center;
}

body.wpsc-cbtn-auto.wpsc-cbtn-align-right ul.products li.product .wpsc-actions--inline {
	justify-content: flex-end;
}

.wpsc-actions .added_to_cart {
	flex-basis: 100%;
	text-align: center;
}

/* Reveal buttons on hover (mouse devices only) */
@media (hover: hover) {
	body.wpsc-btn-hover ul.products li.product .button {
		opacity: 0;
		transform: translateY(6px);
		pointer-events: none;
	}

	body.wpsc-btn-hover ul.products li.product:hover .button,
	body.wpsc-btn-hover ul.products li.product:focus-within .button {
		opacity: 1;
		transform: none;
		pointer-events: auto;
	}
}

/* 4) Product page: Add to cart, Buy Now and the quantity box share one height */
body.wpsc-size-btns.single-product form.cart:not(.variations_form):not(.grouped_form),
body.wpsc-size-btns.single-product form.cart .woocommerce-variation-add-to-cart {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: var(--wpsc-btn-gap, 8px);
}

body.wpsc-size-btns.single-product form.cart:not(.variations_form):not(.grouped_form)::before,
body.wpsc-size-btns.single-product form.cart:not(.variations_form):not(.grouped_form)::after,
body.wpsc-size-btns.single-product form.cart .woocommerce-variation-add-to-cart::before,
body.wpsc-size-btns.single-product form.cart .woocommerce-variation-add-to-cart::after {
	content: none;
	display: none;
}

body.wpsc-size-btns.single-product form.cart .quantity {
	float: none;
	margin: 0;
}

body.wpsc-size-btns.single-product form.cart .quantity .qty {
	box-sizing: border-box;
	min-height: var(--wpsc-sbtn-h, 0px);
}

body.wpsc-size-btns.single-product form.cart .single_add_to_cart_button,
body.wpsc-size-btns.single-product form.cart .wpsc-buy-now--single {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	float: none;
	min-height: var(--wpsc-sbtn-h, 0px);
	margin: 0;
	padding: 0.5em 1.6em;
	border-radius: var(--wpsc-radius);
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
}

body.wpsc-size-btns.wpsc-sbtn-inline.single-product form.cart .single_add_to_cart_button,
body.wpsc-size-btns.wpsc-sbtn-inline.single-product form.cart .wpsc-buy-now--single {
	flex: 1 1 0;
	min-width: 140px;
}

body.wpsc-size-btns.wpsc-sbtn-stack.single-product form.cart .single_add_to_cart_button,
body.wpsc-size-btns.wpsc-sbtn-stack.single-product form.cart .wpsc-buy-now--single {
	flex: 1 1 100%;
}

/* Grouped products keep their table layout; just keep a gap next to Add to cart. */
body.wpsc-size-btns.single-product form.cart.grouped_form .wpsc-buy-now--single {
	margin-left: var(--wpsc-btn-gap, 8px);
}

/* ------------------------------------------------------------ Product page */
.wpsc-savings {
	display: inline-block;
	margin: 0 0 1em;
	padding: 0.25em 0.75em;
	border-radius: 999px;
	background: rgba(230, 57, 70, 0.1);
	color: var(--wpsc-accent);
	font-size: 0.85rem;
	font-weight: 600;
}

.wpsc-trust {
	display: grid;
	gap: 0.5em;
	margin: 1.2em 0;
	padding: 1em;
	border: 1px dashed rgba(0, 0, 0, 0.18);
	border-radius: var(--wpsc-radius);
	list-style: none;
	font-size: 0.9rem;
}

.wpsc-trust li {
	margin: 0;
}

body.wpsc-hide-sku .product_meta .sku_wrapper,
body.wpsc-hide-cats .product_meta .posted_in,
body.wpsc-hide-tags .product_meta .tagged_as {
	display: none !important;
}

/* -------------------------------------------------------- Sticky add to cart */
.wpsc-sticky {
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 9999;
	padding: 10px 16px;
	padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
	background: #fff;
	box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
	transform: translateY(100%);
	visibility: hidden;
	transition: transform 0.25s ease, visibility 0s linear 0.25s;
}

.wpsc-sticky.is-visible {
	transform: none;
	visibility: visible;
	transition: transform 0.25s ease;
}

.wpsc-sticky__inner {
	display: flex;
	align-items: center;
	gap: 12px;
	max-width: 1200px;
	margin: 0 auto;
}

.wpsc-sticky__img img {
	display: block;
	width: 48px;
	height: 48px;
	border-radius: calc(var(--wpsc-radius) / 2);
	object-fit: cover;
}

.wpsc-sticky__info {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-width: 0;
}

.wpsc-sticky__title {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--wpsc-text);
}

.wpsc-sticky__btn {
	flex: 0 0 auto;
	padding: 0.75em 1.4em;
	border: 0;
	border-radius: var(--wpsc-radius);
	background: var(--wpsc-btn-bg);
	color: var(--wpsc-btn-text);
	font-weight: 600;
	cursor: pointer;
}

@media (max-width: 480px) {
	.wpsc-sticky__img {
		display: none;
	}
}

/* -------------------------------------------------------------- Card slider */
.wpsc-slider {
	position: relative;
	display: block;
	width: 100%;
	max-width: 100%;
	overflow: hidden;
	border-radius: calc(var(--wpsc-radius) * 0.75);
}

/* Some themes position card images absolutely inside a fixed-ratio box, which would collapse
 * the slides – so images inside the slider always take part in normal flow. */
body.wpsc-active ul.products li.product .wpsc-slider img {
	position: static !important;
	display: block;
	width: 100% !important;
	max-width: 100% !important;
	height: auto !important;
	margin: 0 !important;
	inset: auto !important;
	transform: none !important;
	aspect-ratio: var(--wpsc-ratio, auto);
	object-fit: cover;
}

.wpsc-track {
	display: flex;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.wpsc-track::-webkit-scrollbar {
	display: none;
}

.wpsc-slide {
	display: block;
	flex: 0 0 100%;
	min-width: 0;
	scroll-snap-align: start;
	scroll-snap-stop: always;
}

.wpsc-arrow {
	position: absolute;
	top: 50%;
	z-index: 2;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.95);
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
	color: #111;
	font-size: 22px;
	line-height: 27px;
	text-align: center;
	cursor: pointer;
	opacity: 0;
	transform: translateY(-50%);
	transition: opacity 0.2s ease;
	user-select: none;
}

.wpsc-prev {
	left: 8px;
}

.wpsc-next {
	right: 8px;
}

body.wpsc-arrows-always .wpsc-arrow,
body.wpsc-active ul.products li.product:hover .wpsc-arrow,
.wpsc-arrow:focus-visible {
	opacity: 1;
}

/* On touch screens swiping is enough unless arrows are set to "always visible". */
@media (hover: none) {
	body:not(.wpsc-arrows-always) .wpsc-arrow {
		display: none;
	}
}

/* Dots sit on a dark pill so they stay visible on light and dark photos. */
.wpsc-dots {
	position: absolute;
	bottom: 8px;
	left: 50%;
	z-index: 2;
	display: flex;
	gap: 6px;
	padding: 5px 9px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.35);
	transform: translateX(-50%);
	pointer-events: none;
}

.wpsc-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.55);
	cursor: pointer;
	pointer-events: auto;
	transition: transform 0.15s ease, background 0.15s ease;
}

.wpsc-dot.is-active {
	background: #fff;
	transform: scale(1.25);
}

/* --------------------------------------------------------- Delivery info tab */
.wpsc-delivery > :first-child {
	margin-top: 0;
}

.wpsc-delivery > :last-child {
	margin-bottom: 0;
}

/* ------------------------------------------------------------ Category tiles */
body.wpsc-active ul.products li.product-category .wpsc-thumb img {
	aspect-ratio: var(--wpsc-cat-ratio, auto);
}

body.wpsc-active ul.products li.product-category .woocommerce-loop-category__title {
	margin: 0.6em 0 0;
	padding: 0;
	font-size: 1rem;
	line-height: 1.3;
	color: var(--wpsc-text);
}

body.wpsc-active ul.products li.product-category .woocommerce-loop-category__title .count {
	background: none;
	color: inherit;
	opacity: 0.65;
	font-size: 0.8em;
}

body.wpsc-cat-align-left ul.products li.product-category {
	text-align: left;
}

body.wpsc-cat-align-center ul.products li.product-category {
	text-align: center;
}

body.wpsc-cat-hover-none ul.products li.product-category:hover .wpsc-thumb img {
	transform: none;
}

body.wpsc-cat-hover-zoom ul.products li.product-category:hover .wpsc-thumb img {
	transform: scale(1.06);
}

/* Category tile styles override the product card style for tiles. */
body.wpsc-catcard-plain ul.products li.product-category {
	padding: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
}

body.wpsc-catcard-boxed ul.products li.product-category {
	padding: 12px;
	border: 1px solid rgba(0, 0, 0, 0.09);
	border-radius: var(--wpsc-radius);
	background: #fff;
	box-shadow: none;
}

body.wpsc-catcard-shadow ul.products li.product-category {
	padding: 12px;
	border: 0;
	border-radius: var(--wpsc-radius);
	background: #fff;
	box-shadow: 0 2px 14px rgba(0, 0, 0, 0.07);
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

body.wpsc-catcard-shadow ul.products li.product-category:hover {
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.13);
	transform: translateY(-3px);
}

body.wpsc-catcard-plain ul.products li.product-category:hover,
body.wpsc-catcard-boxed ul.products li.product-category:hover,
body.wpsc-catcard-overlay ul.products li.product-category:hover {
	transform: none;
	box-shadow: none;
}

/* Overlay: category name on top of the image */
body.wpsc-catcard-overlay ul.products li.product-category {
	overflow: hidden;
	padding: 0;
	border: 0;
	border-radius: var(--wpsc-radius);
	background: transparent;
	box-shadow: none;
}

body.wpsc-catcard-overlay ul.products li.product-category > a {
	position: relative;
	display: block;
}

body.wpsc-catcard-overlay ul.products li.product-category .wpsc-thumb {
	margin: 0;
	border-radius: 0;
}

body.wpsc-catcard-overlay ul.products li.product-category .woocommerce-loop-category__title {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	margin: 0;
	padding: 2.4em 1em 0.9em;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0));
	color: #fff;
	text-align: inherit;
}

body.wpsc-catcard-overlay ul.products li.product-category .woocommerce-loop-category__title .count {
	color: #fff;
}

/* ---------------------------------------------------------- Category banner */
.wpsc-cat-banner {
	position: relative;
	display: flex;
	align-items: flex-end;
	min-height: var(--wpsc-banner-h, 260px);
	margin: 0 0 2em;
	overflow: hidden;
	border-radius: var(--wpsc-radius);
	background: var(--wpsc-btn-bg) center / cover no-repeat;
	color: #fff;
}

.wpsc-cat-banner.has-image::before {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, var(--wpsc-banner-o, 0.4));
}

.wpsc-cat-banner__inner {
	position: relative;
	z-index: 1;
	max-width: 800px;
	padding: 1.5em 2em;
}

.wpsc-cat-banner__title {
	margin: 0 0 0.3em;
	color: #fff;
	font-size: 2rem;
	line-height: 1.2;
}

.wpsc-cat-banner__desc,
.wpsc-cat-banner__desc p {
	margin: 0;
	color: #fff;
	opacity: 0.92;
}

/* ------------------------------------------------------------ Page wrapper */
.wpsc-page-wrap {
	box-sizing: border-box;
}

@media (prefers-reduced-motion: reduce) {
	.wpsc-sticky,
	body.wpsc-active ul.products li.product .wpsc-thumb img,
	body.wpsc-card-shadow ul.products li.product,
	body.wpsc-catcard-shadow ul.products li.product-category {
		transition: none;
	}
}
