/* =============================================
   ULTRA MEGA UPGRADE — ADDITIONS CSS
   Matrix Loader | Glitch | Cursor | Tilt | GSAP
   Morphing BG | Confetti | Scroll Progress
   ============================================= */

/* EPIC LOADING SCREEN OVERRIDES */
.loader {
    background: #000510 !important;
    overflow: hidden;
}

.loader.hidden { opacity: 0 !important; visibility: hidden !important; pointer-events: none !important; }

.matrix-canvas {
    position: absolute;
    inset: 0;
    opacity: 0.3;
    z-index: 0;
    width: 100% !important;
    height: 100% !important;
}

.loader-content {
    position: relative;
    z-index: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 24px !important;
    text-align: center !important;
    background: none !important;
}

.loader-glitch-wrapper { position: relative; }

.loader-logo {
    font-family: 'JetBrains Mono', monospace !important;
    font-size: clamp(2.5rem, 6vw, 5rem) !important;
    font-weight: 800 !important;
    color: #fff !important;
    letter-spacing: 4px !important;
    position: relative !important;
    text-shadow: 0 0 20px rgba(99,102,241,0.8), 0 0 40px rgba(99,102,241,0.4) !important;
    animation: loader-pulse 2s ease-in-out infinite !important;
    background: none !important;
    -webkit-text-fill-color: unset !important;
}

.loader-logo .logo-bracket { color: #06b6d4 !important; }
.loader-logo .logo-slash { color: #8b5cf6 !important; }
.loader-logo-main { color: #fff !important; }

.loader-logo.glitch-text::before,
.loader-logo.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    background: none;
    -webkit-text-fill-color: initial;
}

.loader-logo.glitch-text::before {
    animation: glitch-1 3s infinite linear;
    color: #06b6d4;
    clip-path: polygon(0 30%, 100% 30%, 100% 50%, 0 50%);
    text-shadow: none; opacity: 0.8;
}

.loader-logo.glitch-text::after {
    animation: glitch-2 3s infinite linear;
    color: #ec4899;
    clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%);
    text-shadow: none; opacity: 0.8;
}

@keyframes glitch-1 {
    0%, 90%, 100% { transform: translateX(0); opacity: 0; }
    91% { transform: translateX(-4px); opacity: 0.8; }
    93% { transform: translateX(4px); opacity: 0.8; }
    95% { transform: translateX(-2px); opacity: 0.8; }
    97% { transform: translateX(0); opacity: 0; }
}
@keyframes glitch-2 {
    0%, 85%, 100% { transform: translateX(0); opacity: 0; }
    86% { transform: translateX(4px); opacity: 0.8; }
    88% { transform: translateX(-4px); opacity: 0.8; }
    90% { transform: translateX(2px); opacity: 0.8; }
    92% { transform: translateX(0); opacity: 0; }
}
@keyframes loader-pulse {
    0%, 100% { text-shadow: 0 0 20px rgba(99,102,241,0.8), 0 0 40px rgba(99,102,241,0.4); }
    50% { text-shadow: 0 0 30px rgba(99,102,241,1), 0 0 60px rgba(139,92,246,0.6), 0 0 80px rgba(99,102,241,0.2); }
}

.loader-status-line {
    display: flex; align-items: center; gap: 8px;
    font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; color: #06b6d4;
}
.loader-cursor-blink { animation: loader-blink 0.8s step-end infinite; color: #10b981; }
@keyframes loader-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.loader-bar {
    position: relative !important;
    width: min(400px, 80vw) !important;
    height: 3px !important;
    background: rgba(255,255,255,0.08) !important;
    border-radius: 10px !important;
    overflow: visible !important;
}
.loader-progress {
    height: 100% !important; width: 0%; border-radius: 10px !important;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #06b6d4) !important;
    transition: width 0.1s linear !important; position: relative !important;
}
.loader-progress::after {
    content: ''; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
    width: 8px; height: 8px; border-radius: 50%; background: #fff;
    box-shadow: 0 0 10px #8b5cf6, 0 0 20px #6366f1;
}
.loader-progress-glow {
    position: absolute; top: 50%; left: 0; right: 0; height: 20px;
    transform: translateY(-50%);
    background: linear-gradient(90deg, transparent, rgba(99,102,241,0.2), transparent);
    filter: blur(8px); pointer-events: none;
}
.loader-percent {
    font-family: 'JetBrains Mono', monospace; font-size: 0.75rem;
    color: rgba(255,255,255,0.4); letter-spacing: 2px;
}
.loader-hex-grid {
    display: grid; grid-template-columns: repeat(3, 12px); gap: 4px; margin-top: 8px;
}
.hex-cell {
    width: 12px; height: 12px; border: 1px solid rgba(99,102,241,0.2); border-radius: 2px;
    animation: hex-idle 2s ease-in-out infinite;
}
.hex-cell.active {
    background: rgba(99,102,241,0.4); border-color: rgba(99,102,241,0.8);
    box-shadow: 0 0 6px rgba(99,102,241,0.6); animation: hex-active 1s ease-in-out infinite;
}
@keyframes hex-idle { 0%, 100% { opacity: 0.3; } 50% { opacity: 0.6; } }
@keyframes hex-active { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; box-shadow: 0 0 12px rgba(99,102,241,1); } }

/* MATRIX OVERLAY EASTER EGG */
.matrix-overlay {
    position: fixed; inset: 0; z-index: 99999; display: none;
    pointer-events: all; background: #000;
}
.matrix-overlay.active { display: block; }
.matrix-close-hint {
    position: fixed; bottom: 30px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0,255,70,0.1); border: 1px solid rgba(0,255,70,0.4);
    color: #00ff46; font-family: 'JetBrains Mono', monospace; font-size: 0.8rem;
    padding: 10px 20px; border-radius: 4px; z-index: 999999; opacity: 0;
    transition: all 0.5s ease; pointer-events: none; letter-spacing: 2px;
    white-space: nowrap;
}
.matrix-close-hint.active { opacity: 1; transform: translateX(-50%) translateY(0); }

/* SCROLL PROGRESS BAR */
.scroll-progress-bar {
    position: fixed; top: 0; left: 0; width: 0%; height: 2px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #06b6d4, #ec4899);
    z-index: 10000; box-shadow: 0 0 8px rgba(99,102,241,0.8);
    transition: width 0.1s linear;
}

/* CURSOR ENHANCED */
#cursor {
    position: fixed; width: 8px; height: 8px; background: #fff !important; border-radius: 50%;
    pointer-events: none; z-index: 99999; transform: translate(-50%, -50%);
    transition: width 0.25s ease, height 0.25s ease, background 0.25s ease, border-radius 0.25s ease;
    mix-blend-mode: difference;
}
#cursorFollower {
    position: fixed; width: 36px; height: 36px;
    border: 1.5px solid rgba(99,102,241,0.7); border-radius: 50%;
    pointer-events: none; z-index: 99998; transform: translate(-50%, -50%);
    transition: width 0.35s ease, height 0.35s ease, border-color 0.35s ease, border-radius 0.35s ease, background 0.35s ease;
}

/* Cursor states */
body.cursor-link #cursor { width: 6px; height: 6px; background: #6366f1 !important; }
body.cursor-link #cursorFollower { width: 56px; height: 56px; border-color: #6366f1; background: rgba(99,102,241,0.06); }
body.cursor-button #cursor { width: 10px; height: 10px; background: #fff !important; }
body.cursor-button #cursorFollower { width: 64px; height: 64px; border-color: #8b5cf6; background: rgba(139,92,246,0.08); border-width: 2px; }
body.cursor-text #cursor { width: 3px; height: 24px; border-radius: 2px; background: #06b6d4 !important; }
body.cursor-text #cursorFollower { width: 40px; height: 40px; border-color: #06b6d4; }
body.cursor-image #cursor { width: 12px; height: 12px; border-radius: 3px; background: rgba(255,255,255,0.9) !important; }
body.cursor-image #cursorFollower { width: 70px; height: 70px; border-style: dashed; border-color: rgba(255,255,255,0.4); }

/* CURSOR TRAIL PARTICLES */
.cursor-trail-particle {
    position: fixed; border-radius: 50%; pointer-events: none; z-index: 99990;
    transform: translate(-50%, -50%); animation: trail-fade 0.6s ease-out forwards;
}
@keyframes trail-fade {
    0% { opacity: 0.7; transform: translate(-50%,-50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%,-50%) scale(0); }
}

/* SECTION ATMOSPHERIC BACKGROUNDS */
.services-section {
    background: radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.06) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 50%, rgba(139,92,246,0.04) 0%, transparent 60%);
}
.skills-section {
    background: radial-gradient(ellipse at 50% 30%, rgba(6,182,212,0.07) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 80%, rgba(16,185,129,0.04) 0%, transparent 50%);
}
.portfolio-section {
    background: radial-gradient(ellipse at 30% 60%, rgba(236,72,153,0.05) 0%, transparent 55%),
                radial-gradient(ellipse at 70% 30%, rgba(245,158,11,0.04) 0%, transparent 50%);
}
.contact-section {
    background: radial-gradient(ellipse at 50% 50%, rgba(6,182,212,0.06) 0%, transparent 60%);
}

/* FLOATING TAG ANIMATIONS */
.floating-tag { animation: float-tag 4s ease-in-out infinite !important; }
.tag-1 { animation-delay: 0s !important; }
.tag-2 { animation-delay: 1s !important; }
.tag-3 { animation-delay: 2s !important; }
.tag-4 { animation-delay: 3s !important; }
@keyframes float-tag {
    0%, 100% { transform: translateY(0px) rotate(-2deg); }
    50% { transform: translateY(-14px) rotate(2deg); }
}

/* HERO HIGHLIGHT UNDERLINE GLOW */
.hero-highlight { position: relative; display: inline-block; }
.hero-highlight::after {
    content: ''; position: absolute; bottom: -4px; left: 0; width: 100%; height: 3px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #06b6d4); border-radius: 2px;
    animation: underline-pulse 3s ease-in-out infinite;
}
@keyframes underline-pulse {
    0%, 100% { opacity: 0.6; transform: scaleX(1); }
    50% { opacity: 1; transform: scaleX(1.03); }
}

/* STATS GLOW */
.stat-number {
    background: linear-gradient(135deg, #fff 0%, #06b6d4 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    filter: drop-shadow(0 0 10px rgba(6,182,212,0.4));
}

/* ENHANCED SKILL BARS */
.skill-item:hover { transform: translateX(8px) !important; box-shadow: -4px 0 0 #6366f1, 4px 0 20px rgba(99,102,241,0.2) !important; }
.skill-bar { position: relative; overflow: hidden; }
.skill-bar::after {
    content: ''; position: absolute; top: 0; left: -100%; width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
    animation: skill-shimmer 3s ease-in-out 1.5s infinite;
}
@keyframes skill-shimmer { 0% { left: -100%; } 50%, 100% { left: 150%; } }

/* ENHANCED CARDS */
.service-card, .portfolio-card, .testimonial-card { will-change: transform; }
.service-card:hover { box-shadow: 0 30px 80px rgba(99,102,241,0.25), 0 10px 30px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1) !important; }
.portfolio-card:hover { box-shadow: 0 30px 80px rgba(236,72,153,0.15), 0 10px 30px rgba(0,0,0,0.4) !important; }

/* TESTIMONIALS AUTO-SCROLL */
.testimonials-slider {
    display: flex !important; gap: 24px !important; overflow-x: auto !important;
    scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none !important; padding-bottom: 8px;
}
.testimonials-slider::-webkit-scrollbar { display: none !important; }
.testimonial-card { scroll-snap-align: start; flex: 0 0 340px; transition: transform 0.4s ease, box-shadow 0.4s ease !important; }
.testimonial-card:hover { transform: translateY(-8px) scale(1.02) !important; }

/* CONTACT FORM CELEBRATION */
.contact-form.celebrating { animation: celebrate-shake 0.5s ease; }
@keyframes celebrate-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px) rotate(-1deg); }
    40% { transform: translateX(6px) rotate(1deg); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* BACK TO TOP PULSE */
.back-to-top.visible { animation: back-pulse 2s ease-in-out infinite; }
@keyframes back-pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(99,102,241,0.4); }
    50% { box-shadow: 0 4px 30px rgba(99,102,241,0.7), 0 0 60px rgba(99,102,241,0.2); }
}

/* FOOTER LINE */
.footer { position: relative; overflow: hidden; }
.footer::before {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 60%; height: 1px;
    background: linear-gradient(90deg, transparent, #6366f1, #8b5cf6, transparent);
}

/* ORBIT RINGS */
.ring-1 { animation-duration: 8s !important; }
.ring-2 { animation-duration: 12s !important; animation-direction: reverse !important; }
.ring-3 { animation-duration: 16s !important; }

/* MAGNETIC BUTTON */
.btn { will-change: transform; }
.btn.magnetic-active { transition: transform 0.15s cubic-bezier(0.23, 1, 0.32, 1) !important; }

/* HERO AURORA */
.hero { position: relative; isolation: isolate; }
.hero-aurora {
    position: absolute; inset: -20%; z-index: -1; pointer-events: none;
    background: conic-gradient(
        from 0deg at 50% 50%,
        rgba(99,102,241,0.03) 0deg, rgba(139,92,246,0.06) 60deg,
        rgba(6,182,212,0.03) 120deg, rgba(236,72,153,0.02) 180deg,
        rgba(99,102,241,0.04) 240deg, rgba(16,185,129,0.02) 300deg,
        rgba(99,102,241,0.03) 360deg
    );
    animation: aurora-spin 30s linear infinite;
    border-radius: 50%;
}
@keyframes aurora-spin { to { transform: rotate(360deg); } }

/* GSAP INITIAL STATES */
.gsap-ready .service-card,
.gsap-ready .portfolio-card {
    opacity: 0;
    transform: translateY(50px);
}

/* NAV ENHANCED */
.nav-link { position: relative; }
.nav-link.active::after { box-shadow: 0 0 8px rgba(99,102,241,0.8); }

/* MOBILE ADJUSTMENTS */
@media (max-width: 768px) {
    .loader-logo { font-size: 2rem !important; }
    .testimonial-card { flex: 0 0 280px; }
    .matrix-close-hint { font-size: 0.7rem; padding: 8px 14px; }
}
