/* 
    Nexus Background Engine Styles
    Emerald (#10B981) & Cyan (#06B6D4) Palette
    Supports Dark + Light modes
*/

/* ─── Base Container ──────────────────────────────── */
#nexus-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
    /* Dark mode base */
    background: var(--bg-base);
    transition: background 0.35s ease;
}

html:not(.dark) #nexus-bg {
    background: #F5F7FA;
}

/* ─── Dot Grid ───────────────────────────────────── */
.bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(16, 185, 129, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(16, 185, 129, 0.04) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -2;
}

html:not(.dark) .bg-grid {
    background-image:
        linear-gradient(rgba(16, 185, 129, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(16, 185, 129, 0.12) 1px, transparent 1px);
}

/* ─── Star Particles ──────────────────────────────── */
.star-particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #fff;
    border-radius: 50%;
    box-shadow:
        0 0 10px 2px rgba(16, 185, 129, 0.8),
        0 0 20px 5px rgba(6, 182, 212, 0.4);
    opacity: 0;
}

html:not(.dark) .star-particle {
    background: #10B981;
    box-shadow:
        0 0 10px 3px rgba(16, 185, 129, 0.5),
        0 0 20px 6px rgba(6, 182, 212, 0.25);
}

/* 4-point lens flare */
.star-particle::before,
.star-particle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.star-particle::before {
    width: 40px;
    height: 1px;
    background: radial-gradient(circle, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 70%);
}

.star-particle::after {
    width: 1px;
    height: 40px;
    background: radial-gradient(circle, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 70%);
}

html:not(.dark) .star-particle::before,
html:not(.dark) .star-particle::after {
    background: radial-gradient(circle, rgba(16, 185, 129, 1) 0%, rgba(16, 185, 129, 0) 70%);
}

/* ─── Impact Pulse ────────────────────────────────── */
.impact-pulse {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(16, 185, 129, 0.5);
    border-radius: 50%;
    box-shadow: 0 0 50px 20px rgba(6, 182, 212, 0.3);
    z-index: 0;
}

html:not(.dark) .impact-pulse {
    background: rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 40px 15px rgba(6, 182, 212, 0.2);
}

@keyframes flashPulse {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    100% {
        transform: scale(300);
        opacity: 0;
    }
}

/* ─── Expanding Rings ─────────────────────────────── */
.expanding-ring {
    position: absolute;
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

html:not(.dark) .expanding-ring {
    border-color: rgba(16, 185, 129, 0.15);
}

@keyframes ringOut {
    0% {
        transform: scale(0);
        opacity: 0.8;
    }

    100% {
        transform: scale(5);
        opacity: 0;
    }
}

/* ─── Global Spotlight & Hover Logic ──────────────── */
.spotlight-target {
    position: relative;
    --mouse-x: 50%;
    --mouse-y: 50%;
}

/* The interactive pool of light */
.spotlight-target::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(800px circle at var(--mouse-x) var(--mouse-y),
            rgba(16, 185, 129, 0.08),
            transparent 60%);
    opacity: 0;
    transition: opacity 0.6s ease;
}

.spotlight-target:hover::after {
    opacity: 1;
}

/* Enhanced illumination of section backdrops on hover */
.spotlight-target:hover .ambient-backdrop {
    opacity: 0.25;
    transform: scale(1.05);
}

.ambient-backdrop {
    transition: opacity 0.8s ease, transform 1.2s cubic-bezier(0.2, 0, 0.2, 1);
}