/* Crispalmóvel — Galeria 3D */

/* Botão "Ver em 3D" — canto inferior esquerdo do slider principal */
.crispal-main-slider { position: relative; }
.crispal-3d-btn {
	position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 12;
	display: inline-flex; align-items: center; gap: 7px;
	padding: 10px 15px; border: none; border-radius: 12px; cursor: pointer;
	background: #fff; color: #1a1a1a;
	font-family: 'Poppins', sans-serif; font-size: 13px; font-weight: 600; line-height: 1;
	box-shadow: 0 4px 16px rgba(0,0,0,.2); transition: transform .15s, box-shadow .15s;
}
.crispal-3d-btn:hover { transform: translateX(-50%) translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,.26); }
.crispal-3d-btn svg { width: 18px; height: 18px; stroke: #b50101; }
.crispal-3d-btn.is-loading { pointer-events: none; }
.crispal-3d-btn.is-loading svg { display: none; }
.crispal-3d-btn.is-loading::before {
	content: ''; width: 16px; height: 16px; border: 2px solid rgba(181,1,1,.28);
	border-top-color: #b50101; border-radius: 50%; animation: crispal3dspin .7s linear infinite;
}
@keyframes crispal3dspin { to { transform: rotate(360deg); } }
.crispal-3d-btn.is-active { box-shadow: 0 0 0 2px #b50101 inset; }

/* Anel a pulsar para chamar a atenção (pára ao carregar/abrir) */
.crispal-3d-btn::after {
	content: ''; position: absolute; inset: -5px; border-radius: 16px;
	border: 2px solid rgba(181,1,1,.55); pointer-events: none;
	animation: crispal3dpulse 1.8s ease-out infinite;
}
.crispal-3d-btn.is-loading::after, .crispal-3d-btn.is-active::after { display: none; }
@keyframes crispal3dpulse { 0% { transform: scale(.96); opacity: .7; } 70% { transform: scale(1.12); opacity: 0; } 100% { opacity: 0; } }

/* Palco inline — cobre o slider principal (mesma proporção 3:4) */
.crispal-3d-stage {
	position: absolute; inset: 0; z-index: 20; display: none; background: #f3f2f0;
}
.crispal-3d-stage.is-open { display: block; }
.crispal-3d-mv {
	width: 100%; height: 100%; display: block;
	--poster-color: #f3f2f0;
	background-color: #f3f2f0;
}

/* Barra de progresso ao carregar (nativa do model-viewer, com a cor da marca) */
.crispal-3d-mv::part(default-progress-bar) { height: 4px; background: #b50101; }
.crispal-3d-mv::part(default-progress-mask) { display: none; }

/* Ecrã inteiro */
.crispal-3d-stage.is-max {
	position: fixed; inset: 0; z-index: 100000; display: block; background: #f3f2f0; border-radius: 0;
}

/* Logótipo da marca (horizontal) — canto superior esquerdo */
.crispal-3d-logo {
	position: absolute; top: 15px; left: 16px; z-index: 4;
	height: 30px; width: auto; max-width: 48%; opacity: .95; pointer-events: none;
}
@media (max-width: 520px) { .crispal-3d-logo { height: 24px; } }

/* Seletor de acabamentos — amostras no topo ao centro */
.crispal-3d-finishes {
	position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 4;
	display: flex; gap: 8px; align-items: center; padding: 6px 9px;
	background: rgba(255,255,255,.92); border-radius: 22px; box-shadow: 0 2px 10px rgba(0,0,0,.14);
	max-width: calc(100% - 130px); flex-wrap: wrap; justify-content: center;
	-webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.crispal-3d-swatch {
	width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; padding: 0; cursor: pointer;
	box-shadow: 0 0 0 1px rgba(0,0,0,.18); transition: transform .12s, box-shadow .12s;
}
.crispal-3d-swatch:hover { transform: scale(1.08); }
.crispal-3d-swatch.active { box-shadow: 0 0 0 2px #b50101; }

/* Esconder o botão de AR nativo do model-viewer (usamos o nosso na barra) */
.crispal-3d-mv::part(default-ar-button) { display: none !important; }

/* Barra de controlos — em baixo ao centro */
.crispal-3d-bar {
	position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 4;
	display: flex; align-items: center; gap: 3px; padding: 5px;
	border-radius: 12px; background: rgba(255,255,255,.95);
	box-shadow: 0 4px 16px rgba(0,0,0,.16);
	-webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
	max-width: calc(100% - 16px); flex-wrap: nowrap; justify-content: center;
}
.crispal-3d-ic {
	width: 34px; height: 34px; border: none; border-radius: 8px; background: transparent;
	color: #1a1a1a; cursor: pointer; display: flex; align-items: center; justify-content: center;
	transition: background .15s, color .15s;
}
.crispal-3d-ic:hover { background: #f1efec; color: #b50101; }
.crispal-3d-ic.on { background: #b50101; color: #fff; }
.crispal-3d-ic svg { width: 18px; height: 18px; }
.crispal-3d-sep { width: 1px; height: 20px; background: #e4e1dc; margin: 0; }

/* Botão fechar isolado — canto superior direito (telemóvel) */
.crispal-3d-close {
	position: absolute; top: 12px; right: 12px; z-index: 5;
	width: 36px; height: 36px; border: none; border-radius: 8px;
	background: rgba(255,255,255,.92); color: #1a1a1a; cursor: pointer;
	display: none; align-items: center; justify-content: center;
	box-shadow: 0 2px 8px rgba(0,0,0,.16); transition: color .15s;
}
.crispal-3d-close:hover { color: #b50101; }
.crispal-3d-close svg { width: 18px; height: 18px; }

/* Botão AR isolado e destacado — por cima da barra (só telemóvel) */
.crispal-3d-ar {
	position: absolute; left: 50%; bottom: 66px; transform: translateX(-50%); z-index: 5;
	display: inline-flex; align-items: center; gap: 7px; border: none; border-radius: 24px; cursor: pointer;
	background: #fff; color: #1a1a1a; height: 40px; padding: 0 18px; white-space: nowrap;
	font-family: 'Poppins', sans-serif; font-size: 13px; font-weight: 600; line-height: 1;
	box-shadow: 0 4px 16px rgba(0,0,0,.22);
}
.crispal-3d-ar:hover { box-shadow: 0 6px 20px rgba(0,0,0,.28); }
.crispal-3d-ar svg { width: 18px; height: 18px; stroke: #b50101; }

/* Botão abrir/fechar (mesa extensível) */
.crispal-3d-anim {
	display: inline-flex; align-items: center; gap: 6px; border: none; border-radius: 8px; cursor: pointer;
	background: #fff; color: #1a1a1a; height: 34px; padding: 0 12px; white-space: nowrap;
	font-family: 'Poppins', sans-serif; font-size: 12.5px; font-weight: 600; line-height: 1;
	box-shadow: inset 0 0 0 1px #e4e1dc; transition: background .15s, color .15s;
}
.crispal-3d-anim svg { width: 17px; height: 17px; stroke: #b50101; }
.crispal-3d-anim:hover { background: #f1efec; }
.crispal-3d-anim.on { background: #b50101; color: #fff; box-shadow: none; }
.crispal-3d-anim.on svg { stroke: #fff; }

/* Dica "arraste para rodar" — ao centro (desktop) */
.crispal-3d-hint {
	position: absolute; left: 50%; top: 42%; transform: translate(-50%,-50%); z-index: 4;
	background: rgba(17,17,17,.72); color: #fff; font-family: 'Poppins', sans-serif;
	font-size: 12px; padding: 7px 13px; border-radius: 30px; pointer-events: none;
	opacity: 0; transition: opacity .4s; text-align: center; max-width: 84%; line-height: 1.4;
}
.crispal-3d-hint.show { opacity: 1; }

/* Aviso "Link copiado" (partilha) */
.crispal-3d-toast {
	position: absolute; left: 50%; bottom: 112px; transform: translateX(-50%) translateY(6px); z-index: 6;
	background: rgba(17,17,17,.85); color: #fff; font-family: 'Poppins', sans-serif;
	font-size: 12.5px; font-weight: 600; padding: 8px 14px; border-radius: 30px;
	opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; max-width: 86%; text-align: center;
}
.crispal-3d-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Dispositivos de toque: o pinch-to-zoom chega, esconder os botões de zoom */
@media (pointer: coarse) {
	.crispal-3d-ic--zoom { display: none; }
}

/* Barra ainda mais compacta em ecrãs pequenos (pode quebrar de forma arrumada) */
@media (max-width: 520px) {
	.crispal-3d-bar { gap: 4px; padding: 4px; bottom: 12px; flex-wrap: nowrap; }
	.crispal-3d-ic { width: 34px; height: 34px; }
	.crispal-3d-ic svg { width: 18px; height: 18px; }
	.crispal-3d-anim { height: 34px; padding: 0 11px; font-size: 12px; }
	/* ✕ isolado no canto; tira o ✕ (e o seu separador) da barra */
	.crispal-3d-close { display: flex; }
	.crispal-3d-ic--barclose, .crispal-3d-sep--close { display: none; }
}
