/* ============================================================
   sections.css — 區段疊圖、編排式進場、s3/s4 相連、浮動 CTA
   ============================================================ */

/* ---- 區段骨架 ---- */
.section {
  position: relative;
  display: block;
  font-size: 0; /* 消圖片間白縫 */
  line-height: 0;
}

.section__art {
  position: relative; /* 文字層的定位容器 */
}

.section__bg {
  width: 100%;
  height: auto;
  display: block;
}

/* 透明文字層：與背景同比例、滿欄疊放，自動對位 */
.section__layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  will-change: opacity, transform;
}

/* ---- 編排式進場（choreo）：每層依序錯時淡入 ---- */
.section__layer {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 0.65s ease,
    transform 0.65s ease;
  transition-delay: calc(var(--i, 0) * 180ms);
}

.section.is-visible .section__layer {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   s3 ↔ s4 視覺相連 + 浮動島嶼（騎接縫）+ 飛鳥
   ============================================================ */
.scene-island {
  position: relative; /* 島嶼 / 飛鳥的定位基準 */
}

/* 兩段之間不留縫 */
.scene-island .section + .section {
  margin-top: 0;
}

.island-float,
.bird-float {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  left: 50%;
}

/* 浮動島嶼：騎在 s3/s4 接縫、略偏左（對設計稿 s3-s4-ref-1.jpg） */
.island-float {
  top: 53%;
  left: 29%;
  width: 30%; /* 約 437/1440 ≈ 30% 欄寬 */
  transform: translate(-50%, -50%);
  animation: island-bob 7s ease-in-out infinite;
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.28));
}

/* 飛鳥：島嶼右側、貼近接縫 */
.bird-float {
  top: 56%;
  left: 62%;
  width: 21%; /* 約 329/1440 ≈ 23% */
  transform: translate(-50%, -50%);
  animation: bird-drift 9s ease-in-out infinite;
  opacity: 0.96;
}

@keyframes island-bob {
  0%,
  100% {
    transform: translate(-50%, -50%) translateY(0);
  }
  50% {
    transform: translate(-50%, -50%) translateY(-14px);
  }
}

@keyframes bird-drift {
  0%,
  100% {
    transform: translate(-50%, -50%) translateX(-9px);
  }
  50% {
    transform: translate(-50%, -50%) translateX(9px);
  }
}

/* ============================================================
   浮動 CTA（桌機右側直排 / 手機底部固定列）
   ============================================================ */
.cta-dock {
  position: fixed;
  z-index: 40;
  display: flex;
  gap: 10px;
}

.cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(14, 27, 42, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(197, 169, 111, 0.45);
  color: var(--c-white);
  border-radius: 999px;
  transition:
    background 0.2s ease,
    transform 0.2s ease,
    border-color 0.2s ease;
}

.cta-btn:hover {
  background: rgba(181, 146, 89, 0.92);
  border-color: var(--c-gold-soft);
  transform: translateY(-2px);
}

.cta-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex: none;
}

.cta-btn .cta-text {
  font-size: 13px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* 桌機：欄右側外緣直排 */
@media (min-width: 768px) {
  .cta-dock {
    right: max(16px, calc((100vw - var(--col-width)) / 2 - 132px));
    bottom: 28px;
    flex-direction: column;
  }
  .cta-btn {
    padding: 11px 18px;
    flex-direction: row;
    min-width: 120px;
  }
}

/* 手機：底部固定三鈕等寬列 */
@media (max-width: 767px) {
  .cta-dock {
    left: 0;
    right: 0;
    bottom: 0;
    gap: 0;
    background: linear-gradient(180deg, #2a577f 0%, #1a3a59 100%);
    border-top: 1px solid rgba(197, 169, 111, 0.6);
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.28);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .cta-btn {
    flex: 1;
    flex-direction: column;
    gap: 3px;
    padding: 8px 4px;
    background: transparent;
    border: none;
    border-radius: 10px;
  }
  .cta-btn:hover {
    background: rgba(181, 146, 89, 0.2);
    transform: none;
  }
  .cta-btn .cta-text {
    font-size: 11px;
  }
  /* 底部留白，避免最後內容被 CTA 列遮住 */
  .page {
    padding-bottom: 64px;
  }
}

/* ---- 尊重「減少動態」偏好 ---- */
@media (prefers-reduced-motion: reduce) {
  .section__layer {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .island-float,
  .bird-float {
    animation: none;
  }
  html {
    scroll-behavior: auto;
  }
}
