/* ========================================
   馥靈之鑰 Hour Light - 星空宇宙效果
   hl-cosmos.css v1.0
   ======================================== */

/* ===== 沉浸式星空背景容器 ===== */
.hl-cosmos {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: 
    radial-gradient(ellipse at 30% 20%, rgba(92, 58, 128, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(139, 90, 43, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at center, var(--hl-bg-soft, #0d0917) 0%, var(--hl-bg, #05030a) 100%);
  overflow: hidden;
  pointer-events: none;
}

/* ===== 多層星空 ===== */
.hl-stars-layer {
  position: absolute;
  width: 200%;
  height: 200%;
}

.hl-stars-1 {
  background-image: 
    radial-gradient(2px 2px at 50px 80px, rgba(255,255,255,0.9), transparent),
    radial-gradient(2px 2px at 150px 150px, rgba(168, 130, 87, 0.8), transparent),
    radial-gradient(1.5px 1.5px at 280px 60px, rgba(255,255,255,0.8), transparent),
    radial-gradient(2px 2px at 380px 200px, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 100px 250px, rgba(168, 130, 87, 0.7), transparent),
    radial-gradient(2px 2px at 220px 120px, rgba(255,255,255,0.85), transparent);
  background-size: 450px 350px;
  animation: hl-drift 120s linear infinite, hl-shimmer 6s ease-in-out infinite;
}

.hl-stars-2 {
  background-image: 
    radial-gradient(1.5px 1.5px at 80px 180px, rgba(255,255,255,0.6), transparent),
    radial-gradient(2px 2px at 200px 80px, rgba(168, 130, 87, 0.7), transparent),
    radial-gradient(1px 1px at 320px 250px, rgba(255,255,255,0.5), transparent),
    radial-gradient(2px 2px at 420px 120px, rgba(255,255,255,0.7), transparent);
  background-size: 550px 400px;
  animation: hl-drift 180s linear infinite reverse, hl-shimmer 8s ease-in-out infinite 2s;
}

.hl-stars-3 {
  background-image: 
    radial-gradient(3px 3px at 120px 200px, rgba(233, 194, 125, 0.9), transparent),
    radial-gradient(2.5px 2.5px at 300px 100px, rgba(255,255,255,0.95), transparent),
    radial-gradient(3px 3px at 180px 320px, rgba(251, 230, 194, 0.7), transparent);
  background-size: 600px 450px;
  animation: hl-drift 200s linear infinite, hl-pulse-star 4s ease-in-out infinite;
}

/* ===== 金色流星 ===== */
.hl-meteors {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.hl-meteor {
  position: absolute;
  height: 2px;
  background: linear-gradient(90deg, #e9c27d, #fbe6c2, transparent);
  border-radius: 50%;
  opacity: 0;
  animation: hl-meteor-fall ease-out infinite;
}

.hl-meteor::before {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  background: #fbe6c2;
  border-radius: 50%;
  left: 0;
  top: -2px;
  box-shadow: 0 0 10px #e9c27d, 0 0 20px #e9c27d;
}

.hl-meteor:nth-child(1) { top: 8%; left: 20%; width: 100px; animation-delay: 0s; animation-duration: 8s; }
.hl-meteor:nth-child(2) { top: 15%; left: 60%; width: 80px; animation-delay: 3s; animation-duration: 10s; }
.hl-meteor:nth-child(3) { top: 25%; left: 40%; width: 120px; animation-delay: 6s; animation-duration: 7s; }
.hl-meteor:nth-child(4) { top: 35%; left: 75%; width: 90px; animation-delay: 9s; animation-duration: 9s; }
.hl-meteor:nth-child(5) { top: 45%; left: 30%; width: 110px; animation-delay: 12s; animation-duration: 8s; }
.hl-meteor:nth-child(6) { top: 55%; left: 85%; width: 70px; animation-delay: 15s; animation-duration: 11s; }

/* ===== 神秘光暈 ===== */
.hl-aura {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  animation: hl-aura-pulse 10s ease-in-out infinite;
}

.hl-aura-1 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(233, 194, 125, 0.3) 0%, transparent 70%);
  top: 5%;
  right: 10%;
}

.hl-aura-2 {
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(156, 110, 219, 0.15) 0%, transparent 70%);
  bottom: 15%;
  left: 5%;
  animation-delay: 3s;
}

.hl-aura-3 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(233, 194, 125, 0.12) 0%, transparent 70%);
  top: 50%;
  left: 40%;
  animation-delay: 6s;
}

/* ===== 動畫關鍵幀 ===== */
@keyframes hl-drift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-450px, -350px); }
}

@keyframes hl-shimmer {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

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

@keyframes hl-meteor-fall {
  0% { transform: rotate(35deg) translateX(0); opacity: 0; }
  5% { opacity: 1; }
  15% { transform: rotate(35deg) translateX(300px); opacity: 0; }
  100% { opacity: 0; }
}

@keyframes hl-aura-pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 0.8; }
}

/* ===== 響應式調整 ===== */
@media (max-width: 768px) {
  .hl-aura-1 { width: 200px; height: 200px; }
  .hl-aura-2 { width: 150px; height: 150px; }
  .hl-aura-3 { width: 120px; height: 120px; }
  .hl-meteor { display: none; } /* 手機上隱藏流星節省效能 */
}

/* ===== 減少動態效果（無障礙） ===== */
@media (prefers-reduced-motion: reduce) {
  .hl-stars-layer,
  .hl-meteor,
  .hl-aura {
    animation: none;
  }
}
