/**
 * Product Customizer storefront read-only preview.
 *
 * Single-product pages only. Not loaded in wp-admin.
 * Garment tint is a multiply composite over the original mockup.
 */

.product-customizer-preview {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	margin: 1.5rem 0 0;
	padding: 0;
}

.product-customizer-preview *,
.product-customizer-preview *::before,
.product-customizer-preview *::after {
	box-sizing: border-box;
}

.product-customizer-preview__controls {
	display: inline-flex;
	flex-wrap: nowrap;
	width: auto;
	max-width: 100%;
	margin: 0 0 0.75rem;
	padding: 0;
	border: 1px solid #1d2327;
	border-radius: 999px;
	overflow: hidden;
	background: #fff;
}

.product-customizer-preview__side {
	flex: 1 1 auto;
	min-width: 4.5rem;
	min-height: 2rem;
	padding: 0.35rem 0.95rem;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: #1d2327;
	font-size: 0.8125rem;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
}

.product-customizer-preview__side + .product-customizer-preview__side {
	border-left: 1px solid #1d2327;
}

.product-customizer-preview__side.is-current {
	background: #1d2327;
	color: #fff;
}

.product-customizer-preview__side:focus {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.product-customizer-preview__stage {
	position: relative;
	width: 100%;
}

.product-customizer-preview__loading {
	position: absolute;
	left: 50%;
	bottom: 0.65rem;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	max-width: calc(100% - 1.2rem);
	margin: 0;
	padding: 0.2rem 0.45rem;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.88);
	color: #1d2327;
	font-size: 0.6875rem;
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
	pointer-events: none;
	transform: translateX(-50%);
	box-shadow: 0 0 0.4rem rgba(255, 255, 255, 0.7);
}

.product-customizer-preview__loading.is-error,
.product-customizer-preview__loading.is-warning {
	white-space: normal;
	text-align: left;
	border-radius: 0.65rem;
}

.product-customizer-preview__loading.is-error {
	background: rgba(255, 246, 246, 0.94);
	color: #5c1515;
	box-shadow: 0 0 0 1px rgba(138, 36, 36, 0.42), 0 0 0.4rem rgba(255, 255, 255, 0.7);
}

.product-customizer-preview__loading.is-warning {
	background: rgba(255, 249, 235, 0.94);
	color: #5c4508;
	box-shadow: 0 0 0 1px rgba(146, 104, 12, 0.42), 0 0 0.4rem rgba(255, 255, 255, 0.7);
}

.product-customizer-preview__loading[hidden] {
	display: none;
}

.product-customizer-preview__loading-spinner {
	flex: 0 0 auto;
	box-sizing: border-box;
	width: 0.7rem;
	height: 0.7rem;
	border: 1.5px solid rgba(29, 35, 39, 0.22);
	border-top-color: #1d2327;
	border-radius: 50%;
	animation: product-customizer-preview-spin 0.65s linear infinite;
}

.product-customizer-preview__status-icon {
	position: relative;
	flex: 0 0 auto;
	box-sizing: border-box;
	width: 0.7rem;
	height: 0.7rem;
	display: none;
}

.product-customizer-preview__loading.is-error .product-customizer-preview__loading-spinner,
.product-customizer-preview__loading.is-warning .product-customizer-preview__loading-spinner {
	display: none;
}

.product-customizer-preview__loading.is-error .product-customizer-preview__status-icon,
.product-customizer-preview__loading.is-warning .product-customizer-preview__status-icon {
	display: block;
}

.product-customizer-preview__loading.is-error .product-customizer-preview__status-icon {
	background: #8a2424;
	border-radius: 0.12rem;
}

.product-customizer-preview__loading.is-error .product-customizer-preview__status-icon::before,
.product-customizer-preview__loading.is-error .product-customizer-preview__status-icon::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 0.42rem;
	height: 0.11rem;
	background: #fff;
	transform-origin: center;
}

.product-customizer-preview__loading.is-error .product-customizer-preview__status-icon::before {
	transform: translate(-50%, -50%) rotate(45deg);
}

.product-customizer-preview__loading.is-error .product-customizer-preview__status-icon::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

.product-customizer-preview__loading.is-warning .product-customizer-preview__status-icon {
	width: 0;
	height: 0;
	border-left: 0.38rem solid transparent;
	border-right: 0.38rem solid transparent;
	border-bottom: 0.66rem solid #92680c;
}

.product-customizer-preview__loading.is-warning .product-customizer-preview__status-icon::before {
	content: "";
	position: absolute;
	left: -0.05rem;
	top: 0.22rem;
	width: 0.1rem;
	height: 0.22rem;
	background: #fff7e6;
}

.product-customizer-preview__loading.is-warning .product-customizer-preview__status-icon::after {
	content: "";
	position: absolute;
	left: -0.04rem;
	top: 0.48rem;
	width: 0.08rem;
	height: 0.08rem;
	background: #fff7e6;
	border-radius: 50%;
}

.product-customizer-preview__loading-label {
	min-width: 0;
}

@keyframes product-customizer-preview-spin {
	to {
		transform: rotate(360deg);
	}
}

.product-customizer-preview__view[hidden] {
	display: none;
}

.product-customizer-preview__canvas {
	position: relative;
	display: block;
	width: 100%;
	line-height: 0;
	background-color: #f3f4f5;
	user-select: none;
	-webkit-user-select: none;
}

.product-customizer-preview__garment {
	position: relative;
	display: block;
	width: 100%;
	line-height: 0;
	isolation: isolate;
}

.product-customizer-preview__image {
	display: block;
	width: 100%;
	height: auto;
	background-color: transparent;
}

.product-customizer-preview__tint {
	display: none;
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background-color: var(--product-customizer-garment-tint);
	mix-blend-mode: multiply;
	pointer-events: none;
	-webkit-mask-image: var(--product-customizer-garment-mask);
	mask-image: var(--product-customizer-garment-mask);
	-webkit-mask-size: 100% 100%;
	mask-size: 100% 100%;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-source-type: alpha;
	mask-mode: alpha;
}

.product-customizer-preview.is-tinted .product-customizer-preview__garment.is-maskable .product-customizer-preview__tint {
	display: block;
}

.product-customizer-preview.is-tinted.is-light-garment .product-customizer-preview__garment.is-maskable {
	filter: drop-shadow(0 0 0.6px rgba(29, 35, 39, 0.22)) drop-shadow(0 1px 2px rgba(29, 35, 39, 0.1));
}

.product-customizer-preview__print-area {
	position: absolute;
	display: block;
	box-sizing: border-box;
	overflow: hidden;
	border: 0;
	background: transparent;
	pointer-events: none;
}

.product-customizer-preview__print-area::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 4;
	border: 2px solid rgba(255, 255, 255, 0.92);
	box-shadow: inset 0 0 0 1px rgba(29, 35, 39, 0.72);
	opacity: 0;
	pointer-events: none;
}

.product-customizer-preview__print-area.is-boundary-pulse::after {
	animation: product-customizer-boundary-pulse 0.8s ease-out forwards;
}

@keyframes product-customizer-boundary-pulse {
	0% {
		opacity: 0;
	}

	14% {
		opacity: 1;
	}

	100% {
		opacity: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.product-customizer-preview__loading-spinner {
		animation: none;
		border-color: #1d2327;
		border-top-color: transparent;
	}

	.product-customizer-preview__print-area.is-boundary-pulse::after {
		animation: product-customizer-boundary-static 0.45s step-end forwards;
	}
}

@keyframes product-customizer-boundary-static {
	0%,
	99% {
		opacity: 1;
	}

	100% {
		opacity: 0;
	}
}

.product-customizer-preview__print-area.has-artwork {
	pointer-events: auto;
	touch-action: none;
}

.product-customizer-design-preview {
	position: absolute;
	left: calc(var(--pc-center-x, 0.5) * 100%);
	top: calc(var(--pc-center-y, 0.5) * 100%);
	width: calc(var(--pc-width-ratio, 1) * 100%);
	height: calc(var(--pc-height-ratio, 1) * 100%);
	transform: translate(-50%, -50%);
	border: 0;
	background: transparent;
	box-shadow: none;
	outline: 0;
	touch-action: none;
	cursor: grab;
}

.product-customizer-design-preview.is-selected {
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.88), 0 0 0 2px rgba(29, 35, 39, 0.55);
}

.product-customizer-design-preview.is-interacting {
	cursor: grabbing;
}

.product-customizer-design-preview__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: fill;
	pointer-events: none;
	user-select: none;
	-webkit-user-select: none;
}

.product-customizer-design-handles {
	display: none;
	position: absolute;
	inset: 0;
	z-index: 5;
	pointer-events: none;
}

.product-customizer-design-preview__handle {
	display: none;
}

@media (hover: hover) and (pointer: fine) {
	.product-customizer-design-handles.is-active {
		display: block;
	}

	.product-customizer-design-preview__handle {
		appearance: none;
		-webkit-appearance: none;
		display: block;
		position: absolute;
		left: calc(var(--pc-handle-x, 0) * 100%);
		top: calc(var(--pc-handle-y, 0) * 100%);
		width: 0.7rem;
		height: 0.7rem;
		padding: 0;
		border: 1.5px solid #1d2327;
		border-radius: 1px;
		background: #fff;
		box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9), 0 1px 2px rgba(0, 0, 0, 0.28);
		transform: translate(-50%, -50%);
		pointer-events: auto;
		touch-action: none;
	}

	.product-customizer-design-preview__handle[data-handle="nw"],
	.product-customizer-design-preview__handle[data-handle="se"] {
		cursor: nwse-resize;
	}

	.product-customizer-design-preview__handle[data-handle="ne"],
	.product-customizer-design-preview__handle[data-handle="sw"] {
		cursor: nesw-resize;
	}
}

@media (min-width: 48em) {
	.product-customizer-preview {
		max-width: 36rem;
	}
}
