/**
 * animations.css - 영어 챌린지 애니메이션 & ANTIGRAVITY 효과
 * 위치: /assets/css/animations.css
 *
 * 선택된 ANTIGRAVITY 효과:
 * 1. 입자 흔적 (Particle Trail) - particle, easy - 따라다니는 입자 경로
 * 2. 빛 그라디언트 (Light Gradient) - light, easy - 부드러운 빛 전환
 * 3. 운동량 (Momentum) - gravity, medium - 움직이는 힘 전달
 */

/* ========== 기본 애니메이션 ========== */

/* 페이드 인 */
@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);
    }
}

/* 스케일 인 */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 스케일 펄스 */
@keyframes scalePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* 바운스 */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* 쉐이크 */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

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

/* 플로팅 */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

/* 글로우 펄스 */
@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 111, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 111, 0, 0.6);
    }
}

/* ========== 슬라이드 애니메이션 ========== */

/* 슬라이드 인 */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 슬라이드 콘텐츠 */
.slide-content {
    animation: slideIn 1s ease-out;
}

.slide-badge {
    animation: fadeInDown 0.8s ease-out 0.2s both;
}

.slide-title {
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.slide-desc {
    animation: fadeInUp 0.8s ease-out 0.6s both;
}

.slide-actions {
    animation: fadeInUp 0.8s ease-out 0.8s both;
}

/* ========== 스크롤 애니메이션 ========== */

[data-animate] {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-animate="fade-in"] {
    opacity: 0;
}

[data-animate="fade-in"].animated {
    opacity: 1;
}

[data-animate="slide-up"] {
    transform: translateY(40px);
}

[data-animate="slide-up"].animated {
    opacity: 1;
    transform: translateY(0);
}

[data-animate="slide-down"] {
    transform: translateY(-40px);
}

[data-animate="slide-down"].animated {
    opacity: 1;
    transform: translateY(0);
}

[data-animate="slide-left"] {
    transform: translateX(40px);
}

[data-animate="slide-left"].animated {
    opacity: 1;
    transform: translateX(0);
}

[data-animate="slide-right"] {
    transform: translateX(-40px);
}

[data-animate="slide-right"].animated {
    opacity: 1;
    transform: translateX(0);
}

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

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

/* 딜레이 변형 */
[data-animate-delay="100"] {
    transition-delay: 100ms;
}

[data-animate-delay="200"] {
    transition-delay: 200ms;
}

[data-animate-delay="300"] {
    transition-delay: 300ms;
}

[data-animate-delay="400"] {
    transition-delay: 400ms;
}

[data-animate-delay="500"] {
    transition-delay: 500ms;
}

[data-animate-delay="600"] {
    transition-delay: 600ms;
}

/* ========== ANTIGRAVITY 효과 1: 입자 흔적 (Particle Trail) ========== */

/* 마우스 따라다니는 입자 효과 */
.particle-trail {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
}

.trail-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: trailFade 0.8s ease-out forwards;
}

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

/* 버튼 호버시 입자 효과 */
.btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(255, 255, 255, 0.3) 0%,
        transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
}

.btn-primary:hover::after {
    opacity: 1;
}

/* 카드 입자 흔적 효과 */
.card.particle-effect {
    position: relative;
    overflow: visible;
}

.card.particle-effect::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: radial-gradient(
        circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(255, 111, 0, 0.15) 0%,
        transparent 50%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    border-radius: inherit;
}

.card.particle-effect:hover::before {
    opacity: 1;
}

/* ========== ANTIGRAVITY 효과 2: 빛 그라디언트 (Light Gradient) ========== */

/* 부드러운 빛 전환 배경 */
@keyframes lightGradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.light-gradient {
    background: linear-gradient(
        270deg,
        rgba(255, 111, 0, 0.15),
        rgba(102, 126, 234, 0.15),
        rgba(240, 147, 251, 0.15),
        rgba(255, 111, 0, 0.15)
    );
    background-size: 400% 400%;
    animation: lightGradient 15s ease infinite;
}

/* 섹션 배경 빛 그라디언트 */
.section.light-gradient-bg {
    position: relative;
}

.section.light-gradient-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 111, 0, 0.08) 0%,
        transparent 30%,
        rgba(102, 126, 234, 0.08) 50%,
        transparent 70%,
        rgba(255, 111, 0, 0.08) 100%
    );
    background-size: 200% 200%;
    animation: lightGradient 20s ease infinite;
    pointer-events: none;
}

/* 히어로 빛 그라디언트 */
.hero-light-gradient {
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse at 30% 20%,
        rgba(255, 111, 0, 0.2) 0%,
        transparent 50%
    ),
    radial-gradient(
        ellipse at 70% 80%,
        rgba(102, 126, 234, 0.2) 0%,
        transparent 50%
    );
    animation: heroLightMove 10s ease-in-out infinite;
}

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

/* 텍스트 빛 그라디언트 */
.text-gradient-light {
    background: linear-gradient(
        90deg,
        var(--primary) 0%,
        var(--primary-light) 25%,
        var(--secondary-light) 50%,
        var(--primary-light) 75%,
        var(--primary) 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textGradientShift 4s linear infinite;
}

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

/* 버튼 빛 그라디언트 */
.btn-gradient-light {
    position: relative;
    overflow: hidden;
}

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

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

/* ========== ANTIGRAVITY 효과 3: 운동량 (Momentum) ========== */

/* 운동량 전환 효과 */
.momentum-element {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.momentum-element:hover {
    transform: translateY(-8px) scale(1.02);
}

/* 스크롤시 운동량 효과 */
.momentum-scroll {
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 카드 운동량 효과 */
.card.momentum {
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.card.momentum:hover {
    transform: translateY(-12px) rotate3d(1, -1, 0, 3deg);
}

/* 버튼 운동량 */
.btn.momentum {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn.momentum:hover {
    transform: translateY(-4px) scale(1.05);
}

.btn.momentum:active {
    transform: translateY(-2px) scale(0.98);
}

/* 아이콘 운동량 회전 */
.icon-momentum {
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.icon-momentum:hover {
    transform: rotate(15deg) scale(1.1);
}

/* 리스트 아이템 운동량 */
.list-momentum li {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.list-momentum li:hover {
    transform: translateX(10px);
    padding-left: 10px;
}

/* ========== 로딩 애니메이션 ========== */

/* 페이지 로딩 */
.page-loader {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.loaded {
    opacity: 0;
    visibility: hidden;
}

/* 로딩 스피너 애니메이션 */
.loader-spinner {
    width: 60px;
    height: 60px;
    position: relative;
}

.loader-spinner::before,
.loader-spinner::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
}

.loader-spinner::before {
    border-top-color: var(--primary);
    animation: loaderSpin 1s linear infinite;
}

.loader-spinner::after {
    border-bottom-color: var(--secondary);
    animation: loaderSpin 1s linear infinite reverse;
    animation-delay: 0.2s;
}

@keyframes loaderSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* 콘텐츠 로딩 스켈레톤 */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
    border-radius: var(--border-radius-sm);
}

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

/* ========== 호버 효과 ========== */

/* 카드 호버 빛 효과 */
.card-hover-light {
    position: relative;
    overflow: hidden;
}

.card-hover-light::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle,
        rgba(255, 111, 0, 0.1) 0%,
        transparent 70%
    );
    opacity: 0;
    transform: scale(0);
    transition: all 0.5s ease;
}

.card-hover-light:hover::after {
    opacity: 1;
    transform: scale(1);
}

/* 링크 언더라인 애니메이션 */
.link-underline {
    position: relative;
    display: inline-block;
}

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

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

/* ========== 카운터 애니메이션 ========== */

.counter-animated {
    transition: transform 0.3s ease;
}

.counter-animated.counting {
    animation: counterBounce 0.3s ease;
}

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

/* ========== 알림 애니메이션 ========== */

.notification-enter {
    animation: notificationSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

.notification-exit {
    animation: notificationSlideOut 0.3s ease forwards;
}

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

/* ========== 타이핑 효과 ========== */

.typing-effect {
    overflow: hidden;
    border-right: 2px solid var(--primary);
    white-space: nowrap;
    animation: typing 3s steps(30) 1s forwards, blink 0.75s step-end infinite;
}

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

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

/* ========== 물결 효과 ========== */

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

.ripple-effect .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ========== 체크마크 애니메이션 ========== */

.checkmark {
    width: 24px;
    height: 24px;
    stroke: var(--success);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: checkmarkStroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: checkmarkStroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
}

@keyframes checkmarkStroke {
    100% {
        stroke-dashoffset: 0;
    }
}

/* ========== 진행바 애니메이션 ========== */

.progress-animated .progress-fill {
    animation: progressGrow 1.5s ease-out forwards;
}

@keyframes progressGrow {
    from {
        width: 0;
    }
}

/* ========== 모달 애니메이션 ========== */

.modal-backdrop {
    animation: modalFadeIn 0.3s ease;
}

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

.modal-content {
    animation: modalSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

/* ========== 스크롤 인디케이터 ========== */

.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    animation: scrollBounce 2s infinite;
}

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

.scroll-mouse {
    width: 24px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    position: relative;
}

.scroll-wheel {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 8px;
    background: var(--primary);
    border-radius: 2px;
    animation: scrollWheel 1.5s infinite;
}

@keyframes scrollWheel {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(12px);
    }
}

/* ========== 접근성 - 모션 감소 ========== */

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

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

    .typing-effect {
        animation: none;
        width: auto;
        border-right: none;
    }
}
