/* Animations for Zed-inspired portfolio */
/* ======================================= */

/* Animation Variables */
:root {
    --animation-duration-fast: 200ms;
    --animation-duration-normal: 400ms;
    --animation-duration-slow: 600ms;

    --animation-easing-linear: linear;
    --animation-easing-ease: ease;
    --animation-easing-ease-in: ease-in;
    --animation-easing-ease-out: ease-out;
    --animation-easing-ease-in-out: ease-in-out;
    --animation-easing-cubic-bezier: cubic-bezier(0.4, 0, 0.2, 1);

    /* Custom easing inspired by zed.dev */
    --animation-easing-zed: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --animation-easing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Keyframe Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes bounce {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes float {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

@keyframes blink {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes wave {
    0% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(-25%);
    }
    100% {
        transform: translateX(-50%);
    }
}

@keyframes glitch {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn var(--animation-duration-normal)
        var(--animation-easing-zed) forwards;
    opacity: 0;
}

.animate-fade-in-up {
    animation: fadeInUp var(--animation-duration-normal)
        var(--animation-easing-zed) forwards;
    opacity: 0;
}

.animate-fade-in-down {
    animation: fadeInDown var(--animation-duration-normal)
        var(--animation-easing-zed) forwards;
    opacity: 0;
}

.animate-fade-in-left {
    animation: fadeInLeft var(--animation-duration-normal)
        var(--animation-easing-zed) forwards;
    opacity: 0;
}

.animate-fade-in-right {
    animation: fadeInRight var(--animation-duration-normal)
        var(--animation-easing-zed) forwards;
    opacity: 0;
}

.animate-scale-in {
    animation: scaleIn var(--animation-duration-normal)
        var(--animation-easing-bounce) forwards;
    opacity: 0;
}

.animate-pulse {
    animation: pulse 2s var(--animation-easing-ease-in-out) infinite;
}

.animate-pulse-once {
    animation: pulse 2s var(--animation-easing-ease-in-out) 1;
}

.animate-bounce {
    animation: bounce 1s var(--animation-easing-bounce) infinite;
}

.animate-float {
    animation: float 3s var(--animation-easing-ease-in-out) infinite;
}

.animate-rotate {
    animation: rotate 20s linear infinite;
}

.animate-spin {
    animation: rotate 1s linear infinite;
}

.animate-shimmer {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s linear infinite;
}

.animate-gradient-shift {
    animation: gradientShift 3s ease infinite;
    background-size: 200% 200%;
}

.animate-ripple {
    position: relative;
    overflow: hidden;
}

.animate-ripple::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.6);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%, -50%);
    transform-origin: 50% 50%;
}

.animate-ripple:focus:not(:active)::after {
    animation: ripple 1s var(--animation-easing-ease-out);
}

.animate-typing {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid;
    animation:
        typing 3.5s steps(40, end),
        blink 0.75s step-end infinite;
}

.animate-wave {
    animation: wave 20s linear infinite;
}

.animate-glitch {
    animation: glitch 0.5s var(--animation-easing-linear);
}

/* Animation Delays */
.animate-delay-100 {
    animation-delay: 100ms;
}

.animate-delay-200 {
    animation-delay: 200ms;
}

.animate-delay-300 {
    animation-delay: 300ms;
}

.animate-delay-400 {
    animation-delay: 400ms;
}

.animate-delay-500 {
    animation-delay: 500ms;
}

.animate-delay-1000 {
    animation-delay: 1000ms;
}

.animate-delay-2000 {
    animation-delay: 2000ms;
}

/* Animation Durations */
.animate-duration-fast {
    animation-duration: var(--animation-duration-fast);
}

.animate-duration-normal {
    animation-duration: var(--animation-duration-normal);
}

.animate-duration-slow {
    animation-duration: var(--animation-duration-slow);
}

.animate-duration-2s {
    animation-duration: 2s;
}

.animate-duration-3s {
    animation-duration: 3s;
}

.animate-duration-5s {
    animation-duration: 5s;
}

/* Animation Fill Modes */
.animate-fill-forwards {
    animation-fill-mode: forwards;
}

.animate-fill-backwards {
    animation-fill-mode: backwards;
}

.animate-fill-both {
    animation-fill-mode: both;
}

/* Animation Iteration */
.animate-iteration-once {
    animation-iteration-count: 1;
}

.animate-iteration-infinite {
    animation-iteration-count: infinite;
}

.animate-iteration-twice {
    animation-iteration-count: 2;
}

/* Animation Timing Functions */
.animate-ease-linear {
    animation-timing-function: var(--animation-easing-linear);
}

.animate-ease-ease {
    animation-timing-function: var(--animation-easing-ease);
}

.animate-ease-in {
    animation-timing-function: var(--animation-easing-ease-in);
}

.animate-ease-out {
    animation-timing-function: var(--animation-easing-ease-out);
}

.animate-ease-in-out {
    animation-timing-function: var(--animation-easing-ease-in-out);
}

.animate-ease-cubic {
    animation-timing-function: var(--animation-easing-cubic-bezier);
}

.animate-ease-zed {
    animation-timing-function: var(--animation-easing-zed);
}

.animate-ease-bounce {
    animation-timing-function: var(--animation-easing-bounce);
}

/* Scroll Animation Classes */
[data-scroll] {
    opacity: 0;
    transform: translateY(30px);
    transition:
        opacity var(--animation-duration-normal) var(--animation-easing-zed),
        transform var(--animation-duration-normal) var(--animation-easing-zed);
}

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

[data-scroll-fade] {
    opacity: 0;
    transition: opacity var(--animation-duration-slow)
        var(--animation-easing-zed);
}

[data-scroll-fade].scroll-visible {
    opacity: 1;
}

[data-scroll-scale] {
    opacity: 0;
    transform: scale(0.9);
    transition:
        opacity var(--animation-duration-normal) var(--animation-easing-zed),
        transform var(--animation-duration-normal) var(--animation-easing-zed);
}

[data-scroll-scale].scroll-visible {
    opacity: 1;
    transform: scale(1);
}

[data-scroll-slide-left] {
    opacity: 0;
    transform: translateX(-50px);
    transition:
        opacity var(--animation-duration-normal) var(--animation-easing-zed),
        transform var(--animation-duration-normal) var(--animation-easing-zed);
}

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

[data-scroll-slide-right] {
    opacity: 0;
    transform: translateX(50px);
    transition:
        opacity var(--animation-duration-normal) var(--animation-easing-zed),
        transform var(--animation-duration-normal) var(--animation-easing-zed);
}

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

/* Hover Animation Classes */
.hover-lift {
    transition: transform var(--animation-duration-fast)
        var(--animation-easing-zed);
}

.hover-lift:hover {
    transform: translateY(-4px);
}

.hover-scale {
    transition: transform var(--animation-duration-fast)
        var(--animation-easing-zed);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-rotate {
    transition: transform var(--animation-duration-normal)
        var(--animation-easing-zed);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-glow {
    transition: box-shadow var(--animation-duration-fast)
        var(--animation-easing-zed);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(var(--color-accent-rgb, 0, 122, 255), 0.3);
}

.hover-shake:hover {
    animation: glitch 0.3s var(--animation-easing-linear);
}

.hover-pulse:hover {
    animation: pulse 1s var(--animation-easing-ease-in-out);
}

/* Loading Animations */
.loading-shimmer {
    background: linear-gradient(
        90deg,
        var(--color-bg-tertiary) 25%,
        var(--color-border-light) 50%,
        var(--color-bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s linear infinite;
}

.loading-pulse {
    animation: pulse 2s var(--animation-easing-ease-in-out) infinite;
}

.loading-rotate {
    animation: rotate 1s linear infinite;
}

/* Utility Classes for Animation Control */
.animate-once {
    animation-iteration-count: 1;
}

.animate-paused {
    animation-play-state: paused;
}

.animate-running {
    animation-play-state: running;
}

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

    .animate-fade-in,
    .animate-fade-in-up,
    .animate-fade-in-down,
    .animate-fade-in-left,
    .animate-fade-in-right,
    .animate-scale-in,
    .animate-pulse,
    .animate-pulse-once,
    .animate-bounce,
    .animate-float,
    .animate-rotate,
    .animate-spin,
    .animate-shimmer,
    .animate-gradient-shift,
    .animate-typing,
    .animate-wave,
    .animate-glitch {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    [data-scroll],
    [data-scroll-fade],
    [data-scroll-scale],
    [data-scroll-slide-left],
    [data-scroll-slide-right] {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .hover-lift,
    .hover-scale,
    .hover-rotate,
    .hover-glow {
        transition: none !important;
    }

    .hover-lift:hover,
    .hover-scale:hover,
    .hover-rotate:hover {
        transform: none !important;
    }
}
