@charset "UTF-8";
/* ============================================================
   チャットで案内する（試作）
   ------------------------------------------------------------
   色も書体も top.css の決めごとをそのまま使う。
   このファイルだけで完結させ、既存の見た目には触らない。

   置き場所
     広い画面 … 右下。ページの内容にかからない位置
     スマホ   … 追従の予約ボタン（.book-bar 約60px）の上。
                 予約への導線を隠してはいけないので、そこは避ける
============================================================ */

/* ---------- 右下に出るものを、重ならないように積む ----------
   右下には3つ出る。何もしないと、ぴったり重なる。
   実際にトップページで「トップに戻る」とチャットが重なり、
   どちらも押しにくくなっていた。

   下から順に
     ① 追従の予約バー  .book-bar   （900px以下・約56px＋端末の余白）
     ② チャットのボタン .chat__open （52px）
     ③ トップに戻る     #pagetop    （42px）

   ★ この指定は chat.css に置くこと
     チャットを読み込んでいないページでは、#pagetop は
     top.css の元の位置（右下）のままでよい。
   ★ 折り返しは900pxにそろえること
     .book-bar が出るのは900px以下。チャット側だけ860pxにしていたため、
     861〜900px ではチャットが予約バーに重なっていた。
   ★ 数はここだけに書く
     下の #pagetop はこの値から組み立てる。片方だけ直して
     また重なる、ということが起きないようにするため。 */
:root{
  --fab-gap: 10px;     /* ボタン同士のすきま */
  --chat-h:  52px;     /* チャットのボタンの高さ（.chat__open の min-height と同じ） */
  --chat-b:  16px;     /* チャットのボタンの、下からの位置 */
}
@media (max-width:900px){
  :root{ --chat-b: calc(64px + env(safe-area-inset-bottom)); }
}

/* ボタンは下、対話の枠はその上。DOMの順番は逆なので column-reverse */
.chat{position:fixed;right:16px;bottom:var(--chat-b);z-index:60;
  display:flex;flex-direction:column-reverse;align-items:flex-end;gap:10px;
  font-family:inherit;line-height:1.8}
@media (max-width:900px){
  .chat{right:12px}
}

/* トップに戻るは、チャットのすぐ上へ。

   ★ 「html body」を前に付けること。飾りではなく必要。
     top.css にこの3つがある。
       #pagetop{bottom:16px}
       @media (max-width:900px){ #pagetop{bottom:14px} }
       body.book-bar-on #pagetop{bottom:72px}
     同じ強さで書くと、どちらが勝つかは
     ファイルの読み込み順にぶら下がる。
     chat.css はあとから読み込む形（media="print" → all）なので、
     実際に勝てずに重なったままになった。
     前に html body を付けて強くしておけば、順番に関係なく勝つ。
   ★ book-bar-on の形も書くこと
     予約バーが出ている間だけ top.css の 72px に戻ってしまう。 */
html body #pagetop,
html body.book-bar-on #pagetop{
  bottom: calc(var(--chat-b) + var(--chat-h) + var(--fab-gap));
}

/* ---------- 開くボタン ---------- */
.chat__open{display:inline-flex;align-items:center;gap:9px;
  min-height:52px;padding:0 20px 0 16px;border:0;border-radius:26px;
  background:var(--dark,#26241f);color:#fff;
  font-size:14px;letter-spacing:.04em;cursor:pointer;
  box-shadow:0 6px 22px rgba(40,36,30,.26);
  transition:transform .2s,box-shadow .2s,background .2s}
.chat__open:hover{background:#3a3733;box-shadow:0 8px 26px rgba(40,36,30,.32)}
.chat__open:active{transform:scale(.98)}
/* 吹き出しの印。線だけで描く */
.chat__open__i{position:relative;width:19px;height:15px;flex:0 0 auto;
  border:1.4px solid currentColor;border-radius:4px}
.chat__open__i::after{content:'';position:absolute;left:3px;bottom:-5px;
  width:6px;height:6px;background:var(--dark,#26241f);
  border-right:1.4px solid currentColor;border-bottom:1.4px solid currentColor;
  transform:rotate(45deg)}
.chat__open:hover .chat__open__i::after{background:#3a3733}
@media (max-width:400px){ .chat__open__t{display:none} }
@media (max-width:400px){ .chat__open{padding:0;width:52px;justify-content:center} }

/* 閉じるための × と、そのときの文字。ふだんは出さない */
.chat__open__x{position:relative;width:16px;height:16px;flex:0 0 auto;display:none}
.chat__open__x::before,.chat__open__x::after{content:'';position:absolute;
  left:0;top:7px;width:16px;height:1.4px;background:currentColor}
.chat__open__x::before{transform:rotate(45deg)}
.chat__open__x::after{transform:rotate(-45deg)}
.chat__open__t2{display:none}

/* 開いているあいだは、同じボタンが閉じるボタンになる */
.chat.is-open .chat__open__i,
.chat.is-open .chat__open__t{display:none}
.chat.is-open .chat__open__x{display:block}
.chat.is-open .chat__open__t2{display:inline}
@media (max-width:400px){ .chat__open__t2{display:none} }

/* ---------- 対話の枠 ---------- */
.chat__panel{width:min(92vw,384px);max-height:min(72vh,560px);
  display:flex;flex-direction:column;overflow:hidden;
  background:var(--paper,#fbfaf8);border:1px solid var(--line,#e3dfd7);
  border-radius:14px;box-shadow:0 14px 44px rgba(40,36,30,.24);
  /* 開くときは下から持ち上がる。閉じるまで待ってから hidden にする */
  opacity:0;transform:translateY(12px) scale(.98);transform-origin:100% 100%;
  transition:opacity .22s ease,transform .24s cubic-bezier(.22,1,.36,1)}
.chat__panel.is-shown{opacity:1;transform:none}
@media (max-width:860px){ .chat__panel{max-height:min(68vh,520px)} }

.chat__hd{display:flex;align-items:center;justify-content:space-between;
  padding:12px 12px 12px 18px;background:var(--dark,#26241f);color:#fff}
.chat__hd__t{margin:0;font-size:13.5px;letter-spacing:.1em}
/* 指で押せる大きさ（44px）を確保する */
.chat__close{width:44px;height:44px;border:0;background:transparent;
  position:relative;cursor:pointer;border-radius:50%;color:#fff}
.chat__close:hover{background:rgba(255,255,255,.14)}
.chat__close::before,.chat__close::after{content:'';position:absolute;
  left:15px;top:21px;width:14px;height:1.4px;background:currentColor}
.chat__close::before{transform:rotate(45deg)}
.chat__close::after{transform:rotate(-45deg)}

.chat__body{flex:1 1 auto;overflow-y:auto;overscroll-behavior:contain;
  padding:16px 14px 18px;-webkit-overflow-scrolling:touch}
.chat__body:focus{outline:none}

/* ---------- 吹き出し ---------- */
.chat__b{margin:0 0 12px;max-width:88%}
/* こちらから */
.chat__b--a{padding:13px 15px;background:#fff;
  border:1px solid var(--line,#e3dfd7);border-radius:4px 14px 14px 14px}
/* お客様が選んだもの */
.chat__b--u{margin-left:auto;padding:9px 15px;background:var(--mist,#efece6);
  border-radius:14px 4px 14px 14px;font-size:13.5px;color:var(--ink,#3a3733)}

.chat__q{margin:0;font-size:14.5px;color:var(--ink,#3a3733)}
.chat__note{margin:9px 0 0;font-size:12.5px;line-height:1.9;
  color:var(--sub,#676259)}
.chat__b b{font-weight:600}

/* ---------- ページへの案内 ---------- */
.chat__links{display:grid;gap:7px;margin-top:12px}
.chat__link{display:block;padding:10px 30px 10px 13px;position:relative;
  background:var(--paper,#fbfaf8);border:1px solid var(--line,#e3dfd7);
  border-radius:8px;text-decoration:none;transition:border-color .2s}
.chat__link:hover{border-color:var(--accent,#8a7f6d)}
.chat__link__t{display:block;font-size:13.5px;color:var(--ink,#3a3733)}
.chat__link__d{display:block;margin-top:2px;font-size:12px;
  line-height:1.7;color:var(--sub,#676259)}
.chat__link::after{content:'';position:absolute;right:12px;top:50%;
  width:6px;height:6px;border-top:1.3px solid var(--sub,#676259);
  border-right:1.3px solid var(--sub,#676259);
  transform:translateY(-50%) rotate(45deg)}

/* 電話番号は押せる大きさにする */
.chat__tel{display:flex;flex-direction:column;align-items:center;
  margin-top:12px;padding:11px;min-height:56px;justify-content:center;
  background:var(--dark,#26241f);color:#fff;border-radius:8px;
  text-decoration:none;font-size:19px;letter-spacing:.06em}
.chat__tel small{margin-top:2px;font-size:11.5px;letter-spacing:.08em;
  color:rgba(255,255,255,.72)}

/* ---------- 選択肢 ---------- */
.chat__ch{display:grid;gap:7px;margin:0 0 14px}
.chat__ch button{min-height:44px;padding:10px 16px;
  background:#fff;border:1px solid var(--accent,#8a7f6d);border-radius:22px;
  color:var(--ink,#3a3733);font-size:13.5px;font-family:inherit;
  text-align:left;cursor:pointer;transition:background .2s,color .2s}
.chat__ch button:hover{background:var(--accent,#8a7f6d);color:#fff}
/* 選び終わった段は、履歴として残すが押せなくする */
.chat__ch.is-past{display:none}

/* 動きを減らす設定に従う */
@media (prefers-reduced-motion:reduce){
  .chat__open,.chat__link,.chat__ch button{transition:none}
  .chat__panel{transition:none;opacity:1;transform:none}
}
