/* Title Typing Animation Styles */

.typing-container {
    display: inline-block;
    position: relative;
    min-height: 1.2em;
    line-height: 1.2;
}

.typing-text {
    display: inline;
    white-space: nowrap;
    overflow: hidden;
}

.typing-cursor {
    display: inline;
    font-weight: 100;
    color: #000;
    animation: blink 1s infinite;
    margin-left: 2px;
}

/* Cursor Animations */
@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.1);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Apply cursor animations */
.typing-cursor.blink {
    animation: blink 1s infinite;
}

.typing-cursor.pulse {
    animation: pulse 1s infinite;
}

.typing-cursor.bounce {
    animation: bounce 1s infinite;
}

/* Typing animation effect */
.typing-text.typing {
    border-right: 2px solid;
    animation: typing-blink 1s infinite;
}

@keyframes typing-blink {
    0%, 50% {
        border-color: transparent;
    }
    51%, 100% {
        border-color: currentColor;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .typing-container {
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .typing-container {
        font-size: 0.8em;
    }
}

/* RTL Support */
[dir="rtl"] .typing-container {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .typing-cursor {
    margin-left: 0;
    margin-right: 2px;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .typing-cursor {
        animation: none;
    }
    
    .typing-text.typing {
        animation: none;
        border-right: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .typing-cursor {
        color: #000;
        background-color: #fff;
        padding: 0 1px;
    }
}

/* Print styles */
@media print {
    .typing-cursor {
        display: none;
    }
    
    .typing-text {
        white-space: normal;
        overflow: visible;
    }
}

/* Focus styles for accessibility */
.typing-container:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Loading state */
.typing-container.loading .typing-text {
    opacity: 0.5;
}

.typing-container.loading .typing-cursor {
    animation: pulse 0.5s infinite;
}

/* Error state */
.typing-container.error .typing-text {
    color: #d63638;
}

.typing-container.error .typing-cursor {
    color: #d63638;
    animation: none;
}

/* Success state */
.typing-container.success .typing-text {
    color: #00a32a;
}

/* Animation presets */
.typing-container.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.typing-container.slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.typing-container.slide-down {
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.typing-container.slide-left {
    animation: slideLeft 0.5s ease-out;
}

@keyframes slideLeft {
    from {
        transform: translateX(20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.typing-container.slide-right {
    animation: slideRight 0.5s ease-out;
}

@keyframes slideRight {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Gradient text support */
.typing-text.gradient {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Glitch effect */
.typing-text.glitch {
    position: relative;
}

.typing-text.glitch::before,
.typing-text.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.typing-text.glitch::before {
    animation: glitch-1 0.5s infinite;
    color: #ff0000;
    z-index: -1;
}

.typing-text.glitch::after {
    animation: glitch-2 0.5s infinite;
    color: #00ff00;
    z-index: -2;
}

@keyframes glitch-1 {
    0%, 14%, 15%, 49%, 50%, 99%, 100% {
        transform: translate(0);
    }
    15%, 49% {
        transform: translate(-2px, 2px);
    }
}

@keyframes glitch-2 {
    0%, 20%, 21%, 62%, 63%, 99%, 100% {
        transform: translate(0);
    }
    21%, 62% {
        transform: translate(2px, -2px);
    }
}

/* Neon glow effect */
.typing-text.neon {
    color: #fff;
    text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #0073e6, 0 0 20px #0073e6, 0 0 35px #0073e6, 0 0 40px #0073e6;
    animation: neon-flicker 1.5s infinite alternate;
}

@keyframes neon-flicker {
    0%, 18%, 22%, 25%, 53%, 57%, 100% {
        text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #0073e6, 0 0 20px #0073e6, 0 0 35px #0073e6, 0 0 40px #0073e6;
    }
    20%, 24%, 55% {
        text-shadow: none;
    }
}

/* Typewriter effect */
.typing-text.typewriter {
    font-family: 'Courier New', monospace;
    border-right: 2px solid;
    white-space: nowrap;
    overflow: hidden;
    animation: typewriter 2s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink-caret {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: currentColor;
    }
}
