
/* ========================================
   LOVELLE LAB — Yours in Starlight
   File: background.css
   Version 3.0 — Cinematic Starlight
   Theme: Deep Burgundy
======================================== */


/* ========================================
   01. BACKGROUND BASE
======================================== */

.background {

    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    z-index: 0;

    isolation: isolate;

    overflow: hidden;

    pointer-events: none;

    background-color: var(--bg-darkest, #190B12);
}


/* ========================================
   02. ORIGINAL BACKGROUND IMAGE
======================================== */

.background-image {

    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    z-index: 1;

    background-image:
        url("../assets/images/background/background.png");

    background-position: center center;

    background-repeat: no-repeat;

    background-size: cover;

    opacity: 1;

    transform: scale(1.02);

    pointer-events: none;
}


/* ========================================
   03. SOFT CINEMATIC LIGHT
======================================== */

.background-glow {

    position: absolute;
    inset: 0;

    z-index: 2;

    background: radial-gradient(

        ellipse at 50% 55%,

        rgba(150, 55, 65, 0.12) 0%,

        rgba(100, 25, 40, 0.06) 35%,

        transparent 70%

    );

    opacity: 0.7;

    pointer-events: none;

    transition:

        opacity 1800ms var(--ease-smooth),

        transform 2400ms var(--ease-smooth);
}


/* ========================================
   04. DARK EDGES — VIGNETTE
======================================== */

.background-vignette {

    position: absolute;
    inset: 0;

    z-index: 3;

    background: radial-gradient(

        ellipse at center,

        transparent 35%,

        rgba(18, 3, 9, 0.12) 65%,

        rgba(12, 2, 6, 0.38) 100%

    );

    pointer-events: none;
}


/* ========================================
   05. SOFT LIGHT BEHIND ENVELOPE
======================================== */

.background::after {

    content: "";

    position: absolute;

    left: 50%;

    bottom: 8%;

    width: min(65vw, 650px);

    height: min(40vh, 350px);

    transform: translateX(-50%);

    z-index: 4;

    background: radial-gradient(

        ellipse at center,

        rgba(201, 164, 119, 0.045) 0%,

        rgba(120, 40, 45, 0.035) 35%,

        transparent 75%

    );

    filter: blur(35px);

    opacity: 0.65;

    pointer-events: none;

    transition: opacity 1800ms ease;
}


/* ========================================
   06. INTERACTIVE STARFIELD CANVAS
======================================== */

#starfield-canvas,
.starfield-canvas {

    position: absolute;

    inset: 0;

    width: 100%;

    height: 100%;

    display: block;

    z-index: 15;

    opacity: 1;

    visibility: visible;

    background: transparent;

    pointer-events: none;

    user-select: none;

    -webkit-user-select: none;

    animation: none;

    transition: none;

    filter: none;

    mix-blend-mode: normal;
}


/* ========================================
   07. SECONDARY PARTICLES
======================================== */

.particles-canvas {

    position: absolute;

    inset: 0;

    width: 100%;

    height: 100%;

    z-index: 10;

    background: transparent;

    pointer-events: none;
}


/* ========================================
   08. 3D TYPOGRAPHY SCENE
======================================== */

.scene-container {

    position: absolute;

    inset: 0;

    width: 100%;

    height: 100%;

    z-index: 20;

    pointer-events: none;

    background: transparent;
}


/* ========================================
   09. LETTER AND ENVELOPE LAYERS
======================================== */

.letter-container {

    z-index: 30;
}

.envelope-stage {

    z-index: 40;
}

.sound-toggle {

    z-index: 100;
}


/* ========================================
   10. OPENING STATE
======================================== */

.experience.is-opening .background-glow {

    opacity: 0.9;

    transform: scale(1.03);
}

.experience.is-opening .background::after {

    opacity: 0.85;
}


/* ========================================
   11. OPENED LETTER STATE
======================================== */

.experience.is-open .background-glow {

    opacity: 1;

    transform: scale(1.06);
}

.experience.is-open .background::after {

    opacity: 1;
}


/* ========================================
   12. CLOSING STATE
======================================== */

.experience.is-closing .background-glow {

    opacity: 0.7;

    transform: scale(1);
}

.experience.is-closing .background::after {

    opacity: 0.65;
}


/* ========================================
   13. MOBILE OPTIMIZATION
======================================== */

@media screen and (max-width: 768px) {

    .background-image {

        background-position: center;

        background-size: cover;
    }

    .background-glow {

        background: radial-gradient(

            ellipse at 50% 50%,

            rgba(150, 55, 65, 0.10) 0%,

            transparent 70%

        );
    }

    .background::after {

        width: 90vw;

        height: 30vh;

        filter: blur(25px);
    }

    #starfield-canvas,
    .starfield-canvas {

        width: 100%;

        height: 100%;

        z-index: 15;
    }
}


/* ========================================
   14. ACCESSIBILITY
======================================== */

@media (prefers-reduced-motion: reduce) {

    .background-glow,
    .background::after {

        transition: none;
    }

    #starfield-canvas,
    .starfield-canvas {

        animation: none;

        transition: none;

        opacity: 1;
    }
}


/* ========================================
   END OF BACKGROUND.CSS
======================================== */
