/* Custom Styles and Animations for Portfolio */

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

/* Custom animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulseSlow {
    0%, 100% {
        opacity: 0.2;
        transform: scale(1);
    }
    50% {
        opacity: 0.3;
        transform: scale(1.05);
    }
}

/* Apply animations */
.fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

.fade-in-left {
    animation: fadeInLeft 0.8s ease-out forwards;
}

.fade-in-right {
    animation: fadeInRight 0.8s ease-out forwards;
}

.animate-pulse-slow {
    animation: pulseSlow 3s ease-in-out infinite;
}

/* Intersection Observer animations - initially hidden */
.fade-in,
.fade-in-left,
.fade-in-right {
    opacity: 0;
}

.fade-in.visible,
.fade-in-left.visible,
.fade-in-right.visible {
    opacity: 1;
}

/* Navigation styles */
#navbar {
    transition: all 0.3s ease;
}

#navbar.scrolled {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Skill bars animation */
.skill-bar {
    transition: width 1.5s ease-out;
}

/* Project cards */
.project-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Tech badges */
.tech-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    min-width: 120px;
}

.dark .tech-badge {
    background: #1f2937;
}

.tech-badge:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.tech-badge i {
    color: #0070e0;
}

.dark .tech-badge i {
    color: #4da3ff;
}

.tech-badge span {
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
}

.dark .tech-badge span {
    color: #d1d5db;
}

/* Scroll to top button */
#scroll-top {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#scroll-top.show {
    opacity: 1 !important;
    pointer-events: all !important;
}

#scroll-top:hover {
    transform: translateY(-4px);
}

/* Form styles */
input:focus,
textarea:focus {
    outline: none;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

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

.dark ::-webkit-scrollbar-track {
    background: #1f2937;
}

::-webkit-scrollbar-thumb {
    background: #0070e0;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #0058ad;
}

/* Loading animation for images */
@keyframes shimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

.loading {
    animation: shimmer 1.2s ease-in-out infinite;
    background: linear-gradient(to right, #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%);
    background-size: 800px 104px;
}

/* Responsive utilities */
@media (max-width: 768px) {
    .tech-badge {
        min-width: 100px;
        padding: 0.75rem 1rem;
    }

    .tech-badge span {
        font-size: 0.75rem;
    }

    .tech-badge i {
        font-size: 1.25rem !important;
    }
}

/* Print styles */
@media print {
    nav,
    #scroll-top,
    #contact form {
        display: none;
    }

    .no-print {
        display: none;
    }

    section {
        page-break-inside: avoid;
    }
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible for keyboard navigation */
a:focus-visible,
button:focus-visible {
    outline: 2px solid #0070e0;
    outline-offset: 2px;
}

/* Smooth transitions for dark mode */
* {
    transition-property: background-color, border-color, color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* Override transitions for specific elements */
.skill-bar,
.project-card,
.tech-badge,
#scroll-top,
.nav-link::after {
    transition-property: all;
}

/* Hero section gradient animation */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Form submission states */
.form-success {
    background-color: #10b981 !important;
    color: white !important;
}

.form-error {
    background-color: #ef4444 !important;
    color: white !important;
}

/* Mobile menu animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#mobile-menu {
    animation: slideDown 0.3s ease-out;
}

/* Timeline dots pulse */
@keyframes dotPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(0, 112, 224, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(0, 112, 224, 0);
    }
}

/* Experience timeline styling */
.experience-dot {
    animation: dotPulse 2s infinite;
}

/* Ensure proper spacing and typography */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Improve link hover states */
a {
    transition: color 0.2s ease, transform 0.2s ease;
}

a:active {
    transform: scale(0.98);
}

/* Button hover effects */
button:active,
.btn:active {
    transform: scale(0.98);
}

/* Image optimization */
img {
    max-width: 100%;
    height: auto;
}

/* Lazy loading placeholder */
.lazy-load {
    background: linear-gradient(to right, #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%);
    background-size: 800px 104px;
    animation: shimmer 1.2s ease-in-out infinite;
}
