/* NEWT 風の広告の置き方（AFF-0013。HTML は scripts/lib/affiliate-float.mjs、動きは aff-float.js）
   地と枠は記事の広告カード（site.css の .aff-box）と同じベージュ。札（.aff-pr）は site.css のまま。
   本文を隠さない：PC は右の欄（.post-side、幅 300px）の下側に重ねる。スマホの帯は高さ 64px まで・下の帯（.sticky-bar）の上。×は 44px の押せる大きさ */
.aff-fl { --af-line: #e3d5b8; --af-bg: #fbf6ec; --af-ink: var(--ink, #3a4346); --af-sub: var(--muted, #535d60); color: var(--af-ink); }
.aff-fl * { box-sizing: border-box; }
.aff-fl p { margin: 0; }

/* 共通の文とボタン（ボタンの文字は台帳の文言のまま。切らない） */
.aff-fl__title { font-size: 16px; font-weight: 800; line-height: 1.4; }
.aff-fl__lead { margin-top: 4px !important; font-size: 13px; line-height: 1.6; color: var(--af-sub); }
.aff-fl__caution { margin-top: 6px !important; font-size: 11.5px; color: var(--af-sub); }
a.aff-fl__btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 8px 12px 8px 14px; border-radius: 12px; background: var(--ink, #3a4346); color: #fff; font-size: 14px; font-weight: 700; line-height: 1.4; text-decoration: none; box-shadow: 0 2px 0 rgba(0,0,0,.08); }
a.aff-fl__btn span { min-width: 0; }
a.aff-fl__btn svg { flex: none; }
a.aff-fl__btn:active { transform: translateY(1px); box-shadow: none; }

/* 浮き広告。JavaScript が出すまでは隠しておく（hidden） */
.aff-fl[hidden] { display: none !important; }
.aff-fl { position: fixed; z-index: 5; transition: transform .25s, opacity .25s; }
.aff-fl.is-away { transform: translateY(24px); opacity: 0; pointer-events: none; }
.aff-fl__close { position: absolute; z-index: 1; top: -14px; right: -14px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; background: none; color: var(--af-ink); cursor: pointer; }
.aff-fl__close::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.25); }
.aff-fl__close svg { position: relative; }
.aff-fl__close:focus-visible { outline: none; }
.aff-fl__close:focus-visible::before { box-shadow: 0 0 0 3px var(--accent, #2f6b4f); }
.aff-fl__pc, .aff-fl__sp { display: none; }

/* PC（右の欄がある 1100px 以上）：右の欄の列（幅 300px）の下側に重ねる。本文の列には重ならない。
   画面の高さが低いと右の欄の追従する案内に重なるので、高さ 760px 以上だけ */
@media (min-width: 1100px) {
  .aff-fl:not(.aff-fl--pc) { display: none !important; }
  .aff-fl--pc { right: max(20px, calc((100vw - 1116px) / 2)); bottom: 20px; width: 300px; }
  .aff-fl--pc .aff-fl__pc { display: block; overflow: hidden; border: 1px solid var(--af-line); border-radius: 16px; background: var(--af-bg); box-shadow: 0 8px 28px rgba(0,0,0,.18); }
  .aff-fl--pc .aff-fl__art { display: block; width: 100%; height: 84px; }
  .aff-fl__body { padding: 10px 14px 14px; }
  .aff-fl__body > .aff-pr { margin-top: 8px; }
  .aff-fl__body .aff-fl__btn { margin-top: 6px; }
  /* VC のバナー素材（300×250）は大きさを変えずに出す */
  .aff-fl--pc .aff-fl__pc--banner { padding: 8px 0 0; border: 0; border-radius: 4px; background: #fff; }
  .aff-fl__pc--banner > .aff-pr { margin: 0 0 6px 8px; }
  .aff-fl__pc--banner img { display: block; width: 300px; height: auto; max-width: none; margin: 0; border-radius: 0; }
  .aff-fl--pc .aff-fl__caution { padding: 6px 4px 0; }
}
@media (min-width: 1100px) and (max-height: 759px) { .aff-fl { display: none !important; } }

/* スマホ・タブレット：高さ 64px の細い帯。下の帯（.sticky-bar、スマホだけ）があるときはその上（aff-float.js が --aff-fl-bottom を決める） */
@media (max-width: 1099px) {
  .aff-fl:not(.aff-fl--sp) { display: none !important; }
  .aff-fl--sp { left: 8px; right: 8px; max-width: 520px; margin: 0 auto; bottom: calc(var(--ad-anchor-h, 0px) + var(--aff-fl-bottom, 0px) + env(safe-area-inset-bottom, 0px) + 8px); }
  .aff-fl--sp .aff-fl__sp { display: flex; align-items: center; gap: 10px; height: 64px; padding: 6px 40px 6px 6px; border: 1px solid var(--af-line); border-radius: 14px; background: var(--af-bg); box-shadow: 0 6px 20px rgba(0,0,0,.16); }
  .aff-fl__thumb { flex: none; width: 52px; height: 52px; overflow: hidden; border-radius: 10px; }
  .aff-fl__thumb .aff-fl__art { display: block; width: 52px; height: 52px; }
  .aff-fl__spbody { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px; }
  .aff-fl__sptitle { flex: 1 0 100%; font-size: 12px; font-weight: 700; line-height: 1.3; color: var(--af-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .aff-fl__spbody > .aff-pr { flex: none; }
  .aff-fl__spbody a.aff-fl__btn { flex: 1; min-width: 0; min-height: 30px; margin-top: 2px; padding: 4px 8px 4px 10px; border-radius: 8px; font-size: 13px; white-space: nowrap; box-shadow: none; }
  /* 台帳の文言が長いとき：見出しをやめて、ボタンの文字を2行まで（文字は切らない） */
  .aff-fl--long .aff-fl__sptitle { display: none; }
  .aff-fl--long .aff-fl__spbody a.aff-fl__btn { white-space: normal; font-size: 12px; line-height: 1.3; }
  .aff-fl--sp .aff-fl__close { top: 50%; right: 0; transform: translateY(-50%); }
  .aff-fl--sp .aff-fl__caution { width: fit-content; margin: 4px 0 0 auto !important; padding: 2px 8px; border-radius: 6px; background: var(--af-bg); box-shadow: 0 2px 8px rgba(0,0,0,.12); font-size: 10.5px; }
}
@media (prefers-reduced-motion: reduce) { .aff-fl { transition: none; } }
@media print { .aff-fl { display: none !important; } }
/* VC のバナー（高さ約 290px）は、右の欄の追従する案内に重ならないよう、画面の高さ 860px 以上だけ */
@media (min-width: 1100px) and (max-height: 859px) { .aff-fl[data-kind="banner"] { display: none !important; } }
