/*!
 * ms-share.css — 文章分享 & 收藏皮肤（v2 · 2026-09-26）
 *
 * 渠道图标由开源 Share.js / social-share.js 1.0.16 引擎渲染（iconfont），
 * 本文件只做「工业简约 + 深底」皮肤：不引第三方 CSS，避免它的默认白底浮层与
 * `top:-205px` 二维码定位（在正文里会被祖先 overflow 裁掉）。
 *
 * 交互（用户要求）：正文末尾只有一个分享图标 → 点击弹出面板 → 面板里是几个渠道。
 * 二维码视图在面板内部切换（面板是 fixed 定位，绝不依赖祖先 overflow）。
 */
@font-face {
    font-family: "socialshare";
    src: url("/static/fonts/iconfont.woff") format("woff"),
         url("/static/fonts/iconfont.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ---------------- 正文末尾的入口栏 ---------------- */
.ms-share {
    position: relative;
    margin: 34px 0 6px;
    padding-top: 20px;
    border-top: 1px solid rgba(122, 168, 214, .17);
    font-size: 13.5px;
    line-height: 1;
}
.ms-share-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ms-share-btn {
    display: inline-flex; align-items: center; gap: 7px;
    height: 34px; padding: 0 14px; margin: 0;
    border: 1px solid rgba(122, 168, 214, .28);
    border-radius: 999px;
    background: rgba(255, 255, 255, .03);
    color: #A9C2DA;
    font-size: 13.5px; font-family: inherit; line-height: 1;
    cursor: pointer;
    -webkit-appearance: none;
    transition: border-color .18s ease, color .18s ease, background-color .18s ease;
}
.ms-share-btn:hover { border-color: #8FC4EC; color: #E6F1FB; background: rgba(143, 196, 236, .10); }
.ms-share-btn:focus-visible { outline: 2px solid #8FC4EC; outline-offset: 2px; }
.ms-share-ico { display: inline-flex; align-items: center; justify-content: center; }
.ms-share-ico svg { display: block; }
.ms-share-fav.is-on { border-color: #8FC4EC; color: #E6F1FB; background: rgba(143, 196, 236, .14); }
.ms-share-fav.is-on .ms-share-ico svg path { fill: currentColor; }

/* ---------------- 面板（PC：跟随触发点的 fixed 浮层；移动：底部抽屉） ---------------- */
.ms-share-mask { display: none; }
.ms-share-panel {
    position: fixed; left: 0; top: 0; z-index: 70;
    min-width: 302px; max-width: 340px;
    padding: 14px 16px 16px;
    background: #0B1E33;
    border: 1px solid rgba(122, 168, 214, .22);
    border-radius: 10px;
    box-shadow: 0 18px 46px rgba(0, 0, 0, .55);
    box-sizing: border-box;
}
.ms-share-panel[hidden] { display: none !important; }
.ms-share-head {
    display: flex; align-items: center; justify-content: space-between;
    margin: 0 0 12px;
    color: #8FA9C4; font-size: 13px; letter-spacing: .04em;
}
.ms-share-x {
    width: 24px; height: 24px; margin: 0; padding: 0;
    border: 0; border-radius: 6px; background: transparent;
    color: #7E97B3; font-size: 18px; line-height: 1; cursor: pointer;
}
.ms-share-x:hover { color: #E6F1FB; background: rgba(255, 255, 255, .06); }
.ms-share-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 2px; }
/* ⚠ 必须显式写：`hidden` 属性只是 UA 的 `[hidden]{display:none}`，特异性低于 `.ms-share-row{display:flex}`，
   不写这条的话 row.hidden = true 根本不会隐藏（QR 视图会与渠道图标同时出现）。 */
.ms-share-row[hidden] { display: none !important; }

/* ---------------- Share.js 图标（引擎注入的 <a class="social-share-icon icon-x">） ---------------- */
.ms-share-row .social-share-icon {
    position: relative;
    display: inline-block;
    width: 42px; height: 42px; margin: 0 6px 0 0;
    border: 1px solid #8FC4EC; border-radius: 50%;
    background: transparent;
    color: #8FC4EC;
    font-family: "socialshare" !important;
    font-size: 23px; font-style: normal; line-height: 40px; text-align: center;
    text-decoration: none; vertical-align: middle;
    -webkit-font-smoothing: antialiased;
    transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
.ms-share-row .social-share-icon:hover,
.ms-share-row .social-share-icon:focus-visible { background: currentColor; }
.ms-share-row .social-share-icon:hover:before,
.ms-share-row .social-share-icon:focus-visible:before { color: #fff; }
.ms-share-row .social-share-icon:focus-visible { outline: 2px solid #8FC4EC; outline-offset: 2px; }
.ms-share-row .social-share-icon:before { color: inherit; }

.ms-share-row .icon-wechat { color: #7BC549; border-color: #7BC549; }
.ms-share-row .icon-qq { color: #56B6E7; border-color: #56B6E7; }
.ms-share-row .icon-qzone { color: #FDBE3D; border-color: #FDBE3D; }
.ms-share-row .icon-weibo { color: #FF763B; border-color: #FF763B; }
.ms-share-row .icon-tencent { color: #56B6E7; border-color: #56B6E7; }
.ms-share-row .icon-douban { color: #33B045; border-color: #33B045; }
.ms-share-row .icon-linkedin { color: #0077B5; border-color: #0077B5; }
.ms-share-row .icon-facebook { color: #44619D; border-color: #44619D; }
.ms-share-row .icon-twitter { color: #55ACEE; border-color: #55ACEE; }
.ms-share-row .icon-google { color: #DB4437; border-color: #DB4437; }
.ms-share-row .icon-diandian { color: #307DCA; border-color: #307DCA; }

.ms-share-row .icon-wechat:before { content: "\f09a"; }
.ms-share-row .icon-qq:before { content: "\f11a"; }
.ms-share-row .icon-qzone:before { content: "\f08a"; }
.ms-share-row .icon-weibo:before { content: "\f12a"; }
.ms-share-row .icon-tencent:before { content: "\f07a"; }
.ms-share-row .icon-douban:before { content: "\f10a"; }
.ms-share-row .icon-linkedin:before { content: "\f01a"; }
.ms-share-row .icon-facebook:before { content: "\f03a"; }
.ms-share-row .icon-twitter:before { content: "\f06a"; }
.ms-share-row .icon-google:before { content: "\f04a"; }
.ms-share-row .icon-diandian:before { content: "\f05a"; }

/* 微信锚点里的二维码卡片：默认不显示（我们把它搬进面板的 QR 槽再显示） */
.ms-share-row .wechat-qrcode { display: none; }

/* 复制链接：与渠道同一套圆钮 */
.ms-share-row .ms-share-copy { color: #8FC4EC; border-color: rgba(143, 196, 236, .55); margin-right: 0; }
.ms-share-row .ms-share-copy:hover,
.ms-share-row .ms-share-copy:focus-visible { background: #8FC4EC; }
.ms-share-row .ms-share-copy:hover .ms-share-ico,
.ms-share-row .ms-share-copy:focus-visible .ms-share-ico { color: #fff; }
.ms-share-row .ms-share-copy .ms-share-ico { position: relative; top: 1px; }
.ms-share-row .ms-share-dead { color: #7E97B3; font-size: 12.5px; line-height: 1.7; }

/* ---------------- 二维码视图（面板内切换，永不裁切） ---------------- */
.ms-share-qr { text-align: center; }
.ms-share-qr[hidden] { display: none !important; }
.ms-share-qr-back {
    display: inline-block; margin: 0 0 12px; padding: 0;
    border: 0; background: transparent; color: #8FC4EC;
    font-size: 12.5px; font-family: inherit; cursor: pointer;
}
.ms-share-qr-back:hover { text-decoration: underline; }
.ms-share-qr .wechat-qrcode {
    display: block; position: static;
    width: auto; height: auto; margin: 0 auto;
    padding: 12px 12px 10px;
    background: #fff; border: 0; border-radius: 8px;
    color: #444; font-size: 12px; text-align: center;
}
.ms-share-qr .wechat-qrcode h4 {
    margin: 0 0 8px; padding: 0; height: auto;
    background: transparent; color: #555;
    font-size: 12.5px; font-weight: 600; line-height: 1.4;
}
.ms-share-qr .wechat-qrcode .qrcode { display: inline-block; margin: 0; }
.ms-share-qr .wechat-qrcode .qrcode canvas,
.ms-share-qr .wechat-qrcode .qrcode img { display: block; margin: 0 auto; }
.ms-share-qr .wechat-qrcode .help { margin-top: 6px; }
.ms-share-qr .wechat-qrcode .help p { margin: 2px 0; padding: 0; color: #777; font-size: 11.5px; line-height: 1.6; }

/* ---------------- 环境提示 ---------------- */
.ms-share-hint { margin: 10px 0 0; color: #7E97B3; font-size: 12px; line-height: 1.7; }
.ms-share-hint[hidden] { display: none !important; }

/* ---------------- toast ---------------- */
.ms-share-toast {
    position: fixed; left: 50%; bottom: 86px; z-index: 90;
    max-width: 78vw; padding: 10px 16px;
    background: rgba(11, 30, 51, .97);
    border: 1px solid rgba(143, 196, 236, .35);
    border-radius: 8px;
    color: #E6F1FB; font-size: 13px; line-height: 1.5; text-align: center;
    opacity: 0; visibility: hidden; transform: translate(-50%, 8px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
.ms-share-toast.is-on { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ---------------- 移动端右下角悬浮球（默认关闭，仅移动端 + 正文滚出视口后出现） ---------------- */
.ms-share-fab { display: none; }

@media (max-width: 767px) {
    .ms-share { margin-top: 28px; }
    .ms-share-fab {
        display: block;
        position: fixed; right: 16px; z-index: 58;
        bottom: calc(18px + env(safe-area-inset-bottom, 0px));
        width: 48px; height: 48px; padding: 0; margin: 0;
        background: rgba(11, 30, 51, .92);
        border: 1px solid rgba(143, 196, 236, .38);
        border-radius: 50%;
        color: #8FC4EC;
        cursor: pointer;
        opacity: 0; visibility: hidden; transform: translateY(8px);
        transition: opacity .22s ease, transform .22s ease, visibility .22s;
    }
    .ms-share-fab svg { display: block; margin: 0 auto; }
    .ms-share-fab.is-on { opacity: 1; visibility: visible; transform: none; }

    .ms-share-mask {
        display: none;
        position: fixed; left: 0; right: 0; top: 0; bottom: 0; z-index: 65;
        background: rgba(4, 12, 24, .64);
    }
    .ms-share-mask.is-on { display: block; }

    .ms-share-panel,
    .ms-share-panel[hidden] { display: none !important; }
    .ms-share-panel.is-on,
    .ms-share-panel[hidden].is-on {
        display: block !important;
        left: 0; right: 0; top: auto; bottom: 0;
        min-width: 0; max-width: none;
        padding: 16px 18px calc(20px + env(safe-area-inset-bottom, 0px));
        border-radius: 14px 14px 0 0;
        border-width: 1px 0 0;
        max-height: 82vh;
        overflow-y: auto;
    }
    .ms-share-row { justify-content: space-between; gap: 10px 0; padding: 2px 4px 0; }
    .ms-share-row .social-share-icon { width: 50px; height: 50px; line-height: 48px; font-size: 27px; margin: 0; }
    .ms-share-toast { bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
}

@media print {
    .ms-share-fab, .ms-share-mask, .ms-share-panel, .ms-share-toast { display: none !important; }
}
