/*
 * 追従バナー（トイサブ！ toysub.net テーマ組み込み用）
 * オプネク No005「スーパーバナーの追従」の勝ちパターンを踏襲:
 *   - ヘッダーの中に置き、ヘッダーと一緒に追従・一緒に隠れる
 *   - ページ最上部では隠しておき（ヒーローを覆わない）、トリガー要素を過ぎたら出す
 */

/* ---------- ヘッダー帯（SP 既定 / PC は帯 or 右下を選べる） ---------- */
.tsb-follow--header {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: -1; /* ヘッダーの背面から下へスライドして出る */
  transform: translateY(-100%);
  visibility: hidden;
  transition:
    transform 300ms cubic-bezier(0.455, 0.03, 0.515, 0.955),
    visibility 0s 300ms;
}

.tsb-follow--header.is-shown {
  transform: none;
  visibility: visible;
  transition: transform 300ms cubic-bezier(0.455, 0.03, 0.515, 0.955);
}

.tsb-follow--header .tsb-follow__link {
  display: block;
  line-height: 0;
  background: var(--tsb-follow-bg, #06c755); /* PCで画像の左右を埋める色 */
}

.tsb-follow--header .tsb-follow__img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
}

@media (min-width: 769px) {
  /* PCでは横長画像が巨大化しないよう高さで頭打ちにする */
  .tsb-follow--header .tsb-follow__img {
    width: auto;
    max-width: 100%;
    max-height: 72px;
  }
}

/* ---------- 右下カード（PC向け・今GTMで出している正方形バナーと同じ見た目） ---------- */
.tsb-follow--corner {
  position: fixed;
  right: 24px;
  bottom: 200px;
  z-index: 498; /* ヘッダー(499)より下。タイムズの離脱ポップ（z≥1000）も止めない */
  width: 240px;
  padding: 8px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  visibility: hidden;
}

.tsb-follow--corner.is-shown {
  visibility: visible;
}

@media (max-height: 640px) {
  .tsb-follow--corner {
    bottom: 110px;
  }
}

.tsb-follow--corner .tsb-follow__link {
  display: block;
  line-height: 0;
}

.tsb-follow--corner .tsb-follow__img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.tsb-follow__close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid #ddd;
  border-radius: 50%;
  background: #fff;
  color: #888;
  font-size: 18px;
  line-height: 28px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

/* 押せる範囲を広げる */
.tsb-follow__close::before {
  content: "";
  position: absolute;
  inset: -6px;
}

/* ---------- 画面下部の帯（SP・テーマの緑のボタン .floating_block-sp と同じ置き方） ---------- */
.tsb-follow--bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0; /* 緑のボタンを残すときは JS が緑のボタンの高さ分だけ上げる */
  z-index: 500; /* 緑のボタンと同じ */
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.16);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.5s ease-in-out,
    visibility 0s 0.5s;
}

.tsb-follow--bottom.is-shown {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease-in-out;
}

/* 緑のボタンの上に積むときは、緑のボタン側で iPhone の下端余白を取っているので二重にしない */
.tsb-follow--bottom[data-stack-over] {
  padding-bottom: 0;
}

.tsb-follow--bottom .tsb-follow__link {
  display: block;
  line-height: 0;
}

.tsb-follow--bottom .tsb-follow__img {
  display: block;
  width: 100%;
  height: auto;
}

/* 「隠す（このバナーに置き換える）」を選んだときは緑のボタンを出さない */
@media (max-width: 768px) {
  body.tsb-follow-replace-cta .floating_block-sp {
    display: none !important;
  }
}

/* ---------- 端末ごとの出し分け（WP の「表示位置」設定から付与） ---------- */
@media (max-width: 768px) {
  .tsb-follow--hide-sp {
    display: none;
  }
}

@media (min-width: 769px) {
  .tsb-follow--hide-pc {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tsb-follow--header,
  .tsb-follow--header.is-shown,
  .tsb-follow--bottom,
  .tsb-follow--bottom.is-shown {
    transition: none;
  }
}
