/* ============================================================
   離脱ポップアップ(exit intent)
   画像1枚(750×900@2x)+ 閉じる操作だけ。文字は画像に焼いてあるので
   ここではレイアウトと当たり判定のみを持つ。
   ============================================================ */

.exitpop {
  position: fixed;
  inset: 0;
  z-index: 9998; /* chat.css のオーバーレイより下(チャットが開いたら隠れる) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}

.exitpop[hidden] {
  display: none;
}

/* 暗幕 */
.exitpop-veil {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.exitpop.is-open .exitpop-veil {
  opacity: 1;
}

/* 本体 */
.exitpop-box {
  position: relative;
  width: 100%;
  max-width: 400px;
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  transition:
    opacity 0.24s ease,
    transform 0.24s cubic-bezier(0.2, 1, 0.3, 1);
}

.exitpop.is-open .exitpop-box {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* CTA(画像全体がリンク)
   href="#contact" なので chat.js の起動トリガーにそのまま乗る */
.exitpop-cta {
  display: block;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  -webkit-tap-highlight-color: transparent;
}

.exitpop-cta img {
  display: block;
  width: 100%;
  height: auto;
  /* 縦に長い端末以外でも画面内に収める */
  max-height: 76vh;
  object-fit: contain;
}

.exitpop-cta:active {
  transform: scale(0.985);
}

/* 閉じる✕(画像の右上角に重ねる) */
.exitpop-close {
  position: absolute;
  top: -14px;
  right: -6px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* 「あとで見る」= 逃げ道。✕だけだと閉じ方が分からない層が一定いる */
.exitpop-later {
  display: block;
  margin: 12px auto 0;
  padding: 8px 18px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

@media (max-width: 380px) {
  .exitpop-close {
    top: -10px;
    right: -2px;
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
}

/* アニメーションを控えたい設定の端末では動かさない */
@media (prefers-reduced-motion: reduce) {
  .exitpop-veil,
  .exitpop-box {
    transition: none;
  }
}
