/**
 * 文章弹窗模式（模仿小红书网页端）
 */

/* 打开弹窗时锁定页面滚动 */
html.b2-pm-lock,
html.b2-pm-lock body {
    overflow: hidden;
}

/* 遮罩 */
.b2-pm-mask {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4vh 4vw;
    background-color: rgba(15, 18, 25, .72);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .28s ease, visibility .28s ease;
}

.b2-pm-mask.on {
    opacity: 1;
    visibility: visible;
}

/* 卡片 */
.b2-pm {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(1080px, 100%);
    height: min(88vh, 920px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 32px 90px -20px rgba(0, 0, 0, .55);
    overflow: hidden;
    transform: translateY(26px) scale(.96);
    opacity: 0;
    transition: transform .32s cubic-bezier(.22, .68, .32, 1), opacity .3s ease;
}

.b2-pm-mask.on .b2-pm {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* 顶部工具条 */
.b2-pm-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 18px;
    border-bottom: 1px solid #f0f1f4;
    background: #fff;
    flex: none;
}

.b2-pm-title {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 700;
    color: #121212;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.b2-pm-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
}

.b2-pm-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid #e8eaef;
    border-radius: 999px;
    background: #f7f8fa;
    color: #4a4f57;
    font-size: 12.5px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: all .2s ease;
}

.b2-pm-chip:hover {
    color: var(--b2color);
    border-color: var(--b2lightcolor);
    background: var(--b2light);
    transform: translateY(-1px);
}

.b2-pm-chip.b2-pm-close {
    width: 32px;
    padding: 0;
    justify-content: center;
    font-size: 15px;
}

.b2-pm-chip.b2-pm-close:hover {
    color: #FF3355;
    border-color: rgba(255, 51, 85, .35);
    background: rgba(255, 51, 85, .06);
}

/* 弹幕层 */
.b2-pm-danmu {
    position: relative;
    height: 0;
    overflow: hidden;
    background: var(--b2light);
    flex: none;
    transition: height .3s ease;
}

.b2-pm-danmu.has {
    height: 44px;
    border-bottom: 1px solid #f0f1f4;
}

.b2-pm-danmu-lane {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.b2-pm-danmu-item {
    position: absolute;
    left: 100%;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 76%;
    height: 26px;
    padding: 0 10px;
    box-sizing: border-box;
    border-radius: 999px;
    background: var(--b2light);
    background-color: rgba(67, 97, 238, .08);
    color: #4a4f57;
    font-size: 12px;
    line-height: 26px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .06);
    animation: b2-pm-fly linear forwards;
}

.b2-pm-danmu-item b {
    color: var(--b2color);
    font-weight: 600;
    flex: none;
}

@keyframes b2-pm-fly {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(calc(-100vw - 100%));
    }
}

.b2-pm-danmu.off .b2-pm-danmu-item {
    opacity: 0;
    animation-play-state: paused;
}

.b2-pm-danmu-toggle:not([aria-pressed="true"]),
.b2-pm-danmu-toggle[aria-pressed="false"] {
    opacity: .55;
}

/* 内容区 */
.b2-pm-body {
    flex: 1;
    overflow: hidden;
    display: flex;
}

.b2-pm-body>.b2-pm-skeleton,
.b2-pm-body>.b2-pm-article {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 22px 30px 30px;
    -webkit-overflow-scrolling: touch;
}

/* 骨架屏 */
.b2-pm-skel {
    border-radius: 8px;
    background: linear-gradient(90deg, #f1f2f5 25%, #e9ebef 37%, #f1f2f5 63%);
    background-size: 400% 100%;
    animation: b2-pm-shine 1.4s ease infinite;
}

.b2-pm-skel-author {
    width: 200px;
    height: 40px;
    border-radius: 999px;
    margin-bottom: 20px;
}

.b2-pm-skel-line {
    height: 16px;
    margin-bottom: 14px;
}

.b2-pm-skel-l1 {
    width: 72%;
    height: 24px;
    margin-bottom: 22px;
}

.b2-pm-skel-short {
    width: 46%;
}

@keyframes b2-pm-shine {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: 0 0;
    }
}

.b2-pm-loading-text {
    margin-top: 18px;
    font-size: 13px;
    color: #a8b0bd;
    text-align: center;
}

/* 文章内容 */
.b2-pm-article {
    max-width: 760px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.b2-pm-author {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.b2-pm-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex: none;
}

.b2-pm-author-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 14px;
}

.b2-pm-author-info b {
    color: #121212;
}

.b2-pm-author-info span {
    font-size: 12px;
    color: #a8b0bd;
}

.b2-pm-h1 {
    font-size: 24px;
    line-height: 1.4;
    margin: 0 0 18px;
    color: #121212;
}

/* 弹窗内复用主题正文与评论样式 */
.b2-pm-content {
    font-size: 15px;
    color: #333;
    line-height: 1.8;
}

.b2-pm-content .single-article {
    background: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
}

.b2-pm-content h1,
.b2-pm-content .entry-header {
    display: none;
}

.b2-pm-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.b2-pm-content pre,
.b2-pm-content .post-content pre {
    max-width: 100%;
    overflow-x: auto;
}

.b2-pm-content>h2:first-child {
    margin-top: 0;
}

/* 弹窗内评论区做分隔 */
.b2-pm-content #comments,
.b2-pm-content .comments-area {
    margin-top: 30px;
    padding-top: 22px;
    border-top: 1px dashed #eceef2;
}

/* 底部操作栏 */
.b2-pm-foot {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 8px;
    padding: 10px 18px;
    border-top: 1px solid #f0f1f4;
    background: #fff;
    flex: none;
}

.b2-pm-act {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: #f7f8fa;
    color: #4a4f57;
    font-size: 13px;
    cursor: pointer;
    transition: all .2s ease;
    flex: none;
    white-space: nowrap;
}

.b2-pm-act span {
    white-space: nowrap;
}

.b2-pm-act i {
    font-style: normal;
    font-size: 16px;
    line-height: 1;
}

.b2-pm-act b {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.b2-pm-act:hover {
    background: var(--b2light);
    color: var(--b2color);
    transform: translateY(-1px);
}

.b2-pm-act.b2-pm-like.isset {
    background: rgba(255, 51, 85, .08);
    color: #FF3355;
}

.b2-pm-act.b2-pm-like.isset i {
    animation: b2-pm-pop .35s cubic-bezier(.2, 1.6, .4, 1);
}

.b2-pm-act.b2-pm-fav.isset {
    background: rgba(255, 179, 0, .12);
    color: #E8A200;
}

.b2-pm-act.b2-pm-fav.isset i {
    animation: b2-pm-pop .35s cubic-bezier(.2, 1.6, .4, 1);
}

@keyframes b2-pm-pop {
    0% {
        transform: scale(.5);
    }

    60% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

/* 暗色模式：由 JS 检测主题明暗状态后添加 .b2-pm-dark（跟随主题实时同步） */
.b2-pm-dark .b2-pm {
    background: #1e2025;
}

.b2-pm-dark .b2-pm-head,
.b2-pm-dark .b2-pm-foot {
    background: #1e2025;
    border-color: #2c2f36;
}

.b2-pm-dark .b2-pm-title,
.b2-pm-dark .b2-pm-h1,
.b2-pm-dark .b2-pm-author-info b {
    color: #e8eaee;
}

.b2-pm-dark .b2-pm-chip {
    background: #26282e;
    border-color: #35383f;
    color: #c7ccd4;
}

.b2-pm-dark .b2-pm-danmu.has {
    border-color: #2c2f36;
}

.b2-pm-dark .b2-pm-danmu-item {
    background: rgba(255, 255, 255, .08);
    color: #d5d9df;
}

.b2-pm-dark .b2-pm-content {
    color: #cfd3da;
}

.b2-pm-dark .b2-pm-content h1,
.b2-pm-dark .b2-pm-content h2,
.b2-pm-dark .b2-pm-content h3,
.b2-pm-dark .b2-pm-content h4,
.b2-pm-dark .b2-pm-content h5,
.b2-pm-dark .b2-pm-content h6 {
    color: #e8eaee;
}

.b2-pm-dark .b2-pm-content a {
    color: #7ea6f0;
}

.b2-pm-dark .b2-pm-content table th,
.b2-pm-dark .b2-pm-content table td {
    border-color: #35383f;
    color: #cfd3da;
}

.b2-pm-dark .b2-pm-content blockquote,
.b2-pm-dark .b2-pm-content pre,
.b2-pm-dark .b2-pm-content code {
    background: #26282e;
    color: #cfd3da;
}

.b2-pm-dark .b2-pm-content #comments,
.b2-pm-dark .b2-pm-content .comments-area {
    border-color: #2c2f36;
}

.b2-pm-dark .b2-pm-skel {
    background: linear-gradient(90deg, #26282e 25%, #2e3138 37%, #26282e 63%);
    background-size: 400% 100%;
}

.b2-pm-dark .b2-pm-act {
    background: #26282e;
    color: #c7ccd4;
}

/* 移动端：全屏上滑卡片 */
@media screen and (max-width: 768px) {
    .b2-pm-mask {
        padding: 0;
        align-items: flex-end;
    }

    .b2-pm {
        width: 100%;
        height: 96vh;
        border-radius: 18px 18px 0 0;
        transform: translateY(100%);
    }

    .b2-pm-mask.on .b2-pm {
        transform: translateY(0);
    }

    .b2-pm-head {
        padding: 10px 12px;
    }

    .b2-pm-title {
        font-size: 14px;
    }

    .b2-pm-chip {
        height: 30px;
        padding: 0 10px;
        font-size: 12px;
    }

    .b2-pm-chip.b2-pm-open span,
    .b2-pm-chip.b2-pm-danmu-toggle span {
        display: inline;
    }

    .b2-pm-body>.b2-pm-skeleton,
    .b2-pm-body>.b2-pm-article {
        padding: 16px 16px 24px;
    }

    .b2-pm-h1 {
        font-size: 19px;
    }

    .b2-pm-foot {
        padding: 8px 10px;
    }

    .b2-pm-act {
        padding: 0 12px;
        font-size: 12px;
        gap: 4px;
    }
}

@media (prefers-reduced-motion: reduce) {

    .b2-pm,
    .b2-pm-mask {
        transition: none;
    }

    .b2-pm-danmu-item {
        animation-duration: 20s !important;
    }
}

/* 分享海报弹窗（复用原主题 poster-box 样式，仅做层级与移动端微调） */
.b2-pm-poster-wrap .modal.poster-box {
    z-index: 9999999;
}

.b2-pm-poster-wrap .modal .modal-content {
    z-index: 1;
}

.b2-pm-poster-wrap .poster-box-left img {
    max-width: none;
}

.b2-pm-poster-wrap .fuzhi input {
    max-width: 220px;
}

@media screen and (max-width: 768px) {
    .b2-pm-poster-wrap .modal.poster-box .modal-content {
        width: calc(100% - 20px);
        padding: 16px;
    }

    .b2-pm-poster-wrap .poster-content {
        flex-flow: column;
    }

    .b2-pm-poster-wrap .poster-share {
        width: 100%;
        margin-top: 14px;
    }
}
