/**
 * Scroll reveal animation (fade + float up)
 * Hamakawa Law theme
 *
 * 使い方:
 *   要素に data-reveal を付ける（グループ化したい場合は data-reveal-group、
 *   子要素を時間差で出したい場合は data-reveal-child を子要素に付ける）。
 *   JS（scroll-animation.js）が画面内に入ったタイミングで is-visible クラスを付与する。
 */

/* 動かす要素の初期状態（非表示側） */
[data-reveal],
[data-reveal-child] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

[data-reveal].is-visible,
[data-reveal-child].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* 子要素を時間差で出す（最大8個まで想定。必要なら増やしてください） */
[data-reveal-child]:nth-child(1) { transition-delay: 0s; }
[data-reveal-child]:nth-child(2) { transition-delay: 0.15s; }
[data-reveal-child]:nth-child(3) { transition-delay: 0.3s; }
[data-reveal-child]:nth-child(4) { transition-delay: 0.45s; }
[data-reveal-child]:nth-child(5) { transition-delay: 0.6s; }
[data-reveal-child]:nth-child(6) { transition-delay: 0.75s; }
[data-reveal-child]:nth-child(7) { transition-delay: 0.9s; }
[data-reveal-child]:nth-child(8) { transition-delay: 1.05s; }

/* heroのキャッチコピーは読み込み直後にゆっくり表示（スクロール判定なし） */
.hero__title,
.hero__lead {
  opacity: 0;
  transform: translateY(16px);
  animation: hero-fade-in 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.hero__title { animation-delay: 0.2s; }
.hero__lead  { animation-delay: 0.5s; }

@keyframes hero-fade-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* hero背景は少しズームアウトしながら表示 */
.hero__bg {
  animation: hero-bg-zoom-out 1.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes hero-bg-zoom-out {
  from { transform: scale(1.08); }
  to   { transform: scale(1); }
}

/* JSが動かない場合のフォールバック（要素が消えたままにならないようにする） */
.no-js [data-reveal],
.no-js [data-reveal-child] {
  opacity: 1;
  transform: none;
  transition: none;
}

/* 視差効果を減らす設定の人にはアニメーションを付けない */
@media (prefers-reduced-motion: reduce) {
  [data-reveal],
  [data-reveal-child],
  .hero__title,
  .hero__lead,
  .hero__bg {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
  }
}
