/**
 * 单品页：.cx-sp-product-row 包裹「图库 + 摘要」，sticky 仅在该行内；
 * tabs / 相关商品在 row 之外，避免图库滚出摘要后仍悬挂。
 */

body.single-product.cx-single-product-layout {
	--cx-sp-divider: rgb(229, 231, 235);
	--cx-sp-sticky-top: calc(var(--kadence-sticky-offset, 57px) + 1.5rem);
	--cx-sp-col-gap: 2.5rem;
}

body.single-product.cx-single-product-layout #inner-wrap,
body.single-product.cx-single-product-layout #primary,
body.single-product.cx-single-product-layout .content-container,
body.single-product.cx-single-product-layout .site-main {
	overflow: visible !important;
}

/* 仅图库+摘要行使用 flex；#product-xxx 本身保持块级，tabs 在下方 */
body.single-product.cx-single-product-layout .cx-sp-product-row {
	display: flex !important;
	flex-flow: row nowrap;
	align-items: flex-start;
	position: relative;
	width: 100%;
	max-width: 100%;
	overflow: visible;
	clear: both;
}

body.single-product.cx-single-product-layout .cx-sp-product-row > span.onsale {
	position: absolute;
	z-index: 5;
	margin: 0;
}

body.single-product.cx-single-product-layout .cx-sp-product-row > .woocommerce-product-gallery.images,
body.single-product.cx-single-product-layout .cx-sp-product-row > div.images.woocommerce-product-gallery {
	flex: 0 1 50%;
	max-width: 52%;
	min-width: 0;
	position: sticky !important;
	top: var(--cx-sp-sticky-top);
	align-self: flex-start;
	z-index: 2;
	padding-right: var(--cx-sp-col-gap);
	box-sizing: border-box;
	margin-bottom: 0 !important;
	float: none !important;
	width: auto !important;
	clear: none !important;
}

body.single-product.cx-single-product-layout .cx-sp-product-row > .summary.entry-summary,
body.single-product.cx-single-product-layout .cx-sp-product-row > div.summary {
	flex: 1 1 48%;
	min-width: 0;
	margin-bottom: 0 !important;
	float: none !important;
	width: auto !important;
	clear: none !important;
	padding-left: var(--cx-sp-col-gap);
	border-left: 1px solid var(--cx-sp-divider);
	box-sizing: border-box;
}

/* tabs 等在 row 外，正常块级排列 */
body.single-product.cx-single-product-layout div.product[id^="product-"] > .woocommerce-tabs,
body.single-product.cx-single-product-layout div.product[id^="product-"] > .related,
body.single-product.cx-single-product-layout div.product[id^="product-"] > .up-sells {
	width: 100%;
	clear: both;
}

@media (max-width: 1024px) {
	body.single-product.cx-single-product-layout {
		--cx-sp-sticky-top: 1rem;
		--cx-sp-col-gap: 1.5rem;
	}

	body.single-product.cx-single-product-layout .cx-sp-product-row {
		flex-flow: row wrap;
	}

	body.single-product.cx-single-product-layout .cx-sp-product-row > .woocommerce-product-gallery.images,
	body.single-product.cx-single-product-layout .cx-sp-product-row > div.images.woocommerce-product-gallery {
		flex: 0 0 100%;
		max-width: 100%;
		position: relative !important;
		top: auto;
		padding-right: 0;
		padding-bottom: var(--cx-sp-col-gap);
		border-bottom: 1px solid var(--cx-sp-divider);
	}

	body.single-product.cx-single-product-layout .cx-sp-product-row > .summary.entry-summary,
	body.single-product.cx-single-product-layout .cx-sp-product-row > div.summary {
		flex: 0 0 100%;
		max-width: 100%;
		padding-left: 0;
		padding-top: var(--cx-sp-col-gap);
		border-left: none;
	}
}

@media (max-width: 767px) {
	body.single-product.cx-single-product-layout {
		--cx-sp-col-gap: 1rem;
	}
}
