/* DeLord 0.8: changes apply ONLY to single products with an MKL configurator. */

:root {
	--delord-mkl-gold: #b78947;
	--delord-mkl-gold-hover: #a57635;
	--delord-mkl-ink: #29231d;
}

/* Astra can nest these elements inside extra layout wrappers. The old child
   combinator (>) missed them, leaving the duplicated product above MKL. */
body.delord-mkl-inline-product.single-product div.product div.images,
body.delord-mkl-inline-product.single-product div.product div.summary,
body.delord-mkl-inline-product.single-product div.product .woocommerce-product-gallery,
body.delord-mkl-inline-product.single-product div.product .summary.entry-summary,
body.delord-mkl-inline-product.single-product div.product .ast-product-gallery-layout-horizontal,
body.delord-mkl-inline-product.single-product div.product .ast-woocommerce-product-gallery-wrap,
body.delord-mkl-inline-product.single-product div.product .ast-product-gallery-wrap {
	display: none !important;
}

body.delord-mkl-inline-product.single-product .woocommerce div.product #delord-inline-configurator {
	clear: both;
	float: none;
	width: 100%;
	max-width: none;
	box-sizing: border-box;
	margin: 0 0 48px;
	padding: 0;
	background: transparent;
	border: 0;
}

/* MKL's WSB theme defaults to solid white. Make its broad surfaces inherit
   whatever background the DeLord page has, including future theme colours. */
#delord-inline-configurator .mkl_pc {
	--mkl_pc_color-toolbar_bg: transparent;
	background-color: transparent !important;
}

#delord-inline-configurator .mkl_pc .mkl_pc_container,
#delord-inline-configurator .mkl_pc .mkl_pc_container .mkl_pc_viewer,
#delord-inline-configurator .mkl_pc .mkl_pc_container .mkl_pc_toolbar,
#delord-inline-configurator .mkl_pc .mkl_pc_container .mkl_pc_toolbar section.choices,
#delord-inline-configurator .mkl_pc .mkl_pc_container footer {
	background-color: transparent !important;
}

#delord-inline-configurator .delord-inline-configurator__header {
	margin: 0 0 12px;
}

#delord-inline-configurator .delord-inline-configurator__product-title {
	margin: 0 0 6px;
	color: var(--delord-mkl-ink);
	font-family: Georgia, 'Times New Roman', serif;
	font-size: clamp(1.65rem, 2.7vw, 2.5rem);
	font-weight: 400;
	line-height: 1.2;
}

#delord-inline-configurator .delord-inline-configurator__title {
	margin: 0;
	font-size: clamp(0.93rem, 1.25vw, 1.05rem);
	line-height: 1.5;
	color: #60564a;
}

#delord-inline-configurator .mkl_pc {
	width: 100%;
	max-width: 100%;
	min-height: 520px;
}

/* Hide only WSB's redundant current-value line (e.g. "Bordowy"). The
   selected colour remains represented by the active swatch below it. */
#delord-inline-configurator .mkl_pc .mkl_pc_container .mkl_pc_toolbar section.choices .layers li.layers-list-item > button.layer-item .selected-choice {
	display: none !important;
}

/* The right-hand layer button needs to read as the main configurator control. */
#delord-inline-configurator .mkl_pc.wsb .mkl_pc_container .mkl_pc_toolbar section.choices .layers li.layers-list-item > button.layer-item {
	box-sizing: border-box;
	min-height: 52px;
	padding: 12px 20px !important;
	background: rgba(183, 137, 71, 0.12) !important;
	border: 1px solid var(--delord-mkl-gold) !important;
	border-radius: 6px !important;
	box-shadow: 0 2px 7px rgba(55, 38, 20, 0.07) !important;
	color: var(--delord-mkl-ink) !important;
}

#delord-inline-configurator .mkl_pc.wsb .mkl_pc_container .mkl_pc_toolbar section.choices .layers li.layers-list-item > button.layer-item:hover {
	background: rgba(183, 137, 71, 0.20) !important;
}

#delord-inline-configurator .mkl_pc.wsb .mkl_pc_container .mkl_pc_toolbar section.choices .layers li.layers-list-item > button.layer-item .layer-name {
	color: #49351f !important;
	font-size: 0.9rem !important;
	font-weight: 700 !important;
	letter-spacing: 0.035em;
}

#delord-inline-configurator .mkl_pc.wsb .mkl_pc_container .mkl_pc_toolbar section.choices .layers li.layers-list-item > button.layer-item:focus-visible {
	outline: 3px solid var(--delord-mkl-gold-hover);
	outline-offset: 3px;
}

/* The desktop layout follows the normal DeLord product page:
   photo on the left, title/price/choices/cart on the right. The WSB theme
   normally puts the title outside its toolbar and the cart at its bottom.
   These scoped rules rearrange those existing elements, without duplicating
   MKL's live price or changing its choice/checkout behaviour. */
@media (min-width: 980px) {
	body.delord-mkl-inline-product.single-product .woocommerce div.product #delord-inline-configurator {
		position: relative;
		min-height: 0;
		margin-bottom: 40px;
	}

	#delord-inline-configurator .delord-inline-configurator__header {
		position: absolute;
		z-index: 3;
		top: 0;
		left: 47%;
		right: 0;
		margin: 0;
		padding: 0 18px 0 0;
		pointer-events: none;
	}

	#delord-inline-configurator .delord-inline-configurator__product-title {
		font-size: clamp(1.75rem, 2.65vw, 2.5rem);
		line-height: 1.18;
		max-width: 27ch;
	}

	#delord-inline-configurator .mkl_pc.wsb {
		height: clamp(530px, calc(100svh - 225px), 690px) !important;
		min-height: 0 !important;
	}

	#delord-inline-configurator .mkl_pc.wsb .mkl_pc_container {
		position: relative !important;
		height: 100% !important;
		min-height: 0 !important;
	}

	#delord-inline-configurator .mkl_pc.wsb .mkl_pc_container .mkl_pc_viewer {
		position: absolute !important;
		left: 0 !important;
		right: auto !important;
		top: 0 !important;
		bottom: 0 !important;
		width: 46% !important;
		height: 100% !important;
	}

	/* Scale the *whole* image stack, not individual cushion layers. */
	#delord-inline-configurator .mkl_pc.wsb .mkl_pc_container .mkl_pc_viewer .mkl_pc_layers {
		scale: 0.96;
		translate: 0 0;
		transform-origin: left top;
	}

	#delord-inline-configurator .mkl_pc.wsb .mkl_pc_container .mkl_pc_toolbar {
		position: absolute !important;
		display: block !important;
		left: 47% !important;
		right: 0 !important;
		top: 0 !important;
		bottom: 0 !important;
		width: 53% !important;
		height: 100% !important;
		min-height: 0 !important;
	}

	#delord-inline-configurator .mkl_pc.wsb .mkl_pc_container .mkl_pc_toolbar section.choices {
		position: absolute !important;
		box-sizing: border-box;
		top: 165px !important;
		bottom: 96px !important;
		left: 0 !important;
		right: 0 !important;
		width: 100% !important;
		height: auto !important;
		min-height: 0 !important;
		overflow-x: hidden !important;
		overflow-y: auto !important;
		padding: 0 18px 8px 0;
	}

	/* MKL updates this price when a paid option is selected. Keeping the real
	   node makes currency conversion and future surcharges work as before. */
	#delord-inline-configurator .mkl_pc.wsb .mkl_pc_container .mkl_pc_toolbar .form.form-cart {
		position: absolute !important;
		inset: 0 !important;
		box-sizing: border-box;
		height: 100% !important;
		width: 100% !important;
		margin: 0 !important;
		padding: 0 !important;
		pointer-events: none;
		background: transparent !important;
	}

	#delord-inline-configurator .mkl_pc.wsb .mkl_pc_container .mkl_pc_toolbar .pc-total-price--container {
		position: absolute !important;
		box-sizing: border-box;
		top: 100px !important;
		left: 0 !important;
		right: 18px !important;
		width: auto !important;
		height: auto !important;
		margin: 0 !important;
		padding: 0 !important;
		text-align: left !important;
	}

	#delord-inline-configurator .mkl_pc.wsb .mkl_pc_container .mkl_pc_toolbar .pc-total-price--container .pc-total-price {
		font-size: clamp(1.15rem, 1.7vw, 1.55rem) !important;
		font-weight: 600 !important;
		text-align: left !important;
		color: var(--delord-mkl-ink) !important;
		font-variant-numeric: tabular-nums;
	}

	#delord-inline-configurator .mkl_pc.wsb .mkl_pc_container .mkl_pc_toolbar .pc_configurator_form {
		position: absolute !important;
		box-sizing: border-box;
		left: 0 !important;
		right: 18px !important;
		bottom: 18px !important;
		top: auto !important;
		width: auto !important;
		margin: 0 !important;
		padding: 16px 0 0 !important;
		border-top: 1px solid rgba(94, 71, 45, 0.17);
		display: flex !important;
		align-items: center;
		justify-content: flex-start;
		gap: 12px;
		pointer-events: auto;
	}

	#delord-inline-configurator .mkl_pc.wsb .mkl_pc_container .mkl_pc_toolbar .pc_configurator_form .quantity {
		float: none !important;
		margin: 0 !important;
	}

	/* MKL's footer is empty on LORD, but we preserve it for other products. */
}

/* The official MKL checkout button selector, documented by its maintainer. */
body.delord-mkl-inline-product #delord-inline-configurator .mkl_pc .mkl_pc_container button.configurator-add-to-cart,
body.delord-mkl-inline-product #delord-inline-configurator .mkl_pc .mkl_pc_container .mkl-pc--steps button {
	background: var(--delord-mkl-gold) !important;
	border: 1px solid var(--delord-mkl-gold) !important;
	color: #241b11 !important;
	border-radius: 3px !important;
	box-shadow: none !important;
	font-size: 0.88rem;
	font-weight: 600;
	letter-spacing: 0.03em;
	line-height: 1.35;
	min-height: 46px;
	padding: 11px 22px;
	text-transform: none;
	transition: background-color 150ms ease, border-color 150ms ease;
}

body.delord-mkl-inline-product #delord-inline-configurator .mkl_pc .mkl_pc_container button.configurator-add-to-cart:hover,
body.delord-mkl-inline-product #delord-inline-configurator .mkl_pc .mkl_pc_container .mkl-pc--steps button:hover {
	background: var(--delord-mkl-gold-hover) !important;
	border-color: var(--delord-mkl-gold-hover) !important;
	color: #fff !important;
}

body.delord-mkl-inline-product #delord-inline-configurator .mkl_pc .mkl_pc_container button.configurator-add-to-cart:focus-visible,
#delord-inline-configurator button.choice-item:focus-visible {
	outline: 3px solid #8e672e !important;
	outline-offset: 3px;
}

/* A swatch image in MKL's Thumbnail field fills the circle. */
#delord-inline-configurator .mkl_pc .mkl_pc_container .mkl_pc_toolbar section.choices > ul ul.layer_choices.display-mode-colors .choices-list li.choice button.choice-item i.mkl-pc-thumbnail,
#delord-inline-configurator .mkl_pc .choices-list li.choice button.choice-item .mkl-pc-thumbnail {
	display: block;
	box-sizing: border-box;
	width: 88px !important;
	height: 88px !important;
	max-width: none !important;
	max-height: none !important;
	border-radius: 50% !important;
	border: 1px solid #c7b69d;
	background-size: cover !important;
	background-position: center !important;
	background-repeat: no-repeat;
	overflow: hidden;
}

#delord-inline-configurator .mkl_pc .choices-list li.choice button.choice-item .mkl-pc-thumbnail img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
}

#delord-inline-configurator .mkl_pc .choices-list li.choice {
	min-width: 94px;
	margin: 0 8px 12px 0;
}

/* WSB centres the swatch row inside the right panel by default. Keep each
   colour row left-aligned, including when there are only two seat colours. */
#delord-inline-configurator .mkl_pc.wsb .mkl_pc_toolbar section.choices ul.layer_choices {
	box-sizing: border-box;
	width: 100% !important;
	max-width: none !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
}

#delord-inline-configurator .mkl_pc.wsb .mkl_pc_toolbar section.choices ul.layer_choices li.choices-list {
	box-sizing: border-box;
	display: block !important;
	width: 100% !important;
	max-width: none !important;
	margin: 0 !important;
	padding: 10px 0 0 !important;
	text-align: left !important;
}

#delord-inline-configurator .mkl_pc.wsb .mkl_pc_toolbar section.choices ul.layer_choices li.choices-list > ul {
	display: flex !important;
	flex-wrap: wrap !important;
	align-items: flex-start !important;
	justify-content: flex-start !important;
	align-content: flex-start !important;
	box-sizing: border-box;
	width: 100% !important;
	max-width: none !important;
	margin: 0 !important;
	padding: 0 !important;
	text-align: left !important;
}

#delord-inline-configurator .mkl_pc.wsb .mkl_pc_toolbar section.choices ul.layer_choices li.choices-list > ul > li.choice {
	float: none !important;
	flex: 0 0 auto;
	margin: 0 10px 12px 0 !important;
}

@media (max-width: 767px) {
	body.delord-mkl-inline-product.single-product .woocommerce div.product #delord-inline-configurator {
		margin: 0 0 30px;
		padding: 0;
	}

	#delord-inline-configurator .delord-inline-configurator__header {
		margin-bottom: 16px;
	}

	#delord-inline-configurator .mkl_pc {
		min-height: 440px;
	}

	#delord-inline-configurator .mkl_pc .mkl_pc_container .mkl_pc_toolbar section.choices > ul ul.layer_choices.display-mode-colors .choices-list li.choice button.choice-item i.mkl-pc-thumbnail,
	#delord-inline-configurator .mkl_pc .choices-list li.choice button.choice-item .mkl-pc-thumbnail {
		width: 66px !important;
		height: 66px !important;
	}

	#delord-inline-configurator .mkl_pc .choices-list li.choice {
		min-width: 72px;
	}
}

@media (prefers-reduced-motion: reduce) {
	body.delord-mkl-inline-product #delord-inline-configurator .mkl_pc .mkl_pc_container button.configurator-add-to-cart {
		transition: none;
	}
}

/* 0.9: show the real WooCommerce surcharge alongside MKL's own live price.
   The MKL price remains in the DOM and can continue updating normally. */
#delord-inline-configurator .pc-total-price--container .delord-seat-total-price {
	display: none;
	font-size: clamp(1.15rem, 1.7vw, 1.55rem);
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	color: var(--delord-mkl-ink);
}

#delord-inline-configurator .pc-total-price--container.delord-seat-price-with-fee .pc-total-price {
	display: none !important;
}

#delord-inline-configurator .pc-total-price--container.delord-seat-price-with-fee .delord-seat-total-price {
	display: block;
}

#delord-inline-configurator .layers-list-item > button.layer-item .delord-seat-fee-hint {
	font-size: 0.78rem;
	font-weight: 500;
	white-space: nowrap;
	margin-left: auto;
	padding: 0 26px 0 8px;
	color: #98733d;
}
