/* ファーストビュー：背景写真は画面に固定し、文字だけが上へ流れていく。
   iOS Safari は clip-path の中の fixed がスクロール中にちらつくため、切り抜かずに
   上下の要素で覆う（head のスクリプトが .hero-fixed-on を付けた時だけ） */
.hero-fixed-on .hero-picture {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100lvh;
  /* 固定写真を独立したレイヤーで描き、スクロールのたびの描き直しを避ける */
  transform: translateZ(0);
  backface-visibility: hidden;
}
/* ファーストビューを通り過ぎたら、下の透明なセクションから写真が透けないよう隠す（hero-motion.js） */
.hero-fixed-on.hero-bg-off .hero-picture {
  visibility: hidden;
}
/* ページ上端のヘッダー帯は、固定写真の上を単色で覆う */
.hero-fixed-on .header {
  position: relative;
  z-index: 1;
  background: var(--bg-base);
  box-shadow: 0 0 0 100vmax var(--bg-base);
  clip-path: inset(0 -100vmax);
}

/* 文字は下から順に浮かび上がる（オープニング動画がある時は動画の後に始まる） */
html:not(.fv-intro-on) .hero-content > * {
  animation: hero-rise 0.9s cubic-bezier(0.2, 0, 0, 1) both;
}
html:not(.fv-intro-on) .hero-content > :nth-child(2) { animation-delay: 80ms; }
html:not(.fv-intro-on) .hero-content > :nth-child(3) { animation-delay: 160ms; }
html:not(.fv-intro-on) .hero-content > :nth-child(4) { animation-delay: 240ms; }
html:not(.fv-intro-on) .hero-content > :nth-child(5) { animation-delay: 320ms; }
html:not(.fv-intro-on) .hero-content > :nth-child(6) { animation-delay: 400ms; }
html:not(.fv-intro-on) .hero-content > :nth-child(n + 7) { animation-delay: 480ms; }
/* 子要素ごとに動かすので、hero 全体をまとめて動かす演出は止める */
.fv-intro-done .hero-content {
  animation: none;
}
@keyframes hero-rise {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 画像は読み込みが終わり、画面に入った時にフェードインする（image-fade.js が .is-shown を付ける） */
.img-fade-on main img {
  opacity: 0;
  transition: opacity 1s cubic-bezier(0, 0, 0.2, 1);
}
.img-fade-on main img.is-shown {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .hero-fixed-on .hero-picture {
    position: absolute;
    height: auto;
    transform: none;
    visibility: visible;
  }
  .hero-fixed-on .header {
    box-shadow: none;
    clip-path: none;
  }
  .img-fade-on main img {
    opacity: 1;
    transition: none;
  }
}
