/* ========================================
   ADVANCED ANIMATIONS & EFFECTS CSS
   ======================================== */

/* ========================================
   1. GLITCH EFFECT
   ======================================== */

.glitch-active {
    animation: glitch 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
    position: relative;
}

.glitch-active::before,
.glitch-active::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch-active::before {
    animation: glitch-1 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
    color: #fff;
    z-index: -1;
}

.glitch-active::after {
    animation: glitch-2 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
    color: #fff;
    z-index: -2;
}

@keyframes glitch {

    0%,
    100% {
        transform: translate(0);
    }

    20% {
        transform: translate(-2px, 2px);
    }

    40% {
        transform: translate(-2px, -2px);
    }

    60% {
        transform: translate(2px, 2px);
    }

    80% {
        transform: translate(2px, -2px);
    }
}

@keyframes glitch-1 {

    0%,
    100% {
        transform: translate(0);
        opacity: 0.8;
    }

    20% {
        transform: translate(2px, -2px);
    }

    40% {
        transform: translate(-2px, 2px);
    }

    60% {
        transform: translate(2px, 2px);
    }

    80% {
        transform: translate(-2px, -2px);
    }
}

@keyframes glitch-2 {

    0%,
    100% {
        transform: translate(0);
        opacity: 0.8;
    }

    20% {
        transform: translate(-3px, 3px);
    }

    40% {
        transform: translate(3px, -3px);
    }

    60% {
        transform: translate(-3px, -3px);
    }

    80% {
        transform: translate(3px, 3px);
    }
}

/* ========================================
   2. GRADIENT SPOTLIGHT
   ======================================== */

.gradient-spotlight {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
    mix-blend-mode: screen;
}

/* ========================================
   3. GEOMETRIC SHAPES
   ======================================== */

.geometric-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
    overflow: hidden;
}

.geo-shape {
    position: absolute;
    opacity: 0.03;
    animation: float-geo 10s ease-in-out infinite;
}

.geo-circle {
    width: 100px;
    height: 100px;
    border: 2px solid #fff;
    border-radius: 50%;
}

.geo-square {
    width: 80px;
    height: 80px;
    border: 2px solid #fff;
    transform: rotate(45deg);
}

.geo-triangle {
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-bottom: 86px solid #fff;
}

@keyframes float-geo {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0.03;
    }

    25% {
        transform: translate(20px, -20px) rotate(90deg);
        opacity: 0.05;
    }

    50% {
        transform: translate(0, -40px) rotate(180deg);
        opacity: 0.03;
    }

    75% {
        transform: translate(-20px, -20px) rotate(270deg);
        opacity: 0.05;
    }
}

/* ========================================
   4. RIPPLE EFFECT
   ======================================== */

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: ripple-animation 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(2);
        opacity: 0;
    }
}

/* ========================================
   5. CARD FLIP EFFECT
   ======================================== */

.project-card {
    position: relative;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.project-card.flipped {
    transform: rotateY(180deg);
}

.project-card .project-content {
    backface-visibility: hidden;
}

.flip-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flip-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(180deg);
}

/* ========================================
   6. LOADING ANIMATION
   ======================================== */

.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.loader-content {
    text-align: center;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 2rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loader-text {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    animation: pulse-text 1.5s ease-in-out infinite;
}

@keyframes pulse-text {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.loader-progress {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
}

.loader-bar {
    height: 100%;
    background: linear-gradient(90deg, #fff 0%, #a3a3a3 100%);
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* ========================================
   7. DARK/LIGHT MODE TOGGLE
   ======================================== */

.theme-toggle {
    position: fixed;
    top: 100px;
    right: 2rem;
    width: 60px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.theme-toggle.light::before {
    transform: translateX(30px);
}

body.light-mode {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e5e5e5;
    --text-primary: #000000;
    --text-secondary: #404040;
    --text-muted: #737373;
    --glass-bg: rgba(0, 0, 0, 0.03);
    --glass-border: rgba(0, 0, 0, 0.15);
}

body.light-mode .bg-grid {
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
}

body.light-mode .bg-gradient {
    background: radial-gradient(circle at 20% 50%, rgba(0, 0, 0, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 0, 0, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(0, 0, 0, 0.03) 0%, transparent 50%);
}

/* ========================================
   8. STATS COUNTER ANIMATION
   ======================================== */

.stats-section {
    padding: 4rem 0;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.stat-box {
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    transform-style: preserve-3d;
}

.stat-box:hover {
    transform: translateY(-10px) translateZ(20px) rotateX(5deg);
    border-color: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.stat-number {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 0%, #a3a3a3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    font-family: 'Space Grotesk', sans-serif;
}

.stat-label {
    color: #d4d4d4;
    font-size: 1rem;
    font-weight: 500;
}

/* ========================================
   9. TIMELINE SECTION
   ======================================== */

.timeline-section {
    padding: 4rem 0;
}

.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: translateX(-50%);
}

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
}

.timeline-item:nth-child(odd) {
    flex-direction: row-reverse;
}

.timeline-content {
    width: 45%;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.timeline-content:hover {
    transform: translateY(-5px);
    border-color: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.timeline-dot {
    position: absolute;
    left: 50%;
    width: 16px;
    height: 16px;
    background: #fff;
    border: 3px solid #000;
    border-radius: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    z-index: 2;
}

.timeline-year {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
}

.timeline-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #d4d4d4;
    margin-bottom: 0.5rem;
}

.timeline-description {
    color: #a3a3a3;
    font-size: 0.95rem;
}

/* ========================================
   10. RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
    .timeline::before {
        left: 20px;
    }

    .timeline-item {
        flex-direction: column !important;
        align-items: flex-start;
        padding-left: 50px;
    }

    .timeline-content {
        width: 100%;
    }

    .timeline-dot {
        left: 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .theme-toggle {
        top: 80px;
        right: 1rem;
    }
}
/* ========================================
   11. 3D AI BRAIN CANVAS
   ======================================== */

.ai-brain-canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    pointer-events: none;
    opacity: 0.8;
}

/* ========================================
   12. FLOATING TECH ICONS
   ======================================== */

.floating-icons-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.float-tech-icon {
    position: absolute;
    font-size: 2.5rem;
    opacity: 0.3;
    animation: float3d-icon 10s ease-in-out infinite;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

@keyframes float3d-icon {
    0%, 100% {
        transform: translateZ(0) translateY(0) rotate(0deg);
    }
    50% {
        transform: translateZ(50px) translateY(-30px) rotate(10deg);
    }
}

/* ========================================
   13. CARD FLIP FACES support
   ======================================== */
.project-card {
    position: relative;
    transform-style: preserve-3d;
}

.project-card .project-content,
.project-card .project-image {
    /* Front face logic handled by z-index or default stacking */
    backface-visibility: hidden;
}

.project-card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    transform: rotateY(180deg);
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 5;
    border: 1px solid var(--glass-border);
}

.project-card-back h3 {
    margin-bottom: 1rem;
    color: var(--white);
}

.project-card-back p {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 1.5rem;
}

