/* ============================================
   Animations & Transitions
   ============================================ */

/* --- Fade In Animations --- */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
}

.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s ease forwards;
}

.delay-1 { animation-delay: 0.15s; }
.delay-2 { animation-delay: 0.3s; }
.delay-3 { animation-delay: 0.45s; }
.delay-4 { animation-delay: 0.6s; }
.delay-5 { animation-delay: 0.8s; }

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Scroll Reveal --- */
[data-reveal] {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-reveal].revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children */
[data-reveal]:nth-child(1) { transition-delay: 0s; }
[data-reveal]:nth-child(2) { transition-delay: 0.1s; }
[data-reveal]:nth-child(3) { transition-delay: 0.2s; }
[data-reveal]:nth-child(4) { transition-delay: 0.3s; }
[data-reveal]:nth-child(5) { transition-delay: 0.4s; }
[data-reveal]:nth-child(6) { transition-delay: 0.5s; }

/* --- Hover Effects --- */
.project-card .card-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(10, 10, 11, 0.8) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-card:hover .card-image::after {
    opacity: 1;
}

/* --- Smooth page transitions --- */
body {
    animation: pageLoad 0.5s ease;
}

@keyframes pageLoad {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* --- Link Underline Effect --- */
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    width: 0;
    height: 1px;
    background: var(--text-primary);
    transition: width 0.3s ease, left 0.3s ease;
}

.nav-link:hover::after {
    width: calc(100% - 32px);
    left: 16px;
}

/* --- Card Glow on Hover --- */
.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-card:hover::before {
    opacity: 1;
}

/* --- Button Ripple --- */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

/* --- Form Focus Glow --- */
.form-input:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

/* --- Tech Item Hover --- */
.tech-item {
    position: relative;
    overflow: hidden;
}

.tech-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--text-primary);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.tech-item:hover::before {
    transform: scaleY(1);
}

/* --- Timeline Animation --- */
.timeline-item .timeline-marker {
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.timeline-item:hover .timeline-marker {
    background: var(--text-primary);
    border-color: var(--text-primary);
    transform: scale(1.3);
}

/* --- Cursor trail effect (subtle) --- */
@media (hover: hover) {
    .hero::after {
        content: '';
        position: absolute;
        width: 500px;
        height: 500px;
        background: radial-gradient(circle, rgba(255, 255, 255, 0.02) 0%, transparent 70%);
        pointer-events: none;
        transform: translate(-50%, -50%);
        opacity: 0;
        transition: opacity 0.3s;
    }

    .hero:hover::after {
        opacity: 1;
    }
}

/* --- Loading Animation --- */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.card-placeholder {
    animation: pulse-subtle 3s infinite;
}

@keyframes pulse-subtle {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}
