/**
 * 描述：載入動畫效果
 * 作者：施睿皇 靜睿設計所 Jingrui Design
 * 創建日期：2025-03-27
 * 版本：2.0.1
 * 更新日期：2026-10-13（配色與透明度調整為與網站整體一致）
 */


 /* 2026-10-13 v2.0.1：配色改為網站主色鼠尾草綠（#44514b）並降低不透明度；變數限定於載入畫面內，避免與其他樣式衝突
   原設定：--bg-color-1: rgba(2,40,40,0.95); --bg-color-2: rgba(2,29,29,0.95); */
#loading-screen {
    --jr-loading-bg-1: rgba(68, 81, 75, 0.86);
    --jr-loading-bg-2: rgba(92, 108, 99, 0.80);
}

#loading-screen.hide {
    opacity: 0;
    pointer-events: none;
}

#loading-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease;
    background: linear-gradient(270deg, var(--jr-loading-bg-1), var(--jr-loading-bg-2));
    background-size: 400% 400%;
    -webkit-animation: loading_backgroundAn 30s ease infinite;
    animation: loading_backgroundAn 30s ease infinite;
}

@-webkit-keyframes loading_backgroundAn {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

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


/* 動畫容器 */
#loading-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* LOGO圖片 */
#loading-animation #logo {
    max-width: 250px;
}


/* 針對 logo 圖片預設先隱藏 */
#loading-animation #logo img {
    width: 100%;
    display: block;
    opacity: 0;
    animation: fadeInLogo 1s forwards ease-in-out;
    animation-delay: 0.5s; /* 可依需求調整延遲時間 */
}

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


@media (max-width: 768px) {
  #loading-animation #logo {
    max-width: 180px; /* 手機版 LOGO 縮小 */
  }
}

/* ==========================================
   文字模式與 SVG 動畫樣式 (Text Mode & SVG Animations)
   ========================================== */
#svg_title {
  width: 100%;
  max-width: 600px;
  height: auto;
  margin-bottom: 20px;
}

#svg_title text {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 3.5rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  fill: none;
  stroke: #ffffff;
  stroke-width: 1.5px;
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  animation: drawText 4s ease forwards infinite alternate;
}

@keyframes drawText {
  0% {
    stroke-dashoffset: 400;
    fill: rgba(255, 255, 255, 0);
  }
  70% {
    fill: rgba(255, 255, 255, 0);
  }
  100% {
    stroke-dashoffset: 0;
    fill: rgba(255, 255, 255, 1);
  }
}

#svg_subTitle {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: #ffffff;
  letter-spacing: 0.1em;
  margin: 0 0 30px 0;
  text-align: center;
  opacity: 0.9;
}

#svg_subTitle p {
  margin: 5px 0 0 0;
  font-size: 0.9rem;
  opacity: 0.7;
}

/* 循環旋轉圓環 */
#svg_line {
  position: relative;
}

.loading_shape {
  fill: none;
  stroke: #ffffff;
  stroke-width: 3px;
  stroke-dasharray: 314; /* 2 * PI * 50 */
  stroke-dashoffset: 314;
  transform-origin: center;
  animation: rotateShape 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* 為五個圓圈設定不同的旋轉與延遲，達成波浪旋轉效果 */
.loading_shape:nth-child(1) { animation-delay: 0.1s; opacity: 0.9; }
.loading_shape:nth-child(2) { animation-delay: 0.2s; opacity: 0.7; }
.loading_shape:nth-child(3) { animation-delay: 0.3s; opacity: 0.5; }
.loading_shape:nth-child(4) { animation-delay: 0.4s; opacity: 0.3; }
.loading_shape:nth-child(5) { animation-delay: 0.5s; opacity: 0.1; }

@keyframes rotateShape {
  0% {
    transform: rotate(0deg);
    stroke-dashoffset: 314;
  }
  50% {
    stroke-dashoffset: 100;
  }
  100% {
    transform: rotate(360deg);
    stroke-dashoffset: 314;
  }
}

/* 2026-10-13 v2.0.1：毛玻璃柔化背景；LOGO 加淡陰影維持白字可讀性 */
#loading-screen {
    -webkit-backdrop-filter: blur(12px) saturate(115%);
    backdrop-filter: blur(12px) saturate(115%);
}

#loading-animation #logo img {
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.18));
}
