/* ============================================================
   TYPEWRITER EFFECT - Scroll-triggered Typing Animations
   ============================================================ */

.typewriter {
    position: relative;
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    color: var(--matrix-blue-bright, #60a5fa);
    overflow: hidden;
    white-space: nowrap;
}

/* Typing cursor */
.typewriter::after {
    content: '|';
    position: absolute;
    right: 0;
    color: var(--matrix-blue-primary, #3b82f6);
    animation: cursor-blink 0.8s step-end infinite;
    text-shadow: 0 0 5px rgba(59, 130, 246, 0.8);
}

@keyframes cursor-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Hidden state before typing starts */
.typewriter.typing-hidden {
    opacity: 0;
}

.typewriter.typing-hidden::after {
    display: none;
}

/* Active typing state */
.typewriter.typing-active::after {
    animation: cursor-blink 0.8s step-end infinite;
}

/* Completed typing - hide cursor */
.typewriter.typing-complete::after {
    display: none;
}

/* Multi-line typewriter support */
.typewriter-multiline {
    white-space: normal;
    overflow: visible;
}

.typewriter-multiline .typewriter-line {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
}

.typewriter-multiline .typewriter-line.active {
    opacity: 1;
}

/* Character reveal animation */
@keyframes char-reveal {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.typewriter-char {
    display: inline-block;
    opacity: 0;
    animation: char-reveal 0.05s forwards;
}

/* Terminal-style text for typewriter */
.terminal-typewriter {
    background: rgba(0, 0, 0, 0.7);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.3);
    font-family: 'Share Tech Mono', monospace;
    color: var(--matrix-blue-bright, #60a5fa);
    text-shadow: 0 0 5px rgba(96, 165, 250, 0.5);
    box-shadow: inset 0 0 20px rgba(59, 130, 246, 0.1);
}

.terminal-typewriter::before {
    content: '> ';
    color: var(--matrix-blue-primary, #3b82f6);
    font-weight: bold;
}

/* Glowing text for completed typing */
.typewriter-glow {
    text-shadow:
        0 0 5px rgba(96, 165, 250, 0.8),
        0 0 10px rgba(96, 165, 250, 0.6),
        0 0 15px rgba(96, 165, 250, 0.4);
}

/* Variants for different sections */
.typewriter-hero {
    font-size: clamp(1.5rem, 4vw, 3.5rem);
    line-height: 1.2;
    font-weight: 800;
}

.typewriter-section {
    font-size: clamp(1rem, 2vw, 1.2rem);
    line-height: 1.6;
}

.typewriter-subtitle {
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    font-weight: 400;
    opacity: 0.9;
}

/* Matrix-style number counter typewriter */
.typewriter-counter {
    font-family: 'Share Tech Mono', monospace;
    font-size: 3rem;
    font-weight: 800;
    color: var(--matrix-blue-neon, #00b4ff);
    text-shadow:
        0 0 10px rgba(0, 180, 255, 0.8),
        0 0 20px rgba(0, 180, 255, 0.5);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .typewriter-hero {
        font-size: 2rem;
    }

    .typewriter-section {
        font-size: 1rem;
    }

    .typewriter-counter {
        font-size: 2rem;
    }
}