/* =============================================================
   Related Products Widget
   ============================================================= */

.rpw-wrapper {
	width: 100%;
	box-sizing: border-box;
}

/* ── 区块标题 ──────────────────────────────────────── */
.rpw-section-title {
	margin: 0 0 28px;
	font-size: 22px;
	font-weight: 500;
	line-height: 1.3;
	color: #1d1d1f;
	letter-spacing: 0.2px;
}

/* ── 网格 ─────────────────────────────────────────── */
.rpw-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 24px;
}

/* ── 产品卡 ───────────────────────────────────────── */
.rpw-card {
	display: block;
	text-decoration: none !important;
	color: inherit;
	transition: opacity 0.2s ease;
}

.rpw-card:hover,
.rpw-card:focus,
.rpw-card:visited {
	color: inherit;
	text-decoration: none !important;
}

/* ── 图片容器（双图叠加，悬停切换）────────────────── */
.rpw-image {
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	background-color: #f5f5f5;
	overflow: hidden;
	margin-bottom: 14px;
}

.rpw-image .rpw-img {
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	width: 100% !important;
	height: 100% !important;
	max-width: 100%;
	margin: 0;
	padding: 0;
	object-fit: cover;
	display: block;
	transition: opacity 0.45s ease, transform 0.6s ease;
	will-change: opacity;
}

.rpw-image .rpw-img-main {
	z-index: 1;
	opacity: 1;
}

.rpw-image .rpw-img-hover {
	z-index: 2;
	opacity: 0;
}

/* hover 切换 —— 用 !important 防止主题/WooCommerce 全局 img 样式覆盖 */
.rpw-card:hover .rpw-img-main,
.rpw-card:focus-visible .rpw-img-main {
	opacity: 0 !important;
}

.rpw-card:hover .rpw-img-hover,
.rpw-card:focus-visible .rpw-img-hover {
	opacity: 1 !important;
}

/* 没有 hover 图时给主图一点缩放反馈 */
.rpw-card:not(.rpw-has-hover):hover .rpw-img-main {
	transform: scale(1.04);
}

/* ── 标题 ────────────────────────────────────────── */
.rpw-title {
	margin: 0 0 6px;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.45;
	color: #1d1d1f;
	letter-spacing: 0.1px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	line-clamp: 2;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ── 价格 ────────────────────────────────────────── */
.rpw-price {
	font-size: 13px;
	color: #1d1d1f;
	display: flex;
	align-items: baseline;
	gap: 4px;
	flex-wrap: wrap;
}

.rpw-price .woocommerce-Price-amount {
	color: inherit;
	font-weight: 400;
}

.rpw-price del {
	color: #999;
	font-size: 0.9em;
	margin-right: 4px;
}

.rpw-price ins {
	text-decoration: none;
}

.rpw-currency {
	color: inherit;
}

/* ── 响应式 ──────────────────────────────────────── */
@media (max-width: 1024px) {
	.rpw-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 20px;
	}
}

@media (max-width: 768px) {
	.rpw-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 14px;
	}
	.rpw-section-title {
		font-size: 18px;
		margin-bottom: 18px;
	}
	.rpw-image {
		margin-bottom: 10px;
	}
	.rpw-title,
	.rpw-price {
		font-size: 12px;
	}
}
