/* RoomMC 公開サイト共通の動き（2026-11-29）
   見た目（色・配置）は変えず、動きだけを足す。
   - 読み込み時: ページ冒頭の見出し・説明・ボタンを時間差で表示（CSSのみ・初回描画から効く）
   - スクロール表示: rm-motion.js が画面外の要素にだけ .rm-rv を付け、入ったら .rm-rv-in
   - ホバー・押下: 緩急をそろえ、押したときに少し縮む
   - ページ遷移: 対応ブラウザでヘッダー以外を短くクロスフェード
   prefers-reduced-motion: reduce では全部止める。
   元ファイル: tools/site-motion/rm-motion.css → tools/site-motion/apply.py で site/assets/shared/ へハッシュ付きで配置 */

:root {
  --rm-ease-out: cubic-bezier(.23, 1, .32, 1);
  --rm-ease-move: cubic-bezier(.77, 0, .175, 1);
  --rm-rise: 18px;
  --rm-dur: .8s;
  --rm-step: 70ms;
}
@media (max-width: 640px) {
  :root { --rm-rise: 12px; --rm-dur: .6s; --rm-step: 50ms; }
}

@keyframes rm-enter {
  from { opacity: 0; translate: 0 var(--rm-rise); }
}
@keyframes rm-fade {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  /* ---------- 読み込み時（ページ冒頭だけ・一度だけ） ---------- */
  .hero-main > *,
  .page-hero-text > *,
  .page-hero > .wrap:not(.page-hero-grid) > *,
  main > .section:first-child > .wrap > .eyebrow,
  .bans-title,
  .bans-lead,
  .auth-card,
  .memo-login-card,
  .contact-main {
    animation: rm-enter var(--rm-dur) var(--rm-ease-out) both;
  }
  .hero-main > :nth-child(2), .page-hero-text > :nth-child(2), .page-hero > .wrap:not(.page-hero-grid) > :nth-child(2), .bans-title { animation-delay: .07s; }
  .hero-main > :nth-child(3), .page-hero-text > :nth-child(3), .page-hero > .wrap:not(.page-hero-grid) > :nth-child(3), .bans-lead { animation-delay: .14s; }
  .hero-main > :nth-child(4), .page-hero-text > :nth-child(4), .page-hero > .wrap:not(.page-hero-grid) > :nth-child(4) { animation-delay: .21s; }
  .hero-main > :nth-child(n+5), .page-hero-text > :nth-child(n+5), .page-hero > .wrap:not(.page-hero-grid) > :nth-child(n+5) { animation-delay: .28s; }
  .hero-sns,
  .page-hero-photo {
    animation: rm-fade 1s .2s var(--rm-ease-out) both;
  }
  .toc { animation: rm-fade .8s .3s var(--rm-ease-out) both; }

  /* ---------- スクロール表示 ---------- */
  .rm-rv {
    opacity: 0;
    translate: 0 var(--rm-rise);
  }
  .rm-rv.rm-rv-in {
    opacity: 1;
    translate: none;
    transition:
      opacity var(--rm-dur) var(--rm-ease-out),
      translate calc(var(--rm-dur) + .25s) var(--rm-ease-out);
    transition-delay: calc(var(--rv-i, 0) * var(--rm-step));
  }

  /* ---------- ホバー・押下（緩急をそろえる） ---------- */
  .button {
    transition: background .2s ease, color .2s ease, border-color .2s ease, scale .18s var(--rm-ease-out);
  }
  .button:active { scale: .97; }
  a.row, a.card, .flow-body {
    transition: padding .45s var(--rm-ease-out);
  }
  .row-arrow, .row-icon, .flow-more i, .expand-guide > summary::after {
    transition: transform .4s var(--rm-ease-out), color .2s ease;
  }
  a.card:active, a.row:active { scale: .99; transition: padding .45s var(--rm-ease-out), scale .15s var(--rm-ease-out); }
  header.header .brand .mark { transition: transform .45s var(--rm-ease-out); }

  /* サーバー状況（オンライン時だけ静かに脈打つ） */
  .live[data-state="online"] .live-dot { animation: rm-ping 2.4s ease-out infinite; }
  @keyframes rm-ping {
    0%   { box-shadow: 0 0 0 4px rgba(34, 160, 107, .14), 0 0 0 4px rgba(34, 160, 107, .35); }
    100% { box-shadow: 0 0 0 4px rgba(34, 160, 107, .14), 0 0 0 11px rgba(34, 160, 107, 0); }
  }

  /* ---------- ページ遷移（対応ブラウザのみ・同一サイト内） ---------- */
  @view-transition { navigation: auto; }
  header.header { view-transition-name: rm-header; }
  ::view-transition-old(root) { animation: rm-vt-out .16s ease both; }
  ::view-transition-new(root) { animation: rm-vt-in .38s var(--rm-ease-out) both; }
  @keyframes rm-vt-out { to { opacity: 0; } }
  @keyframes rm-vt-in { from { opacity: 0; translate: 0 8px; } }
}

/* 印刷時は隠れたままにしない */
@media print {
  .rm-rv { opacity: 1 !important; translate: none !important; }
}
