/**
 * Vemax — Galeria do Produto.
 *
 * Everything is scoped under .vemax-product-gallery. The frame rules are
 * intentionally written as ".vemax-product-gallery .vemax-product-image-frame"
 * (never as a bare .vemax-product-image-frame) so they cannot collide with the
 * existing per-widget correction applied to the standalone Image widget in the
 * Single Produto template.
 */

.vemax-product-gallery {
	width: 100%;
}

/* ---------- Main frame (1:1, no fixed height) ---------- */

.vemax-product-gallery .vemax-product-image-frame {
	position: relative; /* anchor for the future "Destaque" badge */
	width: 100%;
	aspect-ratio: 1 / 1;
	background-color: #F7F8FA;
	border-radius: 16px;
	overflow: hidden;
	padding: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
}

/*
 * Elementor ships ".elementor img { height:auto; max-width:100% }" (0-1-1),
 * which outranks a single class. The rule below is scoped through the gallery
 * wrapper (0-2-0) so it wins without !important, and it constrains the image
 * with max-width/max-height instead of forcing 100%/100% — the natural ratio
 * is preserved, nothing is cropped and nothing is stretched.
 */
.vemax-product-gallery .vemax-product-gallery__main-image {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	margin: 0;
}

/* ---------- Thumbnails ---------- */

.vemax-product-gallery__thumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 16px;
}

/*
 * The active theme (Hello Elementor) styles every button with
 * '[type="button"]:hover, [type="button"]:focus { background-color:#c36 }'
 * — a dark pink — and '[type="button"] { color:#c36; transition:all .3s }'.
 * Those selectors score 0-2-0, so the thumb rules are scoped through the
 * gallery wrapper (0-2-0 base / 0-3-0 on state) to outrank them without any
 * !important, and every state repaints the background explicitly.
 */
.vemax-product-gallery .vemax-product-gallery__thumb,
.vemax-product-gallery .vemax-product-gallery__thumb:hover,
.vemax-product-gallery .vemax-product-gallery__thumb:focus,
.vemax-product-gallery .vemax-product-gallery__thumb:focus-visible,
.vemax-product-gallery .vemax-product-gallery__thumb:active {
	background-color: #FFFFFF;
	background-image: none;
	color: inherit;
	-webkit-appearance: none;
	appearance: none;
	box-shadow: none;
}

.vemax-product-gallery .vemax-product-gallery__thumb {
	width: 64px;
	height: 64px;
	padding: 4px;
	margin: 0;
	border: 2px solid #E5E7EB;
	border-radius: 8px;
	overflow: hidden;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.vemax-product-gallery .vemax-product-gallery__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	margin: 0;
	padding: 0;
}

.vemax-product-gallery .vemax-product-gallery__thumb:hover {
	border-color: #1C325A;
}

.vemax-product-gallery .vemax-product-gallery__thumb.is-active {
	border-color: #1C325A;
	box-shadow: 0 2px 8px rgba(15, 30, 56, 0.18);
}

.vemax-product-gallery .vemax-product-gallery__thumb:focus-visible {
	outline: 2px solid #FFD301;
	outline-offset: 3px;
}

/* ---------- Mobile ---------- */

@media (max-width: 767px) {
	.vemax-product-gallery .vemax-product-image-frame {
		padding: 24px;
	}
}

/* =====================================================================
 * SKIN "AXION"
 *
 * Reproduz a galeria de ProductDetail.tsx (linhas 126-151) do projeto
 * original. Só se aplica quando o wrapper tem .vemax-product-gallery--axion,
 * então a skin Vemax acima permanece intacta em qualquer outro site.
 *
 * Equivalências Tailwind do original:
 *   h-80 = 320px · p-8 = 32px · rounded-2xl = 16px · mb-3 = 12px
 *   border-gray-100 = #F3F4F6 · gap-2 = 8px · pb-1 = 4px
 *   w-16 h-16 = 64px · border-2 · rounded-lg = 8px · p-1 = 4px
 *   border-gray-200 = #E5E7EB · border-orange-300 = #FDBA74
 *   border-orange-500 = #F97316 · shadow-md
 * ==================================================================== */

/* ---------- área principal ---------- */

.vemax-product-gallery--axion .vemax-product-image-frame {
	width: 100%;
	height: 320px;
	aspect-ratio: auto; /* anula o 1:1 da skin Vemax */
	background-color: #FFFFFF;
	border: 1px solid #F3F4F6;
	border-radius: 16px;
	padding: 32px;
	margin-bottom: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	box-sizing: border-box;
}

/*
 * Escopo 0-3-0 para vencer ".elementor img" sem !important. max-* em vez de
 * 100% preserva a proporção: nada é recortado, esticado nem deformado, e a
 * altura do bloco nunca muda por causa da imagem.
 */
.vemax-product-gallery--axion .vemax-product-gallery__main-image {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	margin: 0;
}

/* ---------- miniaturas ---------- */

.vemax-product-gallery--axion .vemax-product-gallery__thumbs {
	display: flex;
	flex-wrap: nowrap;      /* linha única, como no original */
	gap: 8px;
	margin-top: 0;          /* o espaçamento vem do margin-bottom do frame */
	overflow-x: auto;
	padding-bottom: 4px;
}

.vemax-product-gallery--axion .vemax-product-gallery__thumb {
	width: 64px;
	height: 64px;
	flex-shrink: 0;
	padding: 4px;
	border: 2px solid #E5E7EB;
	border-radius: 8px;
	transition: border-color 150ms ease, box-shadow 150ms ease;
}

.vemax-product-gallery--axion .vemax-product-gallery__thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.vemax-product-gallery--axion .vemax-product-gallery__thumb:hover {
	border-color: #FDBA74;
}

/* estado ativo vence o hover por vir depois com a mesma especificidade */
.vemax-product-gallery--axion .vemax-product-gallery__thumb.is-active,
.vemax-product-gallery--axion .vemax-product-gallery__thumb.is-active:hover {
	border-color: #F97316;
	/* shadow-md do Tailwind */
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.vemax-product-gallery--axion .vemax-product-gallery__thumb:focus-visible {
	outline: 2px solid #F97316;
	outline-offset: 2px;
}

/*
 * A grade da página empilha em 1023px, mas o widget mantém 320px e as
 * miniaturas horizontais em todos os breakpoints, como no original.
 */
@media (max-width: 767px) {
	.vemax-product-gallery--axion .vemax-product-image-frame {
		height: 320px;
		padding: 32px;
	}
}

/* ---------- Editor-only notice ---------- */

.vemax-product-gallery__notice {
	padding: 12px 14px;
	border: 1px dashed #9CA3AF;
	border-radius: 8px;
	color: #4B5563;
	font-size: 13px;
	font-family: "Open Sans", system-ui, sans-serif;
}
