/* GLB Viewer Pro */
.glbv-wrap {
	--glbv-accent: #1e1e1e;
	position: relative;
	box-sizing: border-box;
	width: var(--glbv-width, 100%);
	height: var(--glbv-height, 500px);
	aspect-ratio: var(--glbv-ratio, auto);
	max-width: min(100%, var(--glbv-max-w, 100%));
	max-height: var(--glbv-max-h, none);
	margin-left: auto;
	margin-right: auto;
	background: var(--glbv-bg, transparent);
	overflow: hidden;
	isolation: isolate;
	-webkit-user-select: none;
	user-select: none;
}

.glbv-stage {
	position: absolute;
	inset: 0;
	z-index: 1;
	touch-action: pan-y;
}

.glbv-stage canvas {
	display: block;
	width: 100% !important;
	height: 100% !important;
	outline: none;
	cursor: grab;
}

.glbv-wrap.is-interacting .glbv-stage canvas {
	cursor: grabbing;
}

/* Loading screen: neutral (or the cover image) until the model is ready. */
.glbv-wrap:not(.is-loaded) .glbv-stage {
	visibility: hidden;
}

.glbv-loading {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 16px;
	z-index: 3;
	pointer-events: none;
	font-size: 14px;
	line-height: 1.4;
	color: #50575e;
	text-align: center;
	background: var(--glbv-poster, none) center / contain no-repeat, var(--glbv-loading-bg, #f3f4f6);
}

.glbv-loading[hidden],
.glbv-wrap.is-loaded .glbv-loading {
	display: none;
}

.glbv-wrap[data-glbv-poster] .glbv-loading {
	justify-content: flex-end;
}

.glbv-wrap[data-glbv-poster] .glbv-loading__text {
	padding: 3px 12px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.8);
}

.glbv-loading__bar {
	width: min(220px, 60%);
	height: 3px;
	border-radius: 3px;
	background: rgba(0, 0, 0, 0.1);
	overflow: hidden;
}

.glbv-loading__bar span {
	display: block;
	width: 0;
	height: 100%;
	background: var(--glbv-accent);
	transition: width 0.2s ease;
}

.glbv-loading.is-indeterminate .glbv-loading__bar span,
.glbv-wrap:not([data-glbv-active]):not(.glbv-preview) .glbv-loading__bar span {
	width: 30%;
	animation: glbv-indeterminate 1.2s ease-in-out infinite;
}

.glbv-loading.is-empty .glbv-loading__bar {
	display: none;
}

/* "On click" mode: show only the neutral screen (or cover) behind the button. */
.glbv-mode-interaction:not(.is-activated) .glbv-loading__text,
.glbv-mode-interaction:not(.is-activated) .glbv-loading__bar {
	visibility: hidden;
}

/* "Ctrl + scroll to zoom" hint */
.glbv-hint {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 7;
	max-width: calc(100% - 32px);
	padding: 10px 16px;
	border-radius: 8px;
	background: rgba(20, 20, 20, 0.78);
	color: #fff;
	font-size: 14px;
	line-height: 1.3;
	text-align: center;
	opacity: 0;
	pointer-events: none;
	transform: translate(-50%, -50%);
	transition: opacity 0.2s ease;
}

.glbv-hint.is-visible {
	opacity: 1;
}

/* Editor guides: blue + = center of the scene, green × = center of the model, red ○ = rotation center */
.glbv-guide {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 4;
	width: 0;
	height: 0;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
	--glbv-guide: #d63638;
	--glbv-guide-size: 24px;
}

.glbv-guide::before,
.glbv-guide::after {
	content: "";
	position: absolute;
	top: -1px;
	left: calc(var(--glbv-guide-size) / -2);
	width: var(--glbv-guide-size);
	height: 2px;
	border-radius: 1px;
	background: var(--glbv-guide);
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85);
}

.glbv-guide::after {
	transform: rotate(90deg);
}

.glbv-guide--env {
	--glbv-guide: #2271b1;
	--glbv-guide-size: 30px;
}

.glbv-guide--model {
	--glbv-guide: #00a32a;
	--glbv-guide-size: 20px;
}

.glbv-guide--model::before {
	transform: rotate(45deg);
}

.glbv-guide--model::after {
	transform: rotate(-45deg);
}

.glbv-guide.glbv-pivot::before {
	top: -7px;
	left: -7px;
	width: 10px;
	height: 10px;
	border: 2px solid var(--glbv-guide);
	border-radius: 50%;
	background: none;
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85), inset 0 0 0 1px rgba(255, 255, 255, 0.85);
}

.glbv-guide.glbv-pivot::after {
	display: none;
}

.glbv-wrap.is-guides .glbv-guide,
.glbv-wrap.is-interacting .glbv-guide,
.glbv-wrap.is-pivot-edit .glbv-guide {
	opacity: 1;
}

/* Sleeping viewer (far from the screen): still image until it wakes up */
.glbv-wrap .glbv-snapshot {
	position: absolute;
	inset: 0;
	z-index: 3;
	width: 100%;
	max-width: none;
	height: 100%;
	margin: 0;
	object-fit: cover;
	pointer-events: none;
}

.glbv-wrap.is-asleep .glbv-loading {
	opacity: 0;
}

@keyframes glbv-indeterminate {
	0% { transform: translateX(-100%); }
	100% { transform: translateX(340%); }
}

/* Click-to-load cover */
.glbv-cover {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 4;
}

.glbv-wrap.is-activated .glbv-cover {
	display: none;
}

/* "View in 3D" button */
.glbv-cover__btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 20px;
	font: inherit;
	font-size: 14px;
	line-height: 1;
	color: #fff;
	background-color: var(--glbv-accent);
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 6px 20px rgba(0, 0, 0, 0.2);
	transition: transform 0.15s ease;
}

.glbv-cover__btn:hover {
	transform: scale(1.04);
}

/* Button bar */
.glbv-toolbar {
	position: absolute;
	left: 50%;
	bottom: 12px;
	z-index: 5;
	display: flex;
	align-items: center;
	gap: 2px;
	max-width: calc(100% - 24px);
	padding: 4px;
	border-radius: 999px;
	background: var(--glbv-accent);
	background: color-mix(in srgb, var(--glbv-accent) 78%, transparent);
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	transform: translateX(-50%);
	transition: opacity 0.3s ease;
}

.glbv-toolbar[hidden],
.glbv-wrap:not(.is-loaded) .glbv-toolbar {
	display: none;
}

.glbv-toolbar.is-idle {
	opacity: 0;
	pointer-events: none;
}

.glbv-wrap .glbv-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	cursor: pointer;
	opacity: 0.9;
	transition: background-color 0.15s ease, opacity 0.15s ease;
}

.glbv-wrap .glbv-btn:hover,
.glbv-wrap .glbv-btn[aria-expanded="true"] {
	opacity: 1;
	background: rgba(255, 255, 255, 0.16);
}

.glbv-wrap .glbv-btn[hidden],
.glbv-wrap .glbv-anim__select[hidden] {
	display: none;
}

.glbv-wrap select.glbv-anim__select {
	height: 32px;
	min-height: 0;
	max-width: 160px;
	margin: 0 4px 0 2px;
	padding: 0 28px 0 12px;
	border: 0;
	border-radius: 999px;
	font: inherit;
	font-size: 13px;
	line-height: 1;
	color: #fff;
	background-color: rgba(255, 255, 255, 0.14);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 8px center;
	background-size: 16px;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.glbv-wrap select.glbv-anim__select option {
	color: #1d2327;
}

.glbv-cover__btn:focus-visible,
.glbv-wrap .glbv-btn:focus-visible,
.glbv-wrap .glbv-anim__select:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 1px;
}

/* Pin list (opened from the bar) */
.glbv-pinlist {
	position: absolute;
	left: 50%;
	bottom: 62px;
	z-index: 6;
	display: flex;
	flex-direction: column;
	width: min(280px, calc(100% - 24px));
	max-height: calc(100% - 90px);
	padding: 6px;
	overflow-y: auto;
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
	transform: translateX(-50%);
}

.glbv-pinlist[hidden] {
	display: none;
}

.glbv-wrap .glbv-pinlist__item {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	margin: 0;
	padding: 8px 10px;
	border: 0;
	border-radius: 8px;
	background: none;
	color: #1d2327;
	font: inherit;
	font-size: 14px;
	text-align: left;
	cursor: pointer;
}

.glbv-wrap .glbv-pinlist__item:hover,
.glbv-wrap .glbv-pinlist__item:focus-visible {
	background: #f0f0f1;
}

.glbv-wrap .glbv-pinlist__toggle {
	margin-bottom: 4px;
	border-bottom: 1px solid #e0e0e0;
	border-radius: 8px 8px 0 0;
	font-weight: 600;
}

.glbv-pinlist__icon {
	display: inline-flex;
	flex: none;
	justify-content: center;
	width: 22px;
	color: var(--glbv-pin, #1e1e1e);
}

.glbv-wrap.is-pins-hidden .glbv-pinlist__item:not(.glbv-pinlist__toggle) {
	opacity: 0.6;
}

.glbv-wrap.is-pins-hidden .glbv-tb-pins {
	opacity: 0.55;
}

.glbv-pinlist__num {
	flex: none;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--glbv-pin, #1e1e1e);
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	line-height: 22px;
	text-align: center;
}

/* Fullscreen */
.glbv-wrap:fullscreen {
	width: 100vw !important;
	height: 100vh !important;
	max-width: none !important;
	max-height: none !important;
	aspect-ratio: auto !important;
}

.glbv-wrap:fullscreen:not(.glbv-bg-color):not(.glbv-bg-gradient):not(.glbv-bg-image):not(.glbv-bg-grid):not(.glbv-bg-hdri) {
	background: #fff;
}

/* Errors and notices */
.glbv-error {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	text-align: center;
	font-size: 14px;
	color: #8a1f11;
	background: rgba(255, 255, 255, 0.9);
	z-index: 6;
}

.glbv-notice {
	padding: 16px;
	border: 1px dashed #c3c4c7;
	font-size: 14px;
	text-align: center;
	color: #50575e;
}

@media (prefers-reduced-motion: reduce) {
	.glbv-loading__bar span {
		animation: none !important;
	}
}

.glbv-wrap:not(.is-loaded) .glbv-toolbar {
	display: none;
}

/* Information pins */
.glbv-pins {
	position: absolute;
	inset: 0;
	z-index: 4;
	pointer-events: none;
	overflow: hidden;
}

.glbv-wrap:not(.is-loaded) .glbv-pins {
	display: none;
}

.glbv-pin {
	position: absolute;
	left: 0;
	top: 0;
	width: 0;
	height: 0;
	transition: opacity 0.2s ease;
}

.glbv-pin[hidden] {
	display: none;
}

.glbv-pin.is-occluded {
	opacity: 0;
	pointer-events: none;
}

.glbv-pin.is-occluded .glbv-pin__dot,
.glbv-pin.is-faded .glbv-pin__dot {
	pointer-events: none;
}

.glbv-pin.is-open,
.glbv-pin.is-selected {
	z-index: 2;
}

.glbv-wrap .glbv-pin__dot {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	left: calc(var(--glbv-pin-size, 28px) / -2);
	top: calc(var(--glbv-pin-size, 28px) / -2);
	width: var(--glbv-pin-size, 28px);
	height: var(--glbv-pin-size, 28px);
	margin: 0;
	padding: 0;
	border: 2px solid #fff;
	border-radius: 50%;
	background: var(--glbv-pin, #1e1e1e);
	color: #fff;
	font: 600 calc(var(--glbv-pin-size, 28px) * 0.43)/1 system-ui, -apple-system, "Segoe UI", sans-serif;
	text-align: center;
	cursor: pointer;
	pointer-events: auto;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
	transition: transform 0.15s ease;
}

.glbv-wrap .glbv-pin__dot:empty::after {
	content: "";
	display: block;
	flex: none;
	width: calc(var(--glbv-pin-size, 28px) * 0.29);
	height: calc(var(--glbv-pin-size, 28px) * 0.29);
	border-radius: 50%;
	background: #fff;
}

.glbv-wrap .glbv-pin__dot:hover,
.glbv-pin.is-open .glbv-pin__dot,
.glbv-pin.is-selected .glbv-pin__dot {
	transform: scale(1.15);
}

.glbv-pin.is-selected .glbv-pin__dot {
	box-shadow: 0 0 0 3px var(--glbv-pin, #1e1e1e), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.glbv-wrap .glbv-pin__dot:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

.glbv-pin__card {
	position: absolute;
	left: calc(var(--glbv-pin-size, 28px) / 2 + 6px);
	top: calc(var(--glbv-pin-size, 28px) / 2 + 6px);
	width: min(260px, 70vw);
	padding: 14px 16px;
	border-radius: 10px;
	background: #fff;
	color: #1d2327;
	font-size: 14px;
	line-height: 1.45;
	text-align: left;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
	pointer-events: auto;
	-webkit-user-select: text;
	user-select: text;
}

.glbv-pin__card[hidden] {
	display: none;
}

.glbv-pin.is-left .glbv-pin__card {
	left: auto;
	right: calc(var(--glbv-pin-size, 28px) / 2 + 6px);
}

.glbv-pin.is-up .glbv-pin__card {
	top: auto;
	bottom: calc(var(--glbv-pin-size, 28px) / 2 + 6px);
}

.glbv-wrap .glbv-pin__close {
	position: absolute;
	top: 4px;
	right: 6px;
	width: 26px;
	height: 26px;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: #646970;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

.glbv-pin__title {
	display: block;
	margin: 0 22px 4px 0;
	font-size: 15px;
}

.glbv-pin__text {
	margin: 0;
	white-space: pre-line;
}

.glbv-pin__link {
	display: inline-block;
	margin-top: 8px;
	color: var(--glbv-pin, #1e1e1e);
	font-weight: 600;
}
