/* ===== 找点啥？首页 · 明亮灵动重构 =====
   目标：彻底颠覆"纵向网格"形式，改为横向滑动轨道 + 全局光标流光 + 持续呼吸动效。
   仅作用于首页 body[data-page="home"]，不改动原结构与其它页面。
   性能底线：仅用 transform / opacity / box-shadow / width 过渡，无逐帧 backdrop-filter。
*/

/* ---------- 0. 让内容浮在全局光标光晕之上 ---------- */
body[data-page="home"] .main-content {
    position: relative;
    z-index: 1;
}

/* ---------- 1. 整体调亮：强化氛围光斑 ---------- */
body[data-page="home"]::before {
    opacity: 1;
    background:
        radial-gradient(42% 36% at 10% 6%, rgba(99, 102, 241, 0.20), transparent 70%),
        radial-gradient(40% 34% at 90% 14%, rgba(14, 165, 233, 0.18), transparent 70%),
        radial-gradient(46% 42% at 78% 94%, rgba(139, 92, 246, 0.16), transparent 70%),
        radial-gradient(42% 36% at 18% 90%, rgba(13, 148, 136, 0.14), transparent 70%);
}

/* 顶部一抹明亮极光带 */
body[data-page="home"] .main-content::before {
    content: "";
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: min(1200px, 92vw);
    height: 260px;
    background: radial-gradient(60% 100% at 50% 0%, rgba(99, 102, 241, 0.10), transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* ---------- 2. Hero 光球调亮 + 加速呼吸 ---------- */
.hero-section::before {
    opacity: 0.78;
    animation-duration: 13s;
}
.hero-section::after {
    opacity: 0.72;
    animation-duration: 15s;
}

/* 标题渐变更鲜亮，并裁剪到文字形状（避免每块字符变成色块） */
.hero-title-line:last-child {
    background: linear-gradient(100deg, #6366F1 0%, #8B5CF6 26%, #0EA5E9 62%, #14B8A6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ---------- 3. 分类区：纵向网格 → 横向自动滑动轨道（形态颠覆） ---------- */
body[data-page="home"] .categories-grid {
    display: flex;
    gap: 18px;
    max-width: none;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    padding: 10px 2px 22px;
    margin: 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    scroll-behavior: smooth;
}
/* 居中技巧：用首尾伪元素吃掉多余空间，内容不满时整体居中；溢出时外边距归零、正常可横滑（避免 justify-content:center 导致首尾卡片不可达） */
body[data-page="home"] .categories-grid::before,
body[data-page="home"] .categories-grid::after {
    content: "";
    flex: 0 0 auto;
    margin: auto;
}
body[data-page="home"] .categories-grid::-webkit-scrollbar { display: none; }
body[data-page="home"] .categories-grid.dragging { cursor: grabbing; scroll-behavior: auto; }

body[data-page="home"] .category-card {
    flex: 0 0 auto;
    width: 224px;
    scroll-snap-align: center;
    animation: catFloat 6s ease-in-out infinite;
}
/* 错落呼吸，避免整齐划一 */
body[data-page="home"] .category-card:nth-child(2n) { animation-delay: -3s; }
body[data-page="home"] .category-card:nth-child(3n) { animation-delay: -1.5s; }
body[data-page="home"] .category-card:nth-child(4n) { animation-delay: -4.5s; }

@keyframes catFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

/* 轨道两侧渐隐遮罩，提示可滑动 */
body[data-page="home"] .categories-section {
    position: relative;
}
body[data-page="home"] .categories-section::before,
body[data-page="home"] .categories-section::after {
    content: "";
    position: absolute;
    top: 70px;
    bottom: 0;
    width: 56px;
    z-index: 3;
    pointer-events: none;
}
body[data-page="home"] .categories-section::before {
    left: 0;
    background: linear-gradient(90deg, var(--bg-body), transparent);
}
body[data-page="home"] .categories-section::after {
    right: 0;
    background: linear-gradient(270deg, var(--bg-body), transparent);
}

/* ---------- 4. 热门资源：保留倾斜，叠加"呼吸光晕"（不动 transform，避免冲突） ---------- */
body[data-page="home"] .featured-card {
    animation: cardBreath 5.5s ease-in-out infinite;
}
body[data-page="home"] .featured-card:nth-child(2n) { animation-delay: -2.5s; }
body[data-page="home"] .featured-card:nth-child(3n) { animation-delay: -4s; }

@keyframes cardBreath {
    0%, 100% { box-shadow: 0 10px 30px -18px rgba(15, 23, 42, 0.20), 0 0 0 0 rgba(99, 102, 241, 0); }
    50%      { box-shadow: 0 14px 36px -18px rgba(99, 102, 241, 0.34), 0 0 24px -6px rgba(14, 165, 233, 0.30); }
}

/* ---------- 5. 统计条：滚动进入时生长 ---------- */
body[data-page="home"] .stat-bar-fill {
    width: 0% !important;
    transition: width 1.15s cubic-bezier(0.21, 0.6, 0.35, 1);
}
body[data-page="home"] .stat-bar-fill.bar-in {
    width: var(--bar-target, 0%) !important;
}

/* ---------- 6. 全局光标流光（明亮，screen 混合，跟随全站） ---------- */
body[data-page="home"] .home-cursor-glow {
    position: fixed;
    left: 0;
    top: 0;
    width: 560px;
    height: 560px;
    margin-left: -280px;
    margin-top: -280px;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(99, 102, 241, 0.15),
        rgba(14, 165, 233, 0.10) 42%,
        rgba(139, 92, 246, 0.06) 60%,
        transparent 70%);
    mix-blend-mode: screen;
    opacity: 0;
    transform: translate3d(var(--gx, 50vw), var(--gy, 40vh), 0);
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 0;
    will-change: transform;
}
body[data-page="home"].cursor-active .home-cursor-glow {
    opacity: 1;
}

/* ---------- 7. 尊重减少动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
    body[data-page="home"] .category-card,
    body[data-page="home"] .featured-card {
        animation: none !important;
    }
    body[data-page="home"] .stat-bar-fill {
        transition: none !important;
        width: var(--bar-target, 0%) !important;
    }
    body[data-page="home"] .home-cursor-glow { display: none !important; }
}
