*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    overflow-x: hidden;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Selection */
::selection {
    background: #0d9488;
    color: white;
}

/* Scroll line animation */
@keyframes scrollLine {
    0% { transform: scaleY(0); transform-origin: top; opacity: 0; }
    50% { transform: scaleY(1); transform-origin: top; opacity: 1; }
    51% { transform: scaleY(1); transform-origin: bottom; }
    100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}

.animate-scroll-line {
    animation: scrollLine 1.8s ease-in-out infinite;
}

/* Hero animations */
.hero-subtitle {
    animation: heroFadeUp 0.8s ease forwards 0.3s;
}
.hero-headline {
    animation: heroFadeUp 0.8s ease forwards 0.5s;
}
.hero-body {
    animation: heroFadeUp 0.8s ease forwards 0.7s;
}
.hero-cta {
    animation: heroFadeUp 0.8s ease forwards 0.9s;
}

@keyframes heroFadeUp {
    from {
        opacity: 0;
        transform: translateY(1.5rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Reveal animations */
.reveal {
    opacity: 0;
    transform: translateY(2rem);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}
.reveal:nth-child(2) { transition-delay: 0.1s; }
.reveal:nth-child(3) { transition-delay: 0.2s; }

/* Gallery items stagger */
.gallery-item {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.gallery-item.revealed {
    opacity: 1;
    transform: scale(1);
}
.gallery-item:nth-child(1) { transition-delay: 0s; }
.gallery-item:nth-child(2) { transition-delay: 0.08s; }
.gallery-item:nth-child(3) { transition-delay: 0.16s; }
.gallery-item:nth-child(4) { transition-delay: 0.24s; }
.gallery-item:nth-child(5) { transition-delay: 0.32s; }
.gallery-item:nth-child(6) { transition-delay: 0.4s; }

/* Service card icon transition */
.service-icon {
    transition: stroke 0.5s ease;
}
.service-card:hover .service-icon {
    stroke: white;
}

/* Nav scroll state */
nav.scrolled {
    background: rgba(2, 6, 23, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(255,255,255,0.05);
}

nav.scrolled .nav-logo-text {
    color: white;
}

nav.scrolled .nav-link {
    color: rgba(255,255,255,0.7);
}

nav.scrolled .nav-link:hover {
    color: white;
}

/* Mobile menu */
.mobile-menu-open #mobileMenu {
    opacity: 1;
    pointer-events: all;
}

.mobile-menu-link {
    opacity: 0;
    transform: translateY(1rem);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.mobile-menu-open .mobile-menu-link {
    opacity: 1;
    transform: translateY(0);
}
.mobile-menu-open .mobile-menu-link:nth-child(1) { transition-delay: 0.1s; }
.mobile-menu-open .mobile-menu-link:nth-child(2) { transition-delay: 0.15s; }
.mobile-menu-open .mobile-menu-link:nth-child(3) { transition-delay: 0.2s; }
.mobile-menu-open .mobile-menu-link:nth-child(4) { transition-delay: 0.25s; }
.mobile-menu-open .mobile-menu-link:nth-child(5) { transition-delay: 0.3s; }

/* Testimonial card hover */
.testimonial-card {
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.5s ease;
}
.testimonial-card:hover {
    transform: translateY(-4px);
}

/* Smooth focus outlines */
input:focus, select:focus, textarea:focus, button:focus {
    outline: none;
}

/* Prevent layout shift on select */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html {
        scroll-behavior: auto;
    }
    .reveal, .gallery-item {
        opacity: 1;
        transform: none;
    }
}
