/* ============================================================
   订阅钩子（P0 推广版）样式
   - 右下角全站浮窗（公众号 / 知识星球 / 课程）
   - 文章末尾订阅卡片
   配色沿用站点 CSS 变量，自动适配暗色模式
   ============================================================ */

/* ---------- 浮窗容器 ---------- */
.subhook{ position:fixed; right:24px; bottom:24px; z-index:9998; font-family:inherit; }
.subhook *{ box-sizing:border-box; }

/* ---------- 悬浮按钮 FAB ---------- */
.subhook-fab{
  position:relative; width:56px; height:56px; border-radius:50%;
  border:none; cursor:pointer; display:flex; align-items:center; justify-content:center;
  background:linear-gradient(135deg,var(--brand),var(--brand-2));
  color:#fff; box-shadow:0 6px 20px rgba(79,70,229,.45);
  transition:transform .2s ease, box-shadow .2s ease;
}
.subhook-fab:hover{ transform:translateY(-2px); box-shadow:0 10px 26px rgba(79,70,229,.55); }
.subhook-fab svg{ width:26px; height:26px; }
.subhook-fab::after{
  content:""; position:absolute; inset:0; border-radius:50%;
  border:2px solid var(--brand); opacity:.6; animation:subhookPulse 2.4s ease-out infinite;
}
.subhook-fab.active::after{ animation:none; opacity:0; }
@keyframes subhookPulse{
  0%{ transform:scale(1); opacity:.6; }
  70%{ transform:scale(1.5); opacity:0; }
  100%{ transform:scale(1.5); opacity:0; }
}
.subhook-fab-label{
  position:absolute; right:64px; white-space:nowrap; font-size:12px; font-weight:600;
  background:var(--card); color:var(--ink); padding:4px 10px; border-radius:20px;
  box-shadow:0 2px 10px var(--shadow); opacity:0; transform:translateX(6px);
  transition:opacity .2s ease, transform .2s ease; pointer-events:none;
}
.subhook-fab:hover .subhook-fab-label{ opacity:1; transform:translateX(0); }

/* ---------- 面板 ---------- */
.subhook-panel{
  position:absolute; right:0; bottom:72px; width:344px;
  background:var(--card); color:var(--ink); border:1px solid var(--line);
  border-radius:16px; box-shadow:0 16px 48px rgba(0,0,0,.18);
  overflow:hidden; opacity:0; transform:translateY(12px) scale(.98);
  pointer-events:none; transition:opacity .22s ease, transform .22s ease;
}
.subhook-panel.open{ opacity:1; transform:translateY(0) scale(1); pointer-events:auto; }

.subhook-close{
  position:absolute; top:10px; right:10px; width:28px; height:28px; border:none; cursor:pointer;
  background:var(--hover-soft); color:var(--muted); border-radius:50%; font-size:18px; line-height:1;
  display:flex; align-items:center; justify-content:center;
}
.subhook-close:hover{ color:var(--ink); background:var(--hover); }

.subhook-head{ padding:18px 18px 12px; background:linear-gradient(135deg,var(--brand),var(--brand-2)); color:#fff; }
.subhook-head strong{ display:block; font-size:16px; font-weight:700; line-height:1.35; }
.subhook-head span{ display:block; margin-top:4px; font-size:12px; opacity:.9; line-height:1.45; }

/* tabs */
.subhook-tabs{ display:flex; padding:10px 12px 0; gap:6px; border-bottom:1px solid var(--line); }
.subhook-tab{
  flex:1; border:none; background:transparent; cursor:pointer; padding:8px 4px 10px;
  font-size:13px; font-weight:600; color:var(--muted); position:relative;
  border-bottom:2px solid transparent; transition:color .15s ease;
}
.subhook-tab.active{ color:var(--brand); border-bottom-color:var(--brand); }
.subhook-tab .ic{ width:15px; height:15px; vertical-align:-3px; margin-right:3px; }

.subhook-body{ padding:18px; min-height:188px; }
.subhook-pane{ display:none; }
.subhook-pane.active{ display:flex; gap:14px; align-items:flex-start; }
.subhook-pane .sh-qr{ flex-shrink:0; width:108px; text-align:center; }
.subhook-pane .sh-qr img{ width:108px; height:108px; border-radius:10px; border:1px solid var(--line); display:block; background:var(--bg); }
.subhook-pane .sh-qr span{ display:block; margin-top:6px; font-size:11px; color:var(--muted-2); }
.subhook-pane .sh-info{ flex:1; min-width:0; }
.subhook-pane .sh-info strong{ font-size:15px; font-weight:700; color:var(--ink); }
.subhook-pane .sh-info p{ margin:6px 0 10px; font-size:12.5px; color:var(--muted); line-height:1.55; }
.subhook-pane .sh-tip{ display:inline-block; font-size:11px; color:var(--brand-2); background:var(--hover-soft); padding:3px 8px; border-radius:6px; }

/* 课程 pane */
.subhook-pane .sh-course p{ font-size:13px; color:var(--muted); margin:0 0 12px; }
.sh-btn{
  display:block; width:100%; text-align:center; padding:10px; margin-bottom:8px;
  background:var(--brand); color:#fff; font-size:13px; font-weight:600; border-radius:9px; text-decoration:none;
}
.sh-btn:hover{ filter:brightness(1.05); }
.sh-btn-ghost{ background:transparent; color:var(--brand-2); border:1px solid var(--line); }

.subhook-dismiss{
  display:block; width:100%; border:none; background:var(--bg); color:var(--muted-2);
  font-size:11.5px; padding:9px; cursor:pointer; border-top:1px solid var(--line);
}
.subhook-dismiss:hover{ color:var(--muted); }

/* ---------- 二维码点击放大 lightbox ---------- */
.qr-lightbox{
  position:fixed; inset:0; z-index:10000; display:none;
  align-items:center; justify-content:center; padding:24px;
  background:rgba(15,17,23,.85); cursor:zoom-out;
}
.qr-lightbox.open{ display:flex; }
.qr-lightbox img{
  max-width:min(86vw, 460px); max-height:86vh; width:auto; height:auto;
  background:#fff; border-radius:14px; padding:16px;
  box-shadow:0 24px 70px rgba(0,0,0,.55); animation:qrLbIn .2s ease;
}
.qr-lightbox .qr-lb-tip{
  position:absolute; bottom:26px; left:0; right:0; text-align:center;
  color:#fff; font-size:13px; letter-spacing:.04em; opacity:.85; pointer-events:none;
}
@keyframes qrLbIn{ from{opacity:0; transform:scale(.92)} to{opacity:1; transform:scale(1)} }

/* ---------- 文章末尾订阅卡片 ---------- */
.sub-card{
  margin-top:28px; padding:22px 24px; background:var(--hover-soft);
  border:1px solid var(--line); border-radius:14px;
}
.sub-card-head{ margin-bottom:16px; }
.sub-card-head strong{ display:flex; align-items:center; font-size:16px; font-weight:700; color:var(--ink); }
.sub-card-head strong .ic{ width:18px; height:18px; margin-right:7px; color:var(--brand); }
.sub-card-head span{ display:block; margin-top:5px; font-size:13px; color:var(--muted); line-height:1.5; }
.sub-card-qrs{ display:flex; gap:22px; flex-wrap:wrap; }
.sub-card-qr{ text-align:center; flex:1; min-width:120px; }
.sub-card-qr img{ width:118px; height:118px; border-radius:10px; border:2px solid var(--card); box-shadow:0 2px 10px var(--shadow); background:#fff; }
.sc-label{ display:block; margin-top:8px; font-size:13px; font-weight:600; color:var(--ink); }
.sc-sub{ display:block; margin-top:2px; font-size:11.5px; color:var(--muted-2); }
.sub-card-cta{
  display:inline-flex; align-items:center; margin-top:18px; padding:11px 22px;
  background:var(--brand); color:#fff; font-size:14px; font-weight:600; border-radius:10px; text-decoration:none;
}
.sub-card-cta:hover{ filter:brightness(1.05); }

/* ---------- 移动端：浮窗变底部抽屉 ---------- */
@media (max-width:520px){
  .subhook{ right:12px; bottom:12px; left:12px; }
  .subhook-fab{ width:52px; height:52px; }
  .subhook-fab-label{ display:none; }
  .subhook-panel{
    right:0; left:0; bottom:72px; width:auto; border-radius:16px 16px 0 0;
    max-height:78vh; overflow-y:auto;
  }
  .sub-card-qrs{ gap:14px; }
  .sub-card-qr{ min-width:100px; }
}
