/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Base Styles */
body {
    background-color: #020617;
    color: white;
    overflow-x: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    cursor: default;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 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;
        scroll-behavior: auto !important;
    }
}

/* Background Layers */
#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    opacity: 0.5;
}

#ripple-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* Hide ripple on touch devices for better performance */
@media (hover: none) and (pointer: coarse) {
    #ripple-canvas {
        display: none;
    }
}

/* Glassmorphism Upgrades */
.glass-panel {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, box-shadow;
}

.glass-panel:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-8px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3), 0 0 30px rgba(59, 130, 246, 0.15);
}

/* Reduce hover effects on touch devices */
@media (hover: none) {
    .glass-panel:hover {
        transform: none;
    }
}

.navbar-glass {
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar-scrolled {
    background: rgba(2, 6, 23, 0.95);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.gradient-text {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #34d399 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite;
}

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

/* Glow effect behind hero text */
.hero-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 600px;
    height: 400px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, rgba(0,0,0,0) 70%);
    pointer-events: none;
    z-index: -1;
    animation: pulseGlow 4s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

@media (min-width: 768px) {
    .hero-glow {
        width: 600px;
        height: 600px;
    }
}

/* Switch Container */
.switch-container {
    position: relative;
    display: inline-flex;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 9999px;
    padding: 4px;
}

.switch-btn {
    padding: 8px 20px;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.switch-btn.active {
    color: white;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.4);
}

.switch-btn.inactive {
    color: #94a3b8;
}

.switch-btn.inactive:hover {
    color: white;
}

/* ============================================
   SCROLL REVEAL ANIMATIONS
   ============================================ */

.reveal-up,
.reveal-left,
.reveal-right,
.reveal-scale {
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-up {
    transform: translateY(60px);
}

.reveal-left {
    transform: translateX(-60px);
}

.reveal-right {
    transform: translateX(60px);
}

.reveal-scale {
    transform: scale(0.9);
}

.reveal-up.revealed,
.reveal-left.revealed,
.reveal-right.revealed,
.reveal-scale.revealed {
    opacity: 1;
    transform: translate(0) scale(1);
}

/* Staggered animation delays */
.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.2s; }
.stagger-3 { transition-delay: 0.3s; }
.stagger-4 { transition-delay: 0.4s; }
.stagger-5 { transition-delay: 0.5s; }
.stagger-6 { transition-delay: 0.6s; }

/* ============================================
   BUTTON ANIMATIONS
   ============================================ */

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

/* ============================================
   RESPONSIVE MOBILE MENU
   ============================================ */

#mobile-menu {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: top;
}

#mobile-menu.hidden {
    opacity: 0;
    transform: scaleY(0);
    pointer-events: none;
}

#mobile-menu:not(.hidden) {
    opacity: 1;
    transform: scaleY(1);
    pointer-events: auto;
}

/* Mobile menu button animation */
#mobile-menu-btn i {
    transition: transform 0.3s ease;
}

#mobile-menu-btn.active i {
    transform: rotate(90deg);
}

/* ============================================
   FORM INPUT ANIMATIONS
   ============================================ */

input, select, textarea {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input:focus, select:focus, textarea:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.2);
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

/* Extra small devices */
@media (max-width: 374px) {
    .switch-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
}

/* Small devices */
@media (max-width: 639px) {
    section {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .glass-panel {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
}

/* Touch-friendly tap targets */
@media (hover: none) and (pointer: coarse) {
    a, button {
        min-height: 44px;
        min-width: 44px;
    }
    
    input, select, textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Landscape phone orientation */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-glow {
        height: 200px;
    }
}

/* ============================================
   LOADING ANIMATION
   ============================================ */

.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #020617;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.loaded {
    opacity: 0;
    visibility: hidden;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(59, 130, 246, 0.1);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ============================================
   FOOTER RESPONSIVE
   ============================================ */

@media (max-width: 767px) {
    footer .grid {
        text-align: center;
    }
    
    footer .flex.items-center.gap-2 {
        justify-content: center;
    }
    
    footer ul {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}

/* ============================================
   CUSTOM SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #020617;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #334155, #1e293b);
    border-radius: 4px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #475569, #334155);
}

/* Hide scrollbar on mobile for cleaner look */
@media (max-width: 767px) {
    ::-webkit-scrollbar {
        width: 4px;
    }
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #334155 #020617;
}

/* ============================================
   SMOOTH LINK TRANSITIONS
   ============================================ */

a {
    transition: color 0.3s ease, transform 0.3s ease;
}

/* ============================================
   FOCUS VISIBLE FOR ACCESSIBILITY
   ============================================ */

:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}
