/* ============================================
   사이트 배경 애니메이션 - 파티클 & 그라데이션
   ============================================ */

/* 배경 애니메이션 컨테이너 */
#bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(135deg, #0d1b2a 0%, #172129 30%, #1a2836 60%, #0f1923 100%);
  background-size: 400% 400%;
  animation: bgGradientShift 30s ease infinite;
  will-change: background-position;
}

/* 배경 그라데이션 이동 애니메이션 */
@keyframes bgGradientShift {
  0% { background-position: 0% 50%; }
  25% { background-position: 100% 0%; }
  50% { background-position: 100% 100%; }
  75% { background-position: 0% 100%; }
  100% { background-position: 0% 50%; }
}

/* ===== 빛나는 파티클 (보케 효과) ===== */
.bg-particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
  transform: translateZ(0);
}

/* 골드 파티클 */
.bg-particle.gold {
  background: radial-gradient(circle, rgba(204, 163, 84, 0.6) 0%, rgba(254, 225, 136, 0.1) 60%, transparent 70%);
  box-shadow: 0 0 15px rgba(204, 163, 84, 0.3), 0 0 30px rgba(204, 163, 84, 0.1);
}

/* 블루 파티클 */
.bg-particle.blue {
  background: radial-gradient(circle, rgba(100, 180, 255, 0.4) 0%, rgba(70, 130, 200, 0.1) 60%, transparent 70%);
  box-shadow: 0 0 15px rgba(100, 180, 255, 0.2), 0 0 30px rgba(100, 180, 255, 0.05);
}

/* 퍼플 파티클 */
.bg-particle.purple {
  background: radial-gradient(circle, rgba(160, 100, 220, 0.35) 0%, rgba(120, 70, 180, 0.1) 60%, transparent 70%);
  box-shadow: 0 0 12px rgba(160, 100, 220, 0.2);
}

/* 화이트 파티클 (별) */
.bg-particle.white {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
}

/* ===== 파티클 사이즈 ===== */
.bg-particle.size-xs { width: 3px; height: 3px; }
.bg-particle.size-sm { width: 6px; height: 6px; }
.bg-particle.size-md { width: 12px; height: 12px; }
.bg-particle.size-lg { width: 20px; height: 20px; }
.bg-particle.size-xl { width: 35px; height: 35px; }

/* ===== 떠다니는 애니메이션 ===== */
@keyframes floatUp1 {
  0% {
    transform: translateY(100vh) translateX(0) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 0.8;
  }
  100% {
    transform: translateY(-10vh) translateX(80px) scale(1);
    opacity: 0;
  }
}

@keyframes floatUp2 {
  0% {
    transform: translateY(100vh) translateX(0) scale(0.3);
    opacity: 0;
  }
  15% {
    opacity: 0.7;
  }
  85% {
    opacity: 0.5;
  }
  100% {
    transform: translateY(-15vh) translateX(-60px) scale(1.2);
    opacity: 0;
  }
}

@keyframes floatUp3 {
  0% {
    transform: translateY(100vh) translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  50% {
    transform: translateY(50vh) translateX(40px) rotate(180deg);
  }
  100% {
    transform: translateY(-5vh) translateX(-30px) rotate(360deg);
    opacity: 0;
  }
}

@keyframes floatDrift {
  0% {
    transform: translateY(100vh) translateX(0px);
    opacity: 0;
  }
  5% {
    opacity: 0.9;
  }
  25% {
    transform: translateY(75vh) translateX(30px);
  }
  50% {
    transform: translateY(50vh) translateX(-20px);
  }
  75% {
    transform: translateY(25vh) translateX(40px);
  }
  95% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(-10vh) translateX(10px);
    opacity: 0;
  }
}

/* ===== 반짝임 애니메이션 (부드럽게: 급격한 opacity 변화 완화) ===== */
@keyframes twinkle {
  0%, 100% { opacity: 0.15; transform: scale(0.7); }
  50% { opacity: 0.6; transform: scale(1); }
}

@keyframes twinkle2 {
  0%, 100% { opacity: 0.15; }
  30% { opacity: 0.5; }
  60% { opacity: 0.25; }
  80% { opacity: 0.55; }
}

/* ===== 각 파티클 개별 배치 및 애니메이션 ===== */

/* --- 골드 파티클들 (8개) --- */
.bg-particle:nth-child(1) {
  left: 5%; animation: floatUp1 14s linear infinite; animation-delay: 0s;
}
.bg-particle:nth-child(2) {
  left: 15%; animation: floatUp2 18s linear infinite; animation-delay: 2s;
}
.bg-particle:nth-child(3) {
  left: 28%; animation: floatDrift 22s linear infinite; animation-delay: 5s;
}
.bg-particle:nth-child(4) {
  left: 42%; animation: floatUp1 16s linear infinite; animation-delay: 3s;
}
.bg-particle:nth-child(5) {
  left: 55%; animation: floatUp3 20s linear infinite; animation-delay: 7s;
}
.bg-particle:nth-child(6) {
  left: 68%; animation: floatDrift 15s linear infinite; animation-delay: 1s;
}
.bg-particle:nth-child(7) {
  left: 82%; animation: floatUp2 19s linear infinite; animation-delay: 4s;
}
.bg-particle:nth-child(8) {
  left: 93%; animation: floatUp1 17s linear infinite; animation-delay: 6s;
}

/* --- 블루 파티클들 (6개) --- */
.bg-particle:nth-child(9) {
  left: 10%; animation: floatUp2 21s linear infinite; animation-delay: 1s;
}
.bg-particle:nth-child(10) {
  left: 25%; animation: floatDrift 25s linear infinite; animation-delay: 8s;
}
.bg-particle:nth-child(11) {
  left: 48%; animation: floatUp3 18s linear infinite; animation-delay: 3s;
}
.bg-particle:nth-child(12) {
  left: 60%; animation: floatUp1 23s linear infinite; animation-delay: 10s;
}
.bg-particle:nth-child(13) {
  left: 75%; animation: floatDrift 16s linear infinite; animation-delay: 5s;
}
.bg-particle:nth-child(14) {
  left: 90%; animation: floatUp2 20s linear infinite; animation-delay: 2s;
}

/* --- 퍼플 파티클들 (4개) --- */
.bg-particle:nth-child(15) {
  left: 8%; animation: floatUp3 24s linear infinite; animation-delay: 6s;
}
.bg-particle:nth-child(16) {
  left: 35%; animation: floatDrift 19s linear infinite; animation-delay: 9s;
}
.bg-particle:nth-child(17) {
  left: 62%; animation: floatUp1 22s linear infinite; animation-delay: 4s;
}
.bg-particle:nth-child(18) {
  left: 88%; animation: floatUp2 26s linear infinite; animation-delay: 11s;
}

/* --- 화이트 별 파티클들 (12개) --- */
.bg-particle:nth-child(19) {
  left: 3%; animation: twinkle 4s ease-in-out infinite; animation-delay: 0s;
  top: 15%;
}
.bg-particle:nth-child(20) {
  left: 12%; animation: twinkle2 5s ease-in-out infinite; animation-delay: 1.5s;
  top: 45%;
}
.bg-particle:nth-child(21) {
  left: 22%; animation: twinkle 6s ease-in-out infinite; animation-delay: 0.5s;
  top: 70%;
}
.bg-particle:nth-child(22) {
  left: 33%; animation: twinkle2 4.5s ease-in-out infinite; animation-delay: 2s;
  top: 25%;
}
.bg-particle:nth-child(23) {
  left: 45%; animation: twinkle 5.5s ease-in-out infinite; animation-delay: 3s;
  top: 60%;
}
.bg-particle:nth-child(24) {
  left: 52%; animation: twinkle2 3.5s ease-in-out infinite; animation-delay: 0.8s;
  top: 10%;
}
.bg-particle:nth-child(25) {
  left: 65%; animation: twinkle 7s ease-in-out infinite; animation-delay: 4s;
  top: 80%;
}
.bg-particle:nth-child(26) {
  left: 73%; animation: twinkle2 4s ease-in-out infinite; animation-delay: 1s;
  top: 35%;
}
.bg-particle:nth-child(27) {
  left: 80%; animation: twinkle 5s ease-in-out infinite; animation-delay: 2.5s;
  top: 55%;
}
.bg-particle:nth-child(28) {
  left: 87%; animation: twinkle2 6s ease-in-out infinite; animation-delay: 3.5s;
  top: 90%;
}
.bg-particle:nth-child(29) {
  left: 95%; animation: twinkle 4s ease-in-out infinite; animation-delay: 0.3s;
  top: 20%;
}
.bg-particle:nth-child(30) {
  left: 58%; animation: twinkle2 5s ease-in-out infinite; animation-delay: 5s;
  top: 40%;
}

/* ===== 글로우 오브 (큰 빛 원) ===== */
.bg-glow-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(60px);
  will-change: transform;
  transform: translateZ(0);
}

.bg-glow-orb:nth-child(1) {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(204, 163, 84, 0.08) 0%, transparent 70%);
  top: 20%;
  left: -5%;
  animation: orbFloat1 30s ease-in-out infinite;
}

.bg-glow-orb:nth-child(2) {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(70, 130, 200, 0.06) 0%, transparent 70%);
  top: 50%;
  right: -10%;
  animation: orbFloat2 35s ease-in-out infinite;
}

.bg-glow-orb:nth-child(3) {
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(160, 100, 220, 0.06) 0%, transparent 70%);
  bottom: 10%;
  left: 30%;
  animation: orbFloat3 25s ease-in-out infinite;
}

.bg-glow-orb:nth-child(4) {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(204, 163, 84, 0.05) 0%, transparent 70%);
  top: 5%;
  right: 20%;
  animation: orbFloat1 28s ease-in-out infinite reverse;
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(50px, 30px); }
  50% { transform: translate(-30px, 60px); }
  75% { transform: translate(40px, -20px); }
}

@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-40px, -30px); }
  50% { transform: translate(30px, -50px); }
  75% { transform: translate(-20px, 40px); }
}

@keyframes orbFloat3 {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(60px, -40px); }
  66% { transform: translate(-40px, 30px); }
}

/* ===== 라인 효과 (미세한 빛 줄기) ===== */
.bg-light-line {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
  transform: translateZ(0);
}

.bg-light-line:nth-child(1) {
  width: 1px;
  height: 120px;
  background: linear-gradient(to bottom, transparent, rgba(204, 163, 84, 0.3), transparent);
  left: 20%;
  animation: lightLineFall 8s linear infinite;
  animation-delay: 2s;
}

.bg-light-line:nth-child(2) {
  width: 1px;
  height: 80px;
  background: linear-gradient(to bottom, transparent, rgba(100, 180, 255, 0.2), transparent);
  left: 50%;
  animation: lightLineFall 10s linear infinite;
  animation-delay: 5s;
}

.bg-light-line:nth-child(3) {
  width: 1px;
  height: 100px;
  background: linear-gradient(to bottom, transparent, rgba(204, 163, 84, 0.25), transparent);
  left: 75%;
  animation: lightLineFall 7s linear infinite;
  animation-delay: 0s;
}

.bg-light-line:nth-child(4) {
  width: 1px;
  height: 150px;
  background: linear-gradient(to bottom, transparent, rgba(160, 100, 220, 0.15), transparent);
  left: 38%;
  animation: lightLineFall 12s linear infinite;
  animation-delay: 8s;
}

.bg-light-line:nth-child(5) {
  width: 1px;
  height: 90px;
  background: linear-gradient(to bottom, transparent, rgba(100, 180, 255, 0.18), transparent);
  left: 85%;
  animation: lightLineFall 9s linear infinite;
  animation-delay: 3s;
}

@keyframes lightLineFall {
  0% {
    transform: translateY(-150px);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 0.5;
  }
  100% {
    transform: translateY(110vh);
    opacity: 0;
  }
}

/* ===== 모바일 최적화 ===== */
@media (max-width: 768px) {
  .bg-particle.size-xl { width: 20px; height: 20px; }
  .bg-particle.size-lg { width: 14px; height: 14px; }
  .bg-glow-orb { filter: blur(40px); }
  .bg-glow-orb:nth-child(1) { width: 200px; height: 200px; }
  .bg-glow-orb:nth-child(2) { width: 250px; height: 250px; }
  .bg-glow-orb:nth-child(3) { width: 150px; height: 150px; }
  .bg-glow-orb:nth-child(4) { width: 200px; height: 200px; }
}

/* ===== 성능 최적화 - prefers-reduced-motion ===== */
@media (prefers-reduced-motion: reduce) {
  #bg-animation,
  .bg-particle,
  .bg-glow-orb,
  .bg-light-line {
    animation: none !important;
  }
  .bg-particle.white {
    opacity: 0.3;
  }
}
