/*
 * 文件: css/home/home-products.css
 * 引用: index.html（首页核心产品模块）
 * 依赖: header.css
 * 区块: .home-products — 单行横向滚动
 */

/* ========== 核心产品区块 ========== */
.home-products {
  --products-manual-duration: 1.1s;
  --home-products-nav-size: 40px;
  --home-products-nav-inset: 0;
  padding: 72px 0 80px;
  background: #f8f9fb;
  overflow-x: clip;
}

/* 滚动区与标题、方案标签同宽：占满 .container 版心内容区 */
.home-products .container {
  width: 100%;
  max-width: var(--kh-shell-max);
  min-width: 0;
  box-sizing: border-box;
}

.home-products__head {
  text-align: center;
  margin-bottom: 40px;
}

.home-products__head h2 {
  font-size: clamp(26px, 3.2vw, 36px);
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 12px;
  line-height: 1.25;
}

.home-products__head p {
  font-size: 16px;
  color: #666;
  margin: 0;
  line-height: 1.6;
}

.home-products__head .head-line {
  display: block;
  width: 48px;
  height: 3px;
  background: #fc6b00;
  margin: 16px auto 0;
  border-radius: 2px;
}

/* ========== 横向滚动容器 ========== */
.home-products__slider {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.home-products__track {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 8px 0 12px;
  outline: none;
  box-sizing: border-box;
}

.home-products__track:focus-visible {
  box-shadow: 0 0 0 2px rgba(29, 81, 152, 0.25);
  border-radius: 8px;
}

/* GPU 滚动层：两份产品列表首尾相接，循环时无感衔接 */
.home-products__strip {
  --home-products-card-gap: 24px;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: var(--home-products-card-gap);
  width: max-content;
  will-change: transform;
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
}

.home-products__grid--clone {
  flex-shrink: 0;
}

.home-products__strip.is-smooth-move {
  transition: transform var(--products-manual-duration) cubic-bezier(0.22, 1, 0.36, 1);
}

.home-products__grid {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: var(--home-products-card-gap, 24px);
  flex-shrink: 0;
}

/* ========== 产品卡片 ========== */
.home-product-card {
  position: relative;
  flex: 0 0 300px;
  width: 300px;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    box-shadow 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(28px);
}

.home-product-card.is-visible,
.home-product-card.is-revealed {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.home-product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(29, 81, 152, 0.14);
}

.home-product-card.is-visible:hover,
.home-product-card.is-revealed:hover {
  transform: translateY(-6px);
}

/* 入场完成后悬停，避免与 translateY(0) 冲突 */
.home-products__strip .home-product-card.is-visible,
.home-products__strip .home-product-card.is-revealed {
  transform: translate3d(0, 0, 0);
}

.home-products__strip .home-product-card.is-visible:hover,
.home-products__strip .home-product-card.is-revealed:hover {
  transform: translate3d(0, -6px, 0);
}

.home-product-card__media {
  position: relative;
  overflow: hidden;
  background: #eef2f7;
  aspect-ratio: 4 / 3;
}

.home-product-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.home-product-card:hover .home-product-card__media img {
  transform: scale(1.06);
}

.home-product-card__badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #1d5198;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  line-height: 1;
  letter-spacing: 0.02em;
}

.home-product-card__body {
  padding: 22px 20px 24px;
  display: grid;
  grid-template-columns: 32px 1fr;
  grid-template-rows: auto auto 1fr auto;
  column-gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.home-product-card__icon {
  grid-column: 1;
  grid-row: 1;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(29, 81, 152, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  align-self: center;
  flex-shrink: 0;
  transition: background 0.3s ease;
}

.home-product-card:hover .home-product-card__icon {
  background: rgba(29, 81, 152, 0.14);
}

.home-product-card__icon .bx {
  font-size: 22px;
  color: #1d5198;
}

.home-product-card__title {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  min-height: 32px;
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0;
  line-height: 1.4;
  align-self: center;
  min-width: 0;
}

.home-product-card__desc {
  grid-column: 1 / -1;
  grid-row: 2;
  font-size: 13px;
  color: #777;
  line-height: 1.65;
  margin: 8px 0 16px;
}

.home-product-card__tags {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  align-self: start;
}

.home-product-card__tags li {
  font-size: 12px;
  color: #555;
  background: #f1f3f6;
  padding: 4px 10px;
  border-radius: 4px;
  line-height: 1.4;
}

.home-product-card__foot {
  grid-column: 1 / -1;
  grid-row: 4;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  align-self: end;
  margin-top: 0;
  padding-top: 14px;
  border-top: 1px solid #f0f0f0;
}

.home-product-card__link {
  font-size: 13px;
  font-weight: 600;
  color: #1d5198;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s ease, gap 0.25s ease;
}

.home-product-card__link:hover {
  color: #fc6b00;
  gap: 8px;
}

.home-product-card__link .bx {
  font-size: 16px;
  line-height: 1;
}

/* ========== 左右导航 ========== */
.home-products__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: var(--home-products-nav-size);
  height: var(--home-products-nav-size);
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #1d5198;
  box-shadow: 0 4px 16px rgba(29, 81, 152, 0.18);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.home-products__nav::before {
  content: '';
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-top: none;
  border-right: none;
}

.home-products__nav--prev {
  left: var(--home-products-nav-inset);
}

.home-products__nav--prev::before {
  transform: translateX(2px) rotate(45deg);
}

.home-products__nav--next {
  right: var(--home-products-nav-inset);
}

.home-products__nav--next::before {
  transform: translateX(-2px) rotate(-135deg);
}

.home-products__nav:hover {
  background: #1d5198;
  color: #fff;
}

.home-products__nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ========== 通信协议标签（单行铺满 .container 版心，等分宽度） ========== */
.home-products__solution-tags {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.home-products__solution-tags > li {
  margin: 0;
  padding: 0;
  list-style: none;
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
}

.home-products__solution-tags a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 12px;
  font-weight: 500;
  color: #555;
  background: #f1f3f6;
  padding: 8px 6px;
  border-radius: 4px;
  line-height: 1.35;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

@media (min-width: 992px) {
  .home-products__solution-tags {
    gap: 10px;
    overflow-x: visible;
  }

  .home-products__solution-tags a {
    font-size: 13px;
    padding: 8px 10px;
    gap: 7px;
  }
}

@media (min-width: 1200px) {
  .home-products__solution-tags {
    gap: 12px;
  }

  .home-products__solution-tags a {
    padding: 8px 12px;
    gap: 8px;
  }
}

.home-products__solution-tags .home-products__solution-icon {
  font-size: 16px;
  color: #1d5198;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.2s ease;
}

@media (min-width: 1200px) {
  .home-products__solution-tags .home-products__solution-icon {
    font-size: 18px;
  }
}

.home-products__solution-tags .home-products__solution-label {
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-products__solution-tags a:hover {
  color: #1d5198;
  background: #e8eef5;
  border-color: rgba(29, 81, 152, 0.12);
}

.home-products__solution-tags a:hover .home-products__solution-icon {
  color: #fc6b00;
}

.home-products__solution-tags a:focus-visible {
  outline: 2px solid #1d5198;
  outline-offset: 2px;
}

/* ========== 底部 CTA ========== */
.home-products__cta {
  text-align: center;
  margin-top: 24px;
}

.home-products__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #1d5198;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 32px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 4px 14px rgba(29, 81, 152, 0.28);
}

.home-products__btn:hover {
  background: #16407a;
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(29, 81, 152, 0.32);
}

.home-products__btn .bx {
  font-size: 18px;
  line-height: 1;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .home-products {
    padding: 52px 0 60px;
  }

  .home-products__head {
    margin-bottom: 28px;
  }

  .home-products__solution-tags {
    margin-top: 16px;
    gap: 6px;
  }

  .home-products__solution-tags a {
    font-size: 11px;
    padding: 7px 4px;
    gap: 4px;
  }

  .home-products__solution-tags .home-products__solution-icon {
    font-size: 15px;
  }

  .home-products {
    --home-products-nav-size: 34px;
  }

  .home-product-card {
    flex: 0 0 260px;
    width: 260px;
  }
}

@media (max-width: 480px) {
  .home-products {
    --home-products-nav-size: 32px;
    --home-products-nav-inset: 4px;
  }

  .home-product-card {
    flex: 0 0 clamp(240px, calc(100vw - var(--kh-shell-pad-x) * 2 - 16px), 300px);
    width: clamp(240px, calc(100vw - var(--kh-shell-pad-x) * 2 - 16px), 300px);
  }
}

/* ========== 减弱动效 ========== */
@media (prefers-reduced-motion: reduce) {
  .home-product-card {
    opacity: 1;
    transform: none;
    transition: box-shadow 0.2s ease;
  }

  .home-product-card.is-visible,
  .home-product-card.is-revealed {
    transition: none;
  }

  .home-product-card:hover,
  .home-product-card.is-visible:hover,
  .home-product-card.is-revealed:hover {
    transform: none;
  }

  .home-products__strip.is-smooth-move {
    transition: none;
  }

  .home-product-card__media img {
    transition: none;
  }

  .home-product-card:hover .home-product-card__media img {
    transform: none;
  }
}
