/**
 * Sofa customizer. Loaded only on sofa product pages and shortcode pages.
 * Colours follow the swing-chair page: ink, paper, muted, line, wash.
 */

.bsc-stage {
	position: relative;
	width: 100%;
	aspect-ratio: var(--bsc-ratio, 1);
	isolation: isolate;
	background: #f6f5f3;
}

.bsc .bsc-base {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	aspect-ratio: auto;
	object-fit: contain;
}

.bsc-tint,
.bsc-lift {
	position: absolute;
	inset: 0;
	background: var(--bsc-color, #3a3a3c);
	pointer-events: none;
	-webkit-mask-image: var(--bsc-mask);
	mask-image: var(--bsc-mask);
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	transition: background-color 150ms ease, opacity 150ms ease;
}

.bsc-tint {
	mix-blend-mode: multiply;
}

.bsc-lift {
	mix-blend-mode: screen;
	opacity: var(--bsc-lift, 0);
}

.bsc-note {
	margin: 0;
	padding: 8px 16px;
	color: #595959;
	font-size: 12px;
	line-height: 1.4;
	text-align: center;
}

.bsc-views {
	display: flex;
	gap: 8px;
	padding: 8px 16px 0;
}

.bsc-view {
	display: flex;
	min-width: 72px;
	min-height: 44px;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 4px;
	border: 1px solid #e4e4e4;
	background: #fff;
	color: #141414;
	font: inherit;
	font-size: 11px;
}

.bsc-view img {
	width: 72px;
	height: 48px;
	object-fit: contain;
	background: #f6f5f3;
}

.bsc-view.is-current,
.bsc-view:focus-visible {
	border: 2px solid #141414;
}

.bsc-group {
	min-width: 0;
	margin: 16px 0 0;
	padding: 0;
	border: 0;
}

.bsc-legend {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0 8px;
	margin: 0 0 8px;
	color: #141414;
	font-size: 14px;
	font-weight: 600;
}

.bsc-legend span {
	color: #595959;
	font-weight: 400;
}

.bsc-models {
	display: flex;
	max-width: 100%;
	gap: 8px;
	margin-right: -16px;
	margin-left: -16px;
	padding: 0 16px 4px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
}

.bsc-model {
	display: flex;
	width: 7.5rem;
	flex: 0 0 7.5rem;
	flex-direction: column;
	gap: 4px;
	scroll-snap-align: start;
	padding: 8px;
	border: 2px solid #e4e4e4;
	background: #fff;
	color: inherit;
	text-align: left;
	text-decoration: none;
}

.bsc-model.is-current {
	border-color: #141414;
}

.bsc-model:focus-visible {
	outline: 2px solid #141414;
	outline-offset: 2px;
}

.bsc-model-thumb {
	display: block;
	width: 100%;
	height: 64px;
	object-fit: contain;
	background: #f6f5f3;
}

.bsc-model-name {
	color: #141414;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.3;
}

.bsc-model-meta {
	color: #595959;
	font-size: 11px;
	line-height: 1.3;
}

.bsc-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.bsc-swatch {
	position: relative;
	display: inline-flex;
	width: 48px;
	height: 48px;
}

.bsc-swatch input[type="radio"] {
	position: absolute;
	z-index: 1;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	cursor: pointer;
	opacity: 0;
	appearance: none;
}

.bsc-chip {
	display: block;
	width: 48px;
	height: 48px;
	border: 1px solid rgba(0, 0, 0, 0.1);
}

.bsc-swatch:has(input:checked) .bsc-chip {
	box-shadow: 0 0 0 3px #fff, 0 0 0 5px #141414;
}

.bsc-swatch:has(input:focus-visible) .bsc-chip {
	outline: 2px solid #141414;
	outline-offset: 3px;
}

.bsc-chip-custom {
	background: conic-gradient(#f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}

.bsc-color {
	position: absolute;
	z-index: 2;
	inset: 0;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	cursor: pointer;
	opacity: 0;
}

.bsc-wa,
.bsc-ask {
	width: 100%;
}

.bsc-shortcode {
	max-width: 720px;
}

.bsc-shortcode-link {
	margin: 16px 0 0;
}

@media (max-width: 1023px) {
	body.bsc-sofa .bsh-product-media {
		position: sticky;
		z-index: 20;
		top: 3.5rem;
		background: #fff;
	}

	body.bsc-sofa .bsc-stage {
		height: 45vh;
		aspect-ratio: auto;
	}

	body.bsc-sofa .bsh-product-summary form.cart,
	body.bsc-sofa .bsc-bar {
		position: fixed;
		z-index: 40;
		right: 0;
		bottom: 0;
		left: 0;
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		gap: 8px;
		align-items: center;
		margin: 0;
		padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
		background: #fff;
		border-top: 1px solid #e4e4e4;
	}

	body.bsc-sofa .bsh-product-summary form.cart .single_add_to_cart_button:not(.bsh-buy-now) {
		flex: 1 1 auto;
		width: auto;
	}

	body.bsc-sofa .bsh-product-summary form.cart .bsh-buy-now,
	body.bsc-sofa .bsh-product-summary form.cart .bsc-wa,
	body.bsc-sofa .bsc-bar .bsc-wa,
	body.bsc-sofa .bsc-bar .bsc-ask {
		flex: 1 1 100%;
	}

	body.bsc-sofa {
		padding-bottom: 8.5rem;
	}

	body.bsc-sofa:has(.bsc-bar) {
		padding-bottom: 11.5rem;
	}

	body.bsc-sofa .bsh-wa {
		bottom: calc(9rem + env(safe-area-inset-bottom, 0px));
	}
}

@media (min-width: 1024px) {
	body.bsc-sofa .bsh-product-layout {
		grid-template-columns: minmax(0, 55%) minmax(0, 1fr);
		align-items: start;
	}

	body.bsc-sofa .bsh-product-media {
		position: sticky;
		top: 72px;
	}

	.bsc-note,
	.bsc-views {
		padding-right: 0;
		padding-left: 0;
		text-align: left;
	}

	.bsc-models {
		margin-right: 0;
		margin-left: 0;
		padding-right: 0;
		padding-left: 0;
	}

	.bsc-swatch,
	.bsc-chip {
		width: 66px;
		height: 66px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bsc-tint,
	.bsc-lift {
		transition: none;
	}
}
