/**
 * animations.css - 한국미래사업학교 애니메이션
 * Antigravity Effects: Solar Eclipse, Cosmic Void, Spiral Arm
 */

/* ============================================
   Base Animation Classes
   ============================================ */
.animate {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Delay classes */
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }
.delay-500 { transition-delay: 500ms; }

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

.fade-in { animation: fadeIn 0.6s ease forwards; }
.fade-in-up { animation: fadeInUp 0.6s ease forwards; }
.fade-in-down { animation: fadeInDown 0.6s ease forwards; }
.fade-in-left { animation: fadeInLeft 0.6s ease forwards; }
.fade-in-right { animation: fadeInRight 0.6s ease forwards; }

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

@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-in { animation: scaleIn 0.5s ease forwards; }
.scale-up { animation: scaleUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }

/* ============================================
   Slide Animations
   ============================================ */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

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

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.slide-in-up { animation: slideInUp 0.5s ease forwards; }
.slide-in-down { animation: slideInDown 0.5s ease forwards; }
.slide-in-left { animation: slideInLeft 0.5s ease forwards; }
.slide-in-right { animation: slideInRight 0.5s ease forwards; }

/* ============================================
   Pulse & Glow Animations
   ============================================ */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 0 40px rgba(102, 126, 234, 0.8);
    }
}

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

.pulse { animation: pulse 2s ease-in-out infinite; }
.pulse-glow { animation: pulseGlow 2s ease-in-out infinite; }
.text-glow { animation: textGlow 2s ease-in-out infinite; }

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

@keyframes floatSlow {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-10px) rotate(2deg);
    }
}

.float { animation: float 4s ease-in-out infinite; }
.float-slow { animation: floatSlow 6s ease-in-out infinite; }

/* ============================================
   Rotate Animations
   ============================================ */
@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

.rotate { animation: rotate 10s linear infinite; }
.rotate-slow { animation: rotateSlow 30s linear infinite; }

/* ============================================
   Shimmer Effect
   ============================================ */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

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

/* ============================================
   Antigravity Effect: Solar Eclipse
   ============================================ */
@keyframes solarEclipse {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
        box-shadow: 0 0 100px rgba(102, 126, 234, 0.8),
                    0 0 200px rgba(118, 75, 162, 0.6);
    }
    100% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 50px rgba(102, 126, 234, 0.4);
    }
}

.solar-eclipse {
    animation: solarEclipse 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.eclipse-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(102, 126, 234, 0.5);
    animation: eclipseRing 3s ease-out infinite;
}

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

/* ============================================
   Antigravity Effect: Cosmic Void
   ============================================ */
@keyframes cosmicVoid {
    0% {
        transform: scale(1.5);
        opacity: 0;
        filter: blur(20px);
    }
    50% {
        filter: blur(5px);
    }
    100% {
        transform: scale(1);
        opacity: 1;
        filter: blur(0);
    }
}

.cosmic-void {
    animation: cosmicVoid 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes voidPulse {
    0%, 100% {
        background: radial-gradient(circle at center,
            rgba(102, 126, 234, 0.2) 0%,
            transparent 70%);
    }
    50% {
        background: radial-gradient(circle at center,
            rgba(118, 75, 162, 0.3) 0%,
            transparent 60%);
    }
}

.void-pulse {
    animation: voidPulse 4s ease-in-out infinite;
}

/* ============================================
   Antigravity Effect: Spiral Arm
   ============================================ */
@keyframes spiralArm {
    0% {
        transform: rotate(0deg) scale(0.8);
        opacity: 0;
    }
    100% {
        transform: rotate(360deg) scale(1);
        opacity: 1;
    }
}

.spiral-arm {
    animation: spiralArm 2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

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

.galaxy-spin {
    animation: galaxySpin 60s linear infinite;
}

/* ============================================
   Star Field Effect
   ============================================ */
@keyframes twinkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

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

.star:nth-child(odd) {
    animation-delay: 1.5s;
}

/* ============================================
   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(0, 0, 0, 0.3);
}

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

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

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

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

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

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

/* ============================================
   Button Ripple Effect
   ============================================ */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::after {
    width: 300px;
    height: 300px;
}

/* ============================================
   Loading Animations
   ============================================ */
@keyframes spinner {
    to { transform: rotate(360deg); }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spinner 0.8s linear infinite;
}

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

.loading-dots {
    display: flex;
    gap: 8px;
}

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

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

/* ============================================
   Scroll Progress Indicator
   ============================================ */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--gradient-cosmic);
    z-index: 9999;
    transition: width 0.1s;
}

/* ============================================
   Page Transition Effects
   ============================================ */
.page-transition-enter {
    opacity: 0;
    transform: translateY(20px);
}

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

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

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

/* ============================================
   Counter Animation
   ============================================ */
.counter {
    display: inline-block;
    transition: all 0.5s ease;
}

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

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--primary); }
}

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

/* ============================================
   Parallax Effect Classes
   ============================================ */
.parallax-slow {
    will-change: transform;
}

.parallax-fast {
    will-change: transform;
}

/* ============================================
   Magnetic Button Effect
   ============================================ */
.magnetic-btn {
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

/* ============================================
   Stagger Animation for Lists
   ============================================ */
.stagger-list > * {
    opacity: 0;
    transform: translateY(20px);
}

.stagger-list.animate > *:nth-child(1) { animation: fadeInUp 0.5s ease forwards 0.1s; }
.stagger-list.animate > *:nth-child(2) { animation: fadeInUp 0.5s ease forwards 0.2s; }
.stagger-list.animate > *:nth-child(3) { animation: fadeInUp 0.5s ease forwards 0.3s; }
.stagger-list.animate > *:nth-child(4) { animation: fadeInUp 0.5s ease forwards 0.4s; }
.stagger-list.animate > *:nth-child(5) { animation: fadeInUp 0.5s ease forwards 0.5s; }
.stagger-list.animate > *:nth-child(6) { animation: fadeInUp 0.5s ease forwards 0.6s; }

/* ============================================
   Text Reveal Animation
   ============================================ */
.text-reveal {
    position: relative;
    overflow: hidden;
}

.text-reveal span {
    display: inline-block;
    transform: translateY(100%);
    animation: textReveal 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes textReveal {
    to {
        transform: translateY(0);
    }
}

/* ============================================
   Image Reveal Animation
   ============================================ */
.image-reveal {
    position: relative;
    overflow: hidden;
}

.image-reveal::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--primary);
    transform: scaleX(1);
    transform-origin: right;
    animation: imageReveal 1s cubic-bezier(0.77, 0, 0.175, 1) forwards;
}

@keyframes imageReveal {
    to {
        transform: scaleX(0);
    }
}

/* ============================================
   Reduced Motion Support
   ============================================ */
@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 {
        opacity: 1;
        transform: none;
    }
}
