/* ============ <poc-video> POC 演示视频组件 ============
   依赖设计令牌（--action / --sh-2 等）带兜底值，单文件可移植。
   断点与设计稿一致：≤640px 走 9:16 竖版。 */

poc-video {
  display: block;
  position: relative;
}

.pv-frame {
  position: relative;
  aspect-ratio: 16 / 10;
  width: 100%;
  border-radius: var(--r-xl, 16px);
  overflow: hidden;
  background: linear-gradient(150deg, #0a3e58, #07141d);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--sh-2, 0 30px 70px rgba(9, 29, 42, 0.16));
}

/* 视频铺满容器；未播放时被封面盖住 */
.pv-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #05121a;
  display: block;
}

/* ---------- 封面层 ---------- */
.pv-cover {
  position: absolute;
  inset: 0;
  z-index: 2;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.pv-cover picture,
.pv-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.pv-img {
  object-fit: cover;
}

/* 底部压暗 + 顶部轻压暗，保证时长角标与播放钮可读 */
.pv-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(4, 12, 18, 0.18) 0%,
    rgba(4, 12, 18, 0) 26%,
    rgba(4, 12, 18, 0.62) 100%
  );
  pointer-events: none;
}

.pv-frame[data-state="playing"] .pv-cover {
  opacity: 0;
  visibility: hidden;
}

/* ---------- 播放钮 ---------- */
.pv-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--action, #0077a8);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  transition: transform 0.18s ease, background-color 0.18s ease;
}

.pv-play:hover {
  transform: translate(-50%, -50%) scale(1.06);
  background: #fff;
}

.pv-play:active {
  transform: translate(-50%, -50%) scale(0.98);
}

.pv-play:focus-visible {
  outline: 3px solid #35c8ee;
  outline-offset: 4px;
}

.pv-play-icon {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

/* 播放失败时的降级链接：白底胶囊 + 文字，替代圆形图标 */
.pv-fallback {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  min-height: 48px;
  padding: 0 26px;
  border-radius: 999px;
  background: #fff;
  color: var(--action, #0077a8);
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  text-decoration: none;
}

.pv-fallback:focus-visible {
  outline: 3px solid #35c8ee;
  outline-offset: 4px;
}

/* ---------- 时长角标（loadedmetadata 后填充） ---------- */
.pv-badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  min-width: 52px;
  text-align: center;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  padding: 3px 9px;
  border-radius: 6px;
  font-family: var(--font-num, "SF Pro Display", "PingFang SC", sans-serif);
}

.pv-badge[hidden] {
  display: none;
}

/* 屏幕阅读器专用文本 */
.pv-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 移动端：9:16 竖版 ---------- */
@media (max-width: 640px) {
  .pv-frame {
    aspect-ratio: 9 / 16;
    border-radius: var(--r-lg, 14px);
  }

  .pv-play {
    width: 60px;
    height: 60px;
  }

  .pv-play-icon {
    width: 24px;
    height: 24px;
  }

  .pv-badge {
    right: 12px;
    bottom: 10px;
    font-size: 12px;
    padding: 2px 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pv-frame,
  .pv-play,
  .pv-cover {
    transition: none;
  }
}

/* ---------- 点击到可播之间：按钮转圈，避免“点了没反应” ---------- */
.pv-frame[data-state="loading"] .pv-play {
  pointer-events: none;
  cursor: progress;
}

.pv-frame[data-state="loading"] .pv-play-icon {
  display: none;
}

.pv-frame[data-state="loading"] .pv-play::before {
  content: "";
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 3px solid rgba(0, 119, 168, 0.2);
  border-top-color: var(--action, #0077a8);
  animation: pv-spin 0.8s linear infinite;
}

@keyframes pv-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .pv-frame[data-state="loading"] .pv-play::before {
    animation-duration: 1.6s;
  }
}
