/* --- Base Reset & Smooth Scroll --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    overflow-x: hidden;
}

/* --- Selection Color --- */
::selection {
    background: rgba(34, 211, 238, 0.2);
    color: #ffffff;
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #05080A;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- Navbar Background on Scroll --- */
.navbar-scrolled {
    background: rgba(5, 8, 10, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* --- Marquee Animation --- */
.marquee-track {
    animation: marqueeScroll 30s linear infinite;
}

/* Hide scrollbar but keep scrolling */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

@keyframes marqueeScroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* --- Fade In Up Animation --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

.animation-delay-100 {
    animation-delay: 100ms;
}

.animation-delay-200 {
    animation-delay: 200ms;
}

.animation-delay-300 {
    animation-delay: 300ms;
}

.animation-delay-400 {
    animation-delay: 400ms;
}

/* --- Scroll Reveal Animation --- */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Staggered Reveal for Grid Children --- */
.service-card.reveal:nth-child(2) { transition-delay: 80ms; }
.service-card.reveal:nth-child(3) { transition-delay: 160ms; }
.service-card.reveal:nth-child(4) { transition-delay: 240ms; }
.service-card.reveal:nth-child(5) { transition-delay: 80ms; }
.service-card.reveal:nth-child(6) { transition-delay: 160ms; }
.service-card.reveal:nth-child(7) { transition-delay: 240ms; }
.service-card.reveal:nth-child(8) { transition-delay: 320ms; }

.project-card.reveal:nth-child(2) { transition-delay: 100ms; }
.project-card.reveal:nth-child(3) { transition-delay: 200ms; }
.project-card.reveal:nth-child(4) { transition-delay: 100ms; }
.project-card.reveal:nth-child(5) { transition-delay: 200ms; }
.project-card.reveal:nth-child(6) { transition-delay: 300ms; }

/* --- Service Card Glow on Hover --- */
.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(34, 211, 238, 0.04), transparent 40%);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
    z-index: 0;
}

.service-card:hover::before {
    opacity: 1;
}

.service-card > * {
    position: relative;
    z-index: 1;
}

/* --- Project Card Image Overlay --- */
.project-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.15);
}

.project-card:hover::after {
    opacity: 1;
}

/* --- Form Select Option Styling --- */
select option {
    background: #0E1216;
    color: rgba(255, 255, 255, 0.8);
    padding: 8px;
}

/* --- Form Status Messages --- */
.status-success {
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.2);
    color: #22D3EE;
}

.status-error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: #F87171;
}

/* --- Button Loading State --- */
.btn-loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: #05080A;
    border-radius: 50%;
    animation: btnSpin 0.6s linear infinite;
    margin-left: 8px;
}

@keyframes btnSpin {
    to { transform: rotate(360deg); }
}

/* --- Timeline Line Glow --- */
.border-l {
    position: relative;
}

/* --- Responsive Adjustments --- */
@media (max-width: 640px) {
    .animate-fade-in-up {
        animation-duration: 0.6s;
    }

    .reveal {
        transform: translateY(25px);
        transition-duration: 0.6s;
    }

    html {
        scroll-padding-top: 64px;
    }
}

/* --- Reduced Motion Support --- */
@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;
    }

    .marquee-track {
        animation: none;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }

    .animate-fade-in-up {
        opacity: 1;
    }
}

/* --- Focus Styles for Accessibility --- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid rgba(34, 211, 238, 0.5);
    outline-offset: 2px;
}

/* --- Smooth Image Loading --- */
img {
    transition: opacity 0.3s ease;
}