/**
 * 社区视频大卡（YouTube / B 站统一）：16:9 铺满正文栏 + 底部黑渐变 + 标题压渐变。
 * 视觉参数照抄工具箱 collection-front.css 的 mytb-coll-video-*（知识库同款），
 * 但 collection-front.css 不在社区页加载，这里在社区作用域内定义同名类；
 * 顺带收口 the_content 意外提升出的裸 .mytb-coll-video-block（去掉 max-w-3xl 限宽）。
 * 点击行为：原地展开官方播放器（wpf-video-card.js）。
 */

/*
 * 上下 1em 对齐正文段落节奏（p+p 的 margin-top:1em）：卡替换掉一个 <p> 后，
 * 下一段不再命中 p+p 选择器，卡自己必须带上 1em 的上下边距，否则文字贴卡。
 */
#wpforo #wpforo-wrap .mytheme-wpf-video {
  display: block;
  margin: 1em 0;
  max-width: none;
}

/* the_content 意外提升路径的裸块：同样铺满、去掉 48rem 限宽，同节奏 */
#wpforo #wpforo-wrap .mytb-coll-video-block {
  width: 100% !important;
  max-width: none !important;
  margin: 1em 0 !important;
}

#wpforo #wpforo-wrap .mytheme-wpf-video__card,
#wpforo #wpforo-wrap .mytb-coll-video-frame {
  position: relative;
  display: block;
  box-sizing: border-box;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--myt-wpf-radius-card) !important;
  overflow: hidden;
  background: #111;
  cursor: pointer;
  text-decoration: none;
  padding: 0;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
}

#wpforo #wpforo-wrap .mytheme-wpf-video__card:focus-visible,
#wpforo #wpforo-wrap .mytb-coll-video-frame:focus-visible {
  outline: 2px solid var(--myt-wpf-focus) !important;
  outline-offset: 2px;
}

#wpforo #wpforo-wrap .mytb-coll-video-poster {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

#wpforo #wpforo-wrap .mytb-coll-video-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, #1a1a1a 0%, #2c2c2c 100%);
}

#wpforo #wpforo-wrap .mytb-coll-video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  pointer-events: none;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease;
}

#wpforo #wpforo-wrap .mytheme-wpf-video__card:hover .mytb-coll-video-play,
#wpforo #wpforo-wrap .mytheme-wpf-video__card:focus-visible .mytb-coll-video-play,
#wpforo #wpforo-wrap .mytb-coll-video-frame:hover .mytb-coll-video-play,
#wpforo #wpforo-wrap .mytb-coll-video-frame:focus-visible .mytb-coll-video-play {
  transform: translate(-50%, -50%) scale(1.06);
  background: rgba(0, 0, 0, 0.7);
}

/* 封面底部标题：叠在图上，白字（知识库同款渐变） */
#wpforo #wpforo-wrap .mytb-coll-video-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  box-sizing: border-box;
  padding: 28px 12px 10px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.78) 100%);
  color: #fff;
  font-size: var(--myt-wpf-fs-caption);
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  text-align: left;
}

/* 点开播放后封面卡退场，播放器顶上 */
#wpforo #wpforo-wrap .mytheme-wpf-video.is-playing > .mytheme-wpf-video__card {
  display: none !important;
}

/* 播放器展开后由外层 .mytheme-wpf-video 的 1em 上下距统一管节奏，这里不再叠边距 */
#wpforo #wpforo-wrap .mytheme-wpf-video__player {
  position: relative;
  margin: 0;
  width: 100%;
  max-width: none;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--myt-wpf-radius-card);
  background: #000;
}

#wpforo #wpforo-wrap .mytheme-wpf-video__iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

#wpforo #wpforo-wrap .mytheme-wpf-video__ext {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 6px 10px !important;
  border-radius: 9999px !important;
  background: rgba(255, 255, 255, 0.92) !important;
  border: 1px solid var(--myt-wpf-color-line-soft) !important;
  color: var(--myt-wpf-color-ink) !important;
  font-size: var(--myt-wpf-fs-footnote) !important;
  font-weight: 500 !important;
  line-height: 1.3 !important;
  text-decoration: none !important;
}

#wpforo #wpforo-wrap .mytheme-wpf-video__ext:hover,
#wpforo #wpforo-wrap .mytheme-wpf-video__ext:focus-visible {
  background: #fff !important;
  color: var(--myt-wpf-color-ink) !important;
}

/* 广场信息流卡里：视频卡贴摘要下，卡与卡之间 10px */
#wpforo #wpforo-wrap .mytheme-wpf-card__bili > .mytheme-wpf-video,
#wpforo #wpforo-wrap .mytheme-wpf-card__video > .mytheme-wpf-video {
  margin: 0 0 10px;
}

#wpforo #wpforo-wrap .mytheme-wpf-card__bili > .mytheme-wpf-video:last-child,
#wpforo #wpforo-wrap .mytheme-wpf-card__video > .mytheme-wpf-video:last-child {
  margin-bottom: 0;
}

@media (prefers-reduced-motion: reduce) {
  #wpforo #wpforo-wrap .mytb-coll-video-play {
    transition: none;
  }
  #wpforo #wpforo-wrap .mytheme-wpf-video__card:hover .mytb-coll-video-play,
  #wpforo #wpforo-wrap .mytb-coll-video-frame:hover .mytb-coll-video-play {
    transform: translate(-50%, -50%);
  }
}
