/**
 * animations.css - 소리튠 영어공부법 애니메이션 스타일
 * ANTIGRAVITY Effects: Planet Ring, Energy Release, Neon Glow
 * Location: /assets/css/animations.css
 */

/* ==========================================
   ANTIGRAVITY Effect 1: Planet Ring (행성 고리)
   Saturn-like ring rotation effect
   ========================================== */
.planet-ring-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

.planet-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: var(--gradient-cosmic);
    border-radius: 50%;
    box-shadow:
        0 0 30px rgba(102, 126, 234, 0.5),
        inset -10px -10px 30px rgba(0, 0, 0, 0.3);
}

.planet-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotateX(70deg);
    width: 180px;
    height: 180px;
    border: 3px solid transparent;
    border-radius: 50%;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--secondary), var(--primary)) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: planetRingSpin 8s linear infinite;
}

.planet-ring::before {
    content: '';
    position: absolute;
    inset: -5px;
    border: 2px solid rgba(240, 147, 251, 0.3);
    border-radius: 50%;
    animation: planetRingSpin 12s linear infinite reverse;
}

@keyframes planetRingSpin {
    from { transform: translate(-50%, -50%) rotateX(70deg) rotateZ(0deg); }
    to { transform: translate(-50%, -50%) rotateX(70deg) rotateZ(360deg); }
}

/* Planet Ring Hero Variant */
.hero-planet-ring {
    position: absolute;
    right: 10%;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.6;
    pointer-events: none;
}

/* ==========================================
   ANTIGRAVITY Effect 2: Energy Release (에너지 방출)
   Power explosion effect
   ========================================== */
.energy-release-container {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto;
}

.energy-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 20px white, 0 0 40px var(--primary), 0 0 60px var(--accent);
    animation: energyPulse 2s ease-in-out infinite;
}

.energy-wave {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px solid var(--primary);
    animation: energyExpand 2s ease-out infinite;
}

.energy-wave:nth-child(1) { animation-delay: 0s; }
.energy-wave:nth-child(2) { animation-delay: 0.4s; }
.energy-wave:nth-child(3) { animation-delay: 0.8s; }
.energy-wave:nth-child(4) { animation-delay: 1.2s; }
.energy-wave:nth-child(5) { animation-delay: 1.6s; }

@keyframes energyPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 20px white, 0 0 40px var(--primary), 0 0 60px var(--accent);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        box-shadow: 0 0 30px white, 0 0 60px var(--primary), 0 0 90px var(--accent);
    }
}

@keyframes energyExpand {
    0% {
        width: 30px;
        height: 30px;
        opacity: 1;
        border-width: 3px;
    }
    100% {
        width: 150px;
        height: 150px;
        opacity: 0;
        border-width: 1px;
    }
}

/* Energy Burst on Button Click */
.btn-energy {
    position: relative;
    overflow: visible;
}

.btn-energy::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(240, 147, 251, 0.5), transparent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: all 0.5s ease;
}

.btn-energy:active::after {
    width: 300px;
    height: 300px;
    opacity: 1;
}

/* ==========================================
   ANTIGRAVITY Effect 3: Neon Glow (네온 글로우)
   Bright neon tube effect
   ========================================== */
.neon-text {
    font-weight: 800;
    text-transform: uppercase;
    color: white;
    text-shadow:
        0 0 5px #fff,
        0 0 10px #fff,
        0 0 20px var(--primary),
        0 0 40px var(--primary),
        0 0 60px var(--primary),
        0 0 80px var(--primary);
    animation: neonFlicker 1.5s ease-in-out infinite alternate;
}

@keyframes neonFlicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        text-shadow:
            0 0 5px #fff,
            0 0 10px #fff,
            0 0 20px var(--primary),
            0 0 40px var(--primary),
            0 0 60px var(--primary),
            0 0 80px var(--primary);
    }
    20%, 24%, 55% {
        text-shadow: none;
    }
}

/* Neon Box */
.neon-box {
    border: 2px solid var(--primary);
    border-radius: var(--radius-md);
    box-shadow:
        0 0 5px var(--primary),
        0 0 10px var(--primary),
        0 0 20px var(--primary),
        inset 0 0 5px var(--primary),
        inset 0 0 10px var(--primary);
    animation: neonBoxPulse 2s ease-in-out infinite;
}

@keyframes neonBoxPulse {
    0%, 100% {
        box-shadow:
            0 0 5px var(--primary),
            0 0 10px var(--primary),
            0 0 20px var(--primary),
            inset 0 0 5px var(--primary),
            inset 0 0 10px var(--primary);
    }
    50% {
        box-shadow:
            0 0 10px var(--primary),
            0 0 20px var(--primary),
            0 0 40px var(--primary),
            inset 0 0 10px var(--primary),
            inset 0 0 20px var(--primary);
    }
}

/* Neon Line */
.neon-line {
    height: 3px;
    background: var(--primary);
    box-shadow:
        0 0 5px var(--primary),
        0 0 10px var(--primary),
        0 0 20px var(--primary);
    animation: neonLineScan 3s ease-in-out infinite;
}

@keyframes neonLineScan {
    0% { transform: scaleX(0); transform-origin: left; }
    50% { transform: scaleX(1); transform-origin: left; }
    51% { transform: scaleX(1); transform-origin: right; }
    100% { transform: scaleX(0); transform-origin: right; }
}

/* Neon Gradient Border */
.neon-border {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-md);
}

.neon-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(45deg, var(--primary), var(--accent), var(--secondary), var(--primary));
    background-size: 400% 400%;
    z-index: -1;
    animation: neonBorderGradient 4s ease infinite;
    filter: blur(2px);
}

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

/* ==========================================
   Sound Wave Animation (for Soritune)
   ========================================== */
.sound-wave-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 60px;
}

.sound-wave-bar {
    width: 6px;
    background: var(--gradient-cosmic);
    border-radius: 3px;
    animation: soundWave 1.2s ease-in-out infinite;
}

.sound-wave-bar:nth-child(1) { animation-delay: 0s; }
.sound-wave-bar:nth-child(2) { animation-delay: 0.1s; }
.sound-wave-bar:nth-child(3) { animation-delay: 0.2s; }
.sound-wave-bar:nth-child(4) { animation-delay: 0.3s; }
.sound-wave-bar:nth-child(5) { animation-delay: 0.4s; }
.sound-wave-bar:nth-child(6) { animation-delay: 0.5s; }
.sound-wave-bar:nth-child(7) { animation-delay: 0.4s; }
.sound-wave-bar:nth-child(8) { animation-delay: 0.3s; }
.sound-wave-bar:nth-child(9) { animation-delay: 0.2s; }
.sound-wave-bar:nth-child(10) { animation-delay: 0.1s; }

@keyframes soundWave {
    0%, 100% { height: 10px; }
    50% { height: 50px; }
}

/* ==========================================
   Frequency Tuning Animation
   ========================================== */
.frequency-tuner {
    position: relative;
    height: 100px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.frequency-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
}

.frequency-wave {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
    background:
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 10px,
            rgba(102, 126, 234, 0.3) 10px,
            rgba(102, 126, 234, 0.3) 11px
        );
    animation: frequencyScroll 2s linear infinite;
}

@keyframes frequencyScroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

.frequency-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 80px;
    background: var(--gradient-cosmic);
    border-radius: 10px;
    animation: frequencyTune 3s ease-in-out infinite;
}

@keyframes frequencyTune {
    0%, 100% { transform: translate(-50%, -50%) translateX(-30px); }
    50% { transform: translate(-50%, -50%) translateX(30px); }
}

/* ==========================================
   Floating Elements Animation
   ========================================== */
.float-slow {
    animation: floatSlow 8s ease-in-out infinite;
}

.float-medium {
    animation: floatMedium 5s ease-in-out infinite;
}

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

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

@keyframes floatMedium {
    0%, 100% { transform: translateY(0) translateX(0); }
    25% { transform: translateY(-10px) translateX(5px); }
    50% { transform: translateY(-20px) translateX(0); }
    75% { transform: translateY(-10px) translateX(-5px); }
}

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

/* ==========================================
   Particle System
   ========================================== */
.particles-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat 10s ease-in-out infinite;
}

.particle:nth-child(odd) {
    background: var(--accent);
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; animation-delay: 1s; }
.particle:nth-child(3) { left: 30%; animation-delay: 2s; }
.particle:nth-child(4) { left: 40%; animation-delay: 3s; }
.particle:nth-child(5) { left: 50%; animation-delay: 4s; }
.particle:nth-child(6) { left: 60%; animation-delay: 5s; }
.particle:nth-child(7) { left: 70%; animation-delay: 6s; }
.particle:nth-child(8) { left: 80%; animation-delay: 7s; }
.particle:nth-child(9) { left: 90%; animation-delay: 8s; }
.particle:nth-child(10) { left: 95%; animation-delay: 9s; }

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) scale(1);
        opacity: 0;
    }
}

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

.text-reveal span {
    display: inline-block;
    transform: translateY(100%);
    animation: textReveal 0.8s ease forwards;
}

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

/* Character by character reveal */
.char-reveal span {
    opacity: 0;
    animation: charReveal 0.5s ease forwards;
}

@keyframes charReveal {
    to { opacity: 1; }
}

/* ==========================================
   Loading Animations
   ========================================== */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(102, 126, 234, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

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

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

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

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

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

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

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

.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: var(--shadow-glow);
}

/* ==========================================
   Gradient Text Animation
   ========================================== */
.animated-gradient-text {
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--secondary), var(--primary));
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 5s ease infinite;
}

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

/* ==========================================
   Typing Animation
   ========================================== */
.typing-text {
    border-right: 2px solid var(--primary);
    white-space: nowrap;
    overflow: hidden;
    animation: typing 3s steps(40) 1s forwards, blink 0.7s infinite;
}

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

@keyframes blink {
    50% { border-color: transparent; }
}

/* ==========================================
   Shake Animation (for errors)
   ========================================== */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

/* ==========================================
   Pulse Animation
   ========================================== */
.pulse {
    animation: pulse 2s ease-in-out infinite;
}

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

.pulse-slow {
    animation: pulse 3s ease-in-out infinite;
}

/* ==========================================
   Bounce Animation
   ========================================== */
.bounce {
    animation: bounce 2s ease infinite;
}

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

/* ==========================================
   Fade Animations
   ========================================== */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Slide Fade */
.slide-fade-up {
    animation: slideFadeUp 0.6s ease forwards;
}

.slide-fade-down {
    animation: slideFadeDown 0.6s ease forwards;
}

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

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

/* ==========================================
   Icon Animations
   ========================================== */
.icon-spin {
    animation: spin 2s linear infinite;
}

.icon-pulse {
    animation: iconPulse 1.5s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

/* ==========================================
   Counter Animation Helper
   ========================================== */
.counter-animate {
    display: inline-block;
}
