/* Header Animations */
@keyframes fadeInDown {
    0% {
        opacity: 0;
        transform: translateY(-30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-down {
    animation: fadeInDown 0.8s ease-out forwards;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s 0.3s ease-out forwards;
    opacity: 0;
}

/* Scroll Animations */
@keyframes slideInUp {
    0% {
        opacity: 0;
        transform: translateY(50px);
        -webkit-transform: translateY(50px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        -webkit-transform: translateY(0);
    }
}

@-webkit-keyframes slideInUp {
    0% {
        opacity: 0;
        -webkit-transform: translateY(50px);
    }
    100% {
        opacity: 1;
        -webkit-transform: translateY(0);
    }
}

@keyframes scaleIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
        -webkit-transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
        -webkit-transform: scale(1);
    }
}

@-webkit-keyframes scaleIn {
    0% {
        opacity: 0;
        -webkit-transform: scale(0.9);
    }
    100% {
        opacity: 1;
        -webkit-transform: scale(1);
    }
}

.scroll-animate {
    opacity: 0;
    transition: all 0.6s ease-out;
    will-change: opacity, transform;
    -webkit-transition: all 0.6s ease-out;
}

.scroll-animate.animated {
    opacity: 1;
    animation: slideInUp 0.8s ease-out forwards;
    -webkit-animation: slideInUp 0.8s ease-out forwards;
}

/* Mobile and Tablet Optimizations */
@media (max-width: 1024px) {
    .scroll-animate {
        opacity: 0;
        transition: all 0.5s ease-out;
        -webkit-transition: all 0.5s ease-out;
    }
    
    .scroll-animate.animated {
        opacity: 1;
        animation: slideInUp 0.6s ease-out forwards;
        -webkit-animation: slideInUp 0.6s ease-out forwards;
    }
}

/* Modal Animations */
@keyframes modalFadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    0% {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-content-animate {
    animation: modalSlideIn 0.4s ease-out forwards;
}

#photoLightbox[style*="display: flex"],
#videoModal[style*="display: flex"] {
    animation: modalFadeIn 0.3s ease-out;
}

/* Image Zoom Animation */
@keyframes zoomIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-zoom-in {
    animation: zoomIn 0.4s ease-out;
}

/* Portfolio Item Hover */
.portfolio-item {
    transform: translateY(0);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.portfolio-item:hover {
    transform: translateY(-12px);
}

/* Filter Button Active State */
.filter-btn.active {
    background-color: #2563eb;
    color: white;
    border-color: #2563eb;
}

/* Video Card Shine Effect */
.video-card .shine {
    position: absolute;
    top: -50%;
    left: -30%;
    height: 200%;
    width: 50%;
    transform: rotate(25deg);
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, .18) 50%, rgba(255, 255, 255, 0) 100%);
    filter: blur(2px);
    animation: shine-sweep 2.2s ease-in-out infinite;
    opacity: 0;
    pointer-events: none;
}

.video-card:hover .shine {
    opacity: 1;
}

@keyframes shine-sweep {
    0% {
        transform: translateX(-120%) rotate(25deg);
    }
    60% {
        transform: translateX(130%) rotate(25deg);
    }
    100% {
        transform: translateX(130%) rotate(25deg);
    }
}

/* Play Button Pulse */
.play-pulse {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 90px;
    height: 90px;
    border-radius: 9999px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.0) 60%);
    animation: pulse 1.8s ease-out infinite;
    transform: scale(0.8);
    filter: blur(1px);
    pointer-events: none;
}

@media (min-width: 640px) {
    .play-pulse {
        width: 110px;
        height: 110px;
    }
}

@keyframes pulse {
    0% {
        opacity: 0.7;
        transform: scale(0.75);
    }
    60% {
        opacity: 0.15;
        transform: scale(1.3);
    }
    100% {
        opacity: 0;
        transform: scale(1.35);
    }
}

/* Badge Animation */
@keyframes badgeSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Touch Optimization */
.touch-manipulation {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.portfolio-item {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.portfolio-item img {
    image-rendering: -webkit-optimize-contrast;
}

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

/* Mobile Optimizations */
@media (max-width: 640px) {
    #photoLightbox > div {
        max-height: 100vh;
    }

    #photoContent {
        min-height: 50vh;
    }
}

/* Safe Area for Notched Devices */
@supports (padding: env(safe-area-inset-top)) {
    #photoLightbox button[onclick="closePhotoModal()"],
    #videoModal button[onclick="closeVideoModal()"] {
        top: max(1rem, env(safe-area-inset-top));
        right: max(1rem, env(safe-area-inset-right));
    }
}

/* Loading States */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Focus Visible for Accessibility */
button:focus-visible,
.filter-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}
