/**
 * 韩漫网 · 动效与交互样式（配合 script.js，不在 HTML 内联）
 */

/* ── Keyframes ── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── 页面入场（script.js: page-enter / is-ready） ── */
body.page-enter {
    opacity: 0;
}

body.page-enter.is-ready {
    opacity: 1;
    transition: opacity 0.35s ease;
}

/* ── 卡片入场 ── */
.comic-card,
.update-item,
.category-card,
.feature-card,
.library-card {
    animation: fadeInUp 0.55s ease both;
}

.comic-card:nth-child(1),
.library-card:nth-child(1) { animation-delay: 0.05s; }
.comic-card:nth-child(2),
.library-card:nth-child(2) { animation-delay: 0.1s; }
.comic-card:nth-child(3),
.library-card:nth-child(3) { animation-delay: 0.15s; }
.comic-card:nth-child(4),
.library-card:nth-child(4) { animation-delay: 0.2s; }
.comic-card:nth-child(5),
.library-card:nth-child(5) { animation-delay: 0.25s; }
.comic-card:nth-child(6),
.library-card:nth-child(6) { animation-delay: 0.3s; }

/* 3D 倾斜卡片由 script.js 控制 transform，避免与 hover 冲突 */
.comic-card.comic-card--tilting {
    transition: transform 0.15s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ── 返回顶部（script.js 动态创建） ── */
.scroll-top-btn {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 900;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 107, 129, 0.35);
    border-radius: 50%;
    background: rgba(18, 18, 26, 0.92);
    color: #ff6b81;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease,
        background 0.2s ease, color 0.2s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.scroll-top-btn.is-shown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    background: #ff6b81;
    color: #fff;
}

@media (max-width: 640px) {
    .scroll-top-btn {
        right: 0.85rem;
        bottom: 0.85rem;
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
}
