/* =========================================================
   ギミック(ニュース本棚と同じしくみ)
   ---------------------------------------------------------
   - 月のしおり:まんが一覧・アーカイブを月で絞り込む
   - モチとシオの案内:絞り込むと2人が件数をしゃべる
   - シオのおすすめ:ランダムに1話選んで連れて行く
   - 時間帯のあいさつ:「今日の1話」で朝・昼・夜のひとこと
   - 動きを止めるボタン
   動きは html に motion-on がついているときだけ(play.js が決める)。
   ========================================================= */

/* ---------- 動きを止めるボタン(ヘッダー) ---------- */
.motion-toggle {
  flex: none;
  gap: 6px;
  padding: 0 12px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}
.motion-toggle::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: transparent;
}
.motion-toggle[aria-pressed="true"] {
  border-color: var(--ink);
}
.motion-toggle[aria-pressed="true"]::before {
  background: var(--ink);
}
.motion-toggle:hover { border-color: var(--red); }

/* ---------- モチとシオの案内 ---------- */
.shelf-guide {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 960px;
  margin: 22px auto 8px;
  padding-right: 120px;
  min-height: 96px;
}
.shelf-guide__face {
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--line);
}
.shelf-guide__line {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 4px 0 4px 14px;
  border-left: 2px solid var(--line);
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--ink);
}
.shelf-guide__line [data-guide-name] {
  color: var(--red);
  font-weight: 700;
}
.pick-button {
  flex: none;
  min-height: 44px;
  padding: 0 18px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.pick-button:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.shelf-guide__peek {
  position: absolute;
  right: 0;
  bottom: -12px;
  width: 110px;
  height: auto;
  pointer-events: none;
}

/* 「今日の1話」のあいさつ(おすすめボタン・顔出しなし) */
.shelf-guide--static {
  max-width: 520px;
  min-height: 0;
  margin: 6px auto 18px;
  padding-right: 0;
}

/* ---------- 月のしおり ---------- */
.bookmarks {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 6px;
  max-width: 960px;
  margin: 18px auto 28px;
  border-top: 2px solid var(--line);
}
.bookmark {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  min-width: 96px;
  min-height: 72px;
  padding: 12px 16px 26px;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
/* しおりの形(下が三角に切れたリボン) */
.bookmark::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--paper);
  border: 2px solid var(--line);
  border-top: 0;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 14px), 0 100%);
}
.bookmark small {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray);
}
.bookmark:hover span { text-decoration: underline; }
/* 選んでいるしおりは赤くなって、下に伸びる */
.bookmark[aria-pressed="true"] { color: #fff; padding-bottom: 36px; }
.bookmark[aria-pressed="true"]::before { background: var(--red); border-color: var(--red); }
.bookmark[aria-pressed="true"] small { color: #fff; }
.motion-on .bookmark { transition: padding-bottom 0.25s ease; }
.motion-on .bookmark:hover { padding-bottom: 34px; }
.motion-on .bookmark[aria-pressed="true"]:hover { padding-bottom: 36px; }

/* ---------- シオのおすすめで選ばれた話 ---------- */
.is-picked {
  outline: 4px solid var(--red);
  outline-offset: 4px;
  border-radius: 10px;
}
.motion-on .is-picked { animation: picked-hop 0.6s ease 2; }
@keyframes picked-hop {
  30% { transform: translateY(-12px); }
  60% { transform: translateY(0); }
}

/* ---------- 案内役の動き ---------- */
.motion-on .shelf-guide.is-talking .shelf-guide__face { animation: guide-hop 0.35s ease; }
@keyframes guide-hop { 40% { transform: translateY(-6px); } }
.motion-on .shelf-guide__peek { animation: peek 6s ease-in-out infinite; }
@keyframes peek {
  0%, 70%, 100% { transform: translateY(0); }
  80%, 90% { transform: translateY(-8px) rotate(-3deg); }
}

/* ---------- スマホ ---------- */
@media (max-width: 600px) {
  .site-header { gap: 6px; padding-inline: 12px; }
  .brand { gap: 6px; }
  .nav a { padding-inline: 8px; }
  .motion-toggle { padding: 0 10px; }

  .shelf-guide {
    flex-wrap: wrap;
    gap: 10px;
    padding-right: 84px;
    margin-inline: 16px;
  }
  .shelf-guide__face { width: 48px; height: 48px; }
  .shelf-guide__line {
    flex-basis: calc(100% - 60px);
    font-size: 1rem;
  }
  .pick-button { margin-left: 58px; }
  .shelf-guide__peek { width: 80px; bottom: auto; top: -8px; }
  .shelf-guide--static { padding-right: 0; }

  /* スマホではしおりを等分に1列で並べる(月がふえたら2段になる) */
  .bookmarks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
    gap: 8px 4px;
    margin-inline: 16px;
  }
  .bookmark { min-width: 0; padding: 10px 6px 24px; white-space: nowrap; }
  .bookmark[aria-pressed="true"] { padding-bottom: 32px; }
  .motion-on .bookmark:hover { padding-bottom: 24px; }
  .motion-on .bookmark[aria-pressed="true"]:hover { padding-bottom: 32px; }
}

/* OS の「視差効果を減らす」設定のときは止める(play.js でも止めている) */
@media (prefers-reduced-motion: reduce) {
  .bookmark, .is-picked, .shelf-guide__face, .shelf-guide__peek {
    animation: none !important;
    transition: none !important;
  }
}
