/* ==========================================================================
   BFL — 滚动弹出浮窗样式 (bfl-popup.css)
   --------------------------------------------------------------------------
   配合 js/vendor/bfl-popup.js。
   位置由 JS 从 data-popup-position 读出后写到 data-bfl-v / data-bfl-h 上。

   加载顺序：放在 bfl_index_new.styles.css 之后，让站点自身样式仍能覆盖。
   ========================================================================== */

.bfl-popup {
  position: fixed;
  z-index: 300;
  width: min(420px, calc(100vw - 32px));
  /* 高度按内容自适应，不要撑满视口 */
  height: auto;
  max-height: calc(100vh - 40px);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  transition: opacity .32s cubic-bezier(.22,.61,.36,1),
              transform .32s cubic-bezier(.22,.61,.36,1),
              visibility .32s;
  pointer-events: none;
}

.bfl-popup.bfl-popup-open {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

/* hidden 是 HTML 上的初始类，JS 接管后由它增删 */
.bfl-popup.hidden { display: none; }

/* ---------- 位置 ---------- */
.bfl-popup[data-bfl-v="bottom"] { bottom: 20px; top: auto; }
.bfl-popup[data-bfl-v="top"]    { top: 20px; bottom: auto; }
.bfl-popup[data-bfl-v="center"] { top: 50%; bottom: auto; transform: translateY(calc(-50% + 16px)); }
.bfl-popup[data-bfl-v="center"].bfl-popup-open { transform: translateY(-50%); }

.bfl-popup[data-bfl-h="right"]  { right: 20px; left: auto; }
.bfl-popup[data-bfl-h="left"]   { left: 20px; right: auto; }
.bfl-popup[data-bfl-h="center"] { left: 50%; right: auto; margin-left: calc(min(420px, calc(100vw - 32px)) / -2); }

/* ---------- 遮罩（本站配置是 no，留着以备切换） ---------- */
.bfl-popup-has-backdrop {
  inset: 0;
  width: 100%;
  max-height: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .6);
  padding: 20px;
}
.bfl-popup-has-backdrop .ct-popup-inner {
  width: min(420px, 100%);
}

/* ---------- 内容容器 ---------- */
.bfl-popup .ct-popup-inner {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(6, 10, 20, .96);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 22px 70px rgba(0, 0, 0, .55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.bfl-popup .entry-content { margin: 0; }

/* 内层各级容器都按内容收缩，避免继承出满屏高度 */
.bfl-popup .ct-popup-inner,
.bfl-popup article,
.bfl-popup .entry-content,
.bfl-popup .kb-row-layout-wrap,
.bfl-popup .kt-row-column-wrap,
.bfl-popup .wp-block-kadence-column,
.bfl-popup .kt-inside-inner-col,
.bfl-popup .wp-block-kadence-videopopup,
.bfl-popup .kadence-video-popup-wrap {
  height: auto;
  min-height: 0;
}

/* 视频保持 16:9，由 padding-bottom 撑出高度 */
.bfl-popup .kadence-video-intrinsic {
  position: relative;
  height: 0;
  overflow: hidden;
}
.bfl-popup .kadence-video-intrinsic > video,
.bfl-popup .kadence-video-intrinsic > .kadence-video-overlay,
.bfl-popup .kadence-video-intrinsic > .kadence-video-popup-link {
  position: absolute;
  inset: 0;
}

/* 弹窗里的行布局不需要再限宽和留白 */
.bfl-popup .kt-row-column-wrap {
  max-width: none;
  padding-inline: 0;
  padding-block: 0;
}

/* alignfull 在浮窗里必须失效。
   它的 calc(50% - 50vw) / width:100vw 是为顶层内容准备的，
   放在 420px 宽的浮窗里会把内容撑成整个视口宽。 */
.bfl-popup .alignfull {
  margin-left: 0;
  margin-right: 0;
  width: 100%;
  max-width: 100%;
}

/* 视频铺满 */
.bfl-popup .kadence-video-intrinsic { width: 100%; }
.bfl-popup video.kadence-video-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- 关闭按钮 ---------- */
.bfl-popup .ct-toggle-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  cursor: pointer;
  transition: background-color .2s ease, transform .2s ease;
}
.bfl-popup .ct-toggle-close:hover {
  background: rgba(0, 0, 0, .8);
  transform: scale(1.06);
}
.bfl-popup .ct-toggle-close .ct-icon {
  width: 11px;
  height: 11px;
  fill: currentColor;
}

/* ---------- 手机 ---------- */
@media (max-width: 600px) {
  .bfl-popup {
    width: calc(100vw - 24px);
    left: 12px !important;
    right: 12px !important;
    margin-left: 0 !important;
  }
  .bfl-popup[data-bfl-v="bottom"] { bottom: 12px; }
}

/* 原 HTML 上带 kb-v-sm-hidden 的区块在小屏应隐藏，尊重这个设定 */
@media (max-width: 767px) {
  .bfl-popup .kb-v-sm-hidden { display: none; }
}

/* ---------- 动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  .bfl-popup { transition: none; transform: none; }
  .bfl-popup[data-bfl-v="center"] { transform: translateY(-50%); }
}
