/* ===== Detail Page ===== */
img {
    max-width: 100%;
}
/* Main Content - white background */
.main-content {
    padding-bottom: 40px;
}

/* Breadcrumb override for detail page */
.breadcrumb {
    max-width: 1200px;
    margin: 0 auto 50px;
    padding: 50px 20px 0;
    font-size: 16px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb-site {
    background: #60cdff;
    color: #333;
    padding: 2px 10px;
    border-radius: 3px;
    font-size: 16px;
    font-weight: 500;
}

/* Article Container */
.article {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.article-container {
    background-color: #fff;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 40px 40px;
}

/* Article Title */
.article-title {
    font-size: 32px;
    font-weight: bold;
    color: #333;
    line-height: 1.4;
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Article Meta */
.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid #60cdff;
    margin-bottom: 50px;
    flex-wrap: wrap;
    gap: 10px;
}

.article-meta-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.article-author {
    font-size: 14px;
    color: #999;
}

.article-date {
    font-size: 14px;
    color: #999;
}

/* Share Buttons */
.article-share {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.share-label {
    font-size: 14px;
    color: #666;
}

.share-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: transform 0.3s;
}

.share-btn:hover {
    transform: scale(1.1);
}

.share-btn img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Share QR Code Popup */
.share-qrcode-popup {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: #fff;
    border: 1px solid #eee;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    padding: 15px;
    border-radius: 4px;
    text-align: center;
    z-index: 100;
}

.article-share:hover .share-qrcode-popup {
    display: block;
}

.share-qrcode-img {
    width: 100px;
    height: 100px;
    margin: 0 auto 10px;
}

.share-qrcode-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.share-qrcode-text {
    font-size: 11px;
    color: #999;
    line-height: 1.4;
    margin: 0;
}

/* Article Body */
.article-body {
    position: relative;
}

/* Article Image */
.article-image {
    margin-bottom: 25px;
    border-radius: 4px;
    overflow: hidden;
}

.article-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Article Text */
.article-text {
    margin-top: 50px;
    margin-bottom: 25px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.article-text * {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* 段落默认不留间距：编辑器里直接相邻的 <p> 视为换行，分段间距由空行段落提供 */
.article-text p {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    margin-bottom: 0;
    text-align: justify;
}

.article-text p:last-child {
    margin-bottom: 0;
}

/* ===== 编辑器空行（.p-empty 由模板脚本 normalizeArticleText 标记）===== */
/* 纯 CSS 无法区分“空行段落”和“段内含 <br> 的正文段落”（两者元素结构相同），
   因此由模板脚本归一化：空行段落加 .p-empty，段末冗余 <br> 直接隐藏 */

/* 编辑器里的空行：显示为 20px 的分段间距 */
.article-text p.p-empty {
    height: 20px;
    margin: 0;
    overflow: hidden;
    font-size: 0;
    line-height: 0;
}

/* 连续多个空行只保留一个间距 */
.article-text p.p-empty + p.p-empty {
    display: none;
}

/* ===== 图片及其下方文字（图注）的默认排版 ===== */

/* 图片段落与上方内容保留段落间距，下方图注紧贴图片 */
.article-text p:has(img) {
    margin-top: 20px;
    margin-bottom: 0;
}

/* 空行之后的图片不再叠加间距（空行本身已提供间距） */
.article-text p.p-empty + p:has(img) {
    margin-top: 0;
}

/* 同一段落内连续出现的图片之间保留间距 */
.article-text img + img {
    margin-top: 20px;
}

/* ===== 视频播放器（DPlayer） ===== */

/* 桌面端播放器占文字栏 60% 并居中 */
#dplayer {
    width: 60%;
    margin: 0 auto;
}

/* 正文图片宽度与文字栏对齐，按文字宽度等比缩放（!important 用于覆盖编辑器输出的内联宽高） */
.article-text img {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 auto;
}

/* 紧跟在图片下面的文字默认视为图注：灰色、小字号、与图片无间距 */
.article-text p:has(img) + p:not(:has(img)) {
    color: #7f7f7f;
    font-size: 15px;
    line-height: 1.6;
}

/* Editor Info */
.article-editor {
    margin-top: 30px;
    /*padding-top: 20px;*/
}

.article-editor p {
    font-size: 13px;
    color: #999;
    line-height: 1.8;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    .main-content {
        padding-bottom: 25px;
    }

    .breadcrumb {
        padding-top: 20px;
        font-size: 12px;
    }

    .article-title {
        font-size: 24px;
    }

    .article-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .article-meta-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .article-author,
    .article-date {
        font-size: 13px;
    }

    .article-text p {
        font-size: 15px;
        line-height: 1.7;
    }

    /* 移动端播放器占满文字栏宽度（!important 用于覆盖旧页面模板里残留的内联宽度） */
    #dplayer {
        width: 100% !important;
        margin: 0 !important;
    }

    .share-btn {
        width: 32px;
        height: 32px;
    }

    .share-btn img {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    .article-title {
        font-size: 20px;
    }

    .article-container {
        padding: 0 15px 30px;
    }

    .article-text p {
        font-size: 14px;
        line-height: 1.6;
    }

    .article-editor p {
        font-size: 12px;
    }
}
