/* Visualiseur 360° des appartements types. Le fond reprend celui des rendus (réglé dans chaque page). */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html,
body {
	width: 100%;
	height: 100%;
	margin: 0;
	overflow: hidden;
	background: var(--fond, #dad9d5);
	font-family: "Montserrat", "Helvetica Neue", Arial, sans-serif;
	-webkit-user-select: none;
	user-select: none;
}

.viewer {
	position: relative;
	width: 100%;
	height: 100%;
	cursor: grab;
	/* Le glissement horizontal fait tourner le plan ; le défilement vertical reste possible. */
	touch-action: pan-y;
}

.viewer.is-drag {
	cursor: grabbing;
}

/* Rendu 16:9 ajusté au cadre : rogné sur les côtés, où il n'y a que du fond. */
#canvas {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0;
	transition: opacity 0.3s;
}

.is-pret #canvas {
	opacity: 1;
}

/* Chargement de la première vue. */
.chargement {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	color: #3b3b3b;
	font-size: 15px;
	pointer-events: none;
	transition: opacity 0.3s;
}

.chargement::before {
	content: "";
	width: 34px;
	height: 34px;
	border: 3px solid rgba(0, 0, 0, 0.15);
	border-top-color: #000;
	border-radius: 50%;
	animation: tourne 0.9s linear infinite;
}

.is-pret .chargement {
	opacity: 0;
}

@keyframes tourne {
	to {
		transform: rotate(360deg);
	}
}

/* Progression du chargement des autres vues, en bas. */
.progress {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 3px;
	background: #c6b171;
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.2s, opacity 0.4s 0.3s;
}

.is-complet .progress {
	opacity: 0;
}

/* Flèches. */
.fleche {
	position: absolute;
	top: 50%;
	width: 48px;
	height: 48px;
	margin-top: -24px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.85);
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.3s, background 0.2s;
	touch-action: none;
}

.is-pret .fleche {
	opacity: 1;
}

.fleche:hover,
.fleche:focus-visible {
	background: #fff;
}

.fleche:focus-visible {
	outline: 2px solid #000;
	outline-offset: 2px;
}

.fleche::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 12px;
	height: 12px;
	border-left: 2px solid #000;
	border-top: 2px solid #000;
}

.fleche--prev {
	left: 14px;
}

.fleche--prev::before {
	transform: translate(-30%, -50%) rotate(-45deg);
}

.fleche--next {
	right: 14px;
}

.fleche--next::before {
	transform: translate(-70%, -50%) rotate(135deg);
}

/* Consigne, masquée dès la première interaction. */
.aide {
	position: absolute;
	left: 50%;
	bottom: 16px;
	transform: translateX(-50%);
	padding: 7px 14px;
	border-radius: 20px;
	background: rgba(0, 0, 0, 0.65);
	color: #fff;
	font-size: 14px;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.4s;
}

.is-pret .aide {
	opacity: 1;
}

.is-touche .aide {
	opacity: 0;
}

.erreur {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	color: #3b3b3b;
	text-align: center;
	font-size: 15px;
}

.erreur[hidden] {
	display: none;
}

.logo {
	position: absolute;
	right: 14px;
	bottom: 12px;
	line-height: 0;
}

.logo img {
	width: 34px;
	height: auto;
}

@media (max-width: 600px) {
	.fleche {
		width: 40px;
		height: 40px;
		margin-top: -20px;
	}

	.fleche--prev {
		left: 8px;
	}

	.fleche--next {
		right: 8px;
	}

	.aide {
		bottom: 12px;
		font-size: 13px;
	}

	.logo img {
		width: 28px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.chargement::before {
		animation-duration: 2.5s;
	}
}
