/* ========== 猫三只的家 — 文章详情页样式 v3 ========== */

:root {
    --bg: #faf8f5;
    --content-bg: #ffffff;
    --text: #3a3a3a;
    --text-light: #6a6a6a;
    --text-lighter: #9a8a7a;
    --accent: #c47a4a;
    --accent-hover: #a86a3a;
    --accent-light: rgba(196, 122, 74, 0.12);
    --border: #eee;
    --shadow: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.08);
    --radius: 12px;
}

/* ========== 文章布局 ========== */

.article-layout {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    justify-content: center;
    position: relative;
}

/* 主文章区 — 更宽 */
.article-main {
    flex: 1;
    min-width: 0;
}

/* 侧边栏 */
.article-sidebar {
    flex: 0 0 140px;
    position: sticky;
    top: 80px;
    align-self: flex-start;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    font-size: 0.82rem;
}

/* ========== 同系列文章（左侧） ========== */

.related-articles {
    margin-bottom: 25px;
    padding: 14px 16px;
    background: var(--content-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.related-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.related-articles ul {
    list-style: none;
    padding: 0;
}

.related-item {
    padding: 4px 6px;
    margin: 2px -6px;
    line-height: 1.5;
    border-radius: 6px;
    transition: background 0.15s;
}

.related-item:hover {
    background: var(--accent-light);
}

.related-item a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.8rem;
    display: block;
}

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

.related-item.current a {
    color: var(--accent);
    font-weight: 600;
}

.related-date {
    color: var(--text-lighter);
    font-size: 0.72rem;
    display: block;
    margin-top: 2px;
}

/* ========== 目录（右侧） ========== */

.toc-sidebar {
    position: relative;
}

.toc-inner {
    padding: 14px 16px;
    background: var(--content-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.toc-inner details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
    font-size: 0.82rem;
    user-select: none;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.toc-inner .toctitle {
    display: none;
}

.toc-inner ul {
    list-style: none;
    padding-left: 12px;
    margin: 0;
}

.toc-inner li {
    padding: 3px 6px;
    margin: 0 -6px;
    line-height: 1.5;
    border-radius: 6px;
    transition: background 0.15s;
}

.toc-inner li:hover {
    background: var(--accent-light);
}

.toc-inner a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.78rem;
    display: block;
}

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

/* ========== 文章详情卡片 ========== */

.article-detail {
    background: var(--content-bg);
    padding: 25px 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.article-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    line-height: 1.4;
}

.article-meta {
    color: var(--text-lighter);
    font-size: 0.85rem;
    margin-bottom: 15px;
}

.article-meta time {
    margin-right: 4px;
}

.reading-time {
    color: var(--text-lighter);
}

/* ========== 标签 ========== */

.tag {
    display: inline-block;
    background: #f5f0eb;
    color: var(--accent);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    text-decoration: none;
    margin-right: 5px;
    margin-bottom: 5px;
    transition: background 0.15s;
}

.tag:hover { background: #ede5dd; }

.article-tags { margin: 10px 0 20px; }

/* ========== 文章正文 ========== */

.article-body {
    margin-top: 25px;
    font-size: 1rem;
    line-height: 1.85;
    color: var(--text);
}

/* --- 标题样式 --- */

.article-body h1 {
    font-size: 1.35rem;
    margin: 28px 0 14px;
    font-weight: 700;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent);
    margin-left: calc(-1 * (25px));
    margin-right: calc(-1 * (25px));
    padding-left: 25px;
    padding-right: 25px;
}

.article-body h2 {
    font-size: 1.2rem;
    margin: 25px 0 12px;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.article-body h3 {
    font-size: 1.05rem;
    margin: 20px 0 10px;
    font-weight: 600;
}

.article-body h4 {
    font-size: 1rem;
    margin: 18px 0 8px;
    font-weight: 600;
}

.article-body p {
    margin-bottom: 16px;
}

.article-body a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s, background 0.15s;
    border-radius: 2px;
    padding: 0 1px;
}

.article-body a:hover {
    border-bottom-color: var(--accent);
    background: var(--accent-light);
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
    display: block;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.article-body img:hover {
    transform: scale(1.01);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.article-body blockquote {
    border-left: 3px solid var(--accent);
    padding: 8px 18px;
    margin: 18px 0;
    color: var(--text-light);
    background: linear-gradient(to right, #faf6f1, #fdfcfa);
    border-radius: 0 8px 8px 0;
    font-style: normal;
    position: relative;
}

.article-body blockquote::before {
    content: "\201C";
    position: absolute;
    top: -4px;
    left: 8px;
    font-size: 2.2rem;
    color: var(--accent);
    opacity: 0.25;
    line-height: 1;
    font-family: Georgia, serif;
}

.article-body ul, .article-body ol {
    margin: 14px 0 14px 24px;
}

.article-body li {
    margin-bottom: 6px;
}

.article-body code {
    background: #f5f0eb;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88em;
    font-family: "SFMono-Regular", "Consolas", "Liberation Mono", "Menlo", monospace;
    color: #c47a4a;
}

.article-body pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 16px 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 18px 0;
    font-size: 0.88rem;
    line-height: 1.6;
    border: 1px solid #3a3a3a;
}

.article-body pre code {
    background: none;
    color: inherit;
    padding: 0;
    border-radius: 0;
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 18px 0;
    font-size: 0.9rem;
    border-radius: 8px;
    overflow: hidden;
}

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

.article-body th {
    background: #faf6f1;
    font-weight: 600;
}

.article-body tbody tr:nth-child(even) {
    background: #fdfcfa;
}

.article-body tbody tr:hover {
    background: var(--accent-light);
}

.article-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 28px 0;
}

/* ========== 文章底部 ========== */

.article-footer {
    margin-top: 35px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.article-footer a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.9rem;
}

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

/* ========== 相册文章 ========== */

.article-body img.zoomed {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90vw;
    max-height: 90vh;
    z-index: 9999;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

/* ========== 响应式 ========== */

/* 中等屏幕：隐藏左右侧栏，文章占满 */
@media (max-width: 1000px) {
    .article-layout.has-sidebar {
        flex-direction: column;
        align-items: center;
    }
    .article-layout.has-sidebar .article-sidebar {
        display: none;
    }
    .article-layout.has-sidebar .article-main {
        max-width: 100%;
        flex: 1;
    }
}

@media (max-width: 600px) {
    .article-detail { padding: 22px 20px; }
    .article-title { font-size: 1.25rem; }
    .article-body { font-size: 0.95rem; }
    .article-body h1 {
        margin-left: calc(-1 * (20px));
        margin-right: calc(-1 * (20px));
        padding-left: 20px;
        padding-right: 20px;
    }
}

/* ========== 脚注/参考文献样式 ========== */
.article-body .footnote {
    margin-top: 40px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    font-size: 0.88rem;
    color: var(--text-light);
}

.article-body .footnote hr {
    display: none;
}

.article-body .footnote ol {
    margin: 0;
    padding-left: 20px;
}

.article-body .footnote li {
    margin-bottom: 8px;
    line-height: 1.7;
}

.article-body .footnote p {
    margin: 0;
}

.article-body .footnote-ref {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.75em;
    vertical-align: super;
    font-weight: 600;
}

.article-body .footnote-ref:hover {
    text-decoration: underline;
}

.article-body .footnote-backref {
    color: var(--accent);
    text-decoration: none;
    font-size: 1em;
    margin-left: 4px;
}


/* ========== 美化 — 引用块渐变边框 ========== */
/* 保留渐变边框效果 */
.article-body blockquote {
    border-image: linear-gradient(to bottom, var(--accent), #e8c4a0) 1;
}

/* ========== 美化 — 文章标题装饰线 ========== */
.article-title::after {
    content: "";
    display: block;
    width: 40px;
    height: 3px;
    background: linear-gradient(to right, var(--accent), #e8c4a0);
    border-radius: 2px;
    margin-top: 12px;
}
