/* ==============================================
   HOME SCREEN — Cinematic intro before universe
   Sits above all existing layers (z-index: 40)
   and fades away when ENTER is clicked.
   Does not touch any existing universe CSS.

   The home screen background is semi-transparent
   so the Starfield canvas (already rendering its
   260 living background stars in "loading" mode
   beneath) bleeds through as the star field.
   ============================================== */


/* -----------------------------------------
   Fullscreen overlay
----------------------------------------- */

:root {
    --cinematic-duration: 35s;
}

.home-screen {
    position: fixed;
    inset: 0;
    z-index: 40;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    /*
     * Semi-transparent dark veil — we animate the opacity
     * from nearly opaque to transparent over the cinematic
     * duration to reveal the universe gradually.
     */
    background: rgba(1, 2, 10, 0.99);
    animation: homeScreenFade var(--cinematic-duration) forwards;

    /* Visibility toggled by JS class */
    pointer-events: auto;

    transition:
        opacity 2.4s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 2.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes homeScreenFade {
    0% {
        background: rgba(1, 2, 10, 0.99);
    }
    20% {
        background: rgba(1, 2, 10, 0.80);
    }
    40% {
        background: rgba(1, 2, 10, 0.40);
    }
    60% {
        background: rgba(1, 2, 10, 0.15);
    }
    80% {
        background: rgba(1, 2, 10, 0.05);
    }
    100% {
        background: rgba(1, 2, 10, 0.00);
    }
}

.home-screen.is-exiting {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    /* Pause the background animation when exiting */
    animation-play-state: paused;
}


/* -----------------------------------------
   Central star glow
   The single focal point of the home screen.
----------------------------------------- */

.home-star {
    position: relative;
    z-index: 1;

    width: 3px;
    height: 3px;

    border-radius: 50%;

    background: rgba(235, 239, 255, 0.0);

    box-shadow:
        0 0 0px  0px  rgba(235, 239, 255, 0.0),
        0 0 0px  0px  rgba(200, 215, 255, 0.0),
        0 0 0px  0px  rgba(160, 185, 240, 0.0);

    /* Appears after background settles */
    opacity: 0;

    /*
     * Phase 2 animation — star slowly brightens over the darkness phase.
     * Delay gives background stars time to appear.
     */
    animation:
        homeStarAppear 5s cubic-bezier(0.22, 1, 0.36, 1) 0s forwards;
}

@keyframes homeStarAppear {
    0% {
        opacity: 0;
        background: rgba(235, 239, 255, 0.0);
        box-shadow:
            0 0 0px  0px  rgba(235, 239, 255, 0.0),
            0 0 0px  0px  rgba(200, 215, 255, 0.0),
            0 0 0px  0px  rgba(160, 185, 240, 0.0);
    }
    40% {
        opacity: 0.6;
        background: rgba(235, 239, 255, 0.5);
        box-shadow:
            0 0 2px  1px  rgba(235, 239, 255, 0.3),
            0 0 8px  3px  rgba(200, 215, 255, 0.12),
            0 0 20px 10px rgba(160, 185, 240, 0.04);
    }
    100% {
        opacity: 1;
        background: rgba(235, 239, 255, 0.96);
        box-shadow:
            0 0 5px  2px  rgba(235, 239, 255, 0.60),
            0 0 18px 8px  rgba(200, 215, 255, 0.26),
            0 0 50px 24px rgba(160, 185, 240, 0.10);
    }
}

/* While exiting: star expands and fades
 * as the universe begins to appear beneath.
 */
.home-screen.is-exiting .home-star {
    animation:
        homeStarExit 1.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes homeStarExit {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    60% {
        transform: scale(6);
        opacity: 0.8;
        box-shadow:
            0 0 18px 10px rgba(235, 239, 255, 0.32),
            0 0 60px 30px rgba(200, 215, 255, 0.16),
            0 0 120px 60px rgba(160, 185, 240, 0.07);
    }
    100% {
        transform: scale(12);
        opacity: 0;
    }
}


/* -----------------------------------------
   Copy block — centred below the star
----------------------------------------- */

.home-copy {
    position: relative;
    z-index: 1;

    margin-top: 52px;

    text-align: center;

    /* Appears after star begins glowing */
    opacity: 0;
    transform: translateY(8px);

    animation:
        homeCopyIn 2.0s cubic-bezier(0.22, 1, 0.36, 1) 5s forwards;
}

@keyframes homeCopyIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.home-screen.is-exiting .home-copy {
    opacity: 0;
    transition: opacity 0.6s ease;
}


/* -----------------------------------------
   Main line
----------------------------------------- */

.home-headline {
    font-family:
        Georgia,
        "Times New Roman",
        serif;

    font-size: clamp(18px, 2.8vw, 28px);
    font-weight: 400;
    line-height: 1.55;

    letter-spacing: 0.01em;

    color: rgba(225, 230, 250, 0.82);

    /* Preserve the two-line break in markup */
    white-space: pre-line;
}


/* -----------------------------------------
   ENTER control
   Appears last — after headline is visible.
----------------------------------------- */

.home-enter {
    margin-top: 44px;

    display: inline-flex;
    align-items: center;
    gap: 10px;

    /* Appears after the headline */
    opacity: 0;
    transform: translateY(5px);

    animation:
        homeEnterIn 2.0s cubic-bezier(0.22, 1, 0.36, 1) 10s forwards,
        homeEnterPulse 3s ease-in-out 12s infinite;
}

@keyframes homeEnterIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes homeEnterPulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0.8;
    }
}

.home-screen.is-exiting .home-enter {
    opacity: 0;
    transition: opacity 0.4s ease;
}


/* -----------------------------------------
   ENTER button — minimal, text-only feel
----------------------------------------- */

.home-enter-btn {
    /* Reset */
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;

    display: inline-flex;
    align-items: center;
    gap: 10px;

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.28em;
    text-transform: uppercase;

    color: rgba(180, 192, 215, 0.45);

    user-select: none;
    -webkit-user-select: none;

    transition:
        color 0.4s ease,
        opacity 0.4s ease;
}

.home-enter-btn:hover {
    color: rgba(225, 230, 250, 0.82);
}


/* Small horizontal rule flanking the text */

.home-enter-rule {
    display: block;
    width: 28px;
    height: 1px;
    background: rgba(180, 192, 215, 0.22);
    transition: width 0.4s ease, background 0.4s ease;
}

.home-enter-btn:hover .home-enter-rule {
    width: 40px;
    background: rgba(180, 192, 215, 0.45);
}


/* -----------------------------------------
   Responsive — stays centred on all sizes
----------------------------------------- */

@media (max-width: 480px) {

    .home-headline {
        font-size: clamp(16px, 5vw, 22px);
        padding: 0 28px;
    }

    .home-copy {
        margin-top: 40px;
    }

    .home-enter {
        margin-top: 36px;
    }
}