/* ==========================================================================
   首页原生模块（离线版）：替代原站依赖服务器 / 第三方插件的部分
   - .xh-banner  原 unslider 全宽大图（内容等比完整显示）
   - .xh-newsslide 原 jslider 资讯轮播
   - .xh-media   原 media 模块（加载后显示图片）
   ========================================================================== */

/* 背景层（原站用脚本设置高度）在离线版中被 site.css 隐藏 */
#scroll_container_bg { width: 100%; }

/* 宽屏时画布居中，全宽大图按视口向两侧延伸 */
body[data-page] #canvas { margin-left: auto; margin-right: auto; }

/* 画布内夹在图层之间的 <script> 节点不参与绝对定位 */
#canvas > script { display: none !important; }

/* 入场动画已由 effects.js 原生复刻；这里只保证图层始终占位可见（显隐交给脚本） */
#canvas .cstlayer[type='media'], #canvas .cstlayer[type='title'] { opacity: 1 !important; }
#canvas .cstlayer[type='media'] { display: block !important; }
/* 动画元素：初始隐藏用 visibility，避免与上面的 display 规则冲突 */
.xh-fx { backface-visibility: hidden; }

/* ---------- 图片模块：原插件 load 事件失败时不显示，这里做兜底 ---------- */
#canvas .wp-media_content img.paragraph_image { display: block !important; }
#canvas .wp-media_content .imgloading { display: none; }

/* ---------- 全宽大图（替代 unslider） ---------- */
/* 注意：这里的覆写放在 .xh-banner--hero 上，避免与 .xh-banner 自身的 width:100% 互相覆盖 */
.xh-banner--hero {
  display: block;
}
.xh-banner {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  /* 原站 unslider 的图层是用脚本把 content 层横向拉满整屏，这里同样处理 */
  --edge: max(0px, (100vw - 1200px) / 2);
  left: calc(-1 * var(--edge)) !important;
  width: calc(1200px + 2 * var(--edge)) !important;
}
/* 原站 easing="slide"：新图从 ±整幅宽滑入、旧图同时反向滑出（1000ms easeOutQuad）。
   JS 直接动画 left，因此 slide 必须只定位 top/left，不能用 inset。 */
.xh-banner__track { position: relative; width: 100%; height: 100%; overflow: hidden; }
.xh-banner__slide {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: block;
  visibility: hidden;
  pointer-events: none;
  background: #000;
  will-change: left;
}
.xh-banner__slide.is-active { visibility: visible; pointer-events: auto; }
/* 轮播图片带链接时，链接层同样要撑满整幅，否则 img 的 100% 高会退化成按宽度自适应 */
.xh-banner__slide > a {
  position: absolute;
  top: 0; left: 0;
  display: block;
  width: 100%; height: 100%;
}
/* 原站 unslider 把图片按整幅宽铺满（content 层 1736px > 1200px 画布），
   视口内看到的是居中裁切后的画面；用 cover 复刻，消除 contain 的上下留白 */
.xh-banner__slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.xh-banner__dot {
  position: absolute;
  left: 0; right: 0;
  bottom: 22px;
  display: flex;
  justify-content: center;
  gap: 10px;
  z-index: 3;
}
.xh-banner__dot button {
  width: 9px; height: 9px;
  padding: 0;
  border: 1px solid #fff;
  background: transparent;
  border-radius: 999px;
  cursor: pointer;
  opacity: .55;
  transition: all .3s ease;
}
.xh-banner__dot button.is-active { width: 26px; background: #fff; opacity: 1; }
.xh-banner__arrow {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 44px; height: 44px;
  margin-top: -22px;
  border: 1px solid rgba(255, 255, 255, .4);
  background: rgba(0, 0, 0, .3);
  cursor: pointer;
  opacity: 0;
  transition: opacity .3s ease, background .3s ease;
}
.xh-banner:hover .xh-banner__arrow { opacity: 1; }
.xh-banner__arrow:hover { background: var(--xh-red); border-color: var(--xh-red); }
.xh-banner__arrow::before {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 8px; height: 8px;
  border-top: 1px solid #fff;
  border-left: 1px solid #fff;
}
.xh-banner__arrow--prev { left: 26px; }
.xh-banner__arrow--prev::before { transform: translate(-30%, -50%) rotate(-45deg); }
.xh-banner__arrow--next { right: 26px; }
.xh-banner__arrow--next::before { transform: translate(-70%, -50%) rotate(135deg); }

/* ---------- 资讯轮播（替代 jslider） ---------- */
.xh-newsslide { position: relative; width: 1200px; height: 100%; background: #fff; overflow: hidden; }
.xh-newsslide__main {
  position: absolute;
  inset: 0 300px 0 0;
  background: #eef1f4;
  overflow: hidden;
}
.xh-newsslide__main img {
  width: 100%; height: 100%;
  object-fit: cover;
}
/* 主图与首页 unslider 同款横向滑动，由 modules.js 动画 left */
.xh-newsslide__main .xh-newsslide__link {
  position: absolute;
  top: 0; left: 0;
  display: block;
  width: 100%; height: 100%;
  z-index: 2;
  will-change: left;
}
.xh-newsslide__nav {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 22px 20px;
  border-left: 1px solid #e6e6e6;
  background: #fff;
}
.xh-newsslide__item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  background: none;
  transition: border-color .3s ease, background .3s ease;
}
.xh-newsslide__item:hover { background: #f7f7f7; }
.xh-newsslide__item.is-active { border-color: #111; }
.xh-newsslide__item img {
  width: 72px; height: 72px;
  object-fit: cover;
  display: block;
  background: #eef1f4;
}
.xh-newsslide__item b {
  display: block;
  font-weight: 400;
  font-family: var(--xh-serif);
  font-size: 15px;
  line-height: 1.5;
  color: #111;
  margin-bottom: 6px;
}
.xh-newsslide__item span {
  display: block;
  font-size: 12px;
  line-height: 1.6;
  color: #7a7a7a;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.xh-newsslide__item.is-active b { color: var(--xh-red); }

@media (max-width: 900px) {
  .xh-newsslide { background: #fff; }
}