/**
 * Ușă 3D — stiluri pentru slide-ul din galeria produsului.
 */

.usa3d-slide {
	position: relative;
	background: #f4f2ef;
	overflow: hidden;
}

.usa3d-model {
	display: block;
	width: 100%;
	aspect-ratio: 3 / 4;
	min-height: 320px;
	background-color: transparent;
	--poster-color: transparent;
	--progress-bar-color: #b08d57;
	--progress-mask: transparent;
	cursor: grab;
}

.usa3d-model:active {
	cursor: grabbing;
}

/* Indiciu discret că slide-ul e interactiv. */
.usa3d-badge {
	position: absolute;
	left: 12px;
	bottom: 12px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 11px;
	border-radius: 999px;
	background: rgba(24, 22, 20, .78);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .02em;
	line-height: 1;
	pointer-events: none;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity .35s ease, transform .35s ease;
	backdrop-filter: blur(4px);
}

.usa3d-slide.is-ready .usa3d-badge {
	opacity: 1;
	transform: translateY(0);
}

.usa3d-badge svg {
	flex: none;
}

/* Badge pe miniatura din navigația galeriei. */
.woocommerce-product-gallery .flex-control-thumbs li.usa3d-thumb {
	position: relative;
}

.woocommerce-product-gallery .flex-control-thumbs li.usa3d-thumb::after {
	content: "3D";
	position: absolute;
	right: 4px;
	bottom: 4px;
	padding: 2px 5px;
	border-radius: 3px;
	background: rgba(24, 22, 20, .82);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: .04em;
	pointer-events: none;
}

@media (max-width: 768px) {
	.usa3d-model {
		min-height: 260px;
	}

	.usa3d-badge {
		left: 8px;
		bottom: 8px;
		font-size: 11px;
		padding: 5px 9px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.usa3d-badge {
		transition: none;
	}
}

/* ====================================================================
   Mod modal — independent de structura galeriei
   ==================================================================== */

/* Butonul. Când tema îl scoate prin cârligul ei, moștenește stilurile temei;
   regulile de aici sunt doar o bază decentă, nu forțează nimic. */
.usa3d-btn-wrap {
	display: inline-flex;
}

.usa3d-btn-wrap .usa3d-open {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	cursor: pointer;
	text-decoration: none;
	line-height: 1;
	white-space: nowrap;
}

.usa3d-btn-wrap .usa3d-open svg {
	flex: none;
}

/* Varianta pusă de JS când tema nu are cârlig: plutitoare peste galerie. */
.usa3d-btn-wrap--floating {
	position: absolute;
	left: 14px;
	bottom: 14px;
	z-index: 20;
}

.usa3d-btn-wrap--floating .usa3d-open {
	padding: 9px 15px;
	border-radius: 999px;
	background: rgba(24, 22, 20, .82);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	box-shadow: 0 2px 12px rgba(0, 0, 0, .18);
	backdrop-filter: blur(5px);
	transition: background .2s ease, transform .2s ease;
}

.usa3d-btn-wrap--floating .usa3d-open:hover {
	background: rgba(24, 22, 20, .95);
	transform: translateY(-1px);
	color: #fff;
}

/* --- Fereastra ---------------------------------------------------- */
/* (modelul e mutat aici de JS, în .usa3d-modal__slot) */

.usa3d-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.usa3d-modal.is-open {
	display: flex;
}

.usa3d-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(16, 15, 14, .84);
	backdrop-filter: blur(3px);
	animation: usa3d-fade .22s ease;
}

.usa3d-modal__panel {
	position: relative;
	z-index: 1;
	width: min(560px, 100%);
	height: min(88vh, 860px);
	display: flex;
	flex-direction: column;
	border-radius: 10px;
	background: #f4f2ef;
	overflow: hidden;
	box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
	animation: usa3d-rise .26s cubic-bezier(.2, .7, .3, 1);
}

.usa3d-modal__slot {
	flex: 1;
	display: flex;
	min-height: 0;
}

.usa3d-modal .usa3d-model {
	flex: 1;
	width: 100%;
	height: auto;
	min-height: 0;
	aspect-ratio: auto;
	touch-action: none;
	background-color: transparent;
	--poster-color: transparent;
	--progress-bar-color: #b08d57;
	cursor: grab;
}

.usa3d-modal .usa3d-model:active {
	cursor: grabbing;
}

.usa3d-modal__hint {
	flex: none;
	margin: 0;
	padding: 12px 16px 15px;
	text-align: center;
	font-size: 12px;
	line-height: 1.4;
	color: #6d6862;
	background: #efece8;
}

.usa3d-modal__close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(24, 22, 20, .78);
	color: #fff;
	cursor: pointer;
	transition: background .2s ease;
}

.usa3d-modal__close:hover {
	background: rgba(24, 22, 20, .96);
}

.usa3d-modal__close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* Blocăm scroll-ul paginii cât timp fereastra e deschisă. */
html.usa3d-lock,
html.usa3d-lock body {
	overflow: hidden;
}

@keyframes usa3d-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes usa3d-rise {
	from { opacity: 0; transform: translateY(14px) scale(.985); }
	to   { opacity: 1; transform: none; }
}

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

	.usa3d-modal__panel {
		width: 100%;
		height: 100%;
		border-radius: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.usa3d-modal__backdrop,
	.usa3d-modal__panel {
		animation: none;
	}
}

/* ====================================================================
   Elementul din galerie — modelul viu, la fața locului
   ==================================================================== */

.usa3d-gallery-slide {
	position: relative;
}

.usa3d-gallery-media {
	position: relative;
	display: block;
	width: 100%;
	overflow: hidden;
	background: #f4f2ef;
}

/*
 * Imaginea distanțier: invizibilă, dar ocupă exact spațiul pe care tema îl
 * așteaptă de la un slide de galerie. Fără ea, un slider cu autoHeight ar
 * calcula înălțime zero și slide-ul ar fi turtit.
 */
.usa3d-gallery-media .usa3d-spacer {
	display: block;
	width: 100%;
	height: auto;
	visibility: hidden;
	pointer-events: none;
}

/* Modelul acoperă exact spațiul rezervat de distanțier. */
.usa3d-gallery-media .usa3d-model {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	min-height: 0;
	aspect-ratio: auto;
	background-color: transparent;
	--poster-color: transparent;
	--progress-bar-color: #b08d57;
	touch-action: none;
	cursor: grab;
	z-index: 1;
}

.usa3d-gallery-media .usa3d-model:active {
	cursor: grabbing;
}

/* Buton de mărire, discret, în colț. */
.usa3d-expand {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(24, 22, 20, .55);
	color: #fff;
	cursor: pointer;
	opacity: 0;
	transition: opacity .25s ease, background .2s ease;
	backdrop-filter: blur(4px);
}

.usa3d-gallery-slide:hover .usa3d-expand,
.usa3d-expand:focus-visible {
	opacity: 1;
}

.usa3d-expand:hover {
	background: rgba(24, 22, 20, .85);
}

@media (hover: none) {
	.usa3d-expand {
		opacity: 1;
	}
}

/*
 * Eticheta se estompează după ce utilizatorul începe să rotească — și-a
 * făcut treaba, nu mai trebuie să acopere produsul.
 */
.usa3d-gallery-badge {
	transition: opacity .3s ease;
}

.usa3d-gallery-slide:hover .usa3d-gallery-badge,
.usa3d-gallery-slide:active .usa3d-gallery-badge {
	opacity: 0;
}

.usa3d-gallery-badge {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
	padding: 18px 16px 20px;
	color: #4a443d;
	text-align: center;
	pointer-events: none;
	z-index: 2;
	background: linear-gradient(to top, rgba(244, 242, 239, .95) 45%, rgba(244, 242, 239, 0));
}

.usa3d-gallery-badge svg {
	margin-bottom: 3px;
	opacity: .95;
}

.usa3d-gallery-badge b {
	font-size: 15px;
	font-weight: 700;
	letter-spacing: .02em;
	line-height: 1.2;
}

.usa3d-gallery-badge i {
	font-size: 12px;
	font-style: normal;
	font-weight: 500;
	opacity: .82;
	line-height: 1.2;
}

.usa3d-gallery-slide:focus-visible {
	outline: 2px solid #b08d57;
	outline-offset: -2px;
}

/* Miniatura: un "3D" discret în colț, ca să se distingă de pozele obișnuite. */
.usa3d-gallery-thumb {
	position: relative;
}

.usa3d-gallery-thumb::after {
	content: "3D";
	position: absolute;
	right: 4px;
	bottom: 4px;
	z-index: 2;
	padding: 2px 5px;
	border-radius: 3px;
	background: rgba(20, 19, 18, .84);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: .04em;
	pointer-events: none;
}

@media (max-width: 600px) {
	.usa3d-gallery-badge {
		padding: 14px 12px 15px;
	}

	.usa3d-gallery-badge b {
		font-size: 14px;
	}
}

/* ====================================================================
   Stratul 3D peste lightbox-ul temei
   ==================================================================== */

.usa3d-pswp-layer {
	position: absolute;
	inset: 0;
	z-index: 1500;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 44px 16px 64px;
	pointer-events: none;
}

.usa3d-pswp-layer.is-visible {
	display: flex;
}

.usa3d-pswp-layer .usa3d-model {
	position: static;
	width: min(560px, 100%);
	height: 100%;
	max-height: 100%;
	min-height: 0;
	aspect-ratio: auto;
	background-color: transparent;
	--poster-color: transparent;
	--progress-bar-color: #b08d57;
	pointer-events: auto;
	touch-action: none;
	cursor: grab;
}

.usa3d-pswp-layer .usa3d-model:active {
	cursor: grabbing;
}

/* Ascundem poza statică a lightbox-ului cât timp modelul e deasupra,
   ca să nu se vadă prin transparențe. */
.pswp:has(.usa3d-pswp-layer.is-visible) .pswp__img {
	opacity: 0;
}

/* ====================================================================
   Elementul cu animația de deschidere
   ==================================================================== */

.usa3d-kind-open .usa3d-gallery-media {
	background: #efece8;
}

/*
 * Indiciu discret: o pastilă pe un singur rând, jos, centrată. Varianta cu
 * degrade întunecat pe 40% din înălțime acoperea produsul.
 */
.usa3d-gallery-badge--pill {
	left: 50%;
	right: auto;
	bottom: 16px;
	transform: translateX(-50%);
	flex-direction: row;
	align-items: center;
	gap: 7px;
	width: auto;
	max-width: calc(100% - 32px);
	padding: 8px 14px;
	border-radius: 999px;
	background: rgba(28, 25, 22, .62);
	color: #fff;
	backdrop-filter: blur(6px);
	box-shadow: 0 2px 10px rgba(0, 0, 0, .14);
	opacity: 1;
	transition: opacity .35s ease, transform .35s ease;
}

.usa3d-gallery-badge--pill i {
	font-size: 12.5px;
	font-style: normal;
	font-weight: 600;
	opacity: 1;
	white-space: nowrap;
}

.usa3d-gallery-badge--pill svg {
	margin: 0;
	flex: none;
}

/* Foaia din pictogramă se leagănă ușor — semnalează că se poate apăsa,
   fără text suplimentar. */
.usa3d-gallery-badge--pill .usa3d-leaf {
	transform-origin: 11px 12px;
	animation: usa3d-swing 2.6s ease-in-out infinite;
}

@keyframes usa3d-swing {
	0%, 55%, 100% { transform: scaleX(1); }
	72%           { transform: scaleX(.42); }
}

/*
 * Pastila rămâne vizibilă: e un comutator care își spune starea, nu un indiciu
 * de unică folosință. Se oprește doar legănarea pictogramei, care după prima
 * apăsare devine zgomot.
 */
.usa3d-hint-used .usa3d-gallery-badge--pill .usa3d-leaf {
	animation: none;
}

/* Ușa deschisă: pictograma rămâne în poziția deschis. */
.is-door-open .usa3d-gallery-badge--pill .usa3d-leaf {
	transform: scaleX(.42);
	transform-origin: 11px 12px;
}

/* Textul se schimbă între „Deschide" și „Închide" — o tranziție scurtă de
   lățime ar sări, deci animăm doar opacitatea. */
.usa3d-gallery-badge--pill i {
	transition: opacity .18s ease;
}

.usa3d-kind-open .usa3d-model {
	cursor: pointer;
	/* Elementul e static, deci pagina trebuie să se poată derula peste el. */
	touch-action: auto;
}

/* Miniatura variantei animate se distinge de cea de rotire. */
.usa3d-thumb-open::after {
	content: "\25B6";
	font-size: 9px;
	letter-spacing: 0;
	padding: 3px 5px;
}

.usa3d-btn-wrap--floating .usa3d-open + .usa3d-open {
	margin-left: 8px;
}

@media (prefers-reduced-motion: reduce) {
	.usa3d-gallery-badge--pill .usa3d-leaf {
		animation: none;
	}
}

/* Cât timp ușa se mișcă, butonul nu răspunde — și se vede că nu răspunde. */
.usa3d-kind-open.is-busy .usa3d-gallery-badge--pill {
	opacity: .55;
}

.usa3d-kind-open.is-busy .usa3d-model {
	cursor: default;
}
