/**
 * CNS Single Product — Concept 04 layout + storefront color tokens.
 * Targets classic Woo single product (+ BuddyBoss / MVX sold-by).
 * Does not invent booking calendars or change ATC / variations / tabs.
 * Fonts: enqueued as cns-sf-fonts from commerce-product.php.
 */

body.cns-commerce-product {
	--cns-pd-ink: #14261c;
	--cns-pd-muted: #5a6f62;
	--cns-pd-line: #d7e3da;
	--cns-pd-soft: #f3f7f2;
	--cns-pd-paper: #fbfcf9;
	--cns-pd-white: #ffffff;
	--cns-pd-green: #245b3b;
	--cns-pd-green-deep: #18382c;
	--cns-pd-accent: #7cae15;
	--cns-pd-sale: #2f8f55;
	--cns-pd-radius: 18px;
	--cns-pd-radius-sm: 12px;
	font-family: "DM Sans", system-ui, sans-serif;
	color: var(--cns-pd-ink);
	background: var(--cns-pd-paper);
}

body.cns-commerce-product #page,
body.cns-commerce-product #content,
body.cns-commerce-product .site-content,
body.cns-commerce-product .bb-grid.site-content-grid,
body.cns-commerce-product .content-area,
body.cns-commerce-product .site-main {
	background: transparent;
	color: var(--cns-pd-ink);
}

/* Theme shop sidebar squeezes product — hide on conversion PDP */
body.cns-commerce-product #secondary,
body.cns-commerce-product .bb-grid.site-content-grid > #secondary,
body.cns-commerce-product .bb-grid.site-content-grid > aside.widget-area {
	display: none !important;
}

body.cns-commerce-product .content-area,
body.cns-commerce-product #primary {
	width: 100% !important;
	max-width: 1120px !important;
	float: none !important;
	margin-left: auto !important;
	margin-right: auto !important;
}

body.cns-commerce-product .woocommerce-breadcrumb,
body.cns-commerce-product .woocommerce-breadcrumb a {
	color: var(--cns-pd-muted);
	font-size: 13px;
}

body.cns-commerce-product .woocommerce-breadcrumb {
	margin: 0 0 14px;
}

/* —— Hero: gallery + sticky buy box —— */
body.cns-commerce-product div.product {
	display: grid !important;
	grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.9fr) !important;
	gap: 18px !important;
	align-items: start !important;
	max-width: 1120px;
	margin: 0 auto;
	position: relative;
}

body.cns-commerce-product div.product > .onsale {
	position: absolute;
	z-index: 2;
	top: 14px;
	left: 14px;
	margin: 0;
	min-height: 28px;
	padding: 4px 12px;
	border: 1px solid #c5d9c8;
	border-radius: 999px;
	background: var(--cns-pd-soft) !important;
	color: var(--cns-pd-green-deep) !important;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.4;
}

body.cns-commerce-product div.product > .woocommerce-product-gallery {
	grid-column: 1;
	grid-row: 1;
	width: 100% !important;
	float: none !important;
	margin: 0 !important;
}

body.cns-commerce-product div.product > .summary.entry-summary {
	grid-column: 2;
	grid-row: 1;
	width: 100% !important;
	float: none !important;
	margin: 0 !important;
	position: sticky;
	top: calc(16px + var(--wp-admin--admin-bar--height, 0px));
	padding: 18px !important;
	border: 1px solid var(--cns-pd-line) !important;
	border-radius: var(--cns-pd-radius) !important;
	background: var(--cns-pd-white) !important;
	box-sizing: border-box;
	box-shadow: none !important;
}

body.cns-commerce-product div.product > .woocommerce-tabs,
body.cns-commerce-product div.product > .wc-tabs-wrapper,
body.cns-commerce-product div.product > .related.products,
body.cns-commerce-product div.product > .up-sells,
body.cns-commerce-product div.product > section.related {
	grid-column: 1 / -1;
}

/* Gallery */
body.cns-commerce-product .woocommerce-product-gallery,
body.cns-commerce-product .woocommerce-product-gallery__wrapper,
body.cns-commerce-product .woocommerce-product-gallery__image,
body.cns-commerce-product .woocommerce-product-gallery__image--placeholder,
body.cns-commerce-product .woocommerce-product-gallery .flex-viewport {
	border-radius: var(--cns-pd-radius) !important;
	overflow: hidden;
	border: 1px solid var(--cns-pd-line);
	background: var(--cns-pd-soft);
}

body.cns-commerce-product .woocommerce-product-gallery__image img,
body.cns-commerce-product .woocommerce-product-gallery__image--placeholder img {
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	display: block;
	margin: 0;
}

body.cns-commerce-product .flex-control-thumbs {
	display: grid !important;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 10px;
	margin: 10px 0 0 !important;
	padding: 0 !important;
	list-style: none;
}

body.cns-commerce-product .flex-control-thumbs li {
	width: auto !important;
	float: none !important;
	margin: 0 !important;
}

body.cns-commerce-product .flex-control-thumbs img {
	width: 100%;
	aspect-ratio: 1;
	object-fit: cover;
	border-radius: var(--cns-pd-radius-sm);
	border: 1px solid var(--cns-pd-line);
	opacity: 1 !important;
}

body.cns-commerce-product .flex-control-thumbs img.flex-active,
body.cns-commerce-product .flex-control-thumbs img:hover {
	border-color: var(--cns-pd-green);
}

/* Buy box */
body.cns-commerce-product .summary .product_title,
body.cns-commerce-product .summary h1.product_title {
	display: block !important;
	margin: 0 0 8px !important;
	font-family: Fraunces, Georgia, serif;
	font-size: clamp(1.35rem, 2.6vw, 1.75rem) !important;
	font-weight: 700 !important;
	letter-spacing: -0.02em;
	line-height: 1.2;
	color: var(--cns-pd-green-deep) !important;
}

/* BuddyBoss often duplicates the title in page header — keep buy-box title, soften page H1 */
body.cns-commerce-product .entry-header .entry-title,
body.cns-commerce-product .page-title-wrap .entry-title {
	display: none !important;
}

body.cns-commerce-product .summary .woocommerce-product-rating,
body.cns-commerce-product .summary .sku_wrapper {
	color: var(--cns-pd-muted);
	font-size: 13px;
	margin: 0 0 6px;
}

body.cns-commerce-product .summary .price {
	margin: 0 0 4px;
	color: var(--cns-pd-green) !important;
	font-size: 1.45rem;
	font-weight: 700;
}

body.cns-commerce-product .summary .price del {
	color: var(--cns-pd-muted);
	font-size: 0.85em;
	font-weight: 500;
	opacity: 0.85;
}

body.cns-commerce-product .summary .price ins {
	text-decoration: none;
	color: var(--cns-pd-green);
}

body.cns-commerce-product .summary .woocommerce-product-details__short-description {
	margin: 0 0 14px;
	color: var(--cns-pd-muted);
	font-size: 14px;
}

body.cns-commerce-product .summary .posted_in,
body.cns-commerce-product .summary .tagged_as,
body.cns-commerce-product .summary .product_meta {
	color: var(--cns-pd-muted);
	font-size: 13px;
}

body.cns-commerce-product .summary .posted_in a,
body.cns-commerce-product .summary .tagged_as a {
	display: inline-flex;
	align-items: center;
	margin: 0 4px 6px 0;
	padding: 4px 10px;
	border-radius: 999px;
	border: 1px solid rgba(124, 174, 21, 0.35);
	color: var(--cns-pd-green) !important;
	font-size: 12px;
	font-weight: 700;
	text-decoration: none !important;
	background: transparent;
}

body.cns-commerce-product .by-store-name-link,
body.cns-commerce-product .summary a.by-store-name-link {
	display: inline-block !important;
	margin: 0 0 12px;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	color: var(--cns-pd-green) !important;
	font-size: 13px;
	font-weight: 650;
	text-decoration: none !important;
}

body.cns-commerce-product .by-store-name-link:hover {
	text-decoration: underline !important;
	text-underline-offset: 3px;
}

/* Variations / qty / ATC */
body.cns-commerce-product form.cart {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 10px;
	margin-top: 8px;
}

body.cns-commerce-product form.cart .woocommerce-variation-add-to-cart {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 10px;
}

body.cns-commerce-product table.variations {
	width: 100%;
	margin: 0 0 12px;
	border: 0;
}

body.cns-commerce-product table.variations th.label,
body.cns-commerce-product table.variations label {
	color: var(--cns-pd-muted);
	font-size: 12px;
	font-weight: 650;
	padding: 0 0 6px;
}

body.cns-commerce-product table.variations select,
body.cns-commerce-product .summary select {
	width: 100%;
	min-height: 42px;
	border-radius: var(--cns-pd-radius-sm);
	border: 1px solid #b9cbbd;
	background: var(--cns-pd-white);
	color: var(--cns-pd-ink);
	padding: 0 12px;
}

body.cns-commerce-product form.cart .quantity {
	margin: 0 10px 10px 0;
}

body.cns-commerce-product form.cart .quantity .qty {
	min-height: 44px;
	width: 72px;
	border-radius: var(--cns-pd-radius-sm);
	border: 1px solid var(--cns-pd-line);
	background: var(--cns-pd-white);
	color: var(--cns-pd-ink);
	font-weight: 700;
	text-align: center;
}

body.cns-commerce-product form.cart .single_add_to_cart_button,
body.cns-commerce-product form.cart button.single_add_to_cart_button {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 48px !important;
	margin: 0 0 8px !important;
	padding: 0 18px !important;
	border: 0 !important;
	border-radius: var(--cns-pd-radius-sm) !important;
	background: var(--cns-pd-accent) !important;
	color: var(--cns-pd-ink) !important;
	font-size: 14px !important;
	font-weight: 700 !important;
	box-shadow: none !important;
}

body.cns-commerce-product form.cart .single_add_to_cart_button:hover,
body.cns-commerce-product form.cart .single_add_to_cart_button:focus {
	filter: brightness(1.05);
	background: var(--cns-pd-accent) !important;
	color: var(--cns-pd-ink) !important;
}

body.cns-commerce-product .woocommerce-variation-availability,
body.cns-commerce-product .stock {
	color: var(--cns-pd-muted);
	font-size: 12px;
	margin: 8px 0 0;
}

/* Tabs */
body.cns-commerce-product .woocommerce-tabs {
	margin-top: 8px;
	padding-top: 8px;
}

body.cns-commerce-product .woocommerce-tabs ul.tabs,
body.cns-commerce-product .woocommerce-tabs ul.wc-tabs {
	display: flex !important;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 14px !important;
	padding: 0 0 10px !important;
	border: 0 !important;
	border-bottom: 1px solid var(--cns-pd-line) !important;
	list-style: none;
	background: transparent !important;
}

body.cns-commerce-product .woocommerce-tabs ul.tabs li {
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	background: transparent !important;
}

body.cns-commerce-product .woocommerce-tabs ul.tabs li a,
body.cns-commerce-product .woocommerce-tabs ul.tabs li a:hover {
	display: inline-flex;
	align-items: center;
	min-height: 34px;
	padding: 0 12px !important;
	border: 0 !important;
	border-radius: 10px;
	background: transparent;
	color: var(--cns-pd-muted) !important;
	font-size: 13px;
	font-weight: 650;
	text-decoration: none !important;
}

body.cns-commerce-product .woocommerce-tabs ul.tabs li.active a,
body.cns-commerce-product .woocommerce-tabs ul.tabs li.active a:hover {
	background: rgba(124, 174, 21, 0.12) !important;
	color: var(--cns-pd-green) !important;
}

body.cns-commerce-product .woocommerce-tabs .woocommerce-Tabs-panel,
body.cns-commerce-product .woocommerce-Tabs-panel {
	padding: 4px 0 0 !important;
	border: 0 !important;
	background: transparent !important;
}

body.cns-commerce-product .woocommerce-Tabs-panel h2,
body.cns-commerce-product .woocommerce-Tabs-panel h2:first-child {
	margin: 0 0 10px;
	font-size: 1.15rem;
	color: var(--cns-pd-green-deep);
}

body.cns-commerce-product .woocommerce-Tabs-panel p,
body.cns-commerce-product .woocommerce-Tabs-panel li {
	color: var(--cns-pd-muted);
	max-width: 68ch;
}

/* MVX Store tab — keep vendor logo compact (theme/global img rules blow it up) */
body.cns-commerce-product .woocommerce-Tabs-panel .product-store-info {
	width: 100%;
	max-width: 520px;
	padding: 16px;
	border: 1px solid var(--cns-pd-line);
	border-radius: var(--cns-pd-radius-sm);
	background: var(--cns-pd-soft);
	box-sizing: border-box;
}

body.cns-commerce-product .woocommerce-Tabs-panel .product-store-info .header {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin-bottom: 12px;
}

body.cns-commerce-product .woocommerce-Tabs-panel .product-store-info .header > img,
body.cns-commerce-product .woocommerce-Tabs-panel .product-store-info .header img {
	width: 64px !important;
	max-width: 64px !important;
	height: 64px !important;
	object-fit: contain !important;
	flex: 0 0 64px;
	border-radius: 10px;
	background: var(--cns-pd-white);
	border: 1px solid var(--cns-pd-line);
	padding: 4px;
	box-sizing: border-box;
}

body.cns-commerce-product .woocommerce-Tabs-panel .product-store-info .heading-wrapper .heading,
body.cns-commerce-product .woocommerce-Tabs-panel .product-store-info .heading-wrapper h4 {
	margin: 0;
	font-size: 1rem;
	color: var(--cns-pd-green-deep);
}

body.cns-commerce-product .woocommerce-Tabs-panel .product-store-info .heading-wrapper a {
	color: var(--cns-pd-green) !important;
	text-decoration: none !important;
	font-weight: 650;
}

body.cns-commerce-product .woocommerce-Tabs-panel .product-store-info .button {
	display: inline-flex !important;
	align-items: center;
	min-height: 40px;
	margin-top: 12px !important;
	padding: 0 14px !important;
	border-radius: 10px !important;
	border: 0 !important;
	background: var(--cns-pd-accent) !important;
	color: var(--cns-pd-ink) !important;
	font-weight: 700 !important;
}

/* Related / up-sells — storefront-aligned equal-height cards */
body.cns-commerce-product .related.products,
body.cns-commerce-product .up-sells,
body.cns-commerce-product section.related.products {
	margin-top: 8px;
}

body.cns-commerce-product .related.products > h2,
body.cns-commerce-product .up-sells > h2 {
	margin: 24px 0 14px;
	font-family: Fraunces, Georgia, serif;
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--cns-pd-green-deep);
}

body.cns-commerce-product .related.products ul.products,
body.cns-commerce-product .up-sells ul.products,
body.cns-commerce-product section.related ul.products {
	display: grid !important;
	grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
	gap: 14px !important;
	align-items: stretch;
	margin: 0 0 1.5rem !important;
	padding: 0 !important;
	list-style: none !important;
	width: 100% !important;
}

body.cns-commerce-product .related.products ul.products::before,
body.cns-commerce-product .related.products ul.products::after,
body.cns-commerce-product .up-sells ul.products::before,
body.cns-commerce-product .up-sells ul.products::after {
	display: none !important;
	content: none !important;
}

body.cns-commerce-product .related.products ul.products li.product,
body.cns-commerce-product .up-sells ul.products li.product,
body.cns-commerce-product section.related ul.products li.product {
	float: none !important;
	width: auto !important;
	max-width: none !important;
	min-width: 0 !important;
	height: 100%;
	min-height: 100%;
	flex: none !important;
	margin: 0 !important;
	padding: 0 0 4px !important;
	display: flex !important;
	flex-direction: column !important;
	flex-wrap: nowrap !important;
	align-items: stretch !important;
	border: 1px solid var(--cns-pd-line) !important;
	border-radius: var(--cns-pd-radius-sm) !important;
	overflow: hidden;
	background: var(--cns-pd-soft) !important;
	box-shadow: none !important;
	text-align: left !important;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

body.cns-commerce-product .related.products ul.products li.product:hover,
body.cns-commerce-product .up-sells ul.products li.product:hover {
	border-color: #b9cfbf !important;
	box-shadow: 0 8px 20px rgba(20, 38, 28, 0.07) !important;
}

body.cns-commerce-product .related.products ul.products li.product .woocommerce-loop-product__link,
body.cns-commerce-product .related.products ul.products li.product a.woocommerce-LoopProduct-link,
body.cns-commerce-product .up-sells ul.products li.product .woocommerce-loop-product__link,
body.cns-commerce-product .up-sells ul.products li.product a.woocommerce-LoopProduct-link {
	display: flex !important;
	flex-direction: column !important;
	flex: 1 1 auto !important;
	width: 100% !important;
	min-height: 0 !important;
	padding: 0;
	color: inherit;
	text-decoration: none !important;
}

body.cns-commerce-product .related.products ul.products li.product img,
body.cns-commerce-product .up-sells ul.products li.product img {
	width: 100% !important;
	max-width: none !important;
	height: auto !important;
	max-height: 180px;
	aspect-ratio: 1 / 1;
	object-fit: contain !important;
	object-position: center;
	margin: 0 !important;
	padding: 8px !important;
	background: var(--cns-pd-white) !important;
	border-radius: 0 !important;
	box-sizing: border-box;
}

body.cns-commerce-product .related.products ul.products li.product .onsale,
body.cns-commerce-product .up-sells ul.products li.product .onsale {
	z-index: 2;
	top: 10px !important;
	left: 10px !important;
	right: auto !important;
	border-radius: 999px !important;
	min-height: 0 !important;
	line-height: 1.2 !important;
	padding: 4px 8px !important;
	background: var(--cns-pd-accent) !important;
	color: #14261c !important;
	font-size: 11px !important;
	font-weight: 800 !important;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

body.cns-commerce-product .related.products ul.products li.product .woocommerce-loop-product__title,
body.cns-commerce-product .related.products ul.products li.product .bb-wc-title,
body.cns-commerce-product .up-sells ul.products li.product .woocommerce-loop-product__title,
body.cns-commerce-product .up-sells ul.products li.product .bb-wc-title {
	margin: 0 !important;
	padding: 12px 12px 0 !important;
	font-family: "DM Sans", system-ui, sans-serif !important;
	font-size: 14px !important;
	font-weight: 650 !important;
	line-height: 1.35 !important;
	color: var(--cns-pd-green-deep) !important;
	text-align: left;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: calc(1.35em * 2);
}

body.cns-commerce-product .related.products ul.products li.product .price,
body.cns-commerce-product .up-sells ul.products li.product .price {
	display: block;
	margin: 6px 0 0 !important;
	padding: 0 12px !important;
	color: var(--cns-pd-sale) !important;
	font-size: 14px !important;
	font-weight: 700 !important;
	line-height: 1.45;
	text-align: left !important;
	position: static !important;
	min-height: calc(1.45em + 4px + 1.25em);
}

body.cns-commerce-product .related.products ul.products li.product .price .required,
body.cns-commerce-product .up-sells ul.products li.product .price .required {
	display: block !important;
	margin: 4px 0 0 !important;
	min-height: 1.25em;
	font-size: 12px !important;
	font-weight: 650 !important;
	line-height: 1.25 !important;
	color: var(--cns-pd-sale) !important;
}

body.cns-commerce-product .related.products ul.products li.product .price del,
body.cns-commerce-product .up-sells ul.products li.product .price del {
	color: #8a9b90 !important;
	font-weight: 500 !important;
	font-size: 12px !important;
	opacity: 1 !important;
	margin-right: 0.35rem;
}

body.cns-commerce-product .related.products ul.products li.product .price ins,
body.cns-commerce-product .up-sells ul.products li.product .price ins {
	text-decoration: none !important;
	background: transparent !important;
	color: var(--cns-pd-sale) !important;
}

body.cns-commerce-product .related.products ul.products li.product a.by-store-name-link,
body.cns-commerce-product .up-sells ul.products li.product a.by-store-name-link {
	display: block !important;
	flex: 0 0 auto !important;
	margin-top: auto !important;
	margin-bottom: 0 !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	padding: 8px 12px 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	color: var(--cns-pd-muted) !important;
	font-size: 12px !important;
	font-weight: 650 !important;
	line-height: 1.35;
	min-height: 1.35em;
	text-decoration: none !important;
}

body.cns-commerce-product .related.products ul.products li.product a.button,
body.cns-commerce-product .related.products ul.products li.product a.add_to_cart_button,
body.cns-commerce-product .related.products ul.products li.product a.product_type_simple,
body.cns-commerce-product .related.products ul.products li.product a.product_type_variable,
body.cns-commerce-product .related.products ul.products li.product .button,
body.cns-commerce-product .up-sells ul.products li.product a.button,
body.cns-commerce-product .up-sells ul.products li.product a.add_to_cart_button,
body.cns-commerce-product .up-sells ul.products li.product .button {
	display: inline-block !important;
	position: relative;
	z-index: 2;
	align-self: flex-start;
	flex: 0 0 auto !important;
	width: auto !important;
	max-width: none !important;
	min-height: 0 !important;
	margin: 8px 12px 14px !important;
	padding: 2px 0 4px !important;
	border-radius: 0 !important;
	border: 0 !important;
	background: transparent !important;
	color: var(--cns-pd-green) !important;
	font-family: "DM Sans", system-ui, sans-serif !important;
	font-size: 13px !important;
	font-weight: 700 !important;
	letter-spacing: 0.02em;
	text-transform: none !important;
	line-height: 1.45 !important;
	text-align: left;
	float: none !important;
	box-shadow: none !important;
	white-space: nowrap;
}

body.cns-commerce-product .related.products ul.products li.product a.button:hover,
body.cns-commerce-product .related.products ul.products li.product a.add_to_cart_button:hover,
body.cns-commerce-product .up-sells ul.products li.product a.button:hover,
body.cns-commerce-product .up-sells ul.products li.product a.add_to_cart_button:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
	background: transparent !important;
	color: var(--cns-pd-green-deep) !important;
	filter: none;
}

@media (max-width: 900px) {
	body.cns-commerce-product div.product {
		grid-template-columns: 1fr !important;
	}

	body.cns-commerce-product div.product > .woocommerce-product-gallery,
	body.cns-commerce-product div.product > .summary.entry-summary {
		grid-column: 1;
		grid-row: auto;
	}

	body.cns-commerce-product div.product > .summary.entry-summary {
		position: static;
	}

	body.cns-commerce-product .flex-control-thumbs {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	body.cns-commerce-product .related.products ul.products,
	body.cns-commerce-product .up-sells ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	}
}

@media (max-width: 520px) {
	body.cns-commerce-product .flex-control-thumbs {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	body.cns-commerce-product form.cart .quantity {
		width: 100%;
		margin-right: 0;
	}

	body.cns-commerce-product form.cart .quantity .qty {
		width: 100%;
	}

	body.cns-commerce-product .related.products ul.products,
	body.cns-commerce-product .up-sells ul.products {
		grid-template-columns: 1fr !important;
	}
}
