/**
 * 鼠标光照特效样式
 * 为整个项目提供真实的鼠标光标光照效果
 */

/* ========== 光照层容器 ========== */

#lighting-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    overflow: hidden;
}

/* ========== 主光源（跟随鼠标）========== */

.mouse-light {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle,
            rgba(255, 255, 255, 0.06) 0%,
            rgba(255, 255, 255, 0.03) 25%,
            rgba(255, 255, 255, 0.015) 50%,
            transparent 75%);
    transform: translate(-50%, -50%);
    filter: blur(30px);
    mix-blend-mode: screen;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* ========== 光晕效果（鼠标中心的微弱亮点）========== */

.light-halo {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    box-shadow:
        0 0 8px 2px rgba(255, 255, 255, 0.15),
        0 0 16px 4px rgba(255, 255, 255, 0.08);
    animation: pulse-halo 3s ease-in-out infinite;
}

/* ========== 光照范围指示器（用于粒子互动）========== */

.light-range-indicator {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: none;
    /* 移除边框 */
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    transition: all 0.3s ease;
    background: radial-gradient(circle,
            rgba(255, 255, 255, 0.04) 0%,
            transparent 75%);
    filter: blur(20px);
}

@keyframes pulse-halo {

    0%,
    100% {
        opacity: 0.3;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1.3);
    }
}

/* ========== 按钮/卡片受光照影响 ========== */

.element-lit {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.element-lit::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    background: radial-gradient(circle at var(--light-x, 50%) var(--light-y, 50%),
            rgba(255, 255, 255, 0.25) 0%,
            rgba(255, 255, 255, 0.1) 30%,
            transparent 70%);
    opacity: calc(var(--light-intensity, 0) * 0.8);
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 1;
}

/* 当元素在光照范围内时显示光晕 */
.element-lit.lit-active::before {
    opacity: calc(var(--light-intensity, 0) * 1.2);
}

.element-lit:hover::before {
    opacity: calc(var(--light-intensity, 0) * 1.2);
}

/* ========== 按钮反光效果 ========== */

.btn-reflection {
    position: relative;
    overflow: hidden;
}

/* 按钮受光照影响的动态反光（根据鼠标位置） */
.btn-reflection.element-lit {
    position: relative;
    overflow: hidden;
    z-index: 1;
    /* 光圈限制在按钮内部，且确保按钮内容在伪元素之上 */
}

.btn-reflection.element-lit::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at var(--light-x, 50%) var(--light-y, 50%),
            rgba(255, 255, 255, 0.9) 0%,
            rgba(255, 255, 255, 0.6) 20%,
            rgba(255, 255, 255, 0.3) 40%,
            transparent 70%);
    opacity: 0;
    transition: opacity 0.1s ease;
    pointer-events: none;
    z-index: -1;
    border-radius: inherit;
}

/* 按钮在光照范围内时显示反光 - 根据强度动态调整 */
.btn-reflection.element-lit.lit-active::before {
    opacity: var(--light-opacity, 1);
}

/* 按钮悬停时也显示反光 */
.btn-reflection.element-lit:hover::before {
    opacity: var(--light-opacity, 1);
}

/* ========== 卡片光照边框 ========== */

.card-glow {
    position: relative;
}

.card-glow::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg,
            rgba(102, 126, 234, 0.3) 0%,
            rgba(118, 75, 162, 0.3) 50%,
            rgba(102, 126, 234, 0.3) 100%);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
    filter: blur(10px);
}

.card-glow:hover::before {
    opacity: 1;
}

/* ========== 导航栏光照效果 ========== */

.navbar-glow {
    position: relative;
}

.navbar-glow::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.3) 50%,
            transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.navbar-glow:hover::after {
    opacity: 1;
}

/* ========== 表单输入框光照 ========== */

.input-glow:focus {
    box-shadow:
        0 0 0 0.2rem rgba(102, 126, 234, 0.25),
        0 0 20px rgba(102, 126, 234, 0.3),
        inset 0 0 10px rgba(255, 255, 255, 0.1);
}

/* ========== 链接悬停发光 ========== */

.link-glow {
    position: relative;
    transition: all 0.3s ease;
}

.link-glow:hover {
    text-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

/* ========== 响应式调整 ========== */

@media (max-width: 768px) {
    .mouse-light {
        width: 180px;
        height: 180px;
    }

    .mouse-light-reflection {
        width: 90px;
        height: 90px;
    }

    .light-halo {
        width: 250px;
        height: 250px;
    }
}

/* ========== 性能优化：减少动画 ========== */

@media (prefers-reduced-motion: reduce) {

    .mouse-light,
    .mouse-light-reflection,
    .light-halo {
        display: none;
    }

    .element-lit::before,
    .btn-reflection::after,
    .card-glow::before {
        display: none;
    }
}