/**
 * 自定义文章页面样式
 * 包含文章摘要、作者信息、文章标题等样式
 */

/* 全局防止横向溢出导致双滚动条 */
html, body {
    overflow-x: hidden !important;
    height: 100%;
    min-height: 100%;
    width: 100%;
}

/* 文章摘要区块样式 */
.post-summary-block {
    margin-bottom: 30px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(0,0,0,0.05);
    background: #fff;
}

.post-summary-header {
    padding: 12px 20px;
    background: linear-gradient(135deg, #a7d1f1 0%, #8fd9e5 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.post-summary-header i {
    margin-right: 10px;
    font-size: 18px;
}

.post-summary-content {
    padding: 20px;
    color: #666;
    line-height: 1.8;
    font-size: 15px;
    background-color: #f9f9f9;
}

/* 作者头像样式 */
.post-author-avatar {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    margin-top: 10px;
}

.author-avatar-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    border: 3px solid #fff;
    margin-right: 15px;
    position: relative;
}

.author-avatar-img::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
    pointer-events: none;
}

.author-avatar-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* 作者信息样式 */
.author-info {
    display: flex;
    flex-direction: column;
}

.author-name {
    font-size: 18px;
    font-weight: 600;
    color: #444;
    margin-bottom: 5px;
    display: block;
}

/* 用户组样式 */
.author-group {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    line-height: 1.4;
    color: #fff;
    background-color: #ff3e3e;
    border-radius: 3px;
    align-self: flex-start;
}

/* 管理员样式 */
.author-group-admin {
    background-color: #ff3e3e;
}

/* 普通用户样式 */
.author-group-user {
    background-color: #28a745;
}

/* 水平布局样式 */
.post-header-flex {
    display: flex;
    align-items: flex-start; /* 改为顶部对齐 */
    margin-bottom: 30px; /* 增加底部间距 */
    flex-wrap: wrap;
}

/* 文章标题样式 */
.post-title-inline {
    font-size: 38px;
    font-weight: 800;
    line-height: 1.2;
    color: #666666;
    margin: 0;
    padding-top: 25px;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* 最多显示两行 */
    -webkit-box-orient: vertical;
    position: relative;
}

/* 移动设备适配 */
@media (max-width: 767px) {
    .post-header-flex {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 20px;
    }
    
    .post-title-inline {
        margin: 15px 0 0 0;
        font-size: 28px;
        padding-top: 5px;
        min-width: auto;
        width: 100%;
    }
    
    .post-author-avatar {
        margin-bottom: 10px;
    }
}

/* 文章标题调整 */
.dlab-post-title {
    margin-bottom: 25px;
}

.dlab-post-title .post-title {
    font-size: 32px;
    line-height: 1.3;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 15px;
}

/* 新增：让文章内容图片自适应屏幕宽度 */
.post-content img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* 修正内容区宽度和自适应问题 */
.page-content, .content-block, .container, .row {
    max-width: 100vw;
    width: 100%;
    box-sizing: border-box;
 /*   overflow-x: hidden;  */
}

/* 图片、表格自适应 */
.post-content img, .post-content table {
    max-width: 100%;
    height: auto;
    display: block;
    box-sizing: border-box;
}

/* 防止内容竖排和溢出 */
.post-content {
    word-break: break-all;
    white-space: normal;
}

/* 新增：提升小屏阅读体验 */
@media (max-width: 767px) {
    .post-summary-content {
        font-size: 14px;
        line-height: 2;
    }
    .author-name {
        font-size: 16px;
        line-height: 1.6;
    }
}

/* 评论区居中显示 */
#comment-list {
    margin-left: auto;
    margin-right: auto;
    max-width: 700px;
    text-align: left;
}
#comment-list > * {
    margin-left: auto;
    margin-right: auto;
}

/* 评论区内部内容居中优化 */
#comment-list .comment-list,
#comment-list .comment-body,
#comment-list .comment-meta,
#comment-list .comment-content,
#comment-list .respond,
#comment-list form,
#comment-list textarea,
#comment-list input[type="text"],
#comment-list input[type="email"],
#comment-list input[type="url"],
#comment-list input[type="submit"] {
    margin-left: auto;
    margin-right: auto;
    display: block;
}
#comment-list .comment-list,
#comment-list .respond {
    width: 100%;
    max-width: 600px;
}
#comment-list .comment-meta,
#comment-list .comment-content {
    text-align: left;
}
#comment-list .comment-author img {
    display: block;
    margin: 0 auto 10px auto;
}
#comment-list .comment-form {
    text-align: center;
}
#comment-list textarea {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}
#comment-list input[type="submit"] {
    display: block;
    margin: 20px auto 0 auto;
}

/* 评论内容区域优化：增加左右内边距和最大宽度 */
#comment-list .comment-content {
    padding-left: 20px;
    padding-right: 20px;
    max-width: 100%;
    box-sizing: border-box;
    text-align: left;
}

/* 只在移动端防止横向溢出 */
@media (max-width: 767px) {
    html, body {
        overflow-x: hidden !important;
    }
    .page-content, .content-block, .container, .row {
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
}

/* 灯箱关闭按钮美化和定位 */
.fancybox__button--close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.3);
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* 去除 Fancybox 滚动条补偿 */
html.with-fancybox {
    --fancybox-scrollbar-compensate: 0px !important;
}

.post-content img,
.post-content table,
.post-content pre,
.post-content code {
    max-width: 100%;
    box-sizing: border-box;
    word-break: break-all;
}

.fancybox__slide {
    position: relative;
}

/* 移除对 Fancybox 工具栏和关闭按钮的强制覆盖，恢复默认样式 */
.fancybox__toolbar, 
.fancybox__toolbar * {
    opacity: 1 !important;
    display: flex !important;
    z-index: 12000 !important;
}
.fancybox__button--close {
    display: flex !important;
    opacity: 1 !important;
    z-index: 12001 !important;
}

/* 再次加强Fancybox工具栏和关闭按钮z-index，确保不被遮挡 */
.fancybox__toolbar, .fancybox__button--close {
    z-index: 12000 !important;
}

/* 移除 .section-full、.content-inner、.bg-white 的 z-index 和 overflow，避免遮挡灯箱 */
.section-full,
.content-inner,
.bg-white {
    z-index: auto !important;
    overflow: visible !important;
}

/* 限制 Fancybox 容器最大宽度并居中显示 */
.section-full .fancybox__container {
    max-width: 900px;
    margin: 0 auto;
    left: 0 !important;
    right: 0 !important;
}

/* 缩小 header 区域顶部空白 */
.header-full .main-bar {
    padding: 8px 0 !important;
}
@media (max-width: 767px) {
    .header-full .main-bar {
        padding: 4px 0 !important;
    }
} 