/* =========================================================
 * LeonZone 首页特效引擎样式
 * 由 /service/effects/effects.js 配合 body[data-effects] 启用
 * 仅在该用户开启对应特效时才加载（index.php 条件 include）
 * ========================================================= */

/* ---------- 通用容器 ---------- */
.fx-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1; /* 高于背景，低于内容 */
    overflow: hidden;
}
.fx-layer.fx-top { z-index: 9999; }

/* ========================================================= */
/* 1. Aurora Ribbon - 顶部彩色极光带                          */
/* ========================================================= */
.fx-aurora {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 320px;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    filter: blur(60px) saturate(140%);
    opacity: 0.55;
    mix-blend-mode: screen;
}
.fx-aurora::before,
.fx-aurora::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -25%;
    width: 150%;
    height: 200%;
    background: conic-gradient(
        from 0deg,
        rgba(120, 180, 255, 0.0) 0%,
        rgba(120, 200, 255, 0.6) 12%,
        rgba(180, 140, 255, 0.55) 28%,
        rgba(255, 140, 200, 0.45) 45%,
        rgba(140, 255, 200, 0.5) 65%,
        rgba(120, 180, 255, 0.0) 100%
    );
    animation: fxAuroraSpin 26s linear infinite;
}
.fx-aurora::after {
    animation-duration: 38s;
    animation-direction: reverse;
    opacity: 0.6;
}
[data-theme="dark"] .fx-aurora { opacity: 0.45; }
@keyframes fxAuroraSpin {
    from { transform: rotate(0deg) translateY(0); }
    50%  { transform: rotate(180deg) translateY(-3%); }
    to   { transform: rotate(360deg) translateY(0); }
}

/* ========================================================= */
/* 2. Starfield / Meteors - 星空与流星 (canvas)               */
/* ========================================================= */
canvas.fx-starfield {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.85;
    mix-blend-mode: screen;
}
[data-theme="light"] canvas.fx-starfield { opacity: 0.4; mix-blend-mode: multiply; }

/* ========================================================= */
/* 3. Time-of-day Tinting - 时段色温叠加                      */
/* ========================================================= */
.fx-tinting {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    transition: background 6s ease;
    mix-blend-mode: soft-light;
    opacity: 0.5;
}

/* ========================================================= */
/* 4. Paper Grain - 纸张颗粒                                  */
/* ========================================================= */
.fx-grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9994;
    opacity: 0.45;
    mix-blend-mode: multiply;
}
[data-theme="dark"] .fx-grain {
    opacity: 0.55;
    mix-blend-mode: screen;
}

/* ========================================================= */
/* 5. Weather - 天气联动 (canvas)                             */
/* ========================================================= */
canvas.fx-weather {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.85;
}

/* ========================================================= */
/* 6. Seasonal - 节气 / 节日装饰 (canvas)                     */
/* ========================================================= */
canvas.fx-seasonal {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    opacity: 0.9;
}

/* ========================================================= */
/* 7. Pointer Trail - 鼠标拖尾                                */
/* ========================================================= */
.fx-trail-dot {
    position: fixed;
    top: 0;
    left: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(0, 122, 255, 0.95) 0%, rgba(0, 122, 255, 0.45) 45%, rgba(0, 122, 255, 0) 80%);
    z-index: 9997;
    will-change: transform, opacity;
}
[data-theme="dark"] .fx-trail-dot {
    background: radial-gradient(circle, rgba(140, 210, 255, 1) 0%, rgba(140, 210, 255, 0.6) 45%, rgba(140, 210, 255, 0) 80%);
}

/* ========================================================= */
/* 8. Magnetic Cursor - 跟随鼠标的光斑（吸附到卡片中心）       */
/* ========================================================= */
.fx-magnetic-spot {
    position: fixed;
    top: 0;
    left: 0;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9996;
    background: radial-gradient(circle, rgba(0, 122, 255, 0.22) 0%, rgba(0, 122, 255, 0.10) 35%, rgba(0, 122, 255, 0.04) 60%, rgba(0, 122, 255, 0) 80%);
    filter: blur(14px);
    will-change: transform;
    transform: translate(-400px, -400px);
}
[data-theme="dark"] .fx-magnetic-spot {
    background: radial-gradient(circle, rgba(140, 210, 255, 0.28) 0%, rgba(140, 210, 255, 0.12) 35%, rgba(140, 210, 255, 0.05) 60%, rgba(140, 210, 255, 0) 80%);
}

/* ========================================================= */
/* 9. Click Ripple - 点击波纹                                 */
/* ========================================================= */
.fx-ripple {
    position: fixed;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    pointer-events: none;
    border: 2px solid rgba(0, 122, 255, 0.6);
    z-index: 9999;
    transform: translate(-50%, -50%) scale(1);
    animation: fxRippleAnim 0.7s ease-out forwards;
    mix-blend-mode: screen;
}
[data-theme="dark"] .fx-ripple { border-color: rgba(120, 200, 255, 0.85); }
@keyframes fxRippleAnim {
    to {
        transform: translate(-50%, -50%) scale(8);
        opacity: 0;
        border-width: 1px;
    }
}

/* ========================================================= */
/* 10. Doodle Mode - 涂鸦画板                                 */
/* ========================================================= */
canvas.fx-doodle {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9995;
}
[data-effects~="doodle"].fx-doodle-active canvas.fx-doodle {
    pointer-events: auto;
    cursor: crosshair;
}
.fx-doodle-toolbar {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%);
    -webkit-backdrop-filter: saturate(180%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 13px;
    color: #333;
    user-select: none;
}
[data-theme="dark"] .fx-doodle-toolbar {
    background: rgba(40, 40, 45, 0.85);
    color: #eee;
    border-color: rgba(255, 255, 255, 0.08);
}
.fx-doodle-toolbar button {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
}
.fx-doodle-toolbar button:hover {
    background: rgba(0, 0, 0, 0.06);
}
[data-theme="dark"] .fx-doodle-toolbar button:hover {
    background: rgba(255, 255, 255, 0.08);
}
.fx-doodle-toolbar .fx-doodle-color {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}
.fx-doodle-toolbar .fx-doodle-color.active {
    transform: scale(1.18);
    box-shadow: 0 0 0 2px var(--accent, #007aff);
}

/* ========================================================= */
/* 11. Tilt on Hover - 卡片倾斜                              */
/* ========================================================= */
[data-effects~="tilt"] .apple-card,
[data-effects~="tilt"] .module-card,
[data-effects~="tilt"] .feature-card,
[data-effects~="tilt"] .swiper-slide {
    transform-style: preserve-3d;
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

/* ---------- 减少动画偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
    .fx-aurora::before,
    .fx-aurora::after { animation: none !important; }
    .fx-trail-dot,
    .fx-ripple { display: none !important; }
}
