/* Preloader Styles */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    /* Updated Background: Deep Radial Gradient + Subtle Grid Pattern */
    background: radial-gradient(circle at center, #1a1c29 0%, #020c1b 100%);
    background-image:
        radial-gradient(circle at center, #1a1c29 0%, #020c1b 100%),
        linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px, 40px 40px;
    /* Grid size */
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    transition: opacity 1s ease-in-out;
    /* Slower fade out */
}

#preloader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-content {
    position: relative;
    width: 300px;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* SVG Line Drawing */
.logo-path {
    fill: none;
    stroke: var(--color-primary-cyan);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 400;
    /* Arbitrary large value covering path length */
    stroke-dashoffset: 400;
    animation: drawPath 2.8s ease-out forwards;
    /* Slowed down from 2s to 3.5s */
}

.logo-base {
    fill: none;
    stroke: #ffffff;
    stroke-width: 3;
    stroke-opacity: 0.3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: drawPath 3.2s ease-out forwards;
    /* Slowed down from 2.5s to 4s */
}

@keyframes drawPath {
    to {
        stroke-dashoffset: 0;
    }
}

/* Text Scramble Container */
.loader-text {
    margin-top: 2rem;
    font-family: var(--font-primary);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: #fff;
    min-height: 2.5rem;
    text-align: center;
}

.loader-status {
    margin-top: 1rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-primary-cyan);
    opacity: 0.7;
    text-transform: uppercase;
}

/* Glitch Effect for Exit */
.glitch-anim {
    animation: glitch-skew 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
    color: red;
    /* Visual indicator of glitch */
}

@keyframes glitch-skew {
    0% {
        transform: translate(0)
    }

    20% {
        transform: translate(-2px, 2px)
    }

    40% {
        transform: translate(-2px, -2px)
    }

    60% {
        transform: translate(2px, 2px)
    }

    80% {
        transform: translate(2px, -2px)
    }

    100% {
        transform: translate(0)
    }
}