/**
 * animations.css - Animation Styles
 * 영어공부 혼자하기 - edu.soritune.com
 * ANTIGRAVITY Effects & TikTok-Inspired Animations
 * Location: /assets/css/animations.css
 */

/* ========================================
   ANTIGRAVITY EFFECTS BASE
======================================== */

/* Canvas Background */
#antigravity-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

/* Particle Galaxy Container */
.particle-galaxy {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -2;
    overflow: hidden;
}

/* ========================================
   KEYFRAME ANIMATIONS
======================================== */

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

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

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

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

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

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

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

@keyframes pulseSoft {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.02); opacity: 0.9; }
}

/* Glow Animations */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 0 40px rgba(102, 126, 234, 0.6), 0 0 60px rgba(118, 75, 162, 0.4);
    }
}

@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
    }
    50% {
        text-shadow: 0 0 20px rgba(102, 126, 234, 0.8), 0 0 30px rgba(240, 147, 251, 0.5);
    }
}

/* Cosmic Effects */
@keyframes cosmicFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-10px) rotate(1deg);
    }
    50% {
        transform: translateY(-5px) rotate(-1deg);
    }
    75% {
        transform: translateY(-15px) rotate(0.5deg);
    }
}

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

@keyframes nebulaPulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.1);
    }
}

/* Zigzag Effect */
@keyframes zigzag {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(0); }
    75% { transform: translateX(5px); }
}

/* Wireframe Grid */
@keyframes wireframeMove {
    0% { transform: perspective(1000px) rotateX(60deg) translateY(0); }
    100% { transform: perspective(1000px) rotateX(60deg) translateY(50px); }
}

/* Radial Lines */
@keyframes radialPulse {
    0%, 100% {
        transform: rotate(0deg) scale(1);
        opacity: 0.5;
    }
    50% {
        transform: rotate(180deg) scale(1.1);
        opacity: 0.8;
    }
}

/* Power Surge */
@keyframes powerSurge {
    0%, 90%, 100% { opacity: 0; }
    5%, 15% { opacity: 1; }
    10% { opacity: 0.5; }
    20%, 85% { opacity: 0; }
}

/* Redshift */
@keyframes redshift {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(30deg);
    }
}

/* Particle Text */
@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0) translateX(0);
        opacity: 1;
    }
    50% {
        transform: translateY(-20px) translateX(10px);
        opacity: 0.7;
    }
}

/* Comet Trail */
@keyframes cometTrail {
    0% {
        transform: translateX(-100%) translateY(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateX(100vw) translateY(100px);
        opacity: 0;
    }
}

/* HDR Bloom */
@keyframes hdrBloom {
    0%, 100% {
        filter: brightness(1) contrast(1);
    }
    50% {
        filter: brightness(1.1) contrast(1.05);
    }
}

/* Penrose Triangle Rotation */
@keyframes penroseRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

/* Fade Animations */
.animate-fadeIn {
    animation: fadeIn 0.6s ease-out forwards;
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fadeInDown {
    animation: fadeInDown 0.6s ease-out forwards;
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.6s ease-out forwards;
}

.animate-fadeInRight {
    animation: fadeInRight 0.6s ease-out forwards;
}

/* Scale Animations */
.animate-scaleIn {
    animation: scaleIn 0.5s ease-out forwards;
}

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

/* Glow */
.animate-glow {
    animation: glow 3s ease-in-out infinite;
}

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

/* Cosmic */
.animate-float {
    animation: cosmicFloat 6s ease-in-out infinite;
}

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

/* Delays */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-900 { animation-delay: 0.9s; }
.delay-1000 { animation-delay: 1s; }

/* Duration */
.duration-fast { animation-duration: 0.3s; }
.duration-normal { animation-duration: 0.6s; }
.duration-slow { animation-duration: 1s; }
.duration-slower { animation-duration: 1.5s; }

/* ========================================
   SCROLL-TRIGGERED ANIMATIONS
======================================== */

/* Initial hidden state for scroll animations */
[data-animate] {
    opacity: 0;
}

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

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

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

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

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

/* Visible state */
[data-animate].animated {
    opacity: 1;
    transform: translate(0) scale(1);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

/* Staggered children animation */
[data-stagger] > * {
    opacity: 0;
    transform: translateY(20px);
}

[data-stagger].animated > * {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

[data-stagger].animated > *:nth-child(1) { transition-delay: 0.1s; }
[data-stagger].animated > *:nth-child(2) { transition-delay: 0.2s; }
[data-stagger].animated > *:nth-child(3) { transition-delay: 0.3s; }
[data-stagger].animated > *:nth-child(4) { transition-delay: 0.4s; }
[data-stagger].animated > *:nth-child(5) { transition-delay: 0.5s; }
[data-stagger].animated > *:nth-child(6) { transition-delay: 0.6s; }

/* ========================================
   HOVER TRANSITIONS
======================================== */

/* Card Hover Effects */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.2);
}

.hover-scale {
    transition: transform 0.3s ease;
}

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

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.4);
}

/* Button Shine Effect */
.btn-shine {
    position: relative;
    overflow: hidden;
}

.btn-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s ease;
}

.btn-shine:hover::before {
    left: 100%;
}

/* Link Underline Animation */
.link-underline {
    position: relative;
}

.link-underline::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-cosmic);
    transition: width 0.3s ease;
}

.link-underline:hover::after {
    width: 100%;
}

/* ========================================
   LOADING ANIMATIONS
======================================== */

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Dots Loading */
.dots-loading {
    display: flex;
    gap: 8px;
}

.dots-loading span {
    width: 10px;
    height: 10px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite;
}

.dots-loading span:nth-child(1) { animation-delay: 0s; }
.dots-loading span:nth-child(2) { animation-delay: 0.2s; }
.dots-loading span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-bg-light) 25%,
        #e8e8e8 50%,
        var(--color-bg-light) 75%
    );
    background-size: 200% 100%;
    animation: skeleton 1.5s ease-in-out infinite;
}

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

/* ========================================
   SLIDER ANIMATIONS
======================================== */

/* Slide Transitions */
.slide-enter {
    opacity: 0;
    transform: translateX(100%);
}

.slide-enter-active {
    opacity: 1;
    transform: translateX(0);
    transition: all 0.5s ease;
}

.slide-exit {
    opacity: 1;
    transform: translateX(0);
}

.slide-exit-active {
    opacity: 0;
    transform: translateX(-100%);
    transition: all 0.5s ease;
}

/* Fade Slide */
.fade-slide {
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-slide.active {
    opacity: 1;
}

/* ========================================
   VAK TEST ANIMATIONS
======================================== */

/* Question Card Animation */
.vak-question-enter {
    opacity: 0;
    transform: translateX(50px);
}

.vak-question-enter-active {
    opacity: 1;
    transform: translateX(0);
    transition: all 0.4s ease-out;
}

/* Option Selection */
.vak-option {
    transition: all 0.3s ease;
}

.vak-option:hover {
    transform: translateX(8px);
    border-color: var(--color-primary);
}

.vak-option.selected {
    background: var(--gradient-card);
    border-color: var(--color-primary);
    transform: translateX(8px);
}

/* Progress Bar */
.vak-progress-fill {
    transition: width 0.4s ease-out;
}

/* Result Reveal */
.vak-result-reveal {
    opacity: 0;
    transform: scale(0.9);
    animation: resultReveal 0.6s ease-out forwards;
}

@keyframes resultReveal {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Radar Chart Animation */
.vak-chart-animate {
    animation: chartDraw 1s ease-out forwards;
}

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

/* ========================================
   COSMIC BACKGROUND EFFECTS
======================================== */

/* Floating Orbs */
.cosmic-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.4;
    animation: cosmicFloat 20s ease-in-out infinite;
    pointer-events: none;
}

.cosmic-orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.5) 0%, transparent 70%);
    top: -100px;
    left: -100px;
}

.cosmic-orb-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(118, 75, 162, 0.5) 0%, transparent 70%);
    top: 50%;
    right: -100px;
    animation-delay: 7s;
}

.cosmic-orb-3 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(240, 147, 251, 0.3) 0%, transparent 70%);
    bottom: -150px;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 14s;
}

/* Stars Background */
.stars-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    animation: starTwinkle 3s ease-in-out infinite;
}

/* Grid Lines */
.cosmic-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(102, 126, 234, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(102, 126, 234, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: wireframeMove 30s linear infinite;
    opacity: 0.5;
    pointer-events: none;
}

/* ========================================
   REDUCED 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;
    }

    .animate-float,
    .animate-pulse,
    .animate-glow,
    .animate-twinkle,
    .cosmic-orb,
    .cosmic-grid {
        animation: none !important;
    }

    [data-animate] {
        opacity: 1;
        transform: none;
    }
}
