/* ===================================
   SNAP ACTION - Main Styles (Optimized)
   =================================== */

:root {
    --blue: #3b82f6;
    --purple: #8b5cf6;
    --cyan: #06b6d4;
}

/* --- Base Styles --- */
body {
    background-color: #050505;
    color: #ffffff;
    cursor: none;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    min-height: 100vh;
}

/* --- Ambient Glow Background (Optimized) --- */
.ambient-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    /* GPU acceleration */
    transform: translateZ(0);
    will-change: transform;
}

.glow-orb-1,
.glow-orb-2,
.glow-orb-3,
.glow-orb-4 {
    position: absolute;
    border-radius: 50%;
    /* Use transform for animations instead of filter changes */
    will-change: transform, opacity;
    /* Reduce blur for performance */
    filter: blur(60px);
}

.glow-orb-1 {
    top: -10%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.3) 0%, transparent 70%);
    animation: pulse1 10s ease-in-out infinite;
}

.glow-orb-2 {
    top: 40%;
    right: -15%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.25) 0%, transparent 70%);
    animation: pulse2 12s ease-in-out infinite;
}

.glow-orb-3 {
    bottom: -20%;
    left: 20%;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.2) 0%, transparent 70%);
    animation: pulse3 14s ease-in-out infinite;
}

.glow-orb-4 {
    top: 60%;
    left: -5%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.2) 0%, transparent 60%);
    animation: pulse1 16s ease-in-out infinite reverse;
}

/* Simplified animations - only transform, no filter changes */
@keyframes pulse1 {
    0%, 100% { opacity: 0.6; transform: scale(1) translateZ(0); }
    50% { opacity: 0.9; transform: scale(1.1) translateZ(0); }
}

@keyframes pulse2 {
    0%, 100% { opacity: 0.5; transform: scale(1) translateX(0) translateZ(0); }
    50% { opacity: 0.8; transform: scale(1.05) translateX(-20px) translateZ(0); }
}

@keyframes pulse3 {
    0%, 100% { opacity: 0.4; transform: scale(1) translateY(0) translateZ(0); }
    50% { opacity: 0.7; transform: scale(1.1) translateY(-15px) translateZ(0); }
}

/* Reduce animations on mobile */
@media (max-width: 768px) {
    .glow-orb-1, .glow-orb-2, .glow-orb-3, .glow-orb-4 {
        animation: none;
        filter: blur(40px);
    }
    .glow-orb-1 { width: 300px; height: 300px; }
    .glow-orb-2 { width: 250px; height: 250px; }
    .glow-orb-3 { width: 200px; height: 200px; }
    .glow-orb-4 { display: none; }
}

/* --- Noise Overlay (Optimized) --- */
.noise {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 90;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    /* Prevent repaints */
    transform: translateZ(0);
}

/* Hide noise on mobile for performance */
@media (max-width: 768px) {
    .noise { display: none; }
}

/* --- Custom Cursor (GPU Accelerated) --- */
.cursor-dot,
.cursor-outline {
    position: fixed;
    top: 0;
    left: 0;
    border-radius: 50%;
    z-index: 9999;
    pointer-events: none;
    /* GPU acceleration */
    will-change: transform;
    transform: translateZ(0);
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background-color: white;
}

.cursor-outline {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: width 0.2s ease-out, height 0.2s ease-out, background-color 0.2s ease-out;
}

.cursor-outline.hovered {
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.05);
    border-color: transparent;
}

/* Hide cursor on touch devices */
@media (hover: none) {
    .cursor-dot, .cursor-outline { display: none; }
    body { cursor: auto; }
}

/* --- Glow Cards (Optimized) --- */
.glow-cards-wrapper {
    position: relative;
}

.glow-card {
    position: relative;
    padding: 1px;
    border-radius: 12px;
    transition: transform 0.3s ease;
    background: transparent;
    /* GPU layer */
    transform: translateZ(0);
}

.glow-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    padding: 1px;
    background: radial-gradient(
        250px circle at var(--xPos, 50%) var(--yPos, 50%),
        var(--glow-color, rgba(139, 92, 246, 0.8)),
        transparent 60%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.glow-cards-wrapper:hover .glow-card::before {
    opacity: 1;
}

.glow-card-inner {
    position: relative;
    background: rgba(24, 24, 27, 0.8);
    border-radius: 11px;
    height: 100%;
    overflow: hidden;
}

.glow-card-inner::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    left: var(--xPos, 50%);
    top: var(--yPos, 50%);
    transform: translate(-50%, -50%) translateZ(0);
    background: radial-gradient(
        circle,
        var(--glow-color-soft, rgba(139, 92, 246, 0.12)),
        transparent 60%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.glow-cards-wrapper:hover .glow-card-inner::before {
    opacity: 1;
}

/* Card colors */
.glow-card.card-blue {
    --glow-color: rgba(59, 130, 246, 0.9);
    --glow-color-soft: rgba(59, 130, 246, 0.1);
}

.glow-card.card-blue-purple {
    --glow-color: rgba(99, 102, 241, 0.9);
    --glow-color-soft: rgba(99, 102, 241, 0.1);
}

.glow-card.card-purple {
    --glow-color: rgba(139, 92, 246, 0.9);
    --glow-color-soft: rgba(139, 92, 246, 0.1);
}

.glow-card.card-purple-cyan {
    --glow-color: rgba(168, 85, 247, 0.9);
    --glow-color-soft: rgba(168, 85, 247, 0.1);
}

.glow-card.card-cyan {
    --glow-color: rgba(6, 182, 212, 0.9);
    --glow-color-soft: rgba(6, 182, 212, 0.1);
}

.glow-card:hover {
    transform: translateY(-5px) translateZ(0);
}

.glow-card-content {
    position: relative;
    z-index: 2;
    padding: 2rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Disable glow effects on mobile */
@media (max-width: 768px) {
    .glow-card::before,
    .glow-card-inner::before {
        display: none;
    }
    .glow-card-inner {
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* --- Loader --- */
.loader-screen {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.progress-bar {
    width: 200px;
    height: 2px;
    background: #222;
    margin-top: 20px;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 0%;
    background: #fff;
    will-change: width;
}

/* --- Creature Animation (Optimized) --- */
#creature-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    pointer-events: none;
    overflow: hidden;
    /* GPU layer */
    transform: translateZ(0);
}

#creature {
    font-size: .15vh;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 90em;
    height: 90em;
    flex-wrap: wrap;
}

#creature div {
    transform-style: preserve-3d;
    position: relative;
    width: 3.5em;
    height: 3.5em;
    margin: 2.5em;
    border-radius: 2em;
    will-change: transform;
    mix-blend-mode: plus-lighter;
    background: var(--blue);
    /* Contain paint */
    contain: layout style paint;
}

/* Hide creature on mobile */
@media (max-width: 768px) {
    #creature-wrapper { display: none; }
}

/* --- Hero SVG Text --- */
.hero-title {
    width: 100%;
    max-width: 80rem;
}

.hero-svg-text {
    font-family: 'Clash Display', system-ui, sans-serif;
    font-size: 56px;
    font-weight: 500;
    letter-spacing: -0.05em;
    paint-order: stroke fill;
}

/* --- Floating Liquid Glass Navbar --- */
.glass-nav {
    width: auto;
    max-width: 95vw;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 50%, rgba(255, 255, 255, 0.1) 100%);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: background 0.3s ease, border-color 0.3s ease;
    /* Fix RTL centering - use left/right instead of transform */
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) translateZ(0);
}

@media (min-width: 768px) {
    .glass-nav { min-width: 800px; }
}

@media (max-width: 767px) {
    .glass-nav {
        width: calc(100% - 32px);
        border-radius: 25px;
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
}

.glass-nav:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.15) 100%);
    border-color: rgba(255, 255, 255, 0.25);
}

/* --- Respect reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .glow-orb-1, .glow-orb-2, .glow-orb-3, .glow-orb-4 {
        animation: none;
    }
    
    #creature-wrapper {
        display: none;
    }
}

/* --- Neuro Canvas Animation (Contact Section) --- */
#neuro-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.3;
    z-index: 0;
}

/* --- Aurora Effect (Hero Section Top) --- */
.aurora {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(89.54% 168.76% at 50% -40%, 
        rgba(139, 92, 246, 0.42) 0%,   /* Purple */
        rgba(99, 102, 241, 0.25) 25%,  /* Indigo */
        rgba(59, 130, 246, 0.15) 40%,  /* Blue */
        transparent 65%
    );
}
