/* =========================================================
   贝福特官网 · 首页专属样式（S5 自 style.css 迁出）
   依赖：先加载 /style.css（设计变量与公共 Hero/导航）
   说明：.home-lead 被新闻/招聘页复用，仍保留在 style.css
   ========================================================= */

/* ---------- 首页轮播层与箭头（仅 index 使用） ---------- */

.hero-slides {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.1s ease;
}

.hero-slide.active {
  opacity: 1;
}

.hero-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slider-arrow {
  position: absolute;
  z-index: 5;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  background: rgba(11, 33, 56, 0.28);
  color: var(--white);
  font-size: 18px;
  transition: background var(--ease), border-color var(--ease);
}

.slider-arrow:hover {
  background: var(--blue);
  border-color: var(--blue);
}

.slider-arrow.prev {
  left: 24px;
}

.slider-arrow.next {
  right: 24px;
}

/* ---------- Home videos ---------- */

.home-videos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 28px 0 48px;
}

.home-video-item {
  min-width: 0;
  overflow: hidden;
  background: var(--light);
  border: 1px solid var(--line);
}

.home-video-player {
  position: relative;
  background: var(--navy);
}

.home-video-item video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: var(--navy);
  cursor: pointer;
}

/* 企业宣传视频封面叠字：整幅画面水平垂直居中 */
.home-video-cover-caption {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 20px;
  box-sizing: border-box;
  text-align: center;
  pointer-events: none;
  background: transparent;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.home-video-player.is-playing .home-video-cover-caption {
  opacity: 0;
  visibility: hidden;
}

.home-video-cover-caption p,
.home-video-cover-line1,
.home-video-cover-line2,
.home-video-cover-line3 {
  margin: 0;
  color: #fff !important;
  -webkit-text-fill-color: #fff;
  opacity: 1;
  text-shadow: none;
}

.home-video-cover-line1 {
  font-size: clamp(15px, 2vw, 20px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.35;
}

.home-video-cover-line2 {
  font-size: clamp(11px, 1.4vw, 14px);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.home-video-cover-line3 {
  margin-top: 2px;
  font-size: clamp(12px, 1.5vw, 15px);
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.4;
}

/* 暂停/未播放：画面中央半透明播放图标 */
.home-video-play-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: 64px;
  height: 64px;
  margin: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
  transform: translate(-50%, -50%);
  /* 可点：与捕获阶段播放逻辑配合，避免点透到 video 再被 controls 二次切换 */
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.home-video-play-btn::after {
  content: "";
  position: absolute;
  left: 52%;
  top: 50%;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 10px 0 10px 16px;
  border-color: transparent transparent transparent #ffffff;
  transform: translate(-30%, -50%);
}

.home-video-player.is-playing .home-video-play-btn {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.home-video-info {
  padding: 18px 22px;
}

.home-video-info h3 {
  margin: 0 0 6px;
  font-size: var(--fs-h3);
  font-weight: 600;
  line-height: 1.45;
  color: var(--navy);
}

.home-video-info p {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--muted);
}

/* =========================================================
   首页专属模块（第二阶段）
   ========================================================= */

body[data-page="home"] .home-hero .hero-overlay {
  background: linear-gradient(
    105deg,
    rgba(11, 33, 56, 0.82) 0%,
    rgba(11, 33, 56, 0.45) 48%,
    rgba(11, 33, 56, 0.18) 100%
  );
}

body[data-page="home"] .home-hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--silver);
}

body[data-page="home"] .home-hero .eyebrow #number {
  color: rgba(255, 255, 255, 0.72);
  font-variant-numeric: tabular-nums;
}

body[data-page="home"] .home-hero .hero-inner h1 {
  max-width: 12ch;
}

body[data-page="home"] .home-content {
  max-width: var(--max);
  padding-top: 56px;
  padding-bottom: 72px;
}

.home-block {
  margin: 0 0 72px;
}

.home-block:last-child {
  margin-bottom: 0;
}

.home-cta-row {
  margin: 28px 0 0;
}

/* 能力条目：四张既有插图 + 短文案，去编号卡片感 */

.home-adv-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px 24px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.home-adv-item {
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.home-adv-item:hover .home-adv-copy h3 {
  color: var(--blue);
}

.home-adv-visual {
  display: block;
  overflow: hidden;
  background: var(--light);
  border: 1px solid var(--line-soft);
}

.home-adv-visual img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 391 / 254;
  object-fit: contain;
  object-position: center;
}

.home-adv-copy h3 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--navy);
  transition: color var(--ease);
}

.home-adv-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

/* 企业介绍 */

.home-intro {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 40px;
  align-items: center;
  padding: 36px 0;
}

.home-intro-copy .kicker {
  margin-top: 0;
}

.home-intro-copy h2 {
  margin: 10px 0 18px;
  font-size: var(--fs-h2);
  line-height: 1.3;
}

.home-intro-copy p {
  margin: 0 0 14px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.9;
}

.home-intro-copy .btn {
  margin-top: 16px;
}

.home-intro-media {
  width: 100%;
  max-width: 520px;
  justify-self: end;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--light);
}

/* 源图 1:1；展示 4:3 居中裁切，避免半栏全宽导致过高 */
.home-intro-media img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center center;
}

/* 视频区 */

.home-video-block .home-videos {
  margin: 8px 0 0;
}

/* 核心产品 */

.home-product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.home-product-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  text-align: left;
  color: var(--navy);
  background: var(--white);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color var(--ease);
}

.home-product-card:hover {
  border-color: var(--silver);
}

.home-product-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  background: var(--light);
  overflow: hidden;
}

.home-product-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transition: transform 0.35s ease;
}

.home-product-card:hover .home-product-photo img {
  transform: scale(1.03);
}

.home-product-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  padding: 18px 18px 20px;
  background: var(--white);
  border-top: 1px solid var(--line);
}

.home-product-body h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.home-product-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.home-product-body span {
  margin-top: auto;
  padding-top: 12px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
}

/* 应用场景 */

.home-scene-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.home-scene-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  transition: border-color var(--ease);
}

.home-scene-card:hover {
  border-color: var(--silver);
}

/* 源图 1:1；展示 4:3 居中裁切，模块内尺寸统一 */
.home-scene-card img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center center;
}

.home-scene-body {
  padding: 16px 18px 20px;
}

.home-scene-body h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
}

.home-scene-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

/* 企业实力 */

.home-strength-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.home-strength-card {
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
}

/* 源图 1:1；由 16:10 改为 4:3，减少对建筑/设备的过度裁切，模块内统一 */
.home-strength-card img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center center;
}

.home-strength-card div {
  padding: 20px 20px 24px;
}

.home-strength-card h3 {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 600;
  color: var(--navy);
}

.home-strength-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

@media (max-width: 900px) {
  .home-adv-grid,
  .home-product-grid,
  .home-scene-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-intro {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 12px 0;
  }

  .home-intro-media {
    max-width: 100%;
    justify-self: stretch;
  }

  .home-strength-grid {
    grid-template-columns: 1fr;
  }

  .home-block {
    margin-bottom: 56px;
  }
}

/* 首页轮播：窄屏图文分区，图区固定 12:5（对应 1920×800），完整显示不裁切 */
@media (max-width: 900px) {
  body[data-page="home"] .home-hero {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    align-items: stretch;
    max-width: 100%;
    overflow-x: hidden;
  }

  body[data-page="home"] .home-hero .hero-slides {
    position: relative;
    inset: auto;
    order: 1;
    width: 100%;
    aspect-ratio: 12 / 5;
    flex: 0 0 auto;
    background: var(--navy);
  }

  body[data-page="home"] .home-hero .hero-slide {
    position: absolute;
    inset: 0;
  }

  body[data-page="home"] .home-hero .hero-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
  }

  body[data-page="home"] .home-hero .hero-overlay {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: auto;
    width: 100%;
    height: auto;
    aspect-ratio: 12 / 5;
    inset: auto;
    z-index: 2;
    pointer-events: none;
  }

  body[data-page="home"] .home-hero .hero-inner {
    position: relative;
    order: 2;
    z-index: 3;
    width: 100%;
    max-width: none;
    height: auto;
    margin: 0;
    padding: 28px 5% 36px;
    box-sizing: border-box;
    background: var(--navy);
  }

  body[data-page="home"] .home-hero .hero-inner h1 {
    max-width: none;
  }

  body[data-page="home"] .home-hero .slider-arrow {
    /* 箭头垂直居中于 12:5 图区（相对视口宽度估算） */
    top: calc(100vw * 5 / 12 / 2);
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    font-size: 15px;
    z-index: 6;
  }

  body[data-page="home"] .home-hero .slider-arrow.prev {
    left: 10px;
  }

  body[data-page="home"] .home-hero .slider-arrow.next {
    right: 10px;
  }

  body[data-page="home"] .home-hero .dots {
    position: absolute;
    left: 50%;
    top: calc(100vw * 5 / 12 - 18px);
    bottom: auto;
    transform: translateX(-50%);
    z-index: 6;
  }
}

@media (max-width: 768px) {
  .slider-arrow {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }

  .slider-arrow.prev {
    left: 10px;
  }

  .slider-arrow.next {
    right: 10px;
  }

  .home-videos {
    grid-template-columns: 1fr;
    gap: 16px;
    margin: 20px 0 32px;
  }

  .home-video-info {
    padding: 14px 16px;
  }

  .home-video-info h3 {
    font-size: 18px;
  }

  .home-video-info p {
    font-size: 14px;
  }
}

@media (max-width: 520px) {
  body[data-page="home"] .home-hero .hero-inner h1 {
    max-width: none;
    font-size: 24px;
  }

  body[data-page="home"] .home-hero .slider-arrow {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  body[data-page="home"] .home-hero .dots {
    top: calc(100vw * 5 / 12 - 14px);
  }

  body[data-page="home"] .home-content {
    padding-top: 36px;
    padding-bottom: 48px;
  }

  .home-adv-grid,
  .home-product-grid,
  .home-scene-grid {
    grid-template-columns: 1fr;
  }

  .home-adv-grid {
    gap: 28px 0;
    border-top: 0;
    padding-top: 0;
  }

  .home-adv-item {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
  }

  .home-adv-visual {
    border: 0;
    background: transparent;
  }

  .home-product-body,
  .home-scene-body,
  .home-strength-card div {
    padding-left: 16px;
    padding-right: 16px;
  }

  .home-block {
    margin-bottom: 44px;
  }
}
