/* ============================================================
 * motion.css — モダンなスクロール演出（軽量・スマホ前提）
 * ============================================================ */

  /* ---------- スクロールスナップ proximity ---------- */
  /* スマホでは強制感が出るので無効化。デスクトップのみ控えめに */
  @media (min-width: 1024px) and (hover: hover) {
    body {
      scroll-snap-type: y proximity;
      scroll-padding-top: 80px;
    }
    [data-snap] {
      scroll-snap-align: start;
      scroll-snap-stop: normal;
    }
  }

/* ---------- 基本: reveal （フェードアップ） ----------
 * 方針: コンテンツは "デフォルトで表示" し、JS が動けば
 * IntersectionObserver で `.reveal-staged` を付けて一度隠してから
 * `.is-in` / `.visible` でフェードアップする。
 *
 * これにより:
 *   - JS が読み込まれない/止まる/IO 不対応の環境でも要素は必ず表示
 *   - JS 動作時のみアニメーション効果が乗る
 *
 * Safari 18.x の scroll-driven animation 不完全実装で `.reveal` が
 * opacity:0 で凍る現象を踏まえた防御的設計。
 * ---------------------------------------------------------- */
.reveal,
.reveal-stagger > * {
  transition: opacity .7s cubic-bezier(.2,.7,.2,1),
              transform .7s cubic-bezier(.2,.7,.2,1);
  will-change: opacity, transform;
}
/* JS が「これからアニメーションする要素」とマーキングした時だけ隠す */
.reveal.reveal-staged,
.reveal-stagger.reveal-staged > * {
  opacity: 0;
  transform: translateY(28px) scale(0.985);
}
/* viewport に入ったら表示 */
.reveal.is-in,
.reveal.visible,
.reveal-stagger.is-in > *,
.reveal-stagger.visible > * {
  opacity: 1;
  transform: translateY(0) scale(1);
}
/* stagger: 子要素を順番に遅らせて出す */
.reveal-stagger.is-in > *:nth-child(1),
.reveal-stagger.visible > *:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger.is-in > *:nth-child(2),
.reveal-stagger.visible > *:nth-child(2) { transition-delay: 80ms; }
.reveal-stagger.is-in > *:nth-child(3),
.reveal-stagger.visible > *:nth-child(3) { transition-delay: 160ms; }
.reveal-stagger.is-in > *:nth-child(4),
.reveal-stagger.visible > *:nth-child(4) { transition-delay: 240ms; }
.reveal-stagger.is-in > *:nth-child(5),
.reveal-stagger.visible > *:nth-child(5) { transition-delay: 320ms; }
.reveal-stagger.is-in > *:nth-child(n+6),
.reveal-stagger.visible > *:nth-child(n+6) { transition-delay: 400ms; }

/* ---------- prefers-reduced-motion: 全効果オフ ---------- */
.motion-off .reveal,
.motion-off .reveal-stagger > * {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}
.motion-off html {
  scroll-snap-type: none !important;
}

  /* バウンスアニメーション（ヒーロー下の↓） */
@keyframes bounce-down {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ---------- カウントアップ用: 数字を等幅に ---------- */
[data-countup] {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ---------- スクロール進捗バー ---------- */
/* 画面上端に細いバー。視覚的ノイズになるため現状非表示。 */
.scroll-progress {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 9999;
  pointer-events: none;
  background: transparent;
}
.scroll-progress__fill {
  height: 100%;
  width: 0%;
  background: var(--progress-color, #BDA68C);
  transition: background-color .4s ease;
  transform-origin: left;
}
@supports (animation-timeline: scroll(root)) {
  .scroll-progress__fill {
    width: 100%;
    transform: scaleX(0);
    animation: progress-grow linear;
    animation-timeline: scroll(root);
  }
  @keyframes progress-grow {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
  }
}

/* ---------- タップフィードバック ---------- */
/* a / button / [role="button"] / .app-card / .all-app-card / .cat-square */
@media (hover: none) and (pointer: coarse) {
  a:not(.no-tap-fx),
  button:not(.no-tap-fx),
  .app-card,
  .all-app-card,
  .cat-square,
  [data-tap] {
    transition: transform .12s cubic-bezier(.2,.7,.2,1), opacity .12s;
    -webkit-tap-highlight-color: transparent;
  }
  a:not(.no-tap-fx):active,
  button:not(.no-tap-fx):active,
  .app-card:active,
  .all-app-card:active,
  .cat-square:not(.is-current):active,
  [data-tap]:active {
    transform: scale(0.97);
    opacity: 0.85;
  }
}

/* ---------- View Transitions（対応ブラウザのみ） ---------- */
@supports (view-transition-name: auto) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: .35s;
    animation-timing-function: cubic-bezier(.2,.7,.2,1);
  }
  ::view-transition-old(root) {
    animation-name: vt-fade-out;
  }
  ::view-transition-new(root) {
    animation-name: vt-fade-in;
  }
  @keyframes vt-fade-out {
    to { opacity: 0; transform: translateY(-8px); }
  }
  @keyframes vt-fade-in {
    from { opacity: 0; transform: translateY(8px); }
  }
}
.motion-off .scroll-progress { display: none; }

/* ---------- フッターのタグライン副題 (italic 部分) ----------
 * mobile (≤500px) では非表示にして、tagline + BMC バッジを 1 行に
 * 収まりやすくする。デスクトップでは引き続き表示。
 * ---------------------------------------------------------- */
@media (max-width: 500px) {
  .footer-tagline-sub,
  .footer-tagline-sep {
    display: none !important;
  }
}

/* ---------- カテゴリナビ (CatNavPatternE) ----------
 * スマホ: 2x2 (現状維持)
 * デスクトップ (≥960px): 横並び 4 列、aspect-ratio 解除して自然な高さ
 * ---------------------------------------------------------- */
.cat-nav-section { max-width: 720px; margin: 0 auto; }
.cat-nav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.cat-nav-grid > .cat-square { aspect-ratio: 1 / 1; }
@media (min-width: 960px) {
  .cat-nav-section { max-width: 1040px; }
  .cat-nav-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .cat-nav-grid > .cat-square {
    aspect-ratio: auto;
    min-height: 200px;
  }
}

/* ---------- 全アプリ一覧 (AllAppsList) ----------
 * スマホ: 1 列 (現状維持)
 * 600-959px: 2 列
 * ≥960px: 3 列
 * ---------------------------------------------------------- */
.all-apps-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 600px) { .all-apps-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .all-apps-grid { grid-template-columns: repeat(3, 1fr); } }
