/* Matrix Glitch Text Styles */
.matrix-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.matrix-text {
    color: #fff;
    font-size: 80px;
    font-family: 'Fira Code', 'Courier New', monospace;
    position: relative;
    z-index: 2;
    cursor: pointer;
    user-select: none;
    text-align: center;
    line-height: 1;
    /* Default state (after typing) has the glow animation */
    animation: glow 1.5s infinite alternate;
}

/* While typing, remove complex animations but keep a strong static glow */
.matrix-text.typing {
    animation: none;
    text-shadow: 0 0 20px #00aeff, 0 0 40px #00aeff, 0 0 60px #00aeff;
}

.matrix-text::before {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    animation: glitch 2s infinite, glow 1.5s infinite alternate;
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
    transform: translate(-2px, -2px);
    opacity: 0.8;
    color: #fff;
    z-index: -1;
}

.matrix-text.typing::before {
    display: none;
}

@keyframes glitch {

    0%,
    100% {
        clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
        transform: translate(0);
    }

    33% {
        clip-path: polygon(0 0, 100% 0, 100% 15%, 0 15%);
        transform: translate(-5px, -5px);
    }

    66% {
        clip-path: polygon(0 85%, 100% 85%, 100% 100%, 0 100%);
        transform: translate(5px, 5px);
    }
}

@keyframes glow {
    0% {
        text-shadow:
            0 0 10px #ff005e,
            0 0 20px #ff005e,
            0 0 40px #ff005e,
            0 0 80px #ff005e,
            0 0 120px #ff005e;
    }

    100% {
        text-shadow:
            0 0 20px #00aeff,
            0 0 40px #00aeff,
            0 0 80px #00aeff,
            0 0 150px #00aeff,
            0 0 300px #00aeff;
    }
}

/* Box shadow equivalent of the text glow for the cursor block */
@keyframes cursor-glow {
    0% {
        box-shadow: 0 0 10px #ff005e, 0 0 20px #ff005e, 0 0 40px #ff005e, 0 0 80px #ff005e, 0 0 120px #ff005e;
        background-color: #fff;
    }

    100% {
        box-shadow: 0 0 20px #00aeff, 0 0 40px #00aeff, 0 0 80px #00aeff, 0 0 150px #00aeff, 0 0 300px #00aeff;
        background-color: #fff;
    }
}

@keyframes cursor-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.cursor-vertical {
    display: inline-block;
    height: 0.82em;
    width: 25px;
    background-color: #fff;
    margin-left: 2px;
    vertical-align: baseline;
    position: relative;
    transform: translateY(2px);

    /* Combined animations: Glow (synced with text) AND Blink */
    animation: cursor-glow 1.5s infinite alternate, cursor-blink 1s step-end infinite;
}

/* When typing, keep blinking but remove color cycle to match static text */
.matrix-text.typing .cursor-vertical {
    animation: cursor-blink 1s step-end infinite;
    box-shadow: 0 0 20px #00aeff, 0 0 40px #00aeff, 0 0 60px #00aeff;
}

@media (max-width: 768px) {
    .matrix-text {
        font-size: 40px;
    }
}