/* ====================================
   ADVANCED ANIMATIONS & TECH EFFECTS
   ==================================== */

/* ====================================
   Particle Canvas
   ==================================== */
#particleCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* ====================================
   Grid Background Effect
   ==================================== */
.grid-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(99, 102, 241, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 0;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(50px, 50px);
    }
}

/* ====================================
   Floating Tech Shapes
   ==================================== */
.tech-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}

.tech-shape {
    position: absolute;
    opacity: 0.15;
    animation: float 20s infinite ease-in-out;
    filter: blur(1px);
}

.tech-circle {
    width: 100px;
    height: 100px;
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    top: 20%;
    left: 10%;
    animation: float 15s infinite ease-in-out, rotate 20s infinite linear;
}

.tech-square {
    width: 80px;
    height: 80px;
    border: 3px solid var(--secondary-color);
    top: 60%;
    right: 15%;
    animation: float 18s infinite ease-in-out 2s, rotate 25s infinite linear reverse;
}

.tech-triangle {
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-bottom: 86px solid var(--primary-color);
    top: 40%;
    left: 70%;
    animation: float 22s infinite ease-in-out 1s;
}

.tech-hexagon {
    width: 60px;
    height: 35px;
    background: var(--accent-color);
    position: absolute;
    top: 80%;
    left: 30%;
    animation: float 17s infinite ease-in-out 3s, rotate 30s infinite linear;
}

.tech-hexagon:before,
.tech-hexagon:after {
    content: "";
    position: absolute;
    width: 0;
    border-left: 30px solid transparent;
    border-right: 30px solid transparent;
}

.tech-hexagon:before {
    bottom: 100%;
    border-bottom: 17px solid var(--accent-color);
}

.tech-hexagon:after {
    top: 100%;
    border-top: 17px solid var(--accent-color);
}

.tech-code {
    font-family: 'Courier New', monospace;
    font-size: 48px;
    font-weight: bold;
    color: var(--primary-color);
    opacity: 0.1;
}

.tech-code:nth-of-type(5) {
    top: 15%;
    right: 20%;
    animation: float 16s infinite ease-in-out 1.5s;
}

.tech-code:nth-of-type(6) {
    bottom: 20%;
    left: 15%;
    animation: float 19s infinite ease-in-out 2.5s;
}

.tech-binary {
    font-family: 'Courier New', monospace;
    font-size: 24px;
    color: var(--secondary-color);
    opacity: 0.12;
    top: 50%;
    right: 5%;
    animation: float 14s infinite ease-in-out 1s, binaryBlink 2s infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    25% {
        transform: translateY(-30px) translateX(20px);
    }
    50% {
        transform: translateY(-60px) translateX(-20px);
    }
    75% {
        transform: translateY(-30px) translateX(20px);
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes binaryBlink {
    0%, 100% {
        opacity: 0.12;
    }
    50% {
        opacity: 0.2;
    }
}

/* ====================================
   Glitch Effect
   ==================================== */
.glitch {
    position: relative;
    animation: glitch-main 3s infinite;
}

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

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 #ff00de;
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 #00fff9, 2px 2px #ff00de;
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim-2 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-main {
    0%, 96%, 100% {
        transform: skew(0deg);
    }
    97% {
        transform: skew(2deg);
    }
    98% {
        transform: skew(-2deg);
    }
    99% {
        transform: skew(1deg);
    }
}

@keyframes glitch-anim-1 {
    0% {
        clip: rect(67px, 9999px, 97px, 0);
    }
    25% {
        clip: rect(28px, 9999px, 140px, 0);
    }
    50% {
        clip: rect(5px, 9999px, 52px, 0);
    }
    75% {
        clip: rect(100px, 9999px, 134px, 0);
    }
    100% {
        clip: rect(42px, 9999px, 88px, 0);
    }
}

@keyframes glitch-anim-2 {
    0% {
        clip: rect(33px, 9999px, 144px, 0);
    }
    25% {
        clip: rect(88px, 9999px, 12px, 0);
    }
    50% {
        clip: rect(119px, 9999px, 75px, 0);
    }
    75% {
        clip: rect(2px, 9999px, 98px, 0);
    }
    100% {
        clip: rect(61px, 9999px, 130px, 0);
    }
}

/* ====================================
   Typing Animation
   ==================================== */
.typing-text {
    display: inline-block;
    overflow: hidden;
    border-right: 3px solid var(--primary-color);
    white-space: nowrap;
    animation: typing 3s steps(30) 1s, blink-caret 0.75s step-end infinite;
    animation-fill-mode: forwards;
    max-width: 0;
}

@keyframes typing {
    from {
        max-width: 0;
    }
    to {
        max-width: 100%;
    }
}

@keyframes blink-caret {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: var(--primary-color);
    }
}

/* ====================================
   Button Glow Effect
   ==================================== */
.btn-glow {
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

.btn-glow::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-glow:hover::before {
    width: 300px;
    height: 300px;
}

.btn-glow span,
.btn-glow i {
    position: relative;
    z-index: 1;
}

.btn-glow:hover {
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.8), 0 0 80px rgba(99, 102, 241, 0.4);
}

/* ====================================
   Button Pulse Effect
   ==================================== */
.btn-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(99, 102, 241, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

/* ====================================
   Scroll Indicator Animation
   ==================================== */
.pulse-animation {
    animation: bounce 2s infinite, pulseGlow 2s infinite;
}

.scroll-indicator p {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

@keyframes pulseGlow {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ====================================
   Fade In Up Animation
   ==================================== */
.fade-in-up {
    animation: fadeInUp 1s ease forwards;
    opacity: 0;
}

/* ====================================
   Service Card Hover Effects
   ==================================== */
.service-card {
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.service-card:hover {
    transform: translateY(-15px) scale(1.02);
}

.service-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-1);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.5s;
    border-radius: 20px;
}

.service-card:hover::after {
    opacity: 0.1;
}

/* ====================================
   Data Counter Animation
   ==================================== */
.data-counter h3 {
    font-variant-numeric: tabular-nums;
}

/* ====================================
   Portfolio Item Reveal
   ==================================== */
.portfolio-item {
    animation: scaleIn 0.6s ease forwards;
    opacity: 0;
    transform: scale(0.8);
}

@keyframes scaleIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ====================================
   Neon Border Effect
   ==================================== */
.neon-border {
    position: relative;
    border: 2px solid transparent;
}

.neon-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #00fff9, #ff00de, #00fff9);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.5s;
    z-index: -1;
    animation: neonRotate 4s linear infinite;
}

.neon-border:hover::before {
    opacity: 1;
}

@keyframes neonRotate {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(360deg);
    }
}

/* ====================================
   Matrix Rain Background (for sections)
   ==================================== */
.matrix-bg {
    position: relative;
    overflow: hidden;
}

.matrix-bg::before {
    content: "01001110 01000001 01001100 01000101 01010100 01001000";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--secondary-color);
    opacity: 0.05;
    line-height: 1.5;
    word-wrap: break-word;
    animation: matrixRain 20s linear infinite;
    z-index: 0;
}

@keyframes matrixRain {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100%);
    }
}

/* ====================================
   Holographic Effect
   ==================================== */
.holographic {
    position: relative;
    background: linear-gradient(45deg, 
        rgba(99, 102, 241, 0.1) 0%,
        rgba(16, 185, 129, 0.1) 50%,
        rgba(245, 158, 11, 0.1) 100%);
    animation: holographicShift 3s ease infinite;
}

@keyframes holographicShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* ====================================
   Text Glow Effect
   ==================================== */
.text-glow {
    text-shadow: 
        0 0 10px rgba(99, 102, 241, 0.8),
        0 0 20px rgba(99, 102, 241, 0.6),
        0 0 30px rgba(99, 102, 241, 0.4),
        0 0 40px rgba(99, 102, 241, 0.2);
    animation: textGlowPulse 2s ease-in-out infinite;
}

@keyframes textGlowPulse {
    0%, 100% {
        text-shadow: 
            0 0 10px rgba(99, 102, 241, 0.8),
            0 0 20px rgba(99, 102, 241, 0.6),
            0 0 30px rgba(99, 102, 241, 0.4);
    }
    50% {
        text-shadow: 
            0 0 20px rgba(99, 102, 241, 1),
            0 0 30px rgba(99, 102, 241, 0.8),
            0 0 40px rgba(99, 102, 241, 0.6);
    }
}

/* ====================================
   Responsive Adjustments
   ==================================== */
@media (max-width: 768px) {
    .tech-shape {
        display: none;
    }
    
    .glitch::before,
    .glitch::after {
        display: none;
    }
    
    .grid-background {
        background-size: 30px 30px;
    }
}