/* ==========================================================================
   トップページ：書籍LPへのフローティングボタン
   PC＝右下の縦長バナー／SP＝下部の横長バー
   ※ 画像（ChatGPT生成）に差し替える場合も、この枠と閉じるボタンはそのまま使う
   ========================================================================== */

.book-float {
  --bf-blue: #2f5dab;
  --bf-blue-deep: #1f3f7a;
  --bf-gold: #958056;
  --bf-line: #d9dde4;
  position: fixed;
  right: 20px;
  bottom: 92px; /* reCAPTCHA v3 のバッジ（右下）の上 */
  z-index: 900; /* ヘッダー(1000)・モバイルメニュー(999)より下 */
  width: 240px;
  border: 1px solid var(--bf-line);
  border-top: 4px solid var(--bf-gold);
  background: #fff;
  box-shadow: 0 10px 30px rgba(31, 63, 122, 0.16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.35s, transform 0.35s, visibility 0.35s;
  line-height: 1.5;
  letter-spacing: 0.04em;
}

/* 既存テーマの「* { line-height; letter-spacing }」を打ち消す */
.book-float,
.book-float * {
  line-height: 1.5;
  letter-spacing: 0.02em;
}

.book-float[hidden] {
  display: none;
}

.book-float.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.book-float__link {
  display: block;
  padding: 16px 16px 14px;
  color: #22262e;
  text-decoration: none;
  text-align: center;
}

.book-float__cover {
  display: block;
  width: 104px;
  height: auto;
  margin: 0 auto 12px;
  box-shadow: 0 6px 16px rgba(31, 63, 122, 0.18);
}

.book-float__body {
  display: block;
  font-family: "Shippori Mincho", "Noto Serif JP", serif;
}

.book-float__body > span {
  display: block;
}

.book-float__eyebrow {
  margin-bottom: 6px;
  color: var(--bf-gold);
  font-size: 12px;
  letter-spacing: 0.2em;
}

.book-float__title {
  color: var(--bf-blue);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
}

.book-float__author {
  margin-top: 2px;
  font-size: 12px;
}

.book-float__status {
  margin-top: 6px;
  color: #565c68;
  font-family: "Noto Serif JP", serif;
  font-size: 12px;
}

.book-float__more {
  margin-top: 10px;
  padding: 6px 0;
  border: 1px solid var(--bf-blue);
  color: var(--bf-blue);
  font-size: 13px;
  letter-spacing: 0.12em;
  transition: background-color 0.25s, color 0.25s;
}

/* 文言は句ごとの span（PC＝1行、SP＝2行）。「.book-float *」の字間指定を受けないよう継承に戻す */
.book-float__more > span {
  letter-spacing: inherit;
  white-space: nowrap;
}

.book-float__link:hover .book-float__more {
  background: var(--bf-blue);
  color: #fff;
}

.book-float__close {
  position: absolute;
  top: -4px;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #565c68;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.book-float__close:hover {
  color: var(--bf-blue-deep);
}

.book-float a:focus-visible,
.book-float button:focus-visible {
  outline: 2px solid var(--bf-blue);
  outline-offset: 2px;
}

/* 表紙を使わない版 */
.book-float--nocover .book-float__link {
  padding-top: 26px;
}

/* ---------- スマートフォン：下部バー（四辺を金色の枠で囲み、画面端から浮かせる） ---------- */
@media (max-width: 767px) {
  .book-float {
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: auto;
    border: 3px solid var(--bf-gold);
    box-shadow: 0 4px 20px rgba(31, 63, 122, 0.22);
    transform: translateY(calc(100% + 16px));
  }

  .book-float__link {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 72px;
    padding: 8px 44px 8px 8px;
    text-align: left;
  }

  .book-float__cover {
    flex: none;
    width: 38px;
    margin: 0;
    box-shadow: 0 2px 6px rgba(31, 63, 122, 0.2);
  }

  .book-float__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
  }

  .book-float__eyebrow {
    grid-column: 1;
    margin: 0;
    font-size: 11px;
  }

  .book-float__title {
    grid-column: 1;
    font-size: 14px;
    line-height: 1.35;
    white-space: normal;
    word-break: keep-all; /* 折り返しは <wbr>（「という」の後）だけ */
  }

  .book-float__author {
    display: none !important;
  }

  .book-float__status {
    grid-column: 1;
    margin: 0;
    font-size: 11px;
  }

  .book-float__more {
    grid-column: 2;
    grid-row: 1 / span 3;
    margin: 0;
    padding: 6px 8px;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-align: center;
    background: var(--bf-blue);
    color: #fff;
  }

  /* 「特設サイトで／詳しく見る」の2行にする */
  .book-float__more > span {
    display: block;
  }

  .book-float__close {
    top: 50%;
    right: 2px;
    transform: translateY(-50%);
  }

  /* 下部バーの表示中は reCAPTCHA のバッジを上へ逃がす */
  body.has-book-float .grecaptcha-badge {
    bottom: 108px !important; /* 書名2行＋枠＋浮かせる余白の分 */
  }
}

@media (prefers-reduced-motion: reduce) {
  .book-float,
  .book-float__more {
    transition: none;
  }
}
