/* =============================================================
 * elements.css —— 必要元素页专属样式
 * 数据来源：Figma 设计稿 node 471:1832 (Slide 16:9 - 15)
 * 说明：
 *   1. body 背景灰色 #D9D9D9（与族谱功能页一致）。
 *   2. 3 个必要元素模块各自带背景图 + 内容层叠层。
 *   3. 每个模块采用不同入场动效（基于 animate.css + wow.js）。
 * ============================================================= */

/* ---------- 1. 整页容器 ---------- */
.page-elements {
  width: 100%;
  background: #D9D9D9;            /* 整体灰色背景 */
  position: relative;
  padding-bottom: 25px;           /* 底部与 footer 间距 */
}

/* =============================================================
 * 区块一：Banner（与族谱功能页相同，无搜索框）
 * Figma 469:283 1920x960 height: 0~960px
 * ============================================================= */
.elements-banner {
  position: relative;
  width: 100%;
  height: 550px;
  background: url('../image/banner-bg.png') center/cover no-repeat;
  overflow: hidden;
}

/* 9 个 SVG 文字图（与族谱功能页一致） */
.elements-banner .banner-words {
  position: absolute;
  left: 50%;
  top: 150px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 80px;                       /* 组间距 */
}
.elements-banner .word-group {
  display: flex;
  align-items: center;
  gap: 10px;                       /* 组内字间距 */
}
.elements-banner .word-item {
  height: 150px;
  max-width: 150px;
  width: auto;
  display: block;
}

/* Banner 下方副标题 */
.elements-banner .banner-subtitle {
  position: absolute;
  left: 50%;
  top: 60%;
  transform: translateX(-50%);
  color: #000;
  text-align: center;
  font-family: "Noto Serif SC";
  font-size: 32px;
  font-style: normal;
  font-weight: 700;
  line-height: 72px;
  letter-spacing: 16px;
  margin: 0;
  white-space: nowrap;
}

/* =============================================================
 * 3 个必要元素区块通用样式
 * 共同的：相对定位、宽 100%、背景图铺满（cover）、25px 间距
 * 独有的：aspect-ratio 用作高度（来自 Figma 原图比例）
 * ============================================================= */
.elements-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 25px;                       /* 25px 间距，露出灰色 body 背景 */
  margin: 0;
  padding: 0;
  list-style: none;
}

.element {
  position: relative;
  width: 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  overflow: hidden;
}

/* ---- 内容通用样式 ---- */

/* 标题：必要元素① + 家族祖训（与功能页同款）
 * Figma 469:180 / 469:197 / 469:211：编号 36px 红 #B81C22，名称 48px 黑色 Noto Serif SC Black
 */
.element-title {
  position: absolute;
  left: 20%;
  transform: translateX(-50%);
  top: 181px;
  font-family: var(--font-serif);
  font-weight: 700;
  white-space: nowrap;
  text-align: center;
  z-index: 3;
}
.element-title .num {
  color: var(--color-accent);
  font-size: 36px;
  font-weight: 700;
  margin-right: 20px;
}
.element-title .name {
  color: #000;
  font-family: "Noto Serif SC";
  font-weight: 900;                /* Black */
  font-size: 48px;
  font-style: normal;
  line-height: normal;
    letter-spacing: 3px;
}

/* 诗句：Noto Serif SC Bold 32px black, leading 63px, 居中 */
.element-poem {
  position: absolute;
  left: 20.4%;
  transform: translateX(-50%);
  top: 392px;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 32px;
  color: #000;
  text-align: center;
  line-height: 63px;
  white-space: nowrap;
  z-index: 3;
}
.element-poem p { margin: 0; }

/* 内容图（在背景之上叠加） */
.element-content {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  display: block;
}

/* 右上角播放按钮（SVG，83x83，Figma 478:33 / 478:37 / 478:40） */
.element-play {
  position: absolute;
  right: 19.9%;                    /* (1920-1538-83)/1920 = 15.6% + 83/1920 = 19.9% */
  top: 180px;
  width: 60px;
  height: 60px;
  z-index: 3;
  cursor: pointer;
  transition: transform .3s ease;
}
.element-play:hover {
  transform: scale(1.1);
}

/* =============================================================
 * 必要元素 ① — 家族祖训
 * Figma 469:184/185 1920x1290 (top 985)
 * 标题 top 1166 → 相对 181px
 * 诗句 top 1377 → 相对 392px
 * 内容图（img12 1读-祖训2）覆盖整块：1920x1290 top 985
 * ============================================================= */
.element-1 {
  aspect-ratio: 1920 / 1050;
  background-image: url('../image/elem1-bg.png');
    background-size: 100% 100%;
}
.element-1 .element-content {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* =============================================================
 * 必要元素 ② — 姓氏起源
 * Figma 469:191/192 1920x1343 (top 2300)
 * 标题 top 2474 → 相对 174px
 * 诗句 top 2690 → 相对 390px
 * 内容图 1920x651 top 2992 → 相对 692px
 * ============================================================= */
.element-2 {
  aspect-ratio: 1920 / 1050;
  background-image: url('../image/elem2-bg.png');
    background-size: 100% 100%;
}
.element-2 .element-title { top: 174px; }
.element-2 .element-poem { top: 390px; }
.element-2 .element-content {
  left: 0;
  bottom: 0;
  width: 100%;
  height: 48.5%;                   /* 651/1343 */
  object-fit: cover;
}

/* =============================================================
 * 必要元素 ③ — 世代映像
 * Figma 469:209/210 1920x1358 (top 3668)
 * 标题 top 3834 → 相对 166px
 * 诗句 top 4045 → 相对 377px
 * 内容图覆盖整块：1920x1357 top 3669
 * ============================================================= */
.element-3 {
  aspect-ratio: 1920 / 1050;
  background-image: url('../image/elem3-bg.png');
    background-size: 100% 100%;
}
.element-3 .element-title { top: 166px; }
.element-3 .element-poem { top: 377px; }
.element-3 .element-content {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* =============================================================
 * 入场动效（每个模块差异化）
 * 由 animate.css 提供关键类，wow.js 触发
 * ============================================================= */
.wow { visibility: hidden; }

/* ----- 视频弹窗（全屏遮罩）----- */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}
.video-modal.is-open {
  display: flex;
}
.video-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
}
.video-modal-inner {
  position: relative;
  width: 90%;
  max-width: 960px;
  z-index: 1;
  animation: modalFadeIn .35s ease;
}
@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
.video-modal-close {
  position: absolute;
  top: -44px;
  right: 0;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  color: #fff;
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
  transition: opacity .2s;
}
.video-modal-close:hover { opacity: 0.7; }
.video-modal-player {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  background: #000;
}

/* =============================================================
 * 响应式 —— 平板（≤ 1200px）
 * ============================================================= */
@media (max-width: 1200px) {
  .elements-banner { height: 520px; }
  .elements-banner .banner-words { top: 200px; gap: 40px; }
  .elements-banner .word-item { height: 90px; }
  .elements-banner .banner-subtitle { font-size: 22px; line-height: 48px; letter-spacing: 10px; }

  .element-title .num { font-size: 28px; }
  .element-title .name { font-size: 36px; }
  .element-poem { font-size: 22px; line-height: 44px; }
  .element-play { width: 60px; height: 60px; right: 5%; top: 30px; }
}

/* =============================================================
 * 响应式 —— 手机（≤ 768px）
 * 关键改造：取消 aspect-ratio 与绝对定位，改为纵向流式布局。
 *           内容图原先覆盖整块（object-fit:cover），窄屏改为静态、
 *           居中、限高展示，文字置于其上方的留白区。
 * ============================================================= */
@media (max-width: 768px) {
  .page-elements main { overflow-x: hidden; }

  .elements-banner { height: 300px; }
  .elements-banner .banner-words { top: 70px; gap: 14px; }
  .elements-banner .word-group { gap: 4px; }
  .elements-banner .word-item { height: 42px; max-width: 50px; }
  .elements-banner .banner-subtitle {
    font-size: 13px;
    line-height: 24px;
    letter-spacing: 4px;
    top: auto;
    bottom: 28px;
    white-space: normal;
    width: 90%;
  }

  /* 元素区块：取消固定宽高比，按内容撑高 */
  .element {
    aspect-ratio: auto !important;
    min-height: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    padding: 32px 16px 36px;
    background-size: cover !important;
    background-position: center top;
  }

  /* 标题：静态、居中、可换行 */
  .element-title {
    position: static !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    text-align: center;
    white-space: normal;
  }
  .element-title .num {
    display: block;
    font-size: 15px;
    margin-right: 0;
    margin-bottom: 6px;
  }
  .element-title .name {
    font-size: 24px;
    letter-spacing: 2px;
  }

  /* 诗句：静态、居中、可换行 */
  .element-poem {
    position: static !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    font-size: 16px;
    line-height: 30px;
    white-space: normal;
    text-align: center;
  }
  .element-poem p { line-height: 30px; }

  /* 内容图：原覆盖整块 → 静态、居中、限高 */
  .element-content {
    position: static !important;
    inset: auto !important;
    left: auto !important;
    top: auto !important;
    bottom: auto !important;
    width: auto !important;
    height: auto !important;
    max-width: 92%;
    max-height: 320px;
    margin: 0 auto;
    display: block;
    object-fit: contain !important;
    pointer-events: auto;
  }

  /* 播放按钮：移至右上角小尺寸 */
  .element-play {
    width: 36px;
    height: 36px;
    right: 12px;
    top: 12px;
  }

  .video-modal-inner { width: 95%; }
  .video-modal-close { top: -36px; font-size: 28px; }
}

/* =============================================================
 * 响应式 —— 小手机（≤ 480px）
 * ============================================================= */
@media (max-width: 480px) {
  .elements-banner { height: 260px; }
  .elements-banner .banner-words { top: 60px; gap: 10px; }
  .elements-banner .word-item { height: 34px; max-width: 42px; }
  .elements-banner .banner-subtitle {
    font-size: 12px;
    letter-spacing: 3px;
    bottom: 22px;
  }

  .element {
    min-height: 340px;
    padding: 26px 14px 30px;
    gap: 12px;
  }
  .element-title .name { font-size: 21px; }
  .element-poem { font-size: 15px; line-height: 28px; }
  .element-poem p { line-height: 28px; }
  .element-content { max-width: 94%; max-height: 280px; }
  .element-play { width: 32px; height: 32px; right: 10px; top: 10px; }
}