.bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.bg-noise {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px;
}

.bg-grid {
    position: absolute;
    inset: 0;
    background-image:
            linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
            linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.5), transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.5), transparent 70%);
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    will-change: transform;
}

.bg-orb--1 {
    width: 550px;
    height: 550px;
    top: -18%;
    right: -12%;
    background: radial-gradient(circle, var(--accent), transparent 70%);
    opacity: 0.09;
    animation: orbDrift1 16s ease-in-out infinite;
}

.bg-orb--2 {
    width: 450px;
    height: 450px;
    bottom: -18%;
    left: -12%;
    background: radial-gradient(circle, var(--primary), transparent 70%);
    opacity: 0.11;
    animation: orbDrift2 20s ease-in-out infinite;
}

.bg-orb--3 {
    width: 350px;
    height: 350px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, var(--secondary), transparent 70%);
    opacity: 0.06;
    animation: orbDrift3 22s ease-in-out infinite;
}


.bokeh {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.bokeh-dot {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    opacity: 0;
    animation: bokehFloat var(--dur) ease-in-out var(--delay) infinite;
}

.bokeh-dot--ring {
    background: transparent;
    border: 1px solid var(--color);
    box-shadow: inset 0 0 8px var(--color), 0 0 4px var(--color);
    filter: blur(1px);
}

.bokeh-dot--solid {
    background: var(--color);
}


.frames {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.ghost-frame {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.025);
    border-radius: 3px;
    opacity: 0;
    animation: frameDrift var(--dur) ease-in-out var(--delay) infinite;
}

.ghost-frame::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 22%;
    background: rgba(255, 255, 255, 0.008);
}

.ghost-frame--landscape {
    width: var(--w, 140px);
    height: calc(var(--w, 140px) * 0.66);
}

.ghost-frame--portrait {
    width: var(--w, 100px);
    height: calc(var(--w, 100px) * 1.4);
}


.cursor-glow {
    position: fixed;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--primary-rgb), 0.04) 0%, rgba(var(--accent-rgb), 0.015) 40%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    transform: translate(-50%, -50%);
    transition: opacity 0.4s ease;
    opacity: 0;
}

.cursor-glow.is-visible {
    opacity: 1;
}


@media (max-width: 768px) {
    .cursor-glow { display: none; }
    .ghost-frame { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .bg-orb,
    .bokeh-dot,
    .ghost-frame,
    .cursor-glow {
        display: none !important;
    }
}