/* ============================================
   Article Detail Page 样式 (detail.css)
   ============================================ */
.main-content {
    padding: 20px 0;
}

.detail-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px 56px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow);
}

/* 头部 */
.detail-header {
    margin-bottom: 32px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--color-border-light);
}

.detail-title {
    font-size: 34px;
    font-weight: 800;
    line-height: 1.3;
    color: var(--color-text);
    margin-bottom: 16px;
    letter-spacing: -.5px;
    overflow: hidden;
    white-space: pre-wrap;
    word-break: break-all;
    word-wrap: break-word;
}

.detail-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 14px;
    color: var(--color-text-muted);
}

.detail-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* 正文 */
.detail-body {
    font-size: 16px;
    line-height: 1.9;
    color: var(--color-text);
}

.detail-body h1,
.detail-body h2,
.detail-body h3,
.detail-body h4 {
    margin: 32px 0 16px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--color-text);
    scroll-margin-top: 90px;
}

.detail-body h1 {
    font-size: 28px;
}

.detail-body h2 {
    font-size: 24px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-border-light);
}

.detail-body h3 {
    font-size: 20px;
}

.detail-body h4 {
    font-size: 17px;
}

.detail-body p {
    margin-bottom: 18px;
}

.detail-body a {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.detail-body a:hover {
    color: var(--color-primary-hover);
}

.detail-body ul,
.detail-body ol {
    margin: 0 0 18px;
    padding-left: 24px;
}

.detail-body ul {
    list-style: disc;
}

.detail-body ol {
    list-style: decimal;
}

.detail-body li {
    margin-bottom: 8px;
}

.detail-body blockquote {
    margin: 24px 0;
    padding: 16px 24px;
    border-left: 4px solid var(--color-primary);
    background: var(--color-primary-light);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--color-text-secondary);
    font-style: italic;
}

.detail-body code {
    background: var(--color-bg-alt);
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    font-size: 14px;
    font-family: "SF Mono", "Fira Code", Consolas, monospace;
    color: #d6336c;
}

.detail-body pre {
    background: #1a1a2e;
    color: #e4e4e7;
    padding: 20px 24px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 24px 0;
    line-height: 1.6;
    position: relative;
}

.detail-body pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: 14px;
}

.detail-body img {
    border-radius: var(--radius);
    margin: 24px 0;
    box-shadow: var(--shadow);
}

.detail-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 14px;
}

.detail-body th,
.detail-body td {
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    text-align: left;
}

.detail-body th {
    background: var(--color-bg-alt);
    font-weight: 600;
}

.detail-body hr {
    border: none;
    border-top: 1px solid var(--color-border-light);
    margin: 32px 0;
}

/* 代码块语言标签 */
.code-lang {
    position: absolute;
    top: 8px;
    right: 16px;
    font-size: 11px;
    color: #71717a;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 底部信息 */
.detail-footer {
    margin-top: 40px;
    padding-top: 28px;
    border-top: 1px solid var(--color-border-light);
}

.detail-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.detail-tag {
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    background: var(--color-bg-alt);
    color: var(--color-text-secondary);
    transition: all var(--transition);
    cursor: pointer;
}

.detail-tag:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.detail-share {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.share-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-muted);
}

.share-btns {
    display: flex;
    gap: 10px;
}

.share-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-bg-alt);
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.share-btn:hover {
    background: var(--color-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(91, 94, 247, .3);
}

/* 上一篇 / 下一篇 */
.detail-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 24px;
}

.detail-nav-item {
    padding: 16px 20px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
    background: var(--color-surface);
    transition: all var(--transition);
    text-decoration: none;
}

.detail-nav-item:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.detail-nav-label {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.detail-nav-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 相关推荐 */
.related-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--color-border-light);
}

.related-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 24px;
}

/* ============================================
   评论区 (仅 Detail 页)
   ============================================ */
.comment-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--color-border-light);
}

.comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.comment-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-count {
    font-size: 14px;
    color: var(--color-text-muted);
    font-weight: 500;
}

/* 评论表单 */
.comment-form {
    background: var(--color-bg-alt);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 32px;
}

.comment-form-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 12px;
}

.comment-input {
    width: 100%;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    outline: none;
    transition: all var(--transition);
    resize: vertical;
}

.comment-input:focus {
    border-color: var(--color-primary);
    background: var(--color-surface);
    box-shadow: 0 0 0 3px rgba(91, 94, 247, .08);
}

.comment-input-name {
    padding-right: 60px;
}

.comment-input-content {
    min-height: 80px;
    padding-right: 60px;
}

.comment-form-row {
    width: 100%;
    margin-top: 10px;
    position: relative;
}

.comment-char-count {
    position: absolute;
    right: 12px;
    bottom: 10px;
    font-size: 11px;
    color: var(--color-text-muted);
    pointer-events: none;
}

.comment-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.btn-comment-submit {
    padding: 8px 20px;
    font-size: 13px;
}

/* 评论列表 */
.comment-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comment-loading {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 14px;
    padding: 24px 0;
}

.comment-empty {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 14px;
    padding: 32px 0;
}

/* 单条评论 */
.comment-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
    padding: 20px 24px;
    transition: all var(--transition);
}

.comment-item:hover {
    box-shadow: var(--shadow-sm);
}

.comment-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.comment-item-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary-light), #e8e6ff);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.comment-item-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.comment-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.comment-item-date {
    font-size: 12px;
    color: var(--color-text-muted);
}

.comment-item-body {
    padding-left: 42px;
}

.comment-item-content {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.7;
    word-break: break-word;
}

/* 评论分页 */
.comment-pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 24px;
}

.comment-pagination .page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 600;
    transition: all var(--transition);
    font-family: inherit;
    text-decoration: none;
}

.comment-pagination .page-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.comment-pagination .page-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(91, 94, 247, .3);
}

.comment-pagination .page-btn.disabled {
    opacity: .35;
    pointer-events: none;
}

/* ============================================
   文章图集：不规则集合（瀑布流小块卡片）
   ============================================ */
.detail-gallery {
    margin: 28px 0 8px;
    padding: 16px;
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border-light, #e8ebf2);
    border-radius: var(--radius, 16px);
    box-shadow: var(--shadow-sm, 0 2px 10px rgba(20, 24, 48, .05));
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);  /* 桌面每行 5 个 */
    grid-auto-rows: 160px;                  /* 高度写死 */
    gap: 10px;
}

/* 手机模式：每行 2 个 */
@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 130px;
    }
}

.gallery-item {
    display: block;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: var(--color-bg-muted, #f2f4f8);
    border: 1px solid var(--color-border-light, #e8ebf2);
    transition: transform .18s ease, box-shadow .18s ease;
    cursor: zoom-in;
}

.gallery-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;          /* 完整显示最宽的图片，不裁剪（居中留白） */
}

.gallery-item:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 8px 22px rgba(20, 24, 48, .14);
}