/* 首页产品板块：白色背景、深蓝标题，与 Banner 和统计栏样式隔离。 */
.home-products {
	--products-heading: #12234a;
	--products-accent: var(--compt-color-accent);
	--products-text: #617184;
	position: relative;
	overflow: hidden;
	padding: clamp(48px, 6vw, 88px) 0;
	background: #fff;
	color: var(--products-text);
	font-family: inherit;
	line-height: 1.7;
}

/* 与「关于我们」一致的大字水印。 */
.home-products::before {
	content: 'PRODUCTS';
	position: absolute;
	top: clamp(8px, 1vw, 18px);
	left: clamp(8px, 2vw, 32px);
	z-index: 0;
	font-size: clamp(72px, 13vw, 200px);
	font-weight: 800;
	line-height: 1;
	letter-spacing: 0.01em;
	color: rgba(18, 35, 74, 0.045);
	pointer-events: none;
	user-select: none;
}

.home-products__inner {
	position: relative;
	z-index: 1;
	width: var(--compt-content-width);
	max-width: none;
	margin-inline: auto;
}

/* 左侧文案，右侧两个按钮并排并与文案底部对齐。 */
.home-products__header {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 32px;
	margin-bottom: 32px;
}

.home-products__copy {
	flex: 1;
	min-width: 0;
	max-width: 760px;
	text-align: left;
}

.home-products__subtitle {
	margin: 0 0 10px;
	color: var(--compt-color-accent);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.4;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

.home-products__title {
	margin: 0 0 16px;
	color: var(--products-heading);
	font-family: inherit;
	font-size: var(--compt-fs-section-title);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0;
	overflow-wrap: anywhere;
}

.home-products__description {
	margin: 0;
	color: var(--products-text);
	font-size: var(--compt-fs-lg);
	line-height: 1.9;
	overflow-wrap: anywhere;
}

.home-products__actions {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	gap: 12px;
}

.home-products__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 12px 24px;
	border: 1px solid var(--products-heading);
	border-radius: 4px;
	font-size: var(--compt-fs-base);
	font-weight: 600;
	line-height: 1.5;
	text-align: center;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 160ms ease, color 160ms ease;
}

.home-products__button--primary {
	background: var(--products-heading);
	color: #fff;
}

.home-products__button--primary:hover {
	background: #0e2b49;
	color: #fff;
}

.home-products__button--outline {
	background: transparent;
	color: var(--products-heading);
}

.home-products__button--outline:hover {
	background: #edf3f8;
	color: var(--products-heading);
}

/* 分类高亮只改变颜色和下划线，避免边框出现时改变布局。 */
.home-products__categories {
	display: flex;
	flex-wrap: wrap;
	gap: 0 28px;
	/* margin-bottom: 32px; */
	border-bottom: 1px solid #e2e8ee;
}

.home-products__category {
	margin: 0;
	padding: 14px 4px;
	border: 0;
	border-bottom: 3px solid transparent;
	background: transparent;
	color: var(--products-text);
	font-family: inherit;
	font-size: var(--compt-fs-base);
	font-weight: 600;
	line-height: 1.5;
	cursor: pointer;
	transition: color 160ms ease, border-bottom-color 160ms ease;
}

.home-products__category:hover,
.home-products__category--active {
	border-bottom-color: var(--products-accent);
	color: var(--products-heading);
}

/* 面板切换：淡入淡出 + 轻微位移，容器高度同步过渡 */
.home-products__panels {
	position: relative;
	transition: height 320ms ease;
}

.home-products__panel {
	transition: opacity 320ms ease, transform 320ms ease;
}

.home-products__panel.is-entering {
	opacity: 0;
	transform: translateY(10px);
}

.home-products__panel.is-leaving {
	position: absolute;
	inset: 0;
	z-index: 1;
	overflow: hidden;
	opacity: 0;
	transform: translateY(8px);
	pointer-events: none;
}

/* 默认 8 个产品自然形成四列两行；每个分类面板独立从 01 编号。 */
.home-products__grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 32px 24px;
	margin: 0;
	padding: 0;
	list-style: none;
	counter-reset: product-number;
}

.home-products__item {
	min-width: 0;
	margin: 0;
	padding: 0;
	counter-increment: product-number;
}

.home-products .product-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	height: 100%;
}

.home-products .product-card__media {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: 1 / 1;
	border-radius: 8px;
	background: #f3f5f7;
	text-decoration: none;
}

.home-products .product-card__media::before {
	content: counter(product-number, decimal-leading-zero);
	position: absolute;
	z-index: 1;
	top: 12px;
	left: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 36px;
	padding-inline: 10px;
	border-radius: 4px;
	background: #fff;
	color: var(--products-heading);
	font-size: 18px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	line-height: 1;
	pointer-events: none;
}

.home-products .product-card__image {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	border-radius: inherit;
	object-fit: cover;
}

.home-products .product-card__content {
	display: flex;
	flex: 1;
	flex-direction: column;
	padding-top: 18px;
}

.home-products .product-card__title {
	margin: 0 0 12px;
	color: var(--products-heading);
	font-family: inherit;
	font-size: 19px;
	font-weight: 600;
	line-height: 1.5;
	overflow-wrap: anywhere;
}

.home-products .product-card__title-link {
	color: inherit;
	text-decoration: none;
}

/* 产品所属栏目：以浅蓝标签展示 */
.home-products .product-card__features {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 0 0 14px;
	padding: 0;
	list-style: none;
}

.home-products .product-card__feature {
	max-width: 100%;
	margin: 0;
	padding: 2px 8px;
	overflow: hidden;
	border-radius: 999px;
	background: #eef6fd;
	color: var(--compt-color-accent-deep);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.6;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.home-products .product-card__feature a {
	display: block;
	overflow: hidden;
	color: inherit;
	text-overflow: ellipsis;
	text-decoration: none;
	white-space: nowrap;
}

.home-products .product-card__feature a:hover,
.home-products .product-card__feature a:focus-visible {
	color: var(--compt-color-accent);
}

.home-products .product-card__link {
	display: inline-flex;
	align-self: flex-start;
	align-items: center;
	gap: 8px;
	margin-top: auto;
	padding-top: 8px;
	color: var(--products-heading);
	font-size: var(--compt-fs-sm);
	font-weight: 600;
	text-decoration: none;
}

.home-products .product-card__link::after {
	content: "\2192";
}

.home-products .product-card__title-link:hover,
.home-products .product-card__link:hover {
	color: #b65310;
}

.home-products__empty {
	margin: 0;
	padding: 48px 20px;
	border-radius: 8px;
	background: #f3f5f7;
	color: var(--products-text);
	text-align: center;
}

/* 兼容现有 JS 的 hidden 属性和 is-hidden 类；面板不设置淡入淡出动画。 */
.home-products [hidden],
.home-products .is-hidden {
	display: none !important;
}

.home-products__button:focus-visible,
.home-products__category:focus-visible,
.home-products .product-card__media:focus-visible,
.home-products .product-card__title-link:focus-visible,
.home-products .product-card__link:focus-visible {
	outline: 3px solid var(--products-heading);
	outline-offset: 4px;
}

/* 桌面大屏：8 个产品一行展示 */
@media (min-width: 1200px) {
	.home-products__grid {
		grid-template-columns: repeat(8, minmax(0, 1fr));
		gap: 24px 14px;
	}

	.home-products .product-card__media::before {
		top: 8px;
		left: 8px;
		min-width: 30px;
		height: 26px;
		padding-inline: 6px;
		font-size: 13px;
	}

	.home-products .product-card__content {
		padding-top: 12px;
	}

	.home-products .product-card__title {
		margin-bottom: 8px;
		font-size: 15px;
		line-height: 1.45;
	}

	.home-products .product-card__features {
		margin-bottom: 10px;
	}

	.home-products .product-card__feature {
		padding: 1px 7px;
		font-size: 11px;
	}

	.home-products .product-card__link {
		gap: 4px;
		padding-top: 6px;
		font-size: 13px;
	}
}

/* 平板和手机均保持两列，长产品名可换行，不撑破网格。 */
@media (max-width: 1024px) {
	.home-products__inner {
		width: calc(100% - 24px);
	}

	.home-products__header {
		flex-direction: column;
		align-items: flex-start;
		gap: 24px;
	}

	.home-products__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 600px) {
	.home-products {
		padding: 44px 0;
	}

	.home-products__description {
		font-size: var(--compt-fs-base);
		line-height: 1.8;
	}

	.home-products__actions {
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		width: 100%;
		max-width: 360px;
	}

	.home-products__button {
		padding: 10px 16px;
		font-size: var(--compt-fs-sm);
	}

	.home-products__categories {
		gap: 0 16px;
		margin-bottom: 24px;
	}

	.home-products__category {
		padding: 12px 2px;
		font-size: var(--compt-fs-sm);
	}

	.home-products__grid {
		gap: 24px 12px;
	}

	.home-products .product-card__media {
		border-radius: 6px;
	}

	.home-products .product-card__media::before {
		top: 8px;
		left: 8px;
		min-width: 30px;
		height: 28px;
		padding-inline: 6px;
		font-size: var(--compt-fs-sm);
	}

	.home-products .product-card__content {
		padding-top: 14px;
	}

	.home-products .product-card__title {
		font-size: var(--compt-fs-lg);
	}

	.home-products .product-card__feature,
	.home-products .product-card__link {
		font-size: 13px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.home-products__button,
	.home-products__category,
	.home-products__panels,
	.home-products__panel {
		transition: none;
	}
}
