/* 共用的海洋背景：深海漸層、光束、水波光紋、氣泡
   搭配 ocean.js 使用（背景用的元素由 ocean.js 自動加到頁面上） */

/* 不設定 html 背景，讓 body 的漸層延伸到整個視窗，光和氣泡才能疊在漸層上、內容的後面 */
html { background: none; }
html body {
  /* 深海漸層：靠近水面是明亮的泳池藍 → 越深越暗 */
  background:
    radial-gradient(ellipse 90% 45% at 50% -5%, rgba(120, 225, 255, .28), transparent 70%),
    linear-gradient(180deg, #1288bd 0%, #0c6aa3 20%, #09477d 44%, #062a55 70%, #03112a 100%);
  background-attachment: fixed;
  background-color: #03112a;
}

/* ===== 海面透下來的光 ===== */
.ocean-light, .ocean-bubbles {
  position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: -1;
}

/* 光束：從海面斜斜照進來，慢慢左右搖晃 */
.ocean-rays {
  position: absolute; inset: -5% -25% 0; mix-blend-mode: screen;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.5) 40%, transparent 78%);
          mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.5) 40%, transparent 78%);
  transform-origin: 50% 0; will-change: transform, opacity;
}
.ocean-rays.r1 {
  background: repeating-linear-gradient(104deg,
    transparent 0, transparent 80px, rgba(190, 255, 245, .17) 125px,
    transparent 185px, transparent 300px);
  animation: ocean-sway1 13s ease-in-out infinite alternate;
}
.ocean-rays.r2 {
  background: repeating-linear-gradient(97deg,
    transparent 0, transparent 140px, rgba(160, 235, 255, .13) 200px,
    transparent 250px, transparent 430px);
  animation: ocean-sway2 19s ease-in-out infinite alternate;
}
@keyframes ocean-sway1 {
  from { transform: translateX(-50px) skewX(-5deg); opacity: .55; }
  to   { transform: translateX(50px)  skewX(4deg);  opacity: 1; }
}
@keyframes ocean-sway2 {
  from { transform: translateX(60px)  skewX(5deg);  opacity: 1; }
  to   { transform: translateX(-60px) skewX(-3deg); opacity: .5; }
}

/* 水波光紋（主要做法）：用 WebGL 即時算出泳池水面那種網狀亮紋 */
.ocean-water {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  mix-blend-mode: screen;
  filter: blur(1.5px);   /* 再柔化一點，水的邊界不會那麼清晰 */
}

/* 水波光紋（備用做法）：瀏覽器不支援 WebGL 時才會用到的兩層圖樣 */
.ocean-caustics {
  position: absolute; inset: 0; mix-blend-mode: screen;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.65) 35%, rgba(0,0,0,.2) 70%, transparent 95%);
          mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.65) 35%, rgba(0,0,0,.2) 70%, transparent 95%);
}
.ocean-caustics i {
  position: absolute; background-image: var(--ocean-caustic); background-repeat: repeat;
  will-change: transform;
}
.ocean-caustics i:nth-child(1) {
  inset: -800px; background-size: 800px 800px; opacity: .2;
  animation: ocean-drift1 60s linear infinite;
}
.ocean-caustics i:nth-child(2) {
  inset: -600px; background-size: 600px 600px; opacity: .13;
  animation: ocean-drift2 41s linear infinite;
}
/* 位移量剛好是一格圖樣的大小，循環時才不會跳一下 */
@keyframes ocean-drift1 { to { transform: translate(800px, 800px); } }
@keyframes ocean-drift2 { to { transform: translate(-600px, 600px); } }

/* 慢慢往上飄的氣泡 */
.ocean-bubbles span {
  position: absolute; bottom: -40px; border-radius: 50%;
  border: 1px solid rgba(186, 230, 253, .35);
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.35), rgba(186,230,253,.06) 60%);
  animation: ocean-rise linear infinite;
}
@keyframes ocean-rise {
  0%   { transform: translate(0, 0); opacity: 0; }
  10%  { opacity: 1; }
  50%  { transform: translate(14px, -55vh); }
  100% { transform: translate(-10px, -115vh); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ocean-rays, .ocean-caustics i { animation: none; }
  .ocean-bubbles { display: none; }
}

/* 暫停時整個背景都不顯示（CSS 動畫也跟著停） */
body.ocean-paused .ocean-light, body.ocean-paused .ocean-bubbles { display: none; }
