/* ==========================================================================
   火立方品牌罗盘 — 分享中心组件样式
   包含：二维码面板 + 转发卡片面板
   复用站点设计系统变量（--brand / --ink / --radius / --shadow-lg ...）
   ========================================================================== */

/* ---------- 触发按钮（浮动兜底版） ---------- */
.qr-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 900;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border: 0; border-radius: 999px;
  background: var(--ink); color: #fff;
  font-size: .9rem; font-weight: 600;
  box-shadow: 0 12px 28px -10px rgba(10,15,30,.55);
  transition: transform .2s var(--ease), background .2s;
}
.qr-fab:hover { background: var(--ink-2); transform: translateY(-2px); }
.qr-fab:active { transform: translateY(0); }

/* 页面内嵌触发按钮（文字型 / 图钉型通用） */
.btn-share { display: inline-flex; align-items: center; gap: 8px; }
.btn-share svg { flex: none; }
.btn-share--icon {
  width: 40px; height: 40px; padding: 0; justify-content: center;
  border-radius: 999px;
}

/* ---------- 弹层骨架 ---------- */
.qr-modal {
  position: fixed; inset: 0; z-index: 2000;
  display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.qr-modal.is-open { display: flex; }
html.qr-locked { overflow: hidden; }

.qr-backdrop {
  position: absolute; inset: 0;
  background: rgba(10,15,30,.52);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .22s var(--ease);
}
.qr-modal.is-open .qr-backdrop { opacity: 1; }

.qr-panel {
  position: relative; z-index: 1;
  width: 100%; max-width: 440px;
  background: var(--bg); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px 28px 22px;
  text-align: center;
  opacity: 0; transform: translateY(14px) scale(.97);
  transition: opacity .24s var(--ease), transform .24s var(--ease);
}
.qr-modal.is-open .qr-panel { opacity: 1; transform: none; }

.qr-close {
  position: absolute; top: 14px; right: 14px;
  width: 34px; height: 34px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--muted);
  transition: color .18s, border-color .18s, background .18s;
}
.qr-close:hover { color: var(--ink); border-color: #CBD3E0; background: var(--bg-soft); }
.qr-close:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- 头部 ---------- */
.qr-head { margin-bottom: 18px; }
.qr-brand {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .78rem; font-weight: 700; letter-spacing: .06em;
  color: var(--muted-2); text-transform: uppercase;
  margin-bottom: 12px;
}
.qr-brand-mark {
  width: 20px; height: 20px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--grad-brand); color: #fff;
  font-size: .72rem; font-weight: 800; letter-spacing: 0;
}
.qr-title {
  font-size: 1.06rem; line-height: 1.4; margin: 0;
  color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.qr-sub { margin: 0 0 0; font-size: .84rem; color: var(--muted); }

/* ---------- 页签切换 ---------- */
.qr-tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--bg-soft); border-radius: 12px;
  margin-bottom: 20px;
}
.qr-tab {
  flex: 1; padding: 9px 12px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted);
  font-size: .88rem; font-weight: 600;
  transition: background .18s var(--ease), color .18s var(--ease), box-shadow .18s var(--ease);
}
.qr-tab:hover { color: var(--ink); }
.qr-tab.is-on {
  background: #fff; color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.qr-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* ---------- 面板 ---------- */
.qr-pane { display: none; }
.qr-pane.is-on { display: block; }

/* ---------- 二维码舞台 ---------- */
.qr-stage { display: flex; justify-content: center; margin: 4px 0 18px; }

.qr-frame {
  position: relative;
  width: 232px; height: 232px;
  padding: 0; border-radius: 18px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px -14px rgba(10,15,30,.28);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.qr-frame::before {
  /* 四角装饰，呼应品牌色 */
  content: ""; position: absolute; inset: 8px;
  border-radius: 12px;
  background:
    linear-gradient(var(--brand), var(--brand)) left top / 16px 2px no-repeat,
    linear-gradient(var(--brand), var(--brand)) left top / 2px 16px no-repeat,
    linear-gradient(var(--accent), var(--accent)) right bottom / 16px 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) right bottom / 2px 16px no-repeat;
  opacity: .5;
  pointer-events: none;
}
.qr-code { line-height: 0; }
.qr-code canvas, .qr-code img { display: block; border-radius: 6px; }

/* 二维码中央品牌标 */
.qr-badge {
  position: absolute; left: 50%; top: 50%;
  width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border-radius: 12px; background: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(10,15,30,.14);
  pointer-events: none;
}
.qr-badge-mark {
  width: 32px; height: 32px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--grad-brand); color: #fff;
  font-size: 1rem; font-weight: 800;
}

.qr-skeleton {
  position: absolute;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  width: 232px; height: 232px;
  border-radius: 18px; border: 1px dashed var(--line);
  background: var(--bg-soft); color: var(--muted);
  font-size: .84rem;
}
.qr-skeleton[hidden] { display: none; }
.qr-skeleton.is-err { color: var(--brand); border-color: #F3C6CE; }
.qr-spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--brand);
  animation: qr-spin .7s linear infinite;
}
@keyframes qr-spin { to { transform: rotate(360deg); } }

/* ---------- 链接行 ---------- */
.qr-linkline {
  margin: 0 0 16px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  border: 1px solid var(--line-2);
  font-family: var(--font-num);
  font-size: .72rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  direction: rtl; text-align: left; /* 长链接优先显示域名尾部 */
}

/* ---------- 转发卡片面板 ---------- */
.qr-poster-wrap {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 260px;
  max-height: 46vh;
  margin-bottom: 14px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--bg-soft);
  border: 1px solid var(--line-2);
  overflow: auto;
}
.qr-poster-img {
  display: block;
  width: auto; max-width: 100%;
  max-height: 42vh;
  border-radius: 10px;
  box-shadow: 0 8px 26px -12px rgba(10,15,30,.30);
}
.qr-poster-img[hidden] { display: none; }
.qr-poster-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  font-size: .85rem; color: var(--muted);
}
.qr-poster-loading[hidden] { display: none; }
.qr-poster-loading.is-err { color: var(--brand); }
.qr-poster-tip {
  margin: 0 0 16px; font-size: .78rem; color: var(--muted-2); text-align: center;
}

/* ---------- 操作按钮 ---------- */
.qr-actions { display: flex; gap: 10px; }
.qr-actions .btn { flex: 1; }

/* ---------- 微信引导 ---------- */
.qr-wechat-tip {
  margin-top: 16px; padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  border: 1px solid #FBD5DD;
  font-size: .8rem; color: var(--brand-700); text-align: left;
  line-height: 1.6;
}
.qr-wechat-tip[hidden] { display: none; }
.qr-wechat-tip b { display: block; margin-bottom: 2px; }

.qr-foot {
  margin: 16px 0 0; font-size: .72rem; color: var(--muted-2);
}

/* ---------- 提示条 ---------- */
.qr-toast {
  position: fixed; left: 50%; bottom: 40px; z-index: 3000;
  transform: translate(-50%, 14px);
  padding: 11px 20px; border-radius: 999px;
  background: var(--ink); color: #fff;
  font-size: .85rem; font-weight: 500;
  box-shadow: 0 12px 30px -12px rgba(10,15,30,.6);
  opacity: 0; transition: opacity .24s var(--ease), transform .24s var(--ease);
  pointer-events: none;
}
.qr-toast.is-in { opacity: 1; transform: translate(-50%, 0); }
.qr-toast.is-err { background: var(--brand-700); }

/* ---------- 移动端：底部抽屉 ---------- */
@media (max-width: 560px) {
  .qr-modal { padding: 0; align-items: flex-end; }
  .qr-panel {
    max-width: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 26px 22px calc(20px + env(safe-area-inset-bottom, 0px));
    transform: translateY(24px);
  }
  .qr-modal.is-open .qr-panel { transform: none; }
  .qr-panel::before {
    content: ""; position: absolute; top: 8px; left: 50%;
    width: 38px; height: 4px; margin-left: -19px;
    border-radius: 999px; background: var(--line);
  }
  .qr-frame, .qr-skeleton { width: 210px; height: 210px; }
  .qr-linkline { font-size: .68rem; }
  .qr-actions { flex-direction: column-reverse; }
  .qr-fab { right: 16px; bottom: 16px; padding: 11px 16px; }
}

/* ---------- 打印 / 降低动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  .qr-fab, .qr-panel, .qr-backdrop, .qr-toast { transition: none; }
  .qr-spinner { animation-duration: 1.6s; }
}
