/* =================================================================
   長崎ITクリニック — 院内ツアー（tour.html 専用）
   実写の院内写真の中を、受付の案内でパン＆ズーム移動するページ。
   デザイントークン・ボタン・フォーム部品は style.css を利用する
   （このファイルは tour.html 固有のレイアウトのみ。トークン再定義はしない）
   ================================================================= */

body.tour-body {
  overflow: hidden;
  overscroll-behavior: none;
  background: #eef4fa;
}

/* ---------- 写真ステージ ---------- */
#viewport { position: fixed; inset: 0; overflow: hidden; background: #dfe8f0; }
#drift, #parallax { position: absolute; inset: 0; }
#parallax { transition: transform .9s cubic-bezier(.25,.1,.25,1); will-change: transform; }
@media (prefers-reduced-motion: reduce) { #parallax { transition: none; } }

#drift { animation: t-drift-breathe 14s ease-in-out infinite alternate; will-change: transform; }
@keyframes t-drift-breathe { from { transform: translateY(0); } to { transform: translateY(-7px); } }
@media (prefers-reduced-motion: reduce) { #drift { animation: none; } }

#wrap {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0;
  transition: transform 1.6s cubic-bezier(.55,.05,.35,1);
  will-change: transform;
}
#wrap.no-anim { transition: none; }
@media (prefers-reduced-motion: reduce) { #wrap { transition-duration: .05s; } }

#photoA, #photoB {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; user-select: none; -webkit-user-drag: none;
  transition: opacity .8s ease;
}
#photoB { opacity: 0; }
@media (prefers-reduced-motion: reduce) { #photoA, #photoB { transition-duration: .05s; } }

#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
  background: radial-gradient(120% 90% at 50% 45%, transparent 64%, rgba(15, 23, 42, .18) 100%);
}

/* ---------- ホットスポット（写真の中のクリック領域） ---------- */
#spots { position: absolute; inset: 0; }
.t-hotspot {
  position: absolute; appearance: none; cursor: pointer;
  background: transparent; border: 3px solid transparent; border-radius: 18px;
  transition: border-color .25s ease, background .25s ease;
}
.t-hotspot:hover, .t-hotspot:focus-visible {
  border-color: rgba(14, 165, 233, .85);
  background: rgba(14, 165, 233, .10);
}

/* ---------- 写真上のアンカー（吹き出し・ネームチップ・画面パネル） ---------- */
#anchors { position: absolute; inset: 0; pointer-events: none; }
.t-anchor { position: absolute; width: 0; height: 0; }
.t-anchor-scale { transform-origin: 0 0; }

.t-bubble {
  position: absolute; transform: translate(-50%, calc(-100% - 14px));
  width: max-content; max-width: 320px;
  background: rgba(255,255,255,.97); border: 1px solid var(--color-border);
  border-radius: 16px 16px 16px 4px; padding: 10px 14px;
  font-size: 13.5px; line-height: 1.7; color: var(--color-primary);
  box-shadow: var(--sh-3);
  opacity: 0; visibility: hidden;
  transition: opacity .45s ease .25s, visibility 0s linear .7s;
}
.t-bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%);
  border: 8px solid transparent; border-top-color: rgba(255,255,255,.97); border-bottom: none;
}
.t-bubble.show { opacity: 1; visibility: visible; transition: opacity .45s ease .25s; }
.t-bubble .b-name { display: block; font-size: 11px; font-weight: 700; color: var(--color-accent); margin-bottom: 2px; }
/* 台詞は \n の位置（文節）で折り返す。単語の途中で改行させない */
.t-bubble .b-text { white-space: pre-line; }
/* 画面端の人物用：吹き出しをアンカーの左側へ展開（見切れ防止） */
.t-bubble.align-right { transform: translate(calc(-100% + 44px), calc(-100% - 14px)); }
.t-bubble.align-right::after { left: auto; right: 30px; transform: none; }

.t-chip {
  position: absolute; transform: translate(-50%, -100%);
  pointer-events: auto; cursor: pointer; appearance: none;
  display: grid; justify-items: center; gap: 2px;
  background: none; border: none; padding: 0;
  opacity: 0; transition: opacity .4s ease .3s;
}
.t-chip.show { opacity: 1; }
.t-chip .c-label {
  font-size: 12.5px; font-weight: 700; color: var(--color-primary);
  background: rgba(255,255,255,.94); border: 1px solid var(--color-border);
  padding: 5px 12px; border-radius: var(--r-pill); box-shadow: var(--sh-2);
  white-space: nowrap;
}
.t-chip .c-sub {
  font-size: 10.5px; font-weight: 700; color: #fff;
  background: var(--color-teal); border-radius: var(--r-pill);
  padding: 2px 9px; white-space: nowrap;
}
.t-chip::after { content: ""; width: 2px; height: 10px; background: rgba(148,163,184,.75); border-radius: 1px; }
.t-chip:hover .c-label, .t-chip:focus-visible .c-label { border-color: #7dd3fc; color: var(--color-accent-strong); }

/* 診断コーナーの画面に重ねる開始パネル */
.t-screen-panel {
  position: absolute; transform: translate(-50%, -50%);
  width: 430px; max-width: 60vw;
  pointer-events: auto;
  background: rgba(255,255,255,.6); backdrop-filter: blur(2px);
  border-radius: var(--r-lg); padding: 26px 28px;
  text-align: center;
  opacity: 0; transition: opacity .45s ease .3s;
}
.t-screen-panel.show { opacity: 1; }
.t-screen-panel h3 { margin: 0 0 6px; font-size: 22px; letter-spacing: .02em; }
.t-screen-panel p { margin: 0 0 16px; font-size: 13px; color: var(--color-muted-fg); line-height: 1.8; }
.t-screen-panel .sp-sub { display: block; margin-top: 12px; font-size: 12.5px; }
.t-screen-panel .sp-sub a { color: var(--color-accent-strong); }

/* ---------- 上部バー ---------- */
.t-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  background: linear-gradient(rgba(255,255,255,.9), rgba(255,255,255,.6) 70%, rgba(255,255,255,0));
  pointer-events: none;
}
.t-topbar > * { pointer-events: auto; }
.t-topbar-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--color-primary); }
.t-brand-cross { width: 20px; height: 20px; display: inline-block; position: relative; flex: none; }
.t-brand-cross::before, .t-brand-cross::after { content: ""; position: absolute; background: var(--color-teal); border-radius: 3px; }
.t-brand-cross::before { left: 50%; top: 0; width: 34%; height: 100%; transform: translateX(-50%); }
.t-brand-cross::after  { top: 50%; left: 0; height: 34%; width: 100%; transform: translateY(-50%); }
.t-brand-name { font-family: var(--font-brand); font-weight: 700; font-size: 19px; letter-spacing: .04em; white-space: nowrap; }
.t-page-chip {
  font-family: var(--font-head); font-weight: 700; font-size: 11px; letter-spacing: .08em;
  color: var(--color-accent-strong); background: var(--color-accent-soft);
  border: 1px solid #bae6fd; border-radius: var(--r-pill); padding: 3px 10px;
  white-space: nowrap;
}
.t-tb-btn {
  appearance: none; border: 1px solid var(--color-border); cursor: pointer;
  background: var(--color-surface); color: var(--color-primary);
  font-size: 13px; font-weight: 700; text-decoration: none;
  padding: 8px 14px; border-radius: var(--r-pill); box-shadow: var(--sh-2);
  transition: transform .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.t-tb-btn:hover { transform: translateY(-1px); box-shadow: var(--sh-3); }

/* ---------- 受付にもどる（ヘッダーより前面に置き、押せない事故を防ぐ） ---------- */
.t-back-btn {
  position: fixed; left: 18px; top: 62px; z-index: 21;
  appearance: none; cursor: pointer;
  border: 1px solid var(--color-border); background: rgba(255,255,255,.94);
  color: var(--color-accent-strong); font-size: 13px; font-weight: 700;
  padding: 9px 16px; border-radius: var(--r-pill); box-shadow: var(--sh-2);
  transition: transform .15s ease, box-shadow .15s ease;
}
.t-back-btn:hover { transform: translateY(-1px); box-shadow: var(--sh-3); }

/* ---------- 場面カード ---------- */
.t-card {
  position: fixed; left: 26px; bottom: 26px; z-index: 18;
  width: min(440px, calc(100vw - 52px));
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: rgba(255,255,255,.95); backdrop-filter: blur(12px);
  border: 1px solid var(--color-border); border-radius: var(--r-lg);
  box-shadow: var(--sh-3); padding: 22px 24px;
  opacity: 0; transform: translateY(16px); pointer-events: none;
  transition: opacity .45s ease, transform .45s ease;
}
.t-card.show { opacity: 1; transform: none; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .t-card { transition-duration: .01s; } }

.t-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.t-card-avatar {
  width: 52px; height: 52px; border-radius: 50%; flex: none;
  background-color: var(--color-accent-soft);
  background-size: cover; background-position: center top;
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}
.t-card-avatar.silhouette {
  background-color: #10254a;
  background-image: radial-gradient(circle at 50% 32%, #35507e 26%, transparent 27%),
                    radial-gradient(circle at 50% 105%, #35507e 45%, transparent 46%);
}
.t-card-avatar.plus {
  display: grid; place-items: center;
  color: var(--color-accent-strong); font-weight: 800; font-size: 24px;
}
.t-card-name { font-weight: 700; font-size: 15px; }
.t-card-role { font-size: 11.5px; color: var(--color-muted-fg); }

.t-card-eyebrow { margin: 0 0 6px; font-family: var(--font-head); font-weight: 800; font-size: 11px; letter-spacing: .18em; color: var(--color-accent); }
.t-card-eyebrow:empty { display: none; }
.t-card-title { margin: 0 0 8px; font-size: 23px; letter-spacing: .02em; line-height: 1.4; }
.t-card-title:empty { display: none; }
.t-card-text { margin: 0; font-size: 14px; line-height: 1.9; color: var(--color-muted-fg); }
.t-card-text:empty { display: none; }
.t-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.t-card-actions:empty { display: none; }
.t-card-actions .btn { padding: 10px 18px; font-size: 13.5px; }

/* 受付メニュー（縦並びの大きな選択肢） */
.t-menu-list { display: grid; gap: 8px; width: 100%; }
.t-menu-btn {
  appearance: none; cursor: pointer; text-decoration: none;
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  border: 1px solid var(--color-border); background: #fff;
  border-radius: var(--r-md); padding: 12px 14px;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.t-menu-btn:hover { transform: translateY(-1px); box-shadow: var(--sh-2); border-color: #7dd3fc; }
.t-menu-btn .m-num {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--color-accent-soft); color: var(--color-accent-strong);
  font-family: var(--font-head); font-weight: 800; font-size: 14px;
}
.t-menu-btn .m-body { flex: 1; min-width: 0; }
.t-menu-btn .m-label { display: block; font-weight: 700; font-size: 14.5px; color: var(--color-primary); }
.t-menu-btn .m-desc { display: block; font-size: 11.5px; color: var(--color-muted-fg); margin-top: 1px; }
.t-menu-btn .m-arrow { flex: none; color: var(--color-teal); font-weight: 800; }

/* ---------- 無料相談フォーム（部品は style.css の form-field 等を利用） ---------- */
.t-form-panel {
  position: fixed; z-index: 22;
  right: 26px; top: 50%; transform: translateY(-50%);
  width: min(430px, calc(100vw - 52px));
  max-height: calc(100vh - 110px);
}
.t-fp-inner {
  background: rgba(255,255,255,.97); backdrop-filter: blur(12px);
  border: 1px solid var(--color-border); border-radius: var(--r-lg);
  box-shadow: var(--sh-3); padding: 24px 26px;
  max-height: calc(100vh - 110px); overflow-y: auto;
  animation: t-panel-in .35s ease both;
}
@keyframes t-panel-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .t-fp-inner { animation: none; } }
.t-fp-title { margin: 0 0 6px; font-size: 20px; }
.t-fp-lead { margin: 0 0 4px; font-size: 13px; color: var(--color-muted-fg); line-height: 1.8; }
.t-fp-inner .form-field { margin-top: 12px; }
.t-fp-inner .form-field input, .t-fp-inner .dock-textarea { width: 100%; }
.t-fp-line { margin: 14px 0 0; font-size: 12.5px; color: var(--color-muted-fg); text-align: center; }
.t-fp-line a { color: var(--color-accent-strong); }

/* ---------- 専門科一覧 ---------- */
.t-dept-panel {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center;
  background: rgba(15, 23, 42, .35); backdrop-filter: blur(3px);
  padding: 20px;
}
.t-dp-inner {
  width: min(720px, 100%);
  max-height: calc(100vh - 60px); overflow-y: auto;
  background: rgba(255,255,255,.98);
  border: 1px solid var(--color-border); border-radius: var(--r-lg);
  box-shadow: var(--sh-3); padding: 26px 28px;
  animation: t-panel-in .35s ease both;
}
@media (prefers-reduced-motion: reduce) { .t-dp-inner { animation: none; } }
.t-dp-head { display: flex; align-items: center; justify-content: space-between; }
.t-dp-head h2 { margin: 0; font-size: 22px; }
.t-dp-close {
  appearance: none; border: none; cursor: pointer; flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--color-surface-2); color: var(--color-muted-fg); font-size: 18px; line-height: 1;
}
.t-dp-close:hover { background: var(--color-border); }
.t-dp-lead { margin: 6px 0 16px; font-size: 13px; color: var(--color-muted-fg); }
.t-dp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.t-dp-item {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  border: 1px solid var(--color-border); border-radius: var(--r-md);
  padding: 13px 15px; background: #fff;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.t-dp-item:hover { transform: translateY(-1px); box-shadow: var(--sh-2); border-color: #7dd3fc; }
.t-dp-item .d-body { flex: 1; min-width: 0; }
.t-dp-item .d-name { display: block; font-weight: 700; font-size: 14.5px; color: var(--color-primary); }
.t-dp-item .d-desc { display: block; font-size: 11.5px; color: var(--color-muted-fg); margin-top: 1px; }
.t-dp-item .d-arrow { color: var(--color-teal); font-weight: 800; }
.t-dp-item.is-disabled { opacity: .55; pointer-events: none; }
.t-dp-item .d-soon {
  flex: none; font-size: 10.5px; font-weight: 700; color: var(--color-muted-fg);
  background: var(--color-surface-2); border-radius: var(--r-pill); padding: 3px 9px;
}
.t-dp-cta {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 14px; padding: 15px 17px;
  background: var(--color-accent-soft); border: 1px solid #bae6fd;
  border-radius: var(--r-md);
}
.t-dp-cta-body { flex: 1; min-width: 220px; }
.t-dp-cta-title { margin: 0 0 3px; font-size: 14px; font-weight: 700; color: var(--color-accent-strong); }
.t-dp-cta-text { margin: 0; font-size: 12px; color: var(--color-muted-fg); line-height: 1.7; }
.t-dp-cta .btn { flex: none; }

/* ---------- noscript フォールバック ---------- */
.t-noscript {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: linear-gradient(180deg, #f8fafc 0%, #eef4fa 100%); padding: 24px 16px;
}
.t-noscript-card {
  width: min(520px, 100%); text-align: center;
  background: #fff; border: 1px solid var(--color-border);
  border-radius: var(--r-lg); box-shadow: var(--sh-3); padding: 40px 30px;
}
.t-noscript-card h1 { font-size: 22px; margin: 0 0 10px; }
.t-noscript-card p { color: var(--color-muted-fg); font-size: 14px; line-height: 2; margin: 0 0 10px; }
.t-noscript-card a { color: var(--color-accent-strong); }

/* ---------- モバイル ---------- */
@media (max-width: 760px) {
  /* ヘッダー：1行に収める（チップやボタンが縦に潰れる崩れを防止） */
  .t-topbar { padding: 10px 12px; gap: 8px; }
  .t-topbar-brand { gap: 7px; min-width: 0; }
  .t-brand-cross { width: 16px; height: 16px; }
  .t-brand-name { font-size: 15.5px; letter-spacing: .02em; }
  .t-page-chip { font-size: 10px; padding: 2px 8px; }
  .t-tb-btn { font-size: 11.5px; padding: 7px 10px; }

  .t-card {
    left: 10px; right: 10px; bottom: 10px; width: auto; padding: 16px 16px;
    max-height: 62vh;
  }
  .t-card-title { font-size: 19px; }
  .t-card-text { font-size: 12.5px; }
  .t-menu-btn { padding: 10px 12px; }
  .t-menu-btn .m-label { font-size: 13.5px; }
  /* 無料相談フォーム：画面下から40%まで（背景の受付が見えるように） */
  .t-form-panel {
    right: 10px; left: 10px; top: auto; bottom: 10px; transform: none;
    width: auto; max-height: 40vh; max-height: 40dvh;
  }
  .t-fp-inner { max-height: 40vh; max-height: 40dvh; padding: 16px 16px; }
  /* 診療科目のご案内：高さ80%・中央配置 */
  .t-dp-grid { grid-template-columns: 1fr; }
  .t-dp-inner { padding: 20px 18px; height: 80vh; height: 80dvh; max-height: none; }
  .t-back-btn { top: 56px; left: 12px; }
  .t-bubble { max-width: 252px; font-size: 12.5px; }
}
@media (max-width: 380px) {
  .t-page-chip { display: none; } /* 極小画面ではチップを畳んで1行を維持 */
}
