/**
 * Animations
 * Testing With Renata Theme
 * 
 * Scroll-triggered animations and micro-interactions.
 */

/* ================================
   ANIMATION KEYFRAMES
   ================================ */

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Fade In Up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Down */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Left */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade In Right */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale In */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

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

/* Pulse Animation */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* Glow Animation */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px var(--accent-green);
    }
    50% {
        box-shadow: 0 0 20px var(--accent-green), 0 0 30px var(--accent-green);
    }
}

/* Text Gradient Animation */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Terminal Typing */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

/* Spin */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Bounce */
@keyframes bounce {
    0%, 20%, 53%, 100% {
        animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
        transform: translateY(0);
    }
    40%, 43% {
        animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
        transform: translateY(-30px);
    }
    70% {
        animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
        transform: translateY(-15px);
    }
    80% {
        transform: translateY(0);
    }
    90% {
        transform: translateY(-4px);
    }
}

/* ================================
   ANIMATION CLASSES
   ================================ */

/* Base animation setup for scroll-triggered animations */
[data-animate] {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-animate].animated {
    opacity: 1;
}

/* Specific animation types */
[data-animate="fade-in"].animated {
    animation: fadeIn 0.6s ease forwards;
}

[data-animate="fade-in-up"] {
    transform: translateY(30px);
}

[data-animate="fade-in-up"].animated {
    transform: translateY(0);
}

[data-animate="fade-in-down"] {
    transform: translateY(-30px);
}

[data-animate="fade-in-down"].animated {
    transform: translateY(0);
}

[data-animate="fade-in-left"] {
    transform: translateX(-30px);
}

[data-animate="fade-in-left"].animated {
    transform: translateX(0);
}

[data-animate="fade-in-right"] {
    transform: translateX(30px);
}

[data-animate="fade-in-right"].animated {
    transform: translateX(0);
}

[data-animate="scale-in"] {
    transform: scale(0.9);
}

[data-animate="scale-in"].animated {
    transform: scale(1);
}

/* Animation Delays */
[data-delay="100"] { transition-delay: 100ms; }
[data-delay="200"] { transition-delay: 200ms; }
[data-delay="300"] { transition-delay: 300ms; }
[data-delay="400"] { transition-delay: 400ms; }
[data-delay="500"] { transition-delay: 500ms; }
[data-delay="600"] { transition-delay: 600ms; }
[data-delay="700"] { transition-delay: 700ms; }
[data-delay="800"] { transition-delay: 800ms; }

/* ================================
   HOVER EFFECTS
   ================================ */

/* Lift on hover */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Scale on hover */
.hover-scale {
    transition: transform var(--transition-base);
}

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

/* Glow on hover */
.hover-glow {
    transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
    box-shadow: var(--shadow-glow-green);
}

/* Border glow on hover */
.hover-border-glow {
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.hover-border-glow:hover {
    border-color: var(--accent-green);
    box-shadow: 0 0 0 1px var(--accent-green);
}

/* ================================
   CONTINUOUS ANIMATIONS
   ================================ */

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

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

.animate-bounce {
    animation: bounce 1s ease infinite;
}

/* ================================
   TEXT EFFECTS
   ================================ */

/* Gradient text */
.text-gradient {
    background: linear-gradient(
        135deg,
        var(--accent-green) 0%,
        var(--accent-cyan) 50%,
        var(--accent-purple) 100%
    );
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 5s ease infinite;
}

/* Typing effect container */
.typing-effect {
    overflow: hidden;
    border-right: 2px solid var(--accent-green);
    white-space: nowrap;
    animation: 
        typing 3.5s steps(40, end),
        blink 0.75s step-end infinite;
}

/* ================================
   STAGGER ANIMATION FOR GRIDS
   ================================ */

.stagger-animate > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.stagger-animate.animated > *:nth-child(1) { transition-delay: 0ms; }
.stagger-animate.animated > *:nth-child(2) { transition-delay: 100ms; }
.stagger-animate.animated > *:nth-child(3) { transition-delay: 200ms; }
.stagger-animate.animated > *:nth-child(4) { transition-delay: 300ms; }
.stagger-animate.animated > *:nth-child(5) { transition-delay: 400ms; }
.stagger-animate.animated > *:nth-child(6) { transition-delay: 500ms; }
.stagger-animate.animated > *:nth-child(7) { transition-delay: 600ms; }
.stagger-animate.animated > *:nth-child(8) { transition-delay: 700ms; }
.stagger-animate.animated > *:nth-child(9) { transition-delay: 800ms; }

.stagger-animate.animated > * {
    opacity: 1;
    transform: translateY(0);
}

/* ================================
   PAGE TRANSITIONS
   ================================ */

.page-transition-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.page-transition-exit {
    opacity: 1;
}

.page-transition-exit-active {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ================================
   LOADING SPINNER
   ================================ */

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner--sm {
    width: 24px;
    height: 24px;
    border-width: 2px;
}

.loading-spinner--lg {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

/* ================================
   REDUCE MOTION
   ================================ */

@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;
    }
    
    [data-animate] {
        opacity: 1;
        transform: none;
    }
}



