/* Blue King Code - Advanced Animations */

/* Loader Styles */
.bkc-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, #1a1f3a 0%, #0a0e27 70%);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 1s cubic-bezier(0.23, 1, 0.320, 1), transform 1s cubic-bezier(0.23, 1, 0.320, 1);
}

.loader-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.loader-particles {
    width: 100%;
    height: 100%;
    opacity: 0.6;
}

.loader-content {
    text-align: center;
    z-index: 2;
    max-width: 600px;
    padding: 2rem;
}

.logo-container {
    margin-bottom: 3rem;
}

.logo-wrapper {
    display: inline-block;
    transition: all 1.5s cubic-bezier(0.23, 1, 0.320, 1);
}

.loading-text {
    margin-bottom: 3rem;
}

.loading-title {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 900;
    margin-bottom: 1rem;
    line-height: 1;
}

.title-part {
    display: inline-block;
    background: linear-gradient(45deg, var(--accent-blue), var(--electric-blue), var(--neon-purple));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: titleReveal 1.5s cubic-bezier(0.23, 1, 0.320, 1) forwards,
               gradientShift 3s ease-in-out infinite alternate;
    transform: translateY(50px);
    opacity: 0;
    margin: 0 0.2em;
}

@keyframes titleReveal {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.loading-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 300;
    letter-spacing: 0.1em;
    animation: fadeInUp 1s ease-out 1s forwards;
    opacity: 0;
}

.progress-container {
    margin-bottom: 2rem;
    animation: fadeInUp 1s ease-out 1.5s forwards;
    opacity: 0;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(100, 255, 218, 0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    margin-bottom: 1rem;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--electric-blue));
    border-radius: 2px;
    transition: width 0.3s ease-out, box-shadow 0.3s ease-out;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressShimmer 2s infinite;
}

@keyframes progressShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.progress-text span {
    font-family: var(--font-body);
}

.loading-details {
    animation: fadeInUp 1s ease-out 2s forwards;
    opacity: 1;
}

.binary-stream {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: var(--accent-blue);
    letter-spacing: 0.1em;
    opacity: 0.6;
    min-height: 1.2em;
    animation: binaryFlicker 0.1s infinite;
}

@keyframes binaryFlicker {
    0%, 95% { opacity: 0.6; }
    96%, 100% { opacity: 0.2; }
}

/* Text Scramble Effect */
.text-scramble {
    position: relative;
    display: inline-block;
}

.text-scramble::before {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    animation: scramble 0.3s ease-out forwards;
}

@keyframes scramble {
    0% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 0; }
}

/* Typewriter Effect */
.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--accent-blue);
    white-space: nowrap;
    margin: 0 auto;
    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: var(--accent-blue); }
}

/* Magnetic Button Effects */
.magnetic-btn {
    position: relative;
    display: inline-block;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.320, 1);
    cursor: pointer;
}

.magnetic-btn::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: radial-gradient(circle, rgba(100, 255, 218, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.magnetic-btn:hover::before {
    opacity: 1;
    animation: magneticPulse 1s ease-in-out infinite;
}

@keyframes magneticPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Enhanced Scroll Animations */
.scroll-reveal {
    opacity: 0;
    transform: translateY(60px);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.320, 1);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.scroll-reveal-left {
    opacity: 0;
    transform: translateX(-60px);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.320, 1);
}

.scroll-reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.scroll-reveal-right {
    opacity: 0;
    transform: translateX(60px);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.320, 1);
}

.scroll-reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* Stagger animation for multiple elements */
.stagger-item {
    animation-delay: calc(var(--stagger-delay, 0) * 0.1s);
}

/* Matrix Rain Effect */
.matrix-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 1s ease;
}

.matrix-rain.active {
    opacity: 0.8;
}

/* Easter Egg Konami Animation */
.konami-activated {
    animation: konamiGlow 2s ease-in-out infinite alternate;
}

@keyframes konamiGlow {
    from {
        filter: hue-rotate(0deg) saturate(1) brightness(1);
    }
    to {
        filter: hue-rotate(180deg) saturate(1.5) brightness(1.2);
    }
}

/* Advanced Particle Effects */
@keyframes particleFloat {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0;
    }
    10%, 90% {
        opacity: 1;
    }
    50% {
        transform: translate(-20px, -100px) rotate(180deg);
    }
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-blue);
    border-radius: 50%;
    pointer-events: none;
    animation: particleFloat 4s linear infinite;
}

/* Glitch Text Effect */
.glitch {
    position: relative;
    color: var(--text-primary);
    font-size: 2rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    animation: glitchText 2s linear infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0.8;
}

.glitch::before {
    animation: glitchBefore 0.3s linear infinite;
    color: #ff0080;
    z-index: -1;
}

.glitch::after {
    animation: glitchAfter 0.3s linear infinite;
    color: #00ffff;
    z-index: -2;
}

@keyframes glitchText {
    0%, 95%, 100% {
        transform: translate(0);
    }
    96% {
        transform: translate(-2px, 0);
    }
    97% {
        transform: translate(2px, 0);
    }
    98% {
        transform: translate(-1px, 0);
    }
    99% {
        transform: translate(1px, 0);
    }
}

@keyframes glitchBefore {
    0%, 95%, 100% {
        transform: translate(0);
    }
    96% {
        transform: translate(-2px, 0);
    }
    97% {
        transform: translate(2px, 0);
    }
}

@keyframes glitchAfter {
    0%, 95%, 100% {
        transform: translate(0);
    }
    96% {
        transform: translate(2px, 0);
    }
    97% {
        transform: translate(-2px, 0);
    }
}

/* Hologram Effect */
.hologram {
    position: relative;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    background-size: 200% 200%;
    animation: hologramScan 3s linear infinite;
}

.hologram::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 2px,
        rgba(100, 255, 218, 0.1) 2px,
        rgba(100, 255, 218, 0.1) 4px
    );
    animation: hologramLines 0.1s linear infinite;
}

@keyframes hologramScan {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 200%; }
}

@keyframes hologramLines {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* Data Flow Animation */
.data-flow {
    position: relative;
    overflow: hidden;
}

.data-flow::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(100, 255, 218, 0.4), transparent);
    animation: dataFlow 2s linear infinite;
}

@keyframes dataFlow {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Performance optimizations */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .text-scramble,
    .typewriter,
    .glitch,
    .hologram,
    .matrix-rain {
        animation: none;
    }
}