/* The 3D model viewer's window.
 *
 * Every value here was an inline style attribute a moment ago, which meant no
 * stylesheet could reach it: the viewer opened as a white panel with grey
 * borders and a #3498db progress bar on top of whatever palette the shop was
 * running. Each declaration reads a theme token and falls back to what was
 * hard-coded before, so a theme that sets nothing gets the old look and a
 * theme that sets tokens gets its own.
 *
 * @package urartu-core
 */
@keyframes urartu3dSpin { to { transform: rotate(360deg); } }

.urartu-3d-overlay {
	position: fixed;
	inset: 0;
	z-index: 9998;
	background-color: var(--u-scrim, rgba(0, 0, 0, .8));
}

.urartu-3d-modal {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 80vw;
	max-width: 80vw;
	height: 80vh;
	z-index: 9999;
	overflow: hidden;
	background-color: var(--u-surface, #fff);
	color: var(--u-surface-fg, #241F1C);
	border: 1px solid var(--u-border, rgba(36, 31, 28, .14));
	border-radius: var(--u-media-radius, 8px);
	box-shadow: var(--u-shadow-3, 0 0 20px rgba(0, 0, 0, .3));
	transition: all .3s ease;
}

.urartu-3d-modal.fullscreen {
	width: 100%;
	height: 100%;
	max-width: none;
	top: 0;
	left: 0;
	transform: none;
	border-radius: 0;
	border: 0;
}

.urartu-3d-modal__controls {
	position: absolute;
	top: 15px;
	right: 15px;
	z-index: 100;
	display: flex;
	gap: 10px;
	align-items: center;
}

.urartu-3d-modal__btn,
.urartu-3d-modal__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 6px 12px;
	background-color: var(--u-surface, #fff);
	color: var(--u-surface-fg, #241F1C);
	border: 1px solid var(--u-border, #ddd);
	border-radius: var(--u-radius-sm, 4px);
	font-family: inherit;
	font-size: 13px;
	line-height: 1.2;
	cursor: pointer;
	transition: border-color .22s var(--u-ease, ease), color .22s var(--u-ease, ease);
}

.urartu-3d-modal__btn:hover,
.urartu-3d-modal__close:hover {
	border-color: var(--u-border-strong, rgba(36, 31, 28, .28));
}

.urartu-3d-modal__close {
	width: 34px;
	height: 34px;
	padding: 0;
	font-size: 16px;
	border-radius: 50%;
}

.urartu-3d-modal__textures {
	position: absolute;
	top: 15px;
	left: 15px;
	z-index: 100;
	display: flex;
	flex-direction: column;
	flex-wrap: wrap;
	gap: 5px;
	max-width: 200px;
}

.texture-thumbnail {
	width: 40px;
	height: 40px;
	border: 2px solid transparent;
	border-radius: var(--u-radius-sm, 4px);
	object-fit: cover;
	cursor: pointer;
}

.texture-thumbnail.active {
	border-color: var(--u-patina, #3498db);
}

.urartu-3d-modal__preloader {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 80%;
	z-index: 50;
	text-align: center;
	opacity: 1;
	transition: opacity .5s ease;
}

.urartu-3d-modal__spinner {
	width: 60px;
	height: 60px;
	margin: 0 auto 20px;
	border: 3px solid var(--u-border, rgba(36, 31, 28, .14));
	border-top-color: var(--u-patina, #3498db);
	border-radius: 50%;
	animation: urartu3dSpin 1s linear infinite;
}

.urartu-3d-modal__stage {
	margin-bottom: 10px;
	font-size: 15px;
	color: var(--u-surface-fg, #333);
}

.urartu-3d-modal__stage #load-progress { font-weight: 700; }

.urartu-3d-modal__track {
	width: 100%;
	height: 6px;
	margin-bottom: 6px;
	overflow: hidden;
	background-color: var(--u-sunken, #f0f0f0);
	border-radius: 999px;
}

.urartu-3d-modal__bar {
	width: 0;
	height: 100%;
	background-color: var(--u-patina, #3498db);
	transition: width .3s ease;
}

.urartu-3d-modal__details {
	font-size: 12px;
	color: var(--u-muted-fg, #777);
}

.urartu-3d-modal__canvas {
	width: 100%;
	height: 100%;
}

/* No room for it, and no fullscreen API worth the button. */
@media (max-width: 768px) {

	#fullscreen-toggle { display: none; }

	.urartu-3d-modal {
		width: 94vw;
		max-width: 94vw;
		height: 78vh;
	}
}
