/* ====== 云端佛堂独立跑马灯样式 ====== */
.temple-marquee-container {
    width: 100%;
    overflow: hidden;
    position: relative;
    padding: 20px 0;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    margin-top: 20px;
    box-sizing: border-box;
}

.temple-marquee-wrapper {
    display: flex;
    animation: temple-marquee-scroll 40s linear infinite;
    width: max-content;
    will-change: transform; /* 优化动画性能 */
    backface-visibility: hidden; /* 防止闪烁 */
    -webkit-font-smoothing: antialiased; /* 字体平滑 */
}

.temple-marquee-wrapper:hover {
    animation-play-state: paused;
}

.temple-marquee-item {
    flex: 0 0 auto;
    width: 330px; /* 卡片宽度，可根据需要调整 */
    margin-right: 20px; /* 卡片间距 */
    transition: transform 0.3s ease; /* 为可能的交互效果添加过渡 */
    box-sizing: border-box;
}

.temple-marquee-item:last-child {
    margin-right: 0; /* 最后一个项不需要右边距 */
}

/* 独立的跑马灯动画 - 可自由调整速度和方向 */
@keyframes temple-marquee-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        /* 移动距离为 - (单个项目宽度 + 间距) * 真实项目数量(4个) */
        /* 确保动画终点能刚好让第一组项目滚动到可视区，实现无缝衔接 */
        transform: translateX(calc(-350px * 4));
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .temple-marquee-container {
        padding: 15px 0;
        margin-top: 15px;
    }
    
    .temple-marquee-item {
        width: 250px; /* 移动端卡片变窄 */
        margin-right: 15px; /* 移动端间距更小 */
    }
    
    /* 移动端也需要调整动画移动距离 */
    @keyframes temple-marquee-scroll {
        100% {
            transform: translateX(calc(-265px * 4));
        }
    }
}

/* 更小屏幕的优化 */
@media (max-width: 480px) {
    .temple-marquee-item {
        width: 200px; /* 小屏幕卡片更窄 */
        margin-right: 10px;
    }
    
    .temple-marquee-container {
        padding: 10px 0;
    }
    
    @keyframes temple-marquee-scroll {
        100% {
            transform: translateX(calc(-210px * 4));
        }
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .temple-marquee-wrapper:hover {
        animation-play-state: running; /* 移动端默认运行 */
    }
    
    .temple-marquee-container {
        -webkit-overflow-scrolling: touch; /* 移动端滚动优化 */
    }
}

/* 性能优化：减少动画在非激活标签页的消耗 */
@media (prefers-reduced-motion: reduce) {
    .temple-marquee-wrapper {
        animation-duration: 60s; /* 减少运动敏感用户的动画速度 */
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    .temple-marquee-container {
        background: rgba(255, 255, 255, 0.05);
    }
}