/*
 * VibeCreAI Animations
 * All keyframe animations and transition effects
 */

/* Loading Cursor Animation */
.loading-cursor {
    animation: blinkCursor 1s infinite;
}

@keyframes blinkCursor {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

/* Hero Title Hover Effects */
.hero-title .glitch-text {
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-title .glitch-text:hover {
    text-shadow: 
        0 0 20px color-mix(in srgb, var(--primary-color) 60%, transparent),
        0 0 40px color-mix(in srgb, var(--primary-color) 40%, transparent);
    transform: translateY(-2px);
}

.hero-title .glitch-text:hover::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    animation: underlineGlow 0.6s ease-out;
}

@keyframes underlineGlow {
    0% {
        width: 0;
        left: 50%;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        width: 100%;
        left: 0;
        opacity: 0.8;
    }
}

/* Hero Subtitle Animations */
.hero-subtitle span {
    display: inline-block;
    opacity: 0;
    text-shadow: 0 0 15px color-mix(in srgb, var(--primary-color) 80%, transparent);
    animation: subtitleGlow 3s ease-in-out infinite;
}

.hero-subtitle span:nth-child(1) { animation-delay: 0s; }
.hero-subtitle span:nth-child(2) { animation-delay: 0.1s; }
.hero-subtitle span:nth-child(3) { animation-delay: 0.2s; }
.hero-subtitle span:nth-child(4) { animation-delay: 0.3s; }
.hero-subtitle span:nth-child(5) { animation-delay: 0.4s; }
.hero-subtitle span:nth-child(6) { animation-delay: 0.5s; }

@keyframes subtitleGlow {
    0%, 100% { 
        opacity: 0.8;
        text-shadow: 0 0 5px color-mix(in srgb, var(--primary-color) 50%, transparent);
        transform: scale(1);
    }
    50% { 
        opacity: 1;
        text-shadow: 
            0 0 10px var(--primary-color),
            0 0 20px color-mix(in srgb, var(--primary-color) 80%, transparent),
            0 0 30px color-mix(in srgb, var(--primary-color) 60%, transparent);
        transform: scale(1.05);
    }
}

/* Glitch Text Effects */
.glitch {
    position: relative;
    color: var(--text-color);
    font-size: 6rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    animation: glitch-1 0.5s infinite;
    color: var(--primary-color);
    z-index: -1;
}

.glitch::after {
    animation: glitch-2 0.5s infinite;
    color: var(--secondary-color);
    z-index: -2;
}

@keyframes glitch-1 {
    0%, 100% {
        clip-path: inset(0 0 0 0);
        transform: translate(0);
    }
    20% {
        clip-path: inset(20% 0 30% 0);
        transform: translate(-2px, 2px);
    }
    40% {
        clip-path: inset(50% 0 20% 0);
        transform: translate(2px, -2px);
    }
    60% {
        clip-path: inset(10% 0 60% 0);
        transform: translate(-2px, 1px);
    }
    80% {
        clip-path: inset(70% 0 10% 0);
        transform: translate(2px, -1px);
    }
}

@keyframes glitch-2 {
    0%, 100% {
        clip-path: inset(0 0 0 0);
        transform: translate(0);
    }
    20% {
        clip-path: inset(60% 0 10% 0);
        transform: translate(2px, -1px);
    }
    40% {
        clip-path: inset(10% 0 70% 0);
        transform: translate(-2px, 2px);
    }
    60% {
        clip-path: inset(30% 0 40% 0);
        transform: translate(1px, -2px);
    }
    80% {
        clip-path: inset(40% 0 30% 0);
        transform: translate(-1px, 2px);
    }
}

/* Section Title Hover Effects */
.section-title:hover, .section-title.is-touch-highlight {
    text-shadow:
        -1px 1px 0 #252525,
        -2px 2px 0 #252525,
        -3px 3px 0 #252525,
        -4px 4px 0 #252525,
        -5px 5px 0 #252525,
        -6px 6px 0 #252525,
        -7px 7px 0 #252525,
        -8px 8px 0 #252525,
        -9px 9px 0 #252525,
        -10px 10px 20px rgba(37, 37, 37, 0.5),
        0 0 20px color-mix(in srgb, var(--primary-color) 80%, transparent),
        0 0 40px color-mix(in srgb, var(--primary-color) 60%, transparent),
        0 0 60px color-mix(in srgb, var(--primary-color) 40%, transparent);
    transform: translateY(-3px) scale(1.02);
}

.section-title:hover::after, .section-title.is-touch-highlight::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    animation: titleUnderlineGlow 0.8s ease-out forwards;
    border-radius: 2px;
}

@keyframes titleUnderlineGlow {
    0% {
        width: 0;
        opacity: 0;
        box-shadow: 0 0 10px color-mix(in srgb, var(--primary-color) 50%, transparent);
    }
    50% {
        opacity: 1;
        box-shadow: 
            0 0 20px color-mix(in srgb, var(--primary-color) 80%, transparent),
            0 0 40px color-mix(in srgb, var(--primary-color) 60%, transparent);
    }
    100% {
        width: 80%;
        opacity: 0.9;
        box-shadow: 
            0 0 15px color-mix(in srgb, var(--primary-color) 70%, transparent),
            0 0 30px color-mix(in srgb, var(--primary-color) 50%, transparent);
    }
}

/* Status Badge Animation */
.status-badge {
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 20px rgba(0, 255, 255, 0.6);
    }
}

/* Floating Action Button Entrance */
.vibe-switcher {
    animation: fabEntrance 0.6s ease-out;
}

@keyframes fabEntrance {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* FAB Pulse Animation */
@keyframes fabPulse {
    0%, 100% {
        box-shadow: 
            0 4px 12px rgba(0, 255, 255, 0.3),
            0 2px 4px rgba(0, 0, 0, 0.2),
            0 0 0 0 rgba(0, 255, 255, 0.4);
    }
    50% {
        box-shadow: 
            0 4px 12px rgba(0, 255, 255, 0.3),
            0 2px 4px rgba(0, 0, 0, 0.2),
            0 0 0 15px rgba(0, 255, 255, 0);
    }
}

.vibe-switcher.pulse {
    animation: fabPulse 2s ease-out infinite;
}

/* Rainbow Pulse Effect */
@keyframes rainbow-pulse {
    0%, 100% {
        filter: hue-rotate(0deg) brightness(1);
    }
    25% {
        filter: hue-rotate(90deg) brightness(1.1);
    }
    50% {
        filter: hue-rotate(180deg) brightness(1.2);
    }
    75% {
        filter: hue-rotate(270deg) brightness(1.1);
    }
}

/* Logo Hover Effects */
.logo:hover {
    transform: translateY(-2px) scale(1.05);
    text-shadow: 
        0 0 15px color-mix(in srgb, var(--primary-color) 80%, transparent),
        0 0 30px color-mix(in srgb, var(--primary-color) 60%, transparent);
}

.logo:hover .logo-ai {
    text-shadow: 
        0 0 20px var(--primary-color),
        0 0 40px color-mix(in srgb, var(--primary-color) 80%, transparent),
        0 0 60px color-mix(in srgb, var(--primary-color) 60%, transparent);
}

.logo:hover::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    animation: logoUnderlineGlow 0.6s ease-out;
    border-radius: 1px;
}

@keyframes logoUnderlineGlow {
    0% {
        width: 0;
        left: 50%;
        opacity: 0;
        box-shadow: 0 0 10px color-mix(in srgb, var(--primary-color) 50%, transparent);
    }
    50% {
        opacity: 1;
        box-shadow: 
            0 0 15px color-mix(in srgb, var(--primary-color) 80%, transparent),
            0 0 25px color-mix(in srgb, var(--primary-color) 60%, transparent);
    }
    100% {
        width: 100%;
        left: 0;
        opacity: 0.9;
        box-shadow: 
            0 0 12px color-mix(in srgb, var(--primary-color) 70%, transparent),
            0 0 20px color-mix(in srgb, var(--primary-color) 50%, transparent);
    }
}

/* Mobile Menu Animations */
.menu-toggle span::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--secondary-color);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu-toggle:hover span::after {
    opacity: 0.6;
    animation: neonPulse 0.6s ease-in-out;
}

@keyframes neonPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Terminal Animations */
.terminal-line {
    margin: 0;
    padding: 1px 0;
    opacity: 0;
    animation: terminalFadeIn 0.3s ease-out forwards;
    text-align: left;
}

@keyframes terminalFadeIn {
    to {
        opacity: 1;
    }
}

.terminal-line:nth-child(1) { animation-delay: 0.1s; }
.terminal-line:nth-child(2) { animation-delay: 0.2s; }
.terminal-line:nth-child(3) { animation-delay: 0.3s; }
.terminal-line:nth-child(4) { animation-delay: 0.4s; }
.terminal-line:nth-child(5) { animation-delay: 0.5s; }
.terminal-line:nth-child(6) { animation-delay: 0.6s; }
.terminal-line:nth-child(7) { animation-delay: 0.7s; }
.terminal-line:nth-child(8) { animation-delay: 0.8s; }
.terminal-line:nth-child(9) { animation-delay: 0.9s; }
.terminal-line:nth-child(10) { animation-delay: 1.0s; }

.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 14px;
    background: #ffffff;
    animation: blink 1s infinite;
    margin-left: 2px;
    vertical-align: text-bottom;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* Shuffle Text Animation Styles */
.shuffle-char {
    display: inline-block;
    overflow: hidden;
    vertical-align: baseline;
    position: relative;
}

.shuffle-char .shuffle-inner {
    display: inline-block;
    white-space: nowrap;
    will-change: transform;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Logo Shuffle Effect Optimizations */
.glitch-text .shuffle-char {
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    color: inherit;
}

/* Ensure smooth animations for shuffle effect */
.shuffle-char,
.shuffle-char .shuffle-inner,
.shuffle-char .shuffle-inner span {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
}

/* Performance optimizations for shuffle animation */
@media (prefers-reduced-motion: reduce) {
    .shuffle-char .shuffle-inner {
        transition: none;
        animation: none;
    }
}

/* True Focus Effect Styles */
.focus-container {
    position: relative;
    display: inline-block;
    font-family: 'Born2bSportyFont', 'MinecraftFont', 'Courier New', monospace;
}

.focus-word {
    display: inline-block;
    transition: filter 0.6s ease;
    filter: blur(5px);
    opacity: 0.4;
}

.focus-word.focused {
    filter: blur(0px);
    opacity: 1;
}

.focus-frame {
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    pointer-events: none;
    transition: all 0.6s ease;
    opacity: 0;
}

.focus-frame.active {
    opacity: 1;
}

.focus-frame .corner {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid var(--primary-color);
}

.focus-frame .corner.top-left {
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: none;
}

.focus-frame .corner.top-right {
    top: 0;
    right: 0;
    border-left: none;
    border-bottom: none;
}

.focus-frame .corner.bottom-left {
    bottom: 0;
    left: 0;
    border-right: none;
    border-top: none;
}

.focus-frame .corner.bottom-right {
    bottom: 0;
    right: 0;
    border-left: none;
    border-top: none;
}

.focus-container,
.focus-container .focus-word,
.focus-container .focus-word.focused {
    text-shadow: none !important;
    transform: none !important;
    scale: none !important;
}

.focus-container .focus-word {
    transition: filter 0.6s ease, opacity 0.6s ease;
}

.focus-container {
    color: var(--primary-color) !important;
}
}