/* ============================================================================
   edunet 首页 · 滚屏组件 (hero.css)
   ----------------------------------------------------------------------------
   2026-11-19 修订：取消 100vw 通栏。线上 5 张滚屏原图都是 3:2 横图
   （1200x798 / 1080x720 / 800x533 / 772x510），原「100vw × 固定 460px」
   约 4.2:1，background-size:cover 会把图放大后上下裁掉约 6 成，只剩中间
   一条，看着就是"图片变形"。现默认「限宽 1200px（与 .webroot 对齐）
   + 原图完整居中显示」，零拉伸、零裁切。

   以下均由 config.js 的 hero 段控制，配置后台可视化调整：
     widthMode  content(限宽，默认) | full(通栏满宽，旧效果)
     maxWidth   限宽模式的最大宽度(px)
     height / heightM  桌面 / 手机端高度(px)
     fit        contain(完整不裁切，默认) | cover(铺满但裁切) | auto(高度按图片比例)
     ratio      fit=auto 时的容器宽高比（1.5 = 3:2，与线上原图一致）
   ============================================================================ */

/* 限宽居中：宽度与正文 .webroot 一致，不再撑满视口 */
.ed-hero-full {
  position: relative;
  width: 100%;
  max-width: var(--ed-hero-maxw, 1200px);
  margin: 20px auto 14px;
  height: var(--ed-hero-h, 460px);
  overflow: hidden;
  background: #0b1e3a;
  box-sizing: border-box;
  border-radius: 6px;
}

/* 通栏模式：仅后台选 widthMode=full 时启用（需要时可一键切回旧效果） */
.ed-hero-full.ed-hero-is-full {
  max-width: none;
  width: 100vw;
  left: 50%;
  margin-left: -50vw;
  margin-top: 0;
  border-radius: 0;
}

/* 高度按图片比例自适应：比例吻合时 cover 也几乎不裁切 */
.ed-hero-full.ed-hero-fit-auto {
  height: auto;
  aspect-ratio: var(--ed-hero-ratio, 1.5);
}

.ed-hero-stage { position: absolute; inset: 0; }

.ed-hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .7s ease;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  cursor: pointer;
}
.ed-hero-slide.is-active { opacity: 1; z-index: 2; }

/* contain 模式：同一张图放大模糊做底，避免两侧出现死黑边 */
.ed-hero-fit-contain .ed-hero-slide::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--ed-hero-bg);
  background-size: cover;
  background-position: center;
  filter: blur(24px) brightness(.58);
  transform: scale(1.12);
  z-index: 0;
}

/* 主图：object-fit:contain 保证原始比例完整显示，绝不拉伸、绝不裁切 */
.ed-hero-pic {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  z-index: 1;
}
/* cover / auto 模式不需要主图，直接由 slide 的背景图铺满 */
.ed-hero-fit-cover .ed-hero-pic,
.ed-hero-fit-auto  .ed-hero-pic { display: none; }

/* 底部渐变遮罩 + 字幕 */
.ed-hero-slide::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 45%;
  background: linear-gradient(to top, rgba(4,16,38,.82) 0%, rgba(4,16,38,.35) 55%, transparent 100%);
  pointer-events: none;
  z-index: 2;
}
.ed-hero-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  padding: 0 24px 34px;
  box-sizing: border-box;
  color: #fff;
}
.ed-hero-is-full .ed-hero-caption {
  padding: 0 max(24px, calc((100vw - 1200px) / 2)) 34px;
}
.ed-hero-caption h2 {
  margin: 0;
  font-size: clamp(18px, 2vw, 28px);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .5px;
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
  max-width: 78%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 左右箭头 */
.ed-hero-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 46px; height: 46px;
  border: 0;
  border-radius: 50%;
  background: rgba(8,22,48,.38);
  color: #fff;
  font-size: 26px;
  line-height: 46px;
  text-align: center;
  cursor: pointer;
  transition: background .2s;
  user-select: none;
}
.ed-hero-arrow:hover { background: rgba(8,22,48,.68); }
.ed-hero-prev { left: 16px; }
.ed-hero-next { right: 16px; }
.ed-hero-is-full .ed-hero-prev { left: max(16px, calc((100vw - 1200px) / 2 - 56px)); }
.ed-hero-is-full .ed-hero-next { right: max(16px, calc((100vw - 1200px) / 2 - 56px)); }

/* 分页圆点 */
.ed-hero-dots {
  position: absolute;
  z-index: 5;
  left: 0; right: 0;
  bottom: 12px;
  text-align: center;
}
.ed-hero-dot {
  display: inline-block;
  width: 10px; height: 10px;
  margin: 0 6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.5);
  cursor: pointer;
  transition: background .2s, transform .2s;
}
.ed-hero-dot.is-active { background: #fff; transform: scale(1.3); }

@media (max-width: 820px) {
  .ed-hero-full { height: var(--ed-hero-h-m, 240px); }
  .ed-hero-full.ed-hero-fit-auto { height: auto; aspect-ratio: var(--ed-hero-ratio, 1.5); }
  .ed-hero-caption,
  .ed-hero-is-full .ed-hero-caption { padding: 0 16px 30px; }
  .ed-hero-caption h2 { font-size: 16px; max-width: 92%; white-space: normal;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .ed-hero-arrow { width: 36px; height: 36px; line-height: 36px; font-size: 20px; }
}
