/* ==========================================================
   会員登録ポップアップ
   位置とサイズはブランド別・PC/SP別のカスタムプロパティで調整する。
   top/bottom、left/rightは使わない側をautoにする。
   Talkappiの位置はcommon/css/talkappi-position.cssで独立して管理する。
   ========================================================== */
:root {
  --popupPromo-width: 280px;
  --popupPromo-max-height: 380px;
  --popupPromo-top: auto;
  --popupPromo-bottom: 20px;
  --popupPromo-left: auto;
  --popupPromo-right: 55px;
}

/* ブランド別PC値。SP側は下の @media ブロック内に対で用意している。 */
html.is-hotel {
  --popupPromo-width: 250px;
  --popupPromo-max-height: 380px;
  --popupPromo-top: auto;
  --popupPromo-bottom: 220px;
  --popupPromo-left: auto;
  --popupPromo-right: 20px;
}
html.is-inn {
  --popupPromo-width: 250px;
  --popupPromo-max-height: 380px;
  --popupPromo-top: auto;
  --popupPromo-bottom: 125px;
  --popupPromo-left: auto;
  --popupPromo-right: 60px;
}
html.is-campana {
  --popupPromo-width: 280px;
  --popupPromo-max-height: 380px;
  --popupPromo-top: auto;
  --popupPromo-bottom: 90px;
  --popupPromo-left: 20px;
  --popupPromo-right: auto;
}

html.is-ref {
  --popupPromo-width: 280px;
  --popupPromo-max-height: 380px;
  --popupPromo-top: auto;
  --popupPromo-bottom: 120px;
  --popupPromo-left: auto;
  --popupPromo-right: 55px;
}
/* lequ PC: Talkappi吹き出し（talkappi-position.css、bottom 140px・高さ約161px）の上に約9px空けて積む */
html.is-lequ {
  --popupPromo-width: 280px;
  --popupPromo-max-height: 380px;
  --popupPromo-top: auto;
  --popupPromo-bottom: 310px;
  --popupPromo-left: auto;
  --popupPromo-right: 30px;
}

.c-popupPromo {
  position: fixed;
  z-index: 500;
  top: var(--popupPromo-top);
  bottom: var(--popupPromo-bottom);
  left: var(--popupPromo-left);
  right: var(--popupPromo-right);
  width: fit-content;
  visibility: hidden;
  transition: bottom 0.25s ease;
}
.c-popupPromo.is-ready {
  visibility: visible;
}
.c-popupPromo_link {
  display: block;
  line-height: 0;
}
.c-popupPromo_img {
  display: block;
  width: auto;
  height: auto;
  max-width: var(--popupPromo-width);
  max-height: min(var(--popupPromo-max-height), calc(100vh - 40px));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.c-popupPromo_img--sp {
  display: none;
}
.c-popupPromo_close {
  position: absolute;
  top: -10px;
  right: -10px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  line-height: 0;
  z-index: 510;
}
.c-popupPromo.is-hidden {
  display: none;
}
/* 空室検索モーダル（#vacancy、z-index:102）の表示中はポップアップを隠す。
   z-index:500のままだとモーダルの閉じるボタン・入力欄・下部リンクに重なり
   操作できなくなる（REF SPでは閉じるボタンを覆っていた）。モーダルの前面化は
   header・Talkappi等との重なり順まで変わるため採らない。モーダルを閉じれば
   元の表示状態に戻る（×で閉じた後の.is-hiddenはそのまま維持される）。
   表示中を示すclassは面ごとに異なる: hotelはhtml.is-modal_active、
   inn/campana/ref/lequは#vacancy.is-modal_active、ポータルは#vacancy.on-display。
   visibility:hiddenは使わない（各ブランドのa/imgに付いたtransition:allで子要素の
   visibilityが最大1.5秒遅れて切り替わり、その間タップを横取りするため）。 */
html.is-modal_active .c-popupPromo,
html:has(#vacancy.is-modal_active) .c-popupPromo,
html:has(#vacancy.on-display) .c-popupPromo {
  display: none;
}

@media screen and (max-width: 768px) {
  :root {
    --popupPromo-width: 150px;
    --popupPromo-max-height: 300px;
    --popupPromo-top: auto;
    --popupPromo-bottom: 66px;
    --popupPromo-left: 12px;
    --popupPromo-right: auto;
  }
  /* ブランド別SP値。PC側ブロックとの対で用意している。 */
  html.is-hotel {
    --popupPromo-width: 150px;
    --popupPromo-max-height: 300px;
    --popupPromo-top: auto;
    --popupPromo-bottom: 266px;
    --popupPromo-left: auto;
    --popupPromo-right: 14px;
  }
  html.is-inn {
    --popupPromo-width: 150px;
    --popupPromo-max-height: 300px;
    --popupPromo-top: auto;
    --popupPromo-bottom: 266px;
    --popupPromo-left: auto;
    --popupPromo-right: 10px;
  }
  html.is-campana {
    --popupPromo-width: 150px;
    --popupPromo-max-height: 300px;
    --popupPromo-top: auto;
    --popupPromo-bottom: 266px;
    --popupPromo-left: auto;
    --popupPromo-right: 10px;
    /* Talkappi実測値で画面外へ移動させない */
  }
  /* ref: 左下のチャット吹き出し・下部固定ナビと重ならないよう右上に固定する。 */
  html.is-ref {
    --popupPromo-width: 150px;
    --popupPromo-max-height: 300px;
    --popupPromo-top: calc(20px + env(safe-area-inset-top, 0px));
    --popupPromo-bottom: auto;
    --popupPromo-left: auto;
    --popupPromo-right: 20px;
  }
  html.is-lequ {
    --popupPromo-width: 150px;
    --popupPromo-max-height: 300px;
    --popupPromo-top: auto;
    --popupPromo-bottom: 260px;
    --popupPromo-left: auto;
    --popupPromo-right: 20px;
  }
  .c-popupPromo_img--pc {
    display: none;
  }
  .c-popupPromo_img--sp {
    display: block;
  }
}
