/* Shopper-facing viewer. Theme-agnostic so it inherits type from the shop. */

.tdp-wrap {
	margin: 1em 0 1.5em;
}

.tdp-open {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .5em;
	line-height: 1;
	cursor: pointer;
}

.tdp-open-icon {
	width: 1.05em;
	height: 1.05em;
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.tdp-open-icon svg {
	width: 100%;
	height: 100%;
	display: block;
}

.tdp-modal[hidden] {
	display: none;
}

.tdp-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	background: rgba(0, 0, 0, .68);
}

.tdp-modal-inner {
	position: relative;
	width: 100%;
	max-width: 760px;
	background: #fff;
	border-radius: 10px;
	padding: 2.25rem 1rem 1rem;
}

.tdp-close {
	position: absolute;
	top: .25rem;
	right: .5rem;
	border: 0;
	background: none;
	font-size: 1.9rem;
	line-height: 1;
	padding: .25rem .5rem;
	cursor: pointer;
	color: #444;
}

.tdp-stage {
	width: 100%;
	height: min(62vh, 460px);
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f4f4f5;
	border-radius: 8px;
	color: #71717a;
	font-size: .9rem;
	text-align: center;
	padding: 1rem;
}

.tdp-stage model-viewer {
	width: 100%;
	height: 100%;
	background: transparent;
	--poster-color: transparent;
}

.tdp-caption {
	margin: .75rem 0 0;
	font-size: .85rem;
	color: #52525b;
	text-align: center;
}

body.tdp-modal-open {
	overflow: hidden;
}

@media (max-width: 600px) {
	.tdp-modal {
		padding: 0;
	}

	.tdp-modal-inner {
		max-width: none;
		height: 100%;
		border-radius: 0;
		display: flex;
		flex-direction: column;
		justify-content: center;
	}

	.tdp-stage {
		height: 70vh;
	}
}

/* Corner badge: the button sits over the product gallery instead of below it.
   Used by the "on_gallery" position; JS drops .tdp-badge-host on the gallery. */
.tdp-badge-host {
	position: relative;
}

.tdp-wrap--on-gallery {
	position: absolute;
	right: 12px;
	bottom: 12px;
	left: auto;
	margin: 0;
	z-index: 20;
}

.tdp-wrap--on-gallery .tdp-open {
	background: rgba(255, 255, 255, .92);
	color: #1a1a1a;
	border: 1px solid rgba(0, 0, 0, .12);
	border-radius: 999px;
	padding: .5em .9em;
	font-size: .8rem;
	line-height: 1;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
}

.tdp-wrap--on-gallery .tdp-open:hover {
	background: #fff;
}

/* Hidden until JS lifts it onto the gallery, so it never flashes in the footer. */
.tdp-wrap--pending {
	opacity: 0;
	pointer-events: none;
}

@media (max-width: 600px) {
	.tdp-wrap--on-gallery {
		right: 8px;
		bottom: 8px;
	}

	.tdp-wrap--on-gallery .tdp-open {
		font-size: .72rem;
		padding: .45em .75em;
	}
}

/* Colour swatches inside the viewer, for models that carry variants. */
.tdp-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
	margin: .9rem 0 .1rem;
}

.tdp-swatches[hidden] {
	display: none;
}

.tdp-swatch {
	border: 1px solid #d4d4d8;
	background: #fff;
	border-radius: 999px;
	padding: 6px 14px;
	font-size: .85rem;
	line-height: 1.2;
	color: #1a1a1a;
	cursor: pointer;
}

.tdp-swatch[aria-pressed="true"] {
	border-color: #1a1a1a;
	box-shadow: 0 0 0 1px #1a1a1a inset;
}
