
/* CSS Scroll Snap */
html {
    scroll-behavior: smooth;
    scroll-snap-type: y mandatory;
}

section {
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

/* View Transitions API */
@view-transition {
    navigation: auto;
}

::view-transition-old(root) {
    animation: fade-out 0.3s ease-out;
}

::view-transition-new(root) {
    animation: fade-in 0.3s ease-in;
}

@keyframes fade-out {
    to { opacity: 0; transform: translateY(-20px); }
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Intersection Observer Animations */
.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
    will-change: opacity, transform;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
    will-change: opacity, transform;
}

.reveal-left.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
    will-change: opacity, transform;
}

.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
    will-change: opacity, transform;
}

.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

/* Stagger delays */
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }

/* Parallax Container */
.parallax-container {
    perspective: 1px;
    height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

.parallax-layer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.parallax-back {
    transform: translateZ(-1px) scale(2);
}

/* Scroll-driven Animations (for browsers that support it) */
@supports (animation-timeline: scroll()) {
    .scroll-animate {
        animation: fade-in-up linear both;
        animation-timeline: view();
        animation-range: entry 25% cover 50%;
    }

    @keyframes fade-in-up {
        from {
            opacity: 0;
            transform: translateY(100px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .progress-bar {
        animation: grow-width linear;
        animation-timeline: scroll(root);
    }

    @keyframes grow-width {
        from { width: 0%; }
        to { width: 100%; }
    }
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, #ef4444 0%, #4f46e5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Dark mode transitions */
body, .card, .nav-blur {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* RTL Support */
[dir="rtl"] .reveal-left {
    transform: translateX(50px);
}

[dir="rtl"] .reveal-left.active {
    transform: translateX(0);
}

[dir="rtl"] .reveal-right {
    transform: translateX(-50px);
}

[dir="rtl"] .reveal-right.active {
    transform: translateX(0);
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb {
    background: #475569;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Floating animation */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
    will-change: transform;
}

/* Pulse glow */
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 0 40px rgba(239, 68, 68, 0.6); }
}

.pulse-glow {
    animation: pulse-glow 3s ease-in-out infinite;
}

/* Language transition */
.lang-content {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.lang-fade-out {
    opacity: 0;
    transform: translateY(-10px);
}