/* ============================================================
 * 各特設ページのトップの見出し（キャッチコピー）の表示時の動き
 * 2026-10-15 ユーザー指示「各専門ページの hero キャッチコピーとかは、動作が重くならないレベルでアニメーションつけて欲しい」。
 *
 * 重くしないための決まり:
 * - 動かすのは「透明度（opacity）」と「位置（transform）」だけ。どちらもブラウザが絵を描き直さずに動かせる種類。
 *   ぼかし・影・文字の大きさや字間など、描き直しが要るものは動かさない。
 * - ページを開いたときに1回だけ（1.5秒ほどで終わる）。スクロールの監視や繰り返しの動きは無い。JavaScript も使わない。
 * - 端末の「視差効果を減らす（動きを減らす）」設定が入っているときは動かさない。
 * ページごとに動き方を変える（虫歯=下から行ごとにせり上がる／歯周病=左から行ごとにすべり込む／予防=ふわっと浮かぶ＋線が伸びる／
 * 技工所=行ごとに左から大きくすべり込む／ホワイトニング=キャッチの画像がふわっと明るく現れる）。噛み合わせは元から動きがあるので足さない。
 * 行ごとの箱 .hm-line は、虫歯トップ・技工所トップのテンプレートで見出しを行に分けたもの（中の span を動かし、箱の外ははみ出させない）。
 * 2026-10-15 h1 の見直し（HANDOFF 項目228）で、キャッチコピーは h1 ではなく p（.cr-fv-catch・.pd-fv-catch・.p-yobo-fv-catch・.mdl-hero-catch）になった。
 * 動きは前と同じ。h1 になったのは上の小さな札・小見出し（.cr-fv-badge・.pd-eyebrow・.p-yobo-fv-area・.mdl-kicker。動きは前のまま）。
 * ============================================================ */

@keyframes hmRise { from { transform: translateY(105%); } to { transform: none; } }
@keyframes hmDrift { from { opacity: 0; transform: translateX(-1.4em); } to { opacity: 1; transform: none; } }
@keyframes hmFadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes hmSlideIn { from { opacity: 0; transform: translateX(-.6em); } to { opacity: 1; transform: none; } }
@keyframes hmFloat { from { opacity: 0; transform: translateY(.45em); } to { opacity: 1; transform: none; } }
@keyframes hmGrow { from { transform: scaleX(0); } to { transform: none; } }
@keyframes hmGlow { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: none; } }

/* 行ごとの箱：中身が下（または左）から出てくるとき、箱の外は見せない。
 * 下にわずかに余白を足して、文字の下端（「ぐ」「げ」などの下側）が切れないようにする */
.hm-line { display: block; overflow: hidden; padding-bottom: .1em; margin-bottom: -.1em; }
.hm-line > span { display: inline-block; }

@media (prefers-reduced-motion: no-preference) {

  /* ---- 虫歯トップ：行ごとに下からせり上がる → 説明文とボタンがふわっと出る ---- */
  body.sp-site--caries .cr-fv-catch .hm-line > span { animation: hmRise .9s cubic-bezier(.2, .7, .2, 1) both; }
  body.sp-site--caries .cr-fv-catch .hm-line:nth-child(1) > span { animation-delay: .1s; }
  body.sp-site--caries .cr-fv-catch .hm-line:nth-child(2) > span { animation-delay: .22s; }
  body.sp-site--caries .cr-fv-catch .hm-line:nth-child(3) > span { animation-delay: .4s; }
  body.sp-site--caries .cr-fv-badge { animation: hmFadeUp .7s cubic-bezier(.2, .7, .2, 1) both; }
  body.sp-site--caries .cr-fv-lead,
  body.sp-site--caries .cr-fv-lead2,
  body.sp-site--caries .cr-fv-btns,
  body.sp-site--caries .cr-fv-panel { animation: hmFadeUp .8s cubic-bezier(.2, .7, .2, 1) both; }
  body.sp-site--caries .cr-fv-lead { animation-delay: .65s; }
  body.sp-site--caries .cr-fv-lead2 { animation-delay: .75s; }
  body.sp-site--caries .cr-fv-btns, body.sp-site--caries .cr-fv-panel { animation-delay: .85s; }

  /* ---- 歯周病トップ：行ごとに左からすべり込む → 説明文・ボタンが続く ---- */
  body.sp-site--periodontal .pd-fv .pd-eyebrow { display: inline-block; animation: hmFadeUp .7s cubic-bezier(.2, .7, .2, 1) both; }
  body.sp-site--periodontal .pd-fv-catch .pd-line { animation: hmSlideIn .9s cubic-bezier(.2, .7, .2, 1) both; }
  body.sp-site--periodontal .pd-fv-catch .pd-line:nth-child(1) { animation-delay: .12s; }
  body.sp-site--periodontal .pd-fv-catch .pd-line:nth-child(2) { animation-delay: .26s; }
  body.sp-site--periodontal .pd-fv-catch .pd-line:nth-child(3) { animation-delay: .4s; }
  body.sp-site--periodontal .pd-fv-lead { animation: hmFadeUp .8s .65s cubic-bezier(.2, .7, .2, 1) both; }
  body.sp-site--periodontal .pd-fv-actions { animation: hmFadeUp .8s .8s cubic-bezier(.2, .7, .2, 1) both; }

  /* ---- 予防歯科トップ：地名の前の線が伸び、見出しがひとかたまりずつふわっと浮かぶ ---- */
  body.sp-site--preventive .p-yobo-fv-area::before { transform-origin: left center; animation: hmGrow .7s .05s cubic-bezier(.2, .7, .2, 1) both; }
  body.sp-site--preventive .p-yobo-fv-area { animation: hmFadeUp .7s cubic-bezier(.2, .7, .2, 1) both; }
  body.sp-site--preventive .p-yobo-fv-catch span { animation: hmFloat 1s cubic-bezier(.2, .7, .2, 1) both; }
  body.sp-site--preventive .p-yobo-fv-catch span:nth-of-type(1) { animation-delay: .2s; }
  body.sp-site--preventive .p-yobo-fv-catch span:nth-of-type(2) { animation-delay: .42s; }
  body.sp-site--preventive .p-yobo-fv-lead { animation: hmFadeUp .8s .75s cubic-bezier(.2, .7, .2, 1) both; }

  /* ---- 技工所トップ（暗い写真の上）：行ごとに左から大きくすべり込む（歯周病より距離を長く、動き出しを鋭く） ---- */
  .mdl-hero .mdl-kicker { animation: hmFadeUp .7s cubic-bezier(.2, .7, .2, 1) both; }
  .mdl-hero-catch .hm-line > span { animation: hmDrift 1.1s cubic-bezier(.16, 1, .3, 1) both; }
  .mdl-hero-catch .hm-line:nth-child(1) > span { animation-delay: .15s; }
  .mdl-hero-catch .hm-line:nth-child(2) > span { animation-delay: .3s; }
  .mdl-hero-catch .hm-line:nth-child(3) > span { animation-delay: .48s; }
  .mdl-hero .mdl-hero-lead { animation: hmFadeUp .8s .85s cubic-bezier(.2, .7, .2, 1) both; }
  .mdl-hero .mdl-hero-btns { animation: hmFadeUp .8s 1s cubic-bezier(.2, .7, .2, 1) both; }

  /* ---- ホワイトニングのトップ（LP）：キャッチの画像がふわっと明るく現れ、予約ボタンが続く ---- */
  .index_kv-h1 { animation: hmFadeUp .7s cubic-bezier(.2, .7, .2, 1) both; } /* キャッチ画像の上の文字の1行（h1。2026-10-15 追加） */
  .index_kv-catch img { animation: hmGlow 1.1s .1s cubic-bezier(.2, .7, .2, 1) both; }
  .index_kv-catch-inner .line_set { animation: hmFadeUp .8s .6s cubic-bezier(.2, .7, .2, 1) both; }
}

/* 技工所は横からすべり込むので、行の箱で切らない */
.mdl-hero-catch .hm-line { overflow: visible; }

/* ホワイトニング：キャッチの画像は1.04倍から元の大きさに戻るので、その間だけ画像の箱の外へはみ出し、
 * スマホ・タブレットの幅でページが横に最大15px動いていた(開いた直後の約1秒)。画像の箱の外は見せない(2026-10-15) */
.index_kv-catch { overflow: clip; }

/* 技工所：見出しの中の文字の箱はすべて水色、という元の指定（dental-lab.css の .mdl-hero-catch span）が行の箱にもかかるため、
 * 元の見た目（最後の行だけ水色）に戻す */
.mdl-hero-catch .hm-line, .mdl-hero-catch .hm-line > span { color: inherit; }
.mdl-hero-catch .hm-line:last-child > span { color: var(--mdl-aqua); }
