/* Animation Keyframes */

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Slide In From Right */
@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide Out To Right */
@keyframes slideOutToRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Slide In From Left */
@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide Out To Left */
@keyframes slideOutToLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

/* Slide Up */
@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Slide Down */
@keyframes slideDown {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Scale In */
@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Scale Out */
@keyframes scaleOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.9);
        opacity: 0;
    }
}

/* Rotate */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Pulse */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

/* Bounce */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Shake */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Float */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Glow */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 107, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 107, 0, 0.8);
    }
}

/* Text Glow */
@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(255, 107, 0, 0.5),
                     0 0 20px rgba(255, 107, 0, 0.3),
                     0 0 30px rgba(255, 107, 0, 0.2);
    }
    50% {
        text-shadow: 0 0 15px rgba(255, 107, 0, 0.7),
                     0 0 25px rgba(255, 107, 0, 0.5),
                     0 0 35px rgba(255, 107, 0, 0.3);
    }
}

/* Gradient Move */
@keyframes gradientMove {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Border Glow */
@keyframes borderGlow {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.7;
    }
}

/* Preview Slide In */
@keyframes previewSlideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Preview Slide Out */
@keyframes previewSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

/* Image Fade In */
@keyframes imageFadeIn {
    from {
        opacity: 0;
        filter: brightness(0.2) blur(5px);
    }
    to {
        opacity: 1;
        filter: brightness(0.3) contrast(1.2);
    }
}

/* Overlay Fade In */
@keyframes overlayFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 0.8;
        transform: translateY(0);
    }
}

/* Freeze Effect */
@keyframes freezeEffect {
    0% {
        filter: brightness(1) saturate(1) blur(0);
    }
    100% {
        filter: brightness(0.3) saturate(1.1) contrast(1.2) blur(0.5px);
    }
}

/* Preview Pulse */
@keyframes previewPulse {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* Loading Shimmer */
@keyframes loadingShimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Pulse Marker */
@keyframes pulseMarker {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.8;
    }
}

/* Mobile Article Slide In */
@keyframes mobileArticleSlideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Mobile Article Slide Out */
@keyframes mobileArticleSlideOut {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(100%);
    }
}

/* Animation Classes */

.animate-fade-in {
    animation: fadeIn 0.6s ease forwards;
}

.animate-slide-in-right {
    animation: slideInFromRight 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.animate-slide-out-right {
    animation: slideOutToRight 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.animate-slide-in-left {
    animation: slideInFromLeft 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.animate-slide-out-left {
    animation: slideOutToLeft 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.animate-slide-up {
    animation: slideUp 0.6s ease forwards;
}

.animate-slide-down {
    animation: slideDown 0.6s ease forwards;
}

.animate-scale-in {
    animation: scaleIn 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.animate-scale-out {
    animation: scaleOut 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.animate-rotate {
    animation: rotate 2s linear infinite;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-bounce {
    animation: bounce 2s infinite;
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

.animate-text-glow {
    animation: textGlow 3s infinite;
}

.animate-gradient {
    background: linear-gradient(45deg, #ff6b00, #ff8533, #ff6b00);
    background-size: 200% 200%;
    animation: gradientMove 3s ease infinite;
}

.animate-preview-slide-in {
    animation: previewSlideIn 0.8s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.animate-preview-slide-out {
    animation: previewSlideOut 0.8s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.animate-image-fade {
    animation: imageFadeIn 0.5s ease forwards;
}

.animate-overlay-fade {
    animation: overlayFadeIn 0.6s ease 0.3s forwards;
}

.animate-freeze {
    animation: freezeEffect 0.8s ease forwards;
}

.animate-preview-pulse {
    animation: previewPulse 3s infinite;
}

.animate-border-glow {
    animation: borderGlow 3s infinite;
}

.animate-pulse-marker {
    animation: pulseMarker 2s infinite;
}

.animate-mobile-slide-in {
    animation: mobileArticleSlideIn 0.5s ease;
}

.animate-mobile-slide-out {
    animation: mobileArticleSlideOut 0.5s ease;
}

/* Animation Delays */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }
.delay-600 { animation-delay: 600ms; }
.delay-700 { animation-delay: 700ms; }
.delay-800 { animation-delay: 800ms; }
.delay-900 { animation-delay: 900ms; }
.delay-1000 { animation-delay: 1000ms; }

/* Animation Fill Modes */
.animate-forwards {
    animation-fill-mode: forwards;
}

.animate-backwards {
    animation-fill-mode: backwards;
}

.animate-both {
    animation-fill-mode: both;
}

/* Animation Play States */
.pause-animation {
    animation-play-state: paused;
}

.play-animation {
    animation-play-state: running;
}

/* Hover Animation Effects */

/* Lift on hover */
.hover-lift {
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.hover-lift:hover {
    transform: translateY(-4px);
}

/* Scale on hover */
.hover-scale {
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* Rotate on hover */
.hover-rotate {
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.hover-rotate:hover {
    transform: rotate(90deg);
}

/* Glow on hover */
.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 15px rgba(255, 107, 0, 0.5);
}

/* Border glow on hover */
.hover-border-glow {
    position: relative;
}

.hover-border-glow::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #ff6b00, #ff8533, #ff6b00);
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hover-border-glow:hover::before {
    opacity: 0.5;
}

/* Active States */

.active-scale {
    transition: transform 0.2s ease;
}

.active-scale:active {
    transform: scale(0.95);
}

.active-rotate {
    transition: transform 0.2s ease;
}

.active-rotate:active {
    transform: rotate(180deg);
}

/* Loading States */

.loading-shimmer {
    position: relative;
    overflow: hidden;
    background: #222;
}

.loading-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    animation: loadingShimmer 1.5s infinite;
}

/* Parallax Effects */

.parallax {
    transition: transform 0.3s ease-out;
    will-change: transform;
}

/* Text Effects */

.text-gradient {
    background: linear-gradient(45deg, #ff6b00, #ff8533);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    background-size: 200% 200%;
    animation: gradientMove 3s ease infinite;
}

.text-shadow {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.text-shadow-glow {
    text-shadow: 0 0 10px rgba(255, 107, 0, 0.5);
}

/* Card Specific Animations */

.card-enter {
    animation: slideUp 0.6s ease forwards;
}

.card-exit {
    animation: slideDown 0.6s ease forwards;
}

.card-hover-effect {
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.card-hover-effect:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Article Specific Animations */

.article-content-enter {
    animation: slideUp 0.8s ease 0.2s forwards;
    opacity: 0;
}

.article-content-exit {
    animation: slideDown 0.8s ease forwards;
}

.drop-cap-animate {
    animation: slideUp 0.6s ease 0.4s forwards;
    opacity: 0;
}

.gallery-item-enter {
    animation: scaleIn 0.6s ease forwards;
    opacity: 0;
    transform-origin: center;
}

/* Modal Animations */

.modal-enter {
    animation: fadeIn 0.4s ease forwards;
}

.modal-exit {
    animation: fadeIn 0.4s ease reverse forwards;
}

.modal-content-enter {
    animation: slideUp 0.6s ease 0.2s forwards;
    opacity: 0;
}

/* Scroll Animations */

.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Blur Effects */

.backdrop-blur {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: backdrop-filter 0.5s ease;
}

/* Wave Effect */

.wave-effect {
    position: relative;
    overflow: hidden;
}

.wave-effect::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.wave-effect:active::after {
    animation: wave 0.6s ease-out;
}

@keyframes wave {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(30, 30);
        opacity: 0;
    }
}

/* Typewriter Effect */

.typewriter {
    overflow: hidden;
    border-right: 2px solid #ff6b00;
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: #ff6b00 }
}

/* Progress Bar */

.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #ff6b00, #ff8533);
    z-index: 9998;
    transition: width 0.3s ease;
}

/* Custom Cursor */

.custom-cursor {
    position: fixed;
    width: 20px;
    height: 20px;
    border: 2px solid #ff6b00;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9997;
    transition: transform 0.2s ease;
    mix-blend-mode: difference;
}

.custom-cursor.hover {
    transform: scale(1.5);
    background: rgba(255, 107, 0, 0.2);
}

/* Page Transition */

.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
    transform: translateY(100%);
}

.page-transition.enter {
    animation: slideUp 0.8s ease reverse forwards;
}

.page-transition.exit {
    animation: slideUp 0.8s ease forwards;
}

/* Responsive Animation Adjustments */

@media (max-width: 768px) {
    .animate-slide-in-right,
    .animate-slide-out-right,
    .animate-slide-in-left,
    .animate-slide-out-left {
        animation-duration: 0.4s;
    }
    
    .hover-lift:hover,
    .hover-scale:hover,
    .hover-rotate:hover {
        transform: none;
    }
    
    .card-hover-effect:hover {
        transform: none;
        box-shadow: none;
    }
}

/* Performance Optimizations */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Print Styles */

@media print {
    .animate-fade-in,
    .animate-slide-in-right,
    .animate-slide-out-right,
    .animate-slide-in-left,
    .animate-slide-out-left,
    .animate-slide-up,
    .animate-slide-down,
    .animate-scale-in,
    .animate-scale-out,
    .animate-rotate,
    .animate-pulse,
    .animate-bounce,
    .animate-shake,
    .animate-float,
    .animate-glow,
    .animate-text-glow,
    .animate-gradient,
    .animate-preview-slide-in,
    .animate-preview-slide-out,
    .animate-image-fade,
    .animate-overlay-fade,
    .animate-freeze,
    .animate-preview-pulse,
    .animate-border-glow,
    .animate-pulse-marker,
    .animate-mobile-slide-in,
    .animate-mobile-slide-out {
        animation: none !important;
    }
    
    .hover-lift,
    .hover-scale,
    .hover-rotate,
    .hover-glow,
    .hover-border-glow,
    .active-scale,
    .active-rotate {
        transition: none !important;
    }
    
    .hover-lift:hover,
    .hover-scale:hover,
    .hover-rotate:hover,
    .hover-glow:hover,
    .hover-border-glow:hover::before,
    .active-scale:active,
    .active-rotate:active {
        transform: none !important;
        box-shadow: none !important;
        opacity: 1 !important;
    }
}