/**
 * Xiongfa B2B single-product presentation.
 */

.single-product.xf-page-main,
.xf-page-main.single-product { max-width: 100%; overflow-x: hidden; }

.single-product .product-entry-wrapper {
	display: grid;
	grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
	column-gap: clamp(40px, 6vw, 88px);
	align-items: start;
}

.single-product .woocommerce-product-gallery img {
	display: block;
	width: 100%;
	max-width: 420px;
	height: auto;
	max-height: 420px;
	margin-inline: auto;
	object-fit: contain;
}
.xf-mobile-product-image { display: none; }
.single-product .woocommerce-product-gallery { min-width: 0; }

/* Desktop fallback only for galleries where WooCommerce could not initialize
 * native zoom because the original image is narrower than the gallery. */
@media (hover: hover) and (pointer: fine) {
	.single-product .woocommerce-product-gallery__image.xf-desktop-zoom-fallback,
	.single-product .woocommerce-product-gallery__image.xf-desktop-zoom-fallback > a {
		overflow: hidden;
	}

	.single-product .woocommerce-product-gallery__image.xf-desktop-zoom-fallback {
		cursor: zoom-in;
	}

	.single-product .woocommerce-product-gallery__image.xf-desktop-zoom-fallback > a {
		display: block;
		width: 100%;
		max-width: 420px;
		margin-inline: auto;
	}

	.single-product .woocommerce-product-gallery__image.xf-desktop-zoom-fallback img {
		transform-origin: var(--xf-desktop-zoom-x, 50%) var(--xf-desktop-zoom-y, 50%);
		transition: transform 140ms ease-out;
		will-change: transform;
	}

	.single-product .woocommerce-product-gallery__image.xf-desktop-zoom-fallback--active img {
		transform: scale(var(--xf-desktop-zoom-scale, 1.35));
	}
}

.single-product.xf-product-single-image .flex-control-thumbs,
.single-product.xf-product-single-image .woocommerce-product-gallery__thumbnails,
.single-product.xf-product-single-image .ct-product-gallery-thumbnails {
	display: none;
}
.single-product .entry-summary { min-width: 0; }
.xf-product-details-section,
.xf-related-products {
	width: min(1200px, calc(100% - 64px));
	margin-inline: auto;
	box-sizing: border-box;
}

.xf-product-details-section {
	padding-block: 60px 20px;
}

.xf-product-details-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 40px;
}

.xf-product-details-grid h2,
.xf-related-products h2 {
	margin-top: 0;
}

.xf-product-description__content > :last-child {
	margin-bottom: 0;
}

.xf-product-dimension-area:empty { display: none; }
.xf-product-dimension-image {
	display: block;
	width: 100%;
	height: auto;
	max-height: 520px;
	margin-inline: auto;
	object-fit: contain;
}

/* Ratchet Sofa Hinges use one verified positions diagram across the approved series. */
.xf-product-dimension-image[src*="Ratchet-Sofa-Hinges/technical/ratchet-sofa-hinges-positions.png"] {
	width: 100%;
	max-width: 760px;
	height: auto;
	margin-inline: 0;
	object-fit: contain;
}

.xf-ratchet-dimensions-trigger {
	display: block;
	max-width: 760px;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: zoom-in;
}

.xf-ratchet-dimensions-lightbox {
	width: min(96vw, 1600px);
	height: min(94vh, 1000px);
	max-width: none;
	max-height: none;
	margin: auto;
	padding: 28px;
	border: 0;
	background: #fff;
}

.xf-ratchet-dimensions-lightbox::backdrop {
	background: rgba(0, 0, 0, 0.78);
}

.xf-ratchet-dimensions-lightbox__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.xf-ratchet-dimensions-lightbox__close {
	position: absolute;
	top: 8px;
	right: 12px;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(29, 35, 41, 0.86);
	color: #fff;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
}

.xf-product-image-lightbox {
		width: 100vw;
		height: 100vh;
		max-width: none;
		max-height: none;
		padding: 24px;
		border: 0;
		background: #fff;
	}
.xf-product-image-lightbox::backdrop { background: #fff; }
.xf-product-image-lightbox__image { display: block; width: 100%; height: 100%; object-fit: contain; }
.xf-product-image-lightbox__close { position: absolute; top: 12px; right: 14px; z-index: 1; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255,255,255,.9); color: #111; font-size: 28px; line-height: 1; }

@media (max-width: 480px) {
	.xf-ratchet-dimensions-lightbox {
	width: 100vw;
	height: 100dvh;
	padding: 20px;
	}
}

.xf-bed-lift-501-specifications {
	margin-top: 24px;
}

.xf-bed-lift-501-specifications__table-wrap {
	max-width: 100%;
	overflow-x: auto;
}

.xf-bed-lift-501-specifications table {
	width: 100%;
	border-collapse: collapse;
	border: 1px solid #dedbd3;
	background: #fff;
	color: var(--theme-text-color, #1d2329);
	table-layout: auto;
}

.xf-bed-lift-501-specifications th,
.xf-bed-lift-501-specifications td {
	padding: 8px 10px;
	border: 1px solid #dedbd3;
	text-align: left;
	vertical-align: top;
	font-size: 13px;
	line-height: 1.3;
	word-break: normal;
	overflow-wrap: normal;
}

.xf-bed-lift-501-specifications thead th {
	background: #f0f0ed;
	color: #1d2329;
	font-weight: 600;
	word-break: normal;
	overflow-wrap: normal;
}

.xf-bed-lift-501-specifications th:nth-child(1),
.xf-bed-lift-501-specifications td:nth-child(1) { width: 10%; }
.xf-bed-lift-501-specifications th:nth-child(2),
.xf-bed-lift-501-specifications td:nth-child(2) { width: 11%; }
.xf-bed-lift-501-specifications th:nth-child(3),
.xf-bed-lift-501-specifications td:nth-child(3) { width: 12%; }
.xf-bed-lift-501-specifications th:nth-child(4),
.xf-bed-lift-501-specifications td:nth-child(4),
.xf-bed-lift-501-specifications th:nth-child(5),
.xf-bed-lift-501-specifications td:nth-child(5),
.xf-bed-lift-501-specifications th:nth-child(6),
.xf-bed-lift-501-specifications td:nth-child(6),
.xf-bed-lift-501-specifications th:nth-child(7),
.xf-bed-lift-501-specifications td:nth-child(7),
.xf-bed-lift-501-specifications th:nth-child(8),
.xf-bed-lift-501-specifications td:nth-child(8) { width: 7%; }
.xf-bed-lift-501-specifications th:nth-child(9),
.xf-bed-lift-501-specifications td:nth-child(9) { width: 32%; }

.xf-bed-lift-501-specifications thead th:nth-child(2),
.xf-bed-lift-501-specifications thead th:nth-child(9) {
	white-space: nowrap;
}

.xf-product-dimensions:has(.xf-bed-lift-501-specifications) .xf-product-dimension-image {
	width: 100%;
	max-width: 340px;
	height: auto;
	margin-inline: 0;
}

/* Keep Model 508's existing technical drawing compact without affecting Bed Lift 501. */
.xf-product-dimension-image[src*="Bed-Lift-Mechanisms/technical/508-dimensions.png"] {
	display: block;
	width: 100%;
	max-width: 480px;
	max-height: 210px;
	height: auto;
	margin-inline: 0;
	object-fit: contain;
}

/* Keep Model 401's confirmed technical drawing compact without affecting other lift products. */
.xf-product-dimension-image[src*="Table-Top-Lift-Mechanisms/technical/401-dimensions.jpg"] {
	display: block;
	width: 100%;
	max-width: 380px;
	height: auto;
	margin-inline: 0;
	object-fit: contain;
}

/* Keep Model 410's confirmed technical drawing compact without affecting other lift products. */
.xf-product-dimension-image[src*="Table-Top-Lift-Mechanisms/technical/410-dimensions.jpg"] {
	display: block;
	width: 100%;
	max-width: 380px;
	height: auto;
	margin-inline: 0;
	object-fit: contain;
}

/* Sofa Connectors technical drawings are shown compactly and left aligned. */
.xf-product-dimension-image[src*="Sofa-Connectors/technical/"] {
	display: block;
	width: 100%;
	max-width: 480px;
	height: auto;
	margin-inline: 0;
	object-fit: contain;
}

.xf-gas-accessories {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	min-height: 80px;
}

.xf-gas-accessories h3,
.xf-gas-specifications h3 {
	margin: 0 0 14px;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.35;
}

.xf-gas-accessories h3 {
	flex: 1 1 auto;
	margin-bottom: 0;
}

.xf-gas-accessories__image {
	display: block;
	width: auto;
	max-width: 240px;
	height: auto;
	max-height: 75px;
	margin-left: auto;
	object-fit: contain;
}

.xf-gas-specifications {
	margin-top: 22px;
}

.xf-gas-specifications__table-wrap {
	max-width: 100%;
	overflow-x: auto;
}

.xf-gas-specifications table {
	width: 100%;
	border-collapse: collapse;
	border: 1px solid #dedbd3;
	background: #fff;
	color: var(--theme-text-color, #1d2329);
	table-layout: fixed;
}

.xf-gas-specifications th,
.xf-gas-specifications td {
	padding: 10px 8px;
	border: 1px solid #dedbd3;
	text-align: left;
	vertical-align: top;
	font-size: 0.875rem;
	overflow-wrap: anywhere;
}

.xf-gas-specifications thead th {
	background: #f0f0ed;
	color: #1d2329;
	font-weight: 600;
}

.xf-related-products { padding-block: 48px 76px; }
.xf-related-products .xf-product-archive-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 28px;
}
.xf-related-products .xf-archive-product {
	display: block;
	min-width: 0;
	border: 1px solid #e7e7e4;
	background: #fff;
	color: inherit;
	text-decoration: none;
}
.xf-related-products .xf-archive-product__media {
	aspect-ratio: 1 / 1;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f0f0ed;
}
.xf-related-products .xf-archive-product__media img {
	display: block;
	width: 100%;
	height: 100%;
	padding: 16px;
	box-sizing: border-box;
	object-fit: contain;
	object-position: center;
}
.xf-related-products .xf-cabinet-handle-card .xf-archive-product__media {
	display: grid;
	place-items: center;
	background: #f3f3f1;
}
.xf-related-products .xf-cabinet-handle-card .xf-archive-product__media img {
	width: 76%;
	height: 76%;
	padding: 0;
	margin: auto;
	object-fit: contain;
}
.xf-related-products .xf-archive-product h3 {
	margin: 0;
	padding: 14px 16px;
	background: #fff;
	font-size: 16px;
	line-height: 1.35;
}
.xf-product-tabs nav { flex-wrap: wrap; }

/* Keep retail controls suppressed if a parent-theme layout changes later. */
.single-product .entry-summary > .price,
.single-product .entry-summary form.cart,
.single-product .entry-summary .woocommerce-product-rating {
	display: none;
}

.xf-product-model {
	margin: 0;
	font-size: 0.95rem;
	letter-spacing: 0.02em;
}

.xf-product-model span {
	font-weight: 600;
}

.xf-product-enquiry {
	display: grid;
	gap: 24px;
}

.xf-product-key-specs {
	display: grid;
	gap: 0;
	margin: 0;
	border-top: 1px solid var(--theme-border-color);
}

.xf-product-key-specs > div {
	display: grid;
	grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1.2fr);
	gap: 16px;
	padding: 11px 0;
	border-bottom: 1px solid var(--theme-border-color);
}

.xf-product-key-specs dt,
.xf-product-key-specs dd {
	margin: 0;
}

.xf-product-key-specs dt {
	font-weight: 600;
}

.xf-product-key-specs dd {
	overflow-wrap: anywhere;
}

.xf-product-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	min-width: 0;
}

.xf-product-action {
	box-sizing: border-box;
	max-width: 100%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 12px 22px;
	border: 1px solid var(--theme-palette-color-1, var(--xf-page-bronze, #ad9672));
	border-radius: var(--theme-button-border-radius, 3px);
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
}

.xf-product-action--primary {
	color: var(--theme-button-text-initial-color, #fff);
	background: var(--theme-palette-color-1, var(--xf-page-bronze, #ad9672));
}

.xf-product-action--secondary {
	color: var(--theme-palette-color-1, var(--xf-page-ink, #171916));
	background: transparent;
}

.xf-product-action:hover,
.xf-product-action:focus-visible {
	color: var(--theme-button-text-hover-color, #fff);
	background: var(--theme-palette-color-2);
	border-color: var(--theme-palette-color-2);
}

/* Match single-product enquiry actions and breadcrumb links to the approved Xiongfa bronze CTA. */
body.single-product .ct-breadcrumbs a {
	color: var(--xf-page-bronze, #ad9672);
}

body.single-product .ct-breadcrumbs a:hover,
body.single-product .ct-breadcrumbs a:focus-visible {
	color: #8d7655;
}

body.single-product .xf-product-action {
	border-color: var(--xf-page-bronze, #ad9672);
}

body.single-product .xf-product-action--primary {
	background: var(--xf-page-bronze, #ad9672);
	color: #fff;
}

body.single-product .xf-product-action--primary:hover,
body.single-product .xf-product-action--primary:focus-visible {
	border-color: #8d7655;
	background: #8d7655;
	color: #fff;
}

body.single-product .xf-product-action--secondary {
	border-color: var(--xf-page-bronze, #ad9672);
	background: transparent;
	color: var(--xf-page-bronze, #ad9672);
}

body.single-product .xf-product-action--secondary:hover,
body.single-product .xf-product-action--secondary:focus-visible {
	border-color: var(--xf-page-bronze, #ad9672);
	background: var(--xf-page-bronze, #ad9672);
	color: #fff;
}

.single-product .woocommerce-tabs,
.single-product .woocommerce-Tabs-panel {
	scroll-margin-top: 32px;
}

.single-product .woocommerce-product-attributes {
	width: 100%;
}

@media (min-width: 1024px) {
	.xf-product-details-grid {
		grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
		gap: clamp(40px, 4vw, 50px);
	}

}

@media (max-width: 1023px) {
	.xf-related-products .xf-product-archive-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	body.single-product .woocommerce-product-gallery { display: none !important; }
	body.single-product .xf-mobile-product-image {
		display: block !important;
		width: 100%;
		max-width: 300px;
		height: auto;
		margin: 0 auto 12px;
		padding: 0;
		border: 0;
		background: transparent;
		cursor: zoom-in;
	}
	body.single-product .xf-mobile-product-image img { display: block; width: auto; max-width: 300px; max-height: 300px; height: auto; margin: 0 auto; object-fit: contain; }
	body.single-product .site-main {
		padding-top: 0 !important;
		padding-bottom: 40px !important;
	}
	body.single-product .woocommerce-product-gallery,
	body.single-product .woocommerce-product-gallery__wrapper,
	body.single-product .woocommerce-product-gallery__image,
	body.single-product .woocommerce-product-gallery__image a {
		height: auto !important;
		min-height: 0 !important;
		padding-top: 0 !important;
		padding-bottom: 0 !important;
		margin-top: 0 !important;
		margin-bottom: 0 !important;
		aspect-ratio: auto !important;
	}
	body.single-product .woocommerce-product-gallery img {
		max-width: 300px;
		max-height: 300px;
		margin: 4px auto 12px;
	}
	.single-product .product-entry-wrapper {
		grid-template-columns: minmax(0, 1fr);
		row-gap: 30px;
	}

	.single-product .product-entry-wrapper { row-gap: 16px; }
	body.single-product .product-entry-wrapper { row-gap: 12px; }
	body.single-product .product-entry-wrapper {
		margin-top: 0 !important;
		padding-top: 0 !important;
	}
	body.single-product .woocommerce-product-gallery {
		margin-bottom: 0 !important;
	}
	body.single-product .entry-summary { margin-top: 0 !important; }
	body.single-product .entry-summary > h1:first-child { margin-top: 0 !important; }
	.single-product .woocommerce-product-gallery,
	.single-product .woocommerce-product-gallery__wrapper,
	.single-product .woocommerce-product-gallery__image,
	.single-product .woocommerce-product-gallery__image a {
		height: auto;
		min-height: 0;
		padding-top: 0;
		padding-bottom: 0;
		margin-top: 0;
		margin-bottom: 0;
		aspect-ratio: auto;
	}
	.single-product .woocommerce-product-gallery img {
		display: block;
		width: auto;
		max-width: 300px;
		max-height: 300px;
		height: auto;
		margin: 16px auto;
		object-fit: contain;
	}

	.xf-product-key-specs > div {
		grid-template-columns: minmax(0, 1fr);
		gap: 3px;
	}

	.xf-product-details-section,
	.xf-related-products {
		width: min(1200px, calc(100% - 32px));
	}

	.xf-product-details-grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 34px;
	}

	.xf-product-details-section { padding-top: 44px; }
	.xf-related-products .xf-product-archive-grid { gap: 18px 12px; }
	.xf-related-products .xf-archive-product h3 { padding: 12px; font-size: 14px; }

	.xf-gas-accessories {
		display: block;
		min-height: 0;
	}

	.xf-gas-accessories h3 {
		margin-bottom: 12px;
	}

	.xf-gas-accessories__image {
		max-width: 200px;
		max-height: 75px;
		margin-left: 0;
	}

	.xf-gas-specifications__table-wrap {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	.xf-gas-specifications table {
		min-width: 600px;
	}

	.xf-bed-lift-501-specifications table {
		min-width: 920px;
	}

	.xf-product-actions {
		display: grid;
		grid-template-columns: minmax(0, 1fr);
		overflow: hidden;
	}

	.xf-product-action {
		width: 100%;
		min-height: 50px;
	}
}
