/* ------------------------------------------------------------------
   デナリLP モーション層(2026-10-31 追加)
   - 既存の HTML / CSS / JS は変更しない。motion.js が付ける data-m 属性と
     html.m-on クラスにだけ効く「上掛け」の CSS。
   - 動きは opacity / translate / scale(個別プロパティ)だけ。既存の
     transform(写真の回転など)と衝突しない。
   - JS が無効・古いブラウザ・「視差効果を減らす」設定では何も動かず、
     全要素が最初から表示される(html.m-on が付かない)。
   ------------------------------------------------------------------ */

:root {
  --m-ease: cubic-bezier(.22, 1, .36, 1);   /* 立ち上がり速く、終わりを長く置く */
  --m-dur: .9s;
  --m-dist: 22px;
}

/* ===== 1. 出現(スクロールで見えたとき / FV は読み込み直後) ===== */
html.m-on [data-m] {
  opacity: 0;
  translate: 0 var(--m-dist);
  transition:
    opacity var(--m-dur) var(--m-ease) var(--m-delay, 0s),
    translate var(--m-dur) var(--m-ease) var(--m-delay, 0s),
    scale var(--m-dur) var(--m-ease) var(--m-delay, 0s);
}
html.m-on [data-m="fade"] { translate: 0 0; }
html.m-on [data-m="scale"] { translate: 0 0; scale: .96; }
html.m-on [data-m="photo"] {              /* FV の写真: 小さく浮いて、わずかに寄る */
  translate: 0 16px;
  scale: .97;
}
html.m-on [data-m="note"] {               /* FV の吹き出し: 最後に小さく乗る */
  translate: 0 8px;
}
html.m-on [data-m="rule"] {               /* 見出し下の短い罫線: 中央から伸びる */
  opacity: 1;
  translate: 0 0;
  scale: 0 1;
  transform-origin: 50% 50%;
}
html.m-on [data-m].is-in {
  opacity: 1;
  translate: 0 0;
  scale: 1;
}

/* ===== 2. FV の常時アニメーション(出現が終わってから静かに) ===== */
html.m-on.m-ambient [class*="hero-section_orbit__"] {
  animation: m-breathe 9s ease-in-out infinite alternate;
}
html.m-on.m-ambient [class*="hero-section_sensorRays__"] {
  animation: m-pulse 3.6s ease-in-out infinite;
}
/* 写真 3 枚は位相 0 から始め、ばらつきは周期の違いだけでつける。負の遅延は出現直後に位相途中へ跳ぶので使わない */
html.m-on.m-ambient [class*="hero-section_sensor__"]   { animation: m-float 7s ease-in-out infinite; }
html.m-on.m-ambient [class*="hero-section_laptop__"]   { animation: m-float 9s ease-in-out infinite; }
html.m-on.m-ambient [class*="hero-section_operator__"] { animation: m-float 8s ease-in-out infinite; }

@keyframes m-breathe { from { scale: 1; } to { scale: 1.05; } }
@keyframes m-pulse   { 0%, 100% { opacity: .72; } 50% { opacity: 1; } }
@keyframes m-float   { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }

/* ===== 3. ホバーの小さな反応(マウス操作の端末だけ) ===== */
@media (hover: hover) and (pointer: fine) {
  html.m-on [class*="service-section_card__"],
  html.m-on [class*="benefits-support_flowCard__"],
  html.m-on [class*="closing-sections_columnCard__"],
  html.m-on [class*="technology-case-study_diagramCard__"] {
    transition: transform .45s var(--m-ease), box-shadow .45s var(--m-ease);
  }
  html.m-on [class*="service-section_card__"]:hover,
  html.m-on [class*="benefits-support_flowCard__"]:hover,
  html.m-on [class*="closing-sections_columnCard__"]:hover,
  html.m-on [class*="technology-case-study_diagramCard__"]:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 34px rgba(16, 74, 140, .12);
  }

  /* 末尾に矢印アイコンを持つリンク: 矢印だけ右へ */
  html.m-on a > svg:last-child,
  html.m-on a [class*="support-follow-up_arrow__"] {
    transition: translate .35s var(--m-ease);
  }
  html.m-on a:hover > svg:last-child,
  html.m-on a:hover [class*="support-follow-up_arrow__"] {
    translate: 4px 0;
  }

  /* 動画サムネの再生マーク */
  html.m-on [class*="technology-case-study_playMark__"] {
    transition: scale .4s var(--m-ease);
  }
  html.m-on a[class*="technology-case-study_videoThumbnail__"]:hover [class*="technology-case-study_playMark__"] {
    scale: 1.08;
  }
}

/* ===== 4. 開閉のなめらかさ ===== */
/* FAQ: 既存の grid-template-rows 遷移を少し長く・余韻のある曲線に */
html.m-on [class*="closing-sections_answer__"] {
  transition: grid-template-rows .5s var(--m-ease), opacity .35s ease;
}
html.m-on [class*="closing-sections_answerInner__"] {
  translate: 0 -6px;
  transition: translate .5s var(--m-ease);
}
html.m-on [data-open="true"] [class*="closing-sections_answerInner__"] {
  translate: 0 0;
}

/* details(仕様など): 対応ブラウザだけ高さをアニメーション */
@supports (interpolate-size: allow-keywords) {
  html.m-on details::details-content {
    height: 0;
    overflow: clip;
    interpolate-size: allow-keywords;
    transition: height .45s var(--m-ease), content-visibility .45s allow-discrete;
  }
  html.m-on details[open]::details-content {
    height: auto;
  }
}

/* 資料申込ダイアログ: 開くときにふわっと(2026-10-31 改: 開始スタイル(starting-style 規則)+ transition から @keyframes へ)
   Chrome では top layer に入る dialog に開始スタイル(starting-style 規則)+ transition(display / overlay allow-discrete)を使うと、
   最初の 1 フレームが不透明(opacity 1)で描かれ、白い箱が一瞬見えることがある。
   @keyframes の from は最初のフレームから効くので、開いた瞬間から opacity 0 で始まる。
   閉じるときは site.js が dialog.close() するだけなので、閉じる動きは付けない。
   背景(::backdrop)の色 #172b4db3 は style-2.css の .materials-request-modal_dialog__…::backdrop と同じ値 */
html.m-on dialog[class*="materials-request-modal_dialog__"][open] {
  animation: m-dialog-in .35s cubic-bezier(.22, 1, .36, 1) both;
}
html.m-on dialog[class*="materials-request-modal_dialog__"][open]::backdrop {
  animation: m-backdrop-in .35s ease both;
}
@keyframes m-dialog-in   { from { opacity: 0; scale: .97; } to { opacity: 1; scale: 1; } }
@keyframes m-backdrop-in { from { background-color: transparent; } to { background-color: #172b4db3; } }
@media (prefers-reduced-motion: reduce) {
  html.m-on dialog[class*="materials-request-modal_dialog__"][open],
  html.m-on dialog[class*="materials-request-modal_dialog__"][open]::backdrop { animation: none; }
}

/* スマホメニュー(2026-10-31 追加): パネルが上から 8px 降りながらフェードインし、項目が 0.05s 刻みで下から順に浮かぶ。
   site.js は開くたびに <template id="mobile-nav-template"> を複製して #mobile-nav を入れ直すので、
   @keyframes は開くたびに最初から再生される。閉じるときは site.js が要素ごと取り除くため、閉じる動きは無い。
   動きは opacity / translate だけ。「視差効果を減らす」設定では動かさない。 */
#mobile-nav {
  animation: m-mnav-panel .35s cubic-bezier(.22, 1, .36, 1) both;
}
#mobile-nav > a {
  animation: m-mnav-item .4s cubic-bezier(.22, 1, .36, 1) both;
}
#mobile-nav > a:nth-child(1) { animation-delay: .05s; }
#mobile-nav > a:nth-child(2) { animation-delay: .1s; }
#mobile-nav > a:nth-child(3) { animation-delay: .15s; }
#mobile-nav > a:nth-child(4) { animation-delay: .2s; }
#mobile-nav > a:nth-child(5) { animation-delay: .25s; }
#mobile-nav > a:nth-child(6) { animation-delay: .3s; }
@keyframes m-mnav-panel { from { opacity: 0; translate: 0 -8px; } to { opacity: 1; translate: 0 0; } }
@keyframes m-mnav-item  { from { opacity: 0; translate: 0 6px; }  to { opacity: 1; translate: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  #mobile-nav,
  #mobile-nav > a { animation: none; }
}

/* ===== 4-2. ページ遷移のクロスフェード(@view-transition)は 2026-10-31 に取り下げ(白い点滅の原因ではなかったため。wp-sub.css 1-8 も同じ) ===== */

/* ===== 5. 動きを止める条件 ===== */
@media (prefers-reduced-motion: reduce) {
  html.m-on [data-m] { opacity: 1; translate: none; scale: none; transition: none; }
  html.m-on.m-ambient [class*="hero-section_"] { animation: none; }
}
@media print {
  html.m-on [data-m] { opacity: 1 !important; translate: none !important; scale: none !important; }
}
