/* 夜釣湖畔：整頁是同一片湖。Hero 是岸上，往下捲就是往水裡潛。
   所有素材都是原生像素，用 --px 放大，人物和背景才是同一種方塊大小。 */

/* --px 為整數倍才不會切出粗細不一的像素；100vw 含捲軸寬度，要裁掉多出來的部分（clip 不影響 sticky） */
body {
  overflow-x: clip;
  background: var(--bg) linear-gradient(var(--sky), var(--sky)) top / 100% 160px no-repeat;
}

main {
  position: relative;
}

/* 湖水：顏色愈往下愈深，波紋與魚影鋪在上面 */
main::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  margin-left: -50vw;
  background:
    url("../../img/scene/water.png") center top / calc(256 * var(--px) / 2) auto repeat,
    linear-gradient(180deg,
      var(--water-1) 0 26%, var(--water-2) 26% 36%, var(--water-3) 36% 46%, var(--water-4) 46% 56%,
      var(--water-5) 56% 66%, var(--water-6) 66% 76%, var(--water-7) 76% 88%, var(--bg) 88% 100%);
  image-rendering: pixelated;
}

/* 岸上：星空鋪滿，樹林貼著水面 */
.scene {
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  margin-left: -50vw;
  overflow: clip; /* 樹林移動時會被水面蓋過 */
  background: var(--sky);
}

.scene > * {
  position: absolute;
  left: 0;
  right: 0;
  image-rendering: pixelated;
}

.scene__sky {
  top: 0;
  bottom: 0;
  background: url("../../img/scene/stars.png") center top / calc(128 * var(--px)) auto repeat;
}

.scene__far,
.scene__near {
  bottom: 0;
  height: calc(16 * var(--px));
  background: url("../../img/scene/trees-far.png") center bottom / calc(128 * var(--px)) auto repeat-x;
}

.scene__near {
  background-image: url("../../img/scene/trees.png");
}

/* 水面的波浪高度：10 排半格 */
.scene__wave {
  bottom: 0;
  width: 100%;
  height: calc(5 * var(--px));
}

/* 文字底下鋪天空色蓋掉星星，和背景同色所以看不出邊界 */
.title img,
.subtitle {
  background: var(--sky);
}

.hero-grid > :first-child {
  padding-bottom: calc(5 * var(--px));
}

/* 人物直接站在岸上，圖片底部就是水面 */
.photo {
  position: relative;
  width: calc(32 * var(--px));
  justify-self: end;
  margin-right: calc(4 * var(--px));
}

.photo img {
  display: block;
  width: 100%;
  height: auto;
  cursor: pointer;
  image-rendering: pixelated;
}

.photo img:focus-visible {
  outline-offset: 2px;
}

/* 水中倒影 */
.photo::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: calc(7 * var(--px));
  background: url("../../img/scene/figure.png") center bottom / 100% auto no-repeat;
  image-rendering: pixelated;
  transform: scaleY(-1);
  opacity: .16;
  pointer-events: none;
}

/* 釣線垂進水裡，尾端是魚標 */
.photo::after {
  content: "";
  position: absolute;
  left: calc(1.5 * var(--px));
  top: 100%;
  width: calc(.5 * var(--px));
  height: calc(5 * var(--px));
  background: linear-gradient(var(--star) 0 80%, var(--lure) 80% 100%);
  pointer-events: none;
  animation: lureBob 2.4s steps(2, jump-none) infinite;
}

@keyframes lureBob {
  0%, 100% { height: calc(5 * var(--px)); }
  50% { height: calc(6 * var(--px)); }
}

/* 水面到第一段內容留出倒影的空間 */
#about {
  padding-top: calc(9 * var(--px));
}

@media (max-width: 960px) {
  .hero-grid > :first-child {
    padding-bottom: 0;
  }

  .photo {
    justify-self: center;
    margin-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .photo::after {
    animation: none;
  }
}
