/* ===================================
   Apple Style Animations
   =================================== */

/* ===================================
   Scroll Animations - Subtle & Smooth
   =================================== */

/* Fade In Animation */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Slide Left Animation */
.slide-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-left.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Slide Right Animation */
.slide-right {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Scale In Animation */
.scale-in {
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.scale-in.visible {
    opacity: 1;
    transform: scale(1);
}

/* ===================================
   Staggered Animations - Gentle Delays
   =================================== */
.skills-grid .skill-card:nth-child(1) { transition-delay: 0.05s; }
.skills-grid .skill-card:nth-child(2) { transition-delay: 0.1s; }
.skills-grid .skill-card:nth-child(3) { transition-delay: 0.15s; }
.skills-grid .skill-card:nth-child(4) { transition-delay: 0.2s; }
.skills-grid .skill-card:nth-child(5) { transition-delay: 0.25s; }
.skills-grid .skill-card:nth-child(6) { transition-delay: 0.3s; }
.skills-grid .skill-card:nth-child(7) { transition-delay: 0.35s; }
.skills-grid .skill-card:nth-child(8) { transition-delay: 0.4s; }

.projects-grid .project-card:nth-child(1) { transition-delay: 0.05s; }
.projects-grid .project-card:nth-child(2) { transition-delay: 0.1s; }
.projects-grid .project-card:nth-child(3) { transition-delay: 0.15s; }

.timeline .timeline-item:nth-child(1) { transition-delay: 0.05s; }
.timeline .timeline-item:nth-child(2) { transition-delay: 0.1s; }
.timeline .timeline-item:nth-child(3) { transition-delay: 0.15s; }

/* ===================================
   Hover Animations - Subtle Elevations
   =================================== */

/* Button Hover Effects */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.3);
}

.btn-secondary:hover {
    transform: none;
}

.btn-outline:hover {
    box-shadow: 0 2px 8px rgba(0, 113, 227, 0.2);
}

/* Skill Card Hover */
.skill-card {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.skill-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* Project Card Hover */
.project-card {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
}

/* Timeline Item Hover */
.timeline-content {
    transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.timeline-content:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Social Link Hover - Smooth Scale */
.social-link {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-link:hover {
    transform: scale(1.1);
}

/* ===================================
   Loading Animation - Gentle Fade In
   =================================== */
body:not(.loaded) .hero-content > * {
    opacity: 0;
}

body.loaded .hero-content > * {
    animation: gentleLoad 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

body.loaded .hero-greeting {
    animation-delay: 0.1s;
}

body.loaded .hero-name {
    animation-delay: 0.2s;
}

body.loaded .hero-subtitle {
    animation-delay: 0.3s;
}

body.loaded .hero-cta {
    animation-delay: 0.4s;
}

@keyframes gentleLoad {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================
   Skill Progress Bar Animation - Smooth
   =================================== */
.skill-progress {
    width: 0 !important;
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.skill-card.visible .skill-progress {
    width: var(--target-width, 0) !important;
}

/* ===================================
   Page Load Animation
   =================================== */
@keyframes pageLoad {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-content {
    animation: pageLoad 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================
   Smooth State Transitions
   =================================== */
a {
    transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

img {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ===================================
   Focus States - Subtle Indicators
   =================================== */
a:focus,
button:focus,
.btn:focus {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

a:focus-visible,
button:focus-visible,
.btn:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ===================================
   Reduced Motion Respect
   =================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .fade-in,
    .slide-left,
    .slide-right,
    .scale-in {
        opacity: 1;
        transform: none;
    }

    .hero-name {
        animation: none;
    }

    .scroll-indicator .arrow {
        animation: none;
    }
}

/* ===================================
   Parallax Effect - Subtle (Optional)
   =================================== */
@media (min-width: 768px) {
    .hero {
        position: relative;
    }

    .parallax-layer {
        transition: transform 0.1s linear;
    }
}

/* ===================================
   Scroll Progress Indicator (Optional)
   =================================== */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background: var(--accent-blue);
    z-index: 9999;
    transition: width 0.1s linear;
}

/* ===================================
   Text Reveal Animation (Optional)
   =================================== */
.reveal-text {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-text.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===================================
   Smooth Scroll Behavior Enhancement
   =================================== */
html {
    scroll-behavior: smooth;
}

/* Improve scroll smoothness for Safari */
@supports (-webkit-touch-callout: none) {
    html {
        scroll-behavior: auto;
    }
}

/* ===================================
   Card Entrance Animations
   =================================== */
@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.skill-card,
.project-card,
.timeline-content {
    animation: cardEntrance 0.6s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

/* ===================================
   Hover Lift Effect - Subtle
   =================================== */
.hover-lift {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* ===================================
   Gentle Pulse Animation (for emphasis)
   =================================== */
@keyframes gentlePulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.gentle-pulse {
    animation: gentlePulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ===================================
   Loading States
   =================================== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 0%,
        var(--bg-tertiary) 50%,
        var(--bg-secondary) 100%
    );
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s ease-in-out infinite;
}

@keyframes skeletonLoading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ===================================
   Smooth Color Transitions
   =================================== */
.color-transition {
    transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================
   Performance Optimization
   =================================== */
/* Use GPU acceleration for smooth animations */
.skill-card,
.project-card,
.timeline-content,
.btn,
.social-link {
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===================================
   Animation Timing Utilities
   =================================== */
.duration-fast { animation-duration: 0.2s; }
.duration-normal { animation-duration: 0.4s; }
.duration-slow { animation-duration: 0.6s; }

.easing-ease { animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
.easing-ease-out { animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
.easing-ease-in-out { animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1); }
