/* 文章详情页公共样式 */

/* 文章详情内嵌视图容器 */
.article-detail-view {
    padding: 2rem;
    max-width: 1440px;
    margin: 0 auto;
}

/* 文章区域布局 */
.article-section {
    padding: 50px 2rem 40px;
    max-width: 1440px;
    margin: 0 auto;
}

.article-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
}

.article-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.article-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* 文章内容样式 */
.article-content {
    color: var(--text-secondary);
    line-height: 1.8;
}

/* article-card 内的 p 不受 components.css 的 .article-card p 全局限制 */
.article-card .article-content p {
    overflow: visible;
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
    white-space: normal;
    text-overflow: unset;
}

.article-content h2 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.article-content h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.article-content p {
    margin: 0.75rem 0;
}

.article-content ul,
.article-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.article-content img {
    max-width: 720px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 1.5rem auto;
}

.article-content li {
    margin: 0.25rem 0;
}

.article-content strong {
    color: var(--text-primary);
}

.article-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}

.article-content th,
.article-content td {
    border: 1px solid var(--border);
    padding: 0.75rem;
    text-align: left;
}

.article-content th {
    background: var(--bg-secondary);
}

.article-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

/* 文章底部 */
.article-footer {
    padding: 1rem;
    text-align: center;
}

.back-button {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 20px;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.back-button:hover {
    opacity: 0.85;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

@media (max-width: 640px) {
    .back-button {
        bottom: 1.5rem;
        right: 1.5rem;
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
}

/* 页脚 */
.footer-section {
    padding: 2rem;
    text-align: center;
    border-top: 1px solid var(--border);
}

.footer-source {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.footer-copyright {
    color: var(--text-secondary);
    font-size: 0.8rem;
    opacity: 0.7;
}

/* 阅读进度条 */
.reading-progress {
    position: fixed;
    top: 64px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--bg-secondary);
    z-index: 999;
}

.reading-progress-bar {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.1s ease;
}

/* 目录导航 */
.toc-wrapper {
    position: fixed;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
}

.toc {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    max-height: 60vh;
    overflow-y: auto;
    display: none;
}

.toc.active {
    display: block;
}

.toc-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.toc-list {
    list-style: none;
}

.toc-item {
    margin: 0.25rem 0;
}

.toc-link {
    display: block;
    padding: 0.25rem 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
}

.toc-link:hover,
.toc-link.active {
    color: var(--accent);
    background: var(--bg-hover);
    border-left-color: var(--accent);
}

.toc-link.level-3 {
    padding-left: 1rem;
}

.toc-toggle {
    position: fixed;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    transition: all 0.2s ease;
    z-index: 101;
}

.toc-toggle:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

/* 代码块样式 */
.article-content pre,
pre.code-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
}

.article-content code,
code.code-inline {
    background: var(--bg-secondary);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85em;
    color: #f97583;
}

.article-content pre code {
    background: transparent;
    padding: 0;
    color: var(--text-primary);
}

/* 代码高亮 */
.code-keyword { color: #ff7b72; }
.code-string { color: #a5d6ff; }
.code-function { color: #d2a8ff; }
.code-comment { color: #8b949e; font-style: italic; }
.code-number { color: #79c0ff; }
.code-variable { color: #ffa657; }

/* 面包屑导航 */
.breadcrumb {
    padding: 0.5rem 2rem;
    max-width: 900px;
    margin: 0 auto;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: var(--accent);
}

.breadcrumb span {
    margin: 0 0.5rem;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .article-section,
    .article-detail-view {
        padding: 80px 1rem 60px;
    }

    .article-card {
        padding: 1.5rem;
        border-radius: 8px;
    }

    .article-title {
        font-size: 1.25rem;
    }

    .article-content h2 {
        font-size: 1.15rem;
    }

    .article-content h3 {
        font-size: 1rem;
    }

    .toc-wrapper,
    .toc-toggle {
        display: none;
    }

    .breadcrumb {
        padding: 0.75rem 1rem;
    }
}
