/* Enhanced custom color palette and base styles */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --accent: #10b981;
    --accent-dark: #059669;
    --neutral-lightest: #f8fafc;
    --neutral-light: #e2e8f0;
    --neutral-medium: #94a3b8;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --gradient-primary: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    --gradient-accent: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* Website-Wide Smooth Scrolling Enhancements */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px; /* Account for fixed header */
}

/* Override for reduced motion users */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Enhanced smooth scrolling for all scrollable containers */
* {
    scroll-behavior: smooth;
}

body {
    zoom: 125%;
    font-family: 'Inter', sans-serif;
    background: var(--neutral-lightest);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Better page section transitions */
.page-section {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.page-hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1;
}

.page-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    position: relative;
    z-index: 2;
}

/* Updated main container for full-screen hero */
.main-container {
    position: relative;
}

/* Full-screen hero section */
.hero-bg-fullscreen {
    background: linear-gradient(135deg, var(--neutral-lightest) 0%, #e0e7ff 100%);
    position: relative;
    min-height: 75vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-bg-fullscreen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 20%, rgba(37, 99, 235, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(16, 185, 129, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 40% 60%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

/* Enhanced floating background elements */
@keyframes blob {
    0% {
        transform: translate(0px, 0px) scale(1);
    }
    33% {
        transform: translate(30px, -50px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
    100% {
        transform: translate(0px, 0px) scale(1);
    }
}

.animate-blob {
    animation: blob 7s infinite;
}

.animation-delay-2000 {
    animation-delay: 2s;
}

.animation-delay-4000 {
    animation-delay: 4s;
}

/* Enhanced scroll indicator animation */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0,0,0);
    }
    40%, 43% {
        transform: translate3d(0,-15px,0);
    }
    70% {
        transform: translate3d(0,-7px,0);
    }
    90% {
        transform: translate3d(0,-2px,0);
    }
}

.animate-bounce {
    animation: bounce 2s infinite;
}

/* Enhanced button styles */
.btn-primary {
    background: var(--gradient-primary);
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    border: none;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: 0.025em;
}
.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.btn-accent {
    background: var(--gradient-accent);
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    border: none;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: 0.025em;
}
.btn-accent:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Enhanced nav styles */
.nav-link.active {
    color: var(--primary);
    font-weight: 600;
}
.nav-link.active::after {
    content: '';
    display: block;
    width: 100%;
    height: 3px;
    background: var(--gradient-primary);
    margin-top: 4px;
    border-radius: 2px;
    transform: scaleX(1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-link::after {
    content: '';
    display: block;
    width: 100%;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 2px;
    transform: scaleX(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-link:hover::after {
    transform: scaleX(1);
}

/* Enhanced scroll animations */
.fade-in-up {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}
.stagger-children > * {
    transition-delay: var(--stagger-delay, 0s);
}

/* Enhanced card styles */
.service-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--neutral-light);
}
.service-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

.project-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--neutral-light);
}
.project-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

/* Enhanced hero section (for other pages) */
.hero-bg {
    background: linear-gradient(135deg, var(--neutral-lightest) 0%, #e0e7ff 100%);
    position: relative;
}
.hero-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 20%, rgba(37, 99, 235, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(16, 185, 129, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

/* Enhanced form styles */
.form-input {
    border: 2px solid var(--neutral-light);
    border-radius: 12px;
    padding: 12px 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

/* Enhanced team member styles */
.team-member {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.team-member:hover {
    transform: translateY(-4px);
}
.team-member img {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.team-member:hover img {
    transform: scale(1.05);
}

/* Mobile menu enhanced */
.mobile-menu-item {
    transition: all 0.2s ease;
}
.mobile-menu-item:hover {
    background: var(--neutral-light);
    padding-left: 1rem;
}

/* Header backdrop blur enhancement */
.header-blur {
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.header-blur.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-md);
}

/* Badge styles */
.badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
}
.badge-blue {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-dark);
}
.badge-green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-dark);
}
.badge-gray {
    background: var(--neutral-light);
    color: var(--text-light);
}

/* Projects Carousel Styles - Ultra Smooth Version */
#projects-carousel-section {
    background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%);
}

.carousel-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    /* Enable hardware acceleration */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
}

.carousel-track {
    display: flex;
    /* Ultra smooth transition with custom cubic bezier */
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    width: 300%; /* Always 3 slides total */
    /* Enable hardware acceleration */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
    /* Smooth rendering optimizations */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000px;
    perspective: 1000px;
}

/* Smooth transition states */
.carousel-track.fast-transition {
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.carousel-track.slow-transition {
    transition: transform 1s cubic-bezier(0.19, 1, 0.22, 1);
}

.carousel-slide {
    flex-shrink: 0;
    box-sizing: border-box;
    width: 33.333333%; /* Each slide is 1/3 of track width */
    /* Smooth slide animations */
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.project-card-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    margin: 0 0.5rem;
    /* Smooth content transitions */
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* Smooth scaling on interaction */
    transform: scale(1);
    -webkit-transform: scale(1);
}

/* Enhanced hover effects */
.project-card-content:hover {
    transform: scale(1.02) translateY(-4px);
    -webkit-transform: scale(1.02) translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Smooth button animations */
.carousel-btn {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 20;
    /* Button hover anticipation */
    transform: scale(1) translateY(-50%);
    -webkit-transform: scale(1) translateY(-50%);
    opacity: 0.8;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.carousel-btn:hover {
    transform: scale(1.15) translateY(-50%);
    -webkit-transform: scale(1.15) translateY(-50%);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3);
    opacity: 1;
}

.carousel-btn:active {
    transform: scale(0.95) translateY(-50%);
    -webkit-transform: scale(0.95) translateY(-50%);
    transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Enhanced indicator animations */
.carousel-indicator {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: scale(1);
    -webkit-transform: scale(1);
    opacity: 0.6;
}

.carousel-indicator.active {
    background: var(--primary);
    transform: scale(1.3);
    -webkit-transform: scale(1.3);
    opacity: 1;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
}

.carousel-indicator:hover {
    transform: scale(1.4);
    -webkit-transform: scale(1.4);
    opacity: 0.9;
    background: var(--primary-light);
}

/* Parallax effect for visual depth */
.carousel-slide .bg-gradient-to-br {
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: scale(1);
    -webkit-transform: scale(1);
}

.carousel-slide:hover .bg-gradient-to-br {
    transform: scale(1.05);
    -webkit-transform: scale(1.05);
}

/* Smooth entrance animations */
@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(100px) scale(0.9);
        -webkit-transform: translateX(100px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
        -webkit-transform: translateX(0) scale(1);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-100px) scale(0.9);
        -webkit-transform: translateX(-100px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
        -webkit-transform: translateX(0) scale(1);
    }
}

/* Apply entrance animations */
.carousel-slide.entering-right {
    animation: slideInFromRight 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.carousel-slide.entering-left {
    animation: slideInFromLeft 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Ensure content below hero starts properly */
#services-section {
    margin-top: 0;
    padding-top: 5rem;
}

/* Enhanced anchor link styles with hover effects */
a[href^="#"] {
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

a[href^="#"]:hover {
    transform: translateY(-1px);
}

/* Smooth focus indicators */
*:focus {
    /* outline: 2px solid var(--primary); */
    outline-offset: 2px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

/* Smooth section transitions */
section {
    scroll-margin-top: 100px; /* Account for fixed header */
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Scroll-to-top button */
.scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.scroll-to-top:hover {
    transform: translateY(-4px) scale(1.1);
    box-shadow: var(--shadow-xl);
}

.scroll-to-top:active {
    transform: translateY(-2px) scale(1.05);
}

/* Smooth page loading animation */
body.loading {
    overflow: hidden;
}

.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--neutral-lightest);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.page-loader .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--neutral-light);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive adjustments for full-screen hero */
@media (max-width: 768px) {
    html {
        scroll-padding-top: 70px;
    }
    
    section {
        scroll-margin-top: 80px;
    }
    
    .hero-bg-fullscreen {
        min-height: 75vh;
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    
    #hero-headline {
        font-size: 3rem !important;
        line-height: 1.1;
        margin-bottom: 1.5rem;
    }
    
    #hero-subheadline {
        font-size: 1.125rem !important;
        margin-bottom: 2rem;
    }
    
    #hero-cta-buttons {
        flex-direction: column;
        gap: 1rem;
    }
    
    .btn-primary, .btn-accent {
        width: 100%;
        max-width: 280px;
        padding: 1rem 2rem;
    }
    
    .page-section {
        transform: none !important;
    }
    
    .carousel-track {
        /* Faster transitions on mobile for better responsiveness */
        transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    
    .project-card-content {
        margin: 0 0.25rem;
    }
    
    .carousel-slide .lg\\:grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 1.5rem !important;
    }
    
    .carousel-slide .order-1,
    .carousel-slide .order-2 {
        order: unset !important;
    }
    
    .carousel-btn {
        width: 40px;
        height: 40px;
        font-size: 0.875rem;
    }
    
    .carousel-indicator {
        width: 8px;
        height: 8px;
    }
    
    /* Touch feedback */
    .carousel-btn:active {
        background: rgba(37, 99, 235, 0.1);
    }
    
    .scroll-to-top {
        width: 45px;
        height: 45px;
        bottom: 1.5rem;
        right: 1.5rem;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .project-card-content {
        margin: 0 0.75rem;
    }
    
    .carousel-track {
        transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
}

@media (min-width: 1025px) {
    .project-card-content {
        margin: 0 1rem;
    }
    
    /* Add subtle parallax for depth */
    .carousel-slide {
        transform-style: preserve-3d;
        -webkit-transform-style: preserve-3d;
    }
}

@media (max-width: 640px) {
    #hero-headline {
        font-size: 2.5rem !important;
    }
    
    #hero-subheadline {
        font-size: 1rem !important;
    }
}

/* Better mobile handling for all sections */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .service-card, .project-card {
        padding: 1.5rem;
    }
    
    .team-member img {
        width: 6rem;
        height: 6rem;
    }
    
    .form-input {
        padding: 0.875rem 1rem;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .carousel-track,
    .carousel-btn,
    .carousel-indicator,
    .project-card-content,
    html,
    *,
    body {
        transition: none !important;
        animation: none !important;
        transform: none !important;
        -webkit-transform: none !important;
        scroll-behavior: auto !important;
    }
}

/* High refresh rate display optimizations */
@media (min-resolution: 120dpi) {
    .carousel-track {
        transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
}

/* Additional enhancements for better visual hierarchy */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
}

p {
    margin-bottom: 1rem;
}

/* Smooth transitions for all interactive elements */
a, button, .service-card, .project-card, .team-member {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced focus states for accessibility */
.form-input:focus,
.btn-primary:focus,
.btn-accent:focus,
button:focus,
a:focus {
    /* outline: 2px solid var(--primary); */
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .header-blur,
    .mobile-menu,
    .btn-primary,
    .btn-accent,
    .animate-blob,
    .carousel-btn,
    .carousel-indicator,
    .scroll-to-top,
    .page-loader {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .carousel-track {
        transform: none !important;
        width: 100% !important;
        display: block;
    }
    
    .carousel-slide {
        width: 100% !important;
        page-break-inside: avoid;
        margin-bottom: 2rem;
    }
}
