/*
 * 6.9 Produtos relacionados. Tokens da marca em common.css.
 * Card A: imagem quadrada sobre o cinza, nome, categoria e preço.
 * Card C: imagem sobre passo de tom, nome na cor da marca, categoria em itálico, preço promocional riscado.
 */

.apw-related {
	--apw-rel-columns: 4;
	--apw-rel-gap: 24px;
	--apw-rel-media-bg: var(--apw-white);

	display: flex;
	flex-direction: column;
	gap: 40px;
	font-family: var(--apw-font-text);
	color: var(--apw-dark);
}

.apw-related .apw-related__title {
	margin: 0;
	font-family: var(--apw-font-heading);
	font-size: var(--apw-size-heading);
	font-weight: var(--apw-heading-weight);
	line-height: 1.25;
	letter-spacing: var(--apw-heading-tracking);
	text-transform: var(--apw-heading-case);
	color: var(--apw-dark);
}

.apw-related__grid {
	display: grid;
	grid-template-columns: repeat(var(--apw-rel-columns), minmax(0, 1fr));
	gap: 40px var(--apw-rel-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.apw-related__card {
	display: flex;
	flex-direction: column;
	gap: 16px;
	margin: 0;
	min-width: 0;
}


/* Imagem */
.apw-related__media {
	position: relative;
	display: block;
	aspect-ratio: 1;
	overflow: hidden;
	background: var(--apw-rel-media-bg);
}

.apw-related .apw-related__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: contain;
	transition: transform 0.8s var(--apw-ease), opacity 0.4s;
}

.apw-related__card:hover .apw-related__img {
	transform: scale(1.04);
}

/* Segunda imagem da galeria ao passar o mouse */
/* Fotos de fundo branco se fundem ao cinza do card, como na galeria. */
.apw-related__media .apw-related__img {
	mix-blend-mode: multiply;
}

.apw-related .apw-related__img--hover {
	opacity: 0;
}

.apw-related__card.has-hover-image:hover .apw-related__img:not(.apw-related__img--hover) {
	opacity: 0;
}

.apw-related__card.has-hover-image:hover .apw-related__img--hover {
	opacity: 1;
}

.apw-related__badge {
	position: absolute;
	top: 12px;
	left: 12px;
	padding: 5px 9px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	color: var(--apw-white);
	background: var(--apw-brand);
}

/* Texto */
.apw-related__body {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.apw-related .apw-related__name {
	margin: 0;
	font-family: var(--apw-font-text);
	font-size: 16px;
	font-weight: 500;
	line-height: 1.35;
	letter-spacing: 0;
	text-transform: none;
}

.apw-related .apw-related__name a {
	color: inherit;
	text-decoration: underline;
	text-decoration-color: transparent;
	text-underline-offset: 4px;
	transition: text-decoration-color 0.3s;
}

.apw-related__card:hover .apw-related__name a,
.apw-related .apw-related__name a:focus-visible {
	text-decoration-color: currentColor;
}

.apw-related .apw-related__cat {
	margin: 0;
	font-size: 14px;
	line-height: 1.4;
	color: var(--apw-muted);
}

.apw-related .apw-related__price {
	margin: 4px 0 0;
	font-size: 16px;
	font-weight: 500;
	color: var(--apw-dark);
}

.apw-related .apw-related__price del {
	margin-right: 6px;
	font-weight: 400;
	color: var(--apw-muted);
	opacity: 1;
}

.apw-related .apw-related__price ins {
	text-decoration: none;
	background: none;
}

/* Card C */
.apw-related--card-c {
	--apw-rel-media-bg: var(--apw-fill);
}

.apw-related--card-c .apw-related__name {
	color: var(--apw-brand);
}

.apw-related--card-c .apw-related__cat {
	font-style: italic;
}

/* Compra rápida: bloco em tinta; vence o ".button" do WooCommerce pela especificidade. */
.apw-related.apw-related .apw-related__add {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	align-self: flex-start;
	min-height: 44px;
	margin: 10px 0 0;
	padding: 0 20px;
	font-family: var(--apw-font-text);
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	color: var(--apw-white);
	background: var(--apw-dark);
	border: 0;
	border-radius: 0;
	transition: background-color 0.2s, transform 0.15s;
}

.apw-related.apw-related .apw-related__add:is(:hover, :focus) {
	color: var(--apw-white);
	background: var(--apw-brand);
}

.apw-related.apw-related .apw-related__add:active {
	transform: scale(0.97);
}

.apw-related.apw-related .apw-related__add.loading {
	opacity: 0.6;
}

.apw-related.apw-related .apw-related__add--link {
	color: var(--apw-dark);
	background: var(--apw-fill);
}

.apw-related .added_to_cart {
	display: inline-block;
	margin-top: 8px;
	font-size: 14px;
	color: var(--apw-dark);
	text-decoration: underline;
	text-underline-offset: 4px;
}

.elementor-editor-active .apw-related__card {
	animation: none;
}

/* Celular: carrossel opcional (o card seguinte aparece cortado de propósito, indicando que desliza). */
@media (max-width: 767px) {
	.apw-related {
		gap: 28px;
	}

	.apw-related--carousel .apw-related__grid {
		display: flex;
		gap: 16px;
		margin-right: -16px;
		padding-right: 16px;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		scrollbar-width: none;
	}

	.apw-related--carousel .apw-related__grid::-webkit-scrollbar {
		display: none;
	}

	.apw-related--carousel .apw-related__card {
		flex: 0 0 72%;
		scroll-snap-align: start;
	}
}

@media (prefers-reduced-motion: reduce) {
	.apw-related__card,
	.apw-related .apw-related__img,
	.apw-related .apw-related__name a {
		animation: none;
		transition: none;
	}
}
