/* ====================
   为什么选择我们 - 视频展示卡（懒加载）
   布局：2 列等宽、移动端 1 列
   ==================== */

/* 容器：放在右栏 features-grid 下方，与功能卡对齐 */
.hero-videos {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(14px, 1.2vw, 22px);
    margin-top: clamp(20px, 2vw, 32px);
}

/* 卡片：深色圆角，hover 轻微提亮 */
.hero-video-card {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: #0d1628;
    box-shadow: 0 8px 24px rgba(13, 22, 40, 0.18);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hero-video-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(13, 22, 40, 0.28);
}

/* 占位区（首帧未抓出来时显示，等比 16:9 黑底） */
.hero-video-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    width: 100%;
    background: #0d1628;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 视频本体：等比填充占位区；占位没出来时由 canvas 海报填满 */
.hero-video-frame video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    background: #0d1628;
}

/* 海报层（canvas 生成的首帧）：完全覆盖 video。视频就绪或点击后自动隐藏 */
.hero-video-poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
    pointer-events: none;
}

/* 播放按钮：海报上居中圆形按钮 */
.hero-video-play {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.15);
    transition: opacity 0.25s ease, background 0.25s ease;
    cursor: pointer;
}

.hero-video-card:hover .hero-video-play {
    background: rgba(0, 0, 0, 0.3);
}

/* 视频播放中：隐藏中间播放按钮（原生控件 click 与自定义 click 都会触发 play 事件） */
.hero-video-card.is-playing .hero-video-play {
    opacity: 0;
    pointer-events: none;
}

/* 播放中 hover：轻微淡入，方便用户重新点出暂停 */
.hero-video-card.is-playing:hover .hero-video-play {
    opacity: 0.4;
}

.hero-video-play i {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #0066ff;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    transition: transform 0.25s ease;
}

.hero-video-card:hover .hero-video-play i {
    transform: scale(1.08);
}

/* 标题（caption）：贴在视频下方 */
.hero-video-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 18px 22px 16px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: linear-gradient(180deg, rgba(13, 22, 40, 0) 0%, rgba(13, 22, 40, 0.82) 100%);
    z-index: 3;
    pointer-events: none;
}

/* 加载中旋转 */
.hero-video-card.is-loading .hero-video-play i::before {
    content: "\f110";   /* fa-spinner */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    animation: hero-video-spin 1s linear infinite;
}

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

/* 移动端：保持 2 列但更紧凑 */
@media (max-width: 768px) {
    .hero-videos {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .hero-video-play i {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
    .hero-video-caption {
        padding: 12px 14px 10px;
        font-size: 13px;
    }
}

/* 超窄屏：折单列 */
@media (max-width: 480px) {
    .hero-videos {
        grid-template-columns: 1fr;
    }
}