/* ============================================================
   首页 · 产品演示视频面（home-film）
   纯增量样式，不依赖、不覆盖公共 styles.css
   ============================================================ */

/* ── 视频面：整屏居中，继承官网背景与留白 ── */
#film {
  min-height: 100dvh;
  display: flex;
  /* 顶部留白避开悬浮导航（导航高约 74px），底部留白让链接完整可见 */
  padding: clamp(76px, 9vh, 104px) 0 40px;
  /* 完全抵消全局 scroll-padding-top：锚点跳转后视频面顶部贴视口顶、整屏完整呈现（仅本元素生效） */
  scroll-margin-top: -100px;
}

#film .shell {
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* 标题与全站其他 section 一致：居左 */

/* ── 播放器区：占满标题与底部之间的一屏剩余空间 ── */
.film-area {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
}

/* ── 视频外框：高度跟随剩余空间，16:9 自洽缩放，任何窗口不裁切 ── */
.film-frame {
  height: 100%;
  width: auto;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  margin-inline: auto;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  display: grid;
  place-items: center;
}

.film-video,
.film-embed {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.film-embed {
  border: 0;
}

/* video 未播放时仍显示 poster，无默认控件占位 */
.film-video:not([src]) {
  object-fit: contain;
}

/* ── 播放按钮：圆形、品牌色、悬浮轻反馈 ── */
.film-play {
  position: absolute;
  inset: 0;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 92px;
  height: 92px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  background: var(--surface);
  color: var(--accent-strong);
  cursor: pointer;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), background-color 0.2s var(--ease-out);
  box-shadow: var(--shadow-sm);
}

.film-play:hover {
  transform: scale(1.06);
  box-shadow: var(--shadow-md);
  background: color-mix(in srgb, currentColor 9%, var(--surface));
}

.film-play:active {
  transform: scale(0.98);
}

.film-play svg {
  width: 28px;
  height: 28px;
  margin-left: 3px;
}

.film-play span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.film-play span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── 错误提示 ── */
.film-error {
  position: absolute;
  inset: auto 16px 16px;
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.film-error a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.film-error a:hover {
  color: var(--accent);
}

/* ── 底部轻量链接与版本提示 ── */
.film-notes {
  margin-top: 18px;
  text-align: center;
}

.film-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.film-links a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent-strong);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.film-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.film-links a::after {
  content: "";
  width: 12px;
  height: 12px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E") no-repeat center / contain;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E") no-repeat center / contain;
}

.film-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

/* ── 深色主题微调 ── */
[data-theme="dark"] .film-frame {
  border-color: var(--line-strong);
  background: var(--surface);
}

[data-theme="dark"] .film-error {
  background: var(--surface-2);
  border-color: var(--line);
}

/* ── 响应式：平板与手机 ── */
@media (max-width: 1020px) {
  .film-frame {
    max-width: 100%;
  }
}

@media (max-width: 760px) {
  #film {
    padding: clamp(52px, 7vh, 76px) 0 44px;
  }

  #film .section-head {
    margin-bottom: 16px;
    position: relative;
    top: 18px;
  }

  #film .section-head h2 {
    font-size: clamp(26px, 6.5vw, 32px);
  }

  #film .section-head p {
    font-size: 15px;
  }

  .film-area {
    padding: 10px 0;
  }

  .film-frame {
    width: 100%;
    height: auto;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
  }

  .film-play {
    width: 78px;
    height: 78px;
  }

  .film-play svg {
    width: 24px;
    height: 24px;
  }

  .film-notes {
    margin-top: 28px;
  }

  .film-links {
    gap: 6px 14px;
  }

  .film-links a {
    font-size: 14px;
  }

  .film-note {
    font-size: 13px;
  }

  .film-error {
    inset: auto 10px 10px;
    font-size: 12px;
  }
}

/* ── 竖屏手机：自然高度内容段，不做整屏（16:9 视频在竖屏无法撑满一屏） ── */
@media (max-width: 760px) and (orientation: portrait) {
  #film {
    min-height: auto;
    /* 顶部留白避开悬浮导航，底部自然留白与全站节奏一致 */
    padding: clamp(72px, 8vh, 88px) 0 48px;
    /* 抵消全局 scroll-padding-top：锚点跳转后标题（含顶部留白）正好落在导航下方，不产生多余空白 */
    scroll-margin-top: -88px;
  }

  #film .section-head {
    position: static;
    top: auto;
    margin-bottom: 20px;
  }

  .film-area {
    flex: none;
    padding: 0;
  }
}

/* ── 极小窗口（任何方向）：自然高度，内容完整可见、不裁切不挤压 ── */
@media (max-height: 520px) {
  #film {
    min-height: auto;
    padding: 24px 0;
    scroll-margin-top: 0;
  }

  #film .section-head {
    margin-bottom: 12px;
  }

  #film .section-head h2 {
    font-size: 24px;
  }

  .film-frame {
    height: min(52vh, 340px);
    width: auto;
    max-width: 100%;
  }

  .film-play {
    width: 64px;
    height: 64px;
  }

  .film-play svg {
    width: 20px;
    height: 20px;
  }

  .film-notes {
    margin-top: 8px;
  }
}

/* ── 减少动效偏好 ── */
@media (prefers-reduced-motion: reduce) {
  .film-play {
    transition: none;
  }
}
