/**
 * Animations & Keyframes
 * 애니메이션 및 키프레임 (크로스 브라우저 호환)
 */

/* ============================================
   Aurora Background Effect
   ============================================ */

.aurora-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: -webkit-linear-gradient(315deg, #0a0a12 0%, #0d1117 50%, #0a0a12 100%);
    background: linear-gradient(135deg, #0a0a12 0%, #0d1117 50%, #0a0a12 100%);
    overflow: hidden;
}

.aurora-bg::before,
.aurora-bg::after {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    -webkit-animation: aurora 15s ease-in-out infinite;
    animation: aurora 15s ease-in-out infinite;
}

.aurora-bg::before {
    background:
        radial-gradient(ellipse at 30% 20%, rgba(80, 200, 180, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(100, 140, 220, 0.12) 0%, transparent 45%),
        radial-gradient(ellipse at 40% 80%, rgba(160, 100, 200, 0.1) 0%, transparent 40%);
    -webkit-animation-delay: 0s;
    animation-delay: 0s;
}

.aurora-bg::after {
    background:
        radial-gradient(ellipse at 60% 30%, rgba(60, 180, 200, 0.12) 0%, transparent 45%),
        radial-gradient(ellipse at 20% 70%, rgba(140, 120, 220, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(80, 160, 180, 0.08) 0%, transparent 40%);
    -webkit-animation-delay: -7s;
    animation-delay: -7s;
}

@-webkit-keyframes aurora {
    0%, 100% {
        -webkit-transform: translate(0, 0) rotate(0deg) scale(1);
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    25% {
        -webkit-transform: translate(2%, 1%) rotate(1deg) scale(1.02);
        transform: translate(2%, 1%) rotate(1deg) scale(1.02);
    }
    50% {
        -webkit-transform: translate(-1%, 2%) rotate(-1deg) scale(0.98);
        transform: translate(-1%, 2%) rotate(-1deg) scale(0.98);
    }
    75% {
        -webkit-transform: translate(-2%, -1%) rotate(0.5deg) scale(1.01);
        transform: translate(-2%, -1%) rotate(0.5deg) scale(1.01);
    }
}

@keyframes aurora {
    0%, 100% {
        -webkit-transform: translate(0, 0) rotate(0deg) scale(1);
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    25% {
        -webkit-transform: translate(2%, 1%) rotate(1deg) scale(1.02);
        transform: translate(2%, 1%) rotate(1deg) scale(1.02);
    }
    50% {
        -webkit-transform: translate(-1%, 2%) rotate(-1deg) scale(0.98);
        transform: translate(-1%, 2%) rotate(-1deg) scale(0.98);
    }
    75% {
        -webkit-transform: translate(-2%, -1%) rotate(0.5deg) scale(1.01);
        transform: translate(-2%, -1%) rotate(0.5deg) scale(1.01);
    }
}

/* Aurora Glow Elements */
.aurora-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    -webkit-filter: blur(120px);
    filter: blur(120px);
    opacity: 0.4;
    -webkit-animation: glow-pulse 8s ease-in-out infinite;
    animation: glow-pulse 8s ease-in-out infinite;
}

.aurora-glow-1 {
    top: -20%;
    left: 10%;
    background: -webkit-linear-gradient(top, rgba(60, 200, 180, 0.3) 0%, rgba(80, 140, 200, 0.2) 100%);
    background: linear-gradient(180deg, rgba(60, 200, 180, 0.3) 0%, rgba(80, 140, 200, 0.2) 100%);
    -webkit-animation-delay: 0s;
    animation-delay: 0s;
}

.aurora-glow-2 {
    top: 30%;
    right: -10%;
    background: -webkit-linear-gradient(top, rgba(100, 120, 200, 0.25) 0%, rgba(140, 100, 180, 0.15) 100%);
    background: linear-gradient(180deg, rgba(100, 120, 200, 0.25) 0%, rgba(140, 100, 180, 0.15) 100%);
    -webkit-animation-delay: -3s;
    animation-delay: -3s;
}

.aurora-glow-3 {
    bottom: -10%;
    left: 30%;
    background: -webkit-linear-gradient(top, rgba(80, 180, 160, 0.2) 0%, rgba(60, 140, 180, 0.15) 100%);
    background: linear-gradient(180deg, rgba(80, 180, 160, 0.2) 0%, rgba(60, 140, 180, 0.15) 100%);
    -webkit-animation-delay: -5s;
    animation-delay: -5s;
}

@-webkit-keyframes glow-pulse {
    0%, 100% {
        -webkit-transform: scale(1);
        transform: scale(1);
        opacity: 0.4;
    }
    50% {
        -webkit-transform: scale(1.1);
        transform: scale(1.1);
        opacity: 0.5;
    }
}

@keyframes glow-pulse {
    0%, 100% {
        -webkit-transform: scale(1);
        transform: scale(1);
        opacity: 0.4;
    }
    50% {
        -webkit-transform: scale(1.1);
        transform: scale(1.1);
        opacity: 0.5;
    }
}

/* ============================================
   Text Gradient Animation
   ============================================ */

.text-gradient-animate {
    background: -webkit-linear-gradient(
        0deg,
        #D35400 0%,
        #E67E22 25%,
        #F39C12 50%,
        #E67E22 75%,
        #D35400 100%
    );
    background: linear-gradient(
        90deg,
        #D35400 0%,
        #E67E22 25%,
        #F39C12 50%,
        #E67E22 75%,
        #D35400 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    -webkit-animation: gradient-shift 3s ease-in-out infinite;
    animation: gradient-shift 3s ease-in-out infinite;
}

/* Fallback for browsers without background-clip: text */
@supports not (-webkit-background-clip: text) {
    .text-gradient-animate {
        color: #D35400;
        background: none;
    }
}

.text-gradient-animate-light {
    background: -webkit-linear-gradient(
        0deg,
        #4ECDC4 0%,
        #44A08D 25%,
        #6DD5ED 50%,
        #44A08D 75%,
        #4ECDC4 100%
    );
    background: linear-gradient(
        90deg,
        #4ECDC4 0%,
        #44A08D 25%,
        #6DD5ED 50%,
        #44A08D 75%,
        #4ECDC4 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    -webkit-animation: gradient-shift 3s ease-in-out infinite;
    animation: gradient-shift 3s ease-in-out infinite;
}

@supports not (-webkit-background-clip: text) {
    .text-gradient-animate-light {
        color: #4ECDC4;
        background: none;
    }
}

@-webkit-keyframes gradient-shift {
    0%, 100% {
        background-position: 0% center;
    }
    50% {
        background-position: 100% center;
    }
}

@keyframes gradient-shift {
    0%, 100% {
        background-position: 0% center;
    }
    50% {
        background-position: 100% center;
    }
}

/* ============================================
   Background Thermal Grid
   ============================================ */

.bg-thermal-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: -ms-grid;
    display: grid;
    -ms-grid-columns: (1fr)[32];
    grid-template-columns: repeat(32, 1fr);
    -ms-grid-rows: (1fr)[24];
    grid-template-rows: repeat(24, 1fr);
    pointer-events: none;
    z-index: 0;
    opacity: 0.06;
    -webkit-filter: blur(12px);
    filter: blur(12px);
}

.bg-pixel {
    width: 100%;
    height: 100%;
    -webkit-transition: background-color 2s ease;
    -o-transition: background-color 2s ease;
    transition: background-color 2s ease;
}

/* ============================================
   Thermal Grid Component
   ============================================ */

.thermal-grid-container {
    position: absolute;
    right: 8vw;
    top: 50%;
    -webkit-transform: translateY(-50%);
    -ms-transform: translateY(-50%);
    transform: translateY(-50%);
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 1em;
    z-index: 1;
    opacity: 0.85;
}

.thermal-grid {
    display: -ms-grid;
    display: grid;
    -ms-grid-columns: (1fr)[32];
    grid-template-columns: repeat(32, 1fr);
    gap: 1px;
    width: 320px;
    height: 240px;
    background: #0a0a0a;
    padding: 5px;
    border-radius: 10px;
    -webkit-box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
}

.thermal-pixel {
    width: 100%;
    /* aspect-ratio fallback for older browsers */
    padding-bottom: 100%; /* Creates 1:1 aspect ratio */
    height: 0;
    border-radius: 1px;
    position: relative;
}

/* Modern browsers with aspect-ratio support */
@supports (aspect-ratio: 1) {
    .thermal-pixel {
        aspect-ratio: 1;
        padding-bottom: 0;
        height: auto;
    }
}

.thermal-label {
    font-size: 0.9rem;
    color: var(--warm-gray);
    color: #4A4A4A;
    letter-spacing: 0.05em;
}

/* ============================================
   Large Screen Scaling
   ============================================ */

@media (min-width: 1920px) {
    .aurora-glow {
        width: 800px;
        height: 800px;
    }

    .thermal-grid {
        width: 420px;
        height: 315px;
        border-radius: 14px;
    }
}

@media (min-width: 2560px) {
    .aurora-glow {
        width: 1000px;
        height: 1000px;
        -webkit-filter: blur(160px);
        filter: blur(160px);
    }

    .thermal-grid {
        width: 520px;
        height: 390px;
        border-radius: 16px;
    }
}

@media (min-width: 3840px) {
    .aurora-glow {
        width: 1400px;
        height: 1400px;
        -webkit-filter: blur(200px);
        filter: blur(200px);
    }

    .thermal-grid {
        width: 720px;
        height: 540px;
        border-radius: 20px;
        gap: 2px;
        padding: 8px;
    }

    .thermal-label {
        font-size: 1.1rem;
    }
}

@media (min-width: 5120px) {
    .aurora-glow {
        width: 1800px;
        height: 1800px;
        -webkit-filter: blur(260px);
        filter: blur(260px);
    }

    .thermal-grid {
        width: 960px;
        height: 720px;
        border-radius: 24px;
        gap: 2px;
        padding: 10px;
    }

    .thermal-label {
        font-size: 1.2rem;
    }
}

@media (min-width: 7680px) {
    .aurora-glow {
        width: 2600px;
        height: 2600px;
        -webkit-filter: blur(360px);
        filter: blur(360px);
    }

    .thermal-grid {
        width: 1400px;
        height: 1050px;
        border-radius: 32px;
        gap: 3px;
        padding: 14px;
    }

    .thermal-label {
        font-size: 1.4rem;
    }

    .bg-thermal-grid {
        -webkit-filter: blur(20px);
        filter: blur(20px);
    }
}
