/* Echo Theme - Typecho 1.2
   简洁优雅, 阅读优先
   =============================================== */

/* 变量 - 亮色 */
:root {
    --bg: #ffffff;
    --bg-soft: #fafafa;
    --bg-card: #ffffff;
    --bg-code: #f5f5f7;
    --bg-pre: #1e1e1e;
    --text: #1d1d1f;
    --text-soft: #6e6e73;
    --text-mute: #999;
    --border: #e5e5e7;
    --border-soft: #f0f0f2;
    --accent: #2563eb;
    --accent-soft: #dbeafe;
    --link: #2563eb;
    --link-hover: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #ea580c;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 4px 12px rgba(0,0,0,0.06);
    --radius: 8px;
    --radius-sm: 4px;
    --max-width: 1200px;
    --content-width: 760px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
    --header-h: 64px;
    --transition: 0.2s ease;
}

/* 变量 - 暗色 */
[data-theme="dark"], :root[data-theme="dark"] {
    --bg: #1a1a1c;
    --bg-soft: #232325;
    --bg-card: #232325;
    --bg-code: #2c2c2e;
    --bg-pre: #0d0d0e;
    --text: #e5e5e7;
    --text-soft: #a0a0a4;
    --text-mute: #6e6e73;
    --border: #38383a;
    --border-soft: #2c2c2e;
    --accent: #60a5fa;
    --accent-soft: #1e3a5f;
    --link: #60a5fa;
    --link-hover: #93c5fd;
    --shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* 自动跟随系统 */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #1a1a1c;
        --bg-soft: #232325;
        --bg-card: #232325;
        --bg-code: #2c2c2e;
        --bg-pre: #0d0d0e;
        --text: #e5e5e7;
        --text-soft: #a0a0a4;
        --text-mute: #6e6e73;
        --border: #38383a;
        --border-soft: #2c2c2e;
        --accent: #60a5fa;
        --accent-soft: #1e3a5f;
        --link: #60a5fa;
        --link-hover: #93c5fd;
        --shadow: 0 4px 12px rgba(0,0,0,0.3);
    }
}

/* 重置 */
*,*::before,*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    transition: background var(--transition), color var(--transition);
}
img { max-width: 100%; height: auto; }
a { color: var(--link); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--link-hover); }

/* 跳过链接(无障碍) */
.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--accent); color: #fff;
    padding: 8px 16px; z-index: 9999;
}
.skip-link:focus { left: 0; }

/* 布局 */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}
.site-main { padding: 32px 0 64px; min-height: calc(100vh - var(--header-h) - 200px); }
.site-main .container { display: grid; grid-template-columns: 1fr 280px; gap: 40px; align-items: start; }
.content-area { min-width: 0; }
.content-full { grid-column: 1 / -1; max-width: var(--content-width); margin: 0 auto; }
.sidebar { position: sticky; top: calc(var(--header-h) + 20px); }

/* 头部 */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border-soft);
    height: var(--header-h);
}
.site-header .container { display: flex; align-items: center; gap: 24px; height: 100%; }
.site-brand { display: flex; align-items: baseline; gap: 10px; color: var(--text); font-weight: 600; }
.site-brand:hover { color: var(--accent); }
.site-logo { height: 28px; width: auto; }
.site-title { font-size: 18px; }
.site-subtitle { font-size: 12px; color: var(--text-mute); font-weight: normal; }
.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a {
    color: var(--text-soft);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all var(--transition);
}
.site-nav a:hover { color: var(--text); background: var(--bg-soft); }
.site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.site-nav .nav-admin { opacity: 0.5; font-size: 12px; }
.site-tools { display: flex; gap: 8px; }
.theme-toggle {
    background: transparent; border: 1px solid var(--border);
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    color: var(--text-soft); cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
}
.theme-toggle:hover { color: var(--text); border-color: var(--text-soft); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

/* 文章列表 */
.section-title { font-size: 14px; font-weight: 500; color: var(--text-soft); margin: 0 0 16px; }
.sticky-badge { background: #dc2626; color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 700; box-shadow: 0 1px 2px rgba(220,38,38,0.3); letter-spacing: 0.5px; }
.sticky-list { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px dashed var(--border); }
.post-item { padding: 24px 0; border-bottom: 1px solid var(--border-soft); }
.post-item:last-child { border-bottom: none; }
.post-title { font-size: 22px; margin: 0 0 8px; font-weight: 600; line-height: 1.4; }
.post-title a { color: var(--text); }
.post-title a:hover { color: var(--accent); }
.post-meta { font-size: 13px; color: var(--text-mute); margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.post-meta a { color: var(--text-soft); }
.post-meta .dot { color: var(--text-mute); margin: 0 4px; }
.post-meta .post-author a:hover { color: var(--accent); }
.post-excerpt { color: var(--text-soft); font-size: 15px; line-height: 1.75; margin: 12px 0 16px; }
.post-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.read-more { font-size: 14px; color: var(--accent); font-weight: 500; }
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    display: inline-block; font-size: 12px;
    padding: 2px 8px; background: var(--bg-soft);
    border: 1px solid var(--border); border-radius: 3px;
    color: var(--text-soft); transition: all var(--transition);
}
.tag:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* 文章详情 */
.post-article { background: var(--bg-card); }
.post-header { padding-bottom: 16px; border-bottom: 1px solid var(--border-soft); margin-bottom: 24px; }
.post-article .post-title { font-size: 28px; line-height: 1.35; }
.post-stats { display: inline-flex; gap: 10px; }
.post-content { font-size: 16px; line-height: 1.85; color: var(--text); }
.post-content p { margin: 1em 0; }
.post-content h1, .post-content h2, .post-content h3, .post-content h4 { font-weight: 600; margin: 1.6em 0 0.6em; line-height: 1.35; }
.post-content h2 { font-size: 22px; padding-bottom: 8px; border-bottom: 1px solid var(--border-soft); }
.post-content h3 { font-size: 18px; }
.post-content blockquote {
    margin: 1.2em 0; padding: 12px 18px;
    border-left: 3px solid var(--accent);
    background: var(--bg-soft); color: var(--text-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.post-content ul, .post-content ol { padding-left: 1.5em; margin: 1em 0; }
.post-content li { margin: 0.3em 0; }
.post-content img { display: block; margin: 1.2em auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.post-content table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.post-content th, .post-content td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.post-content th { background: var(--bg-soft); }

/* 代码高亮 */
.code-block-wrapper {
    position: relative;
    margin: 1.2em 0;
}
.code-block-wrapper:hover .code-copy-btn { opacity: 1; }
.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity .2s, background .2s;
    font-family: var(--font-sans);
    z-index: 2;
    line-height: 1.4;
}
.code-copy-btn:hover { background: rgba(37,99,235,0.85); border-color: transparent; }
.code-copy-btn.copied { background: #16a34a; border-color: transparent; opacity: 1; }
.post-content pre {
    background: var(--bg-pre);
    color: #d4d4d4;
    padding: 16px 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    position: relative;
}
.post-content pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.post-content :not(pre) > code {
    background: var(--bg-code);
    color: #c7254e;
    padding: 2px 6px; border-radius: 3px;
    font-family: var(--font-mono); font-size: 0.9em;
}
[data-theme="dark"] .post-content :not(pre) > code { color: #f0a8b8; }

/* 高亮配色 (内置浅色/深色自适应) */
.hl-keyword { color: #c586c0; }
.hl-string { color: #ce9178; }
.hl-number { color: #b5cea8; }
.hl-comment { color: #6a9955; font-style: italic; }
.hl-function { color: #dcdcaa; }
.hl-tag { color: #569cd6; }
.hl-attr { color: #9cdcfe; }
.hl-built_in { color: #4ec9b0; }
.hl-operator { color: #d4d4d4; }
.hl-punctuation { color: #d4d4d4; }
.hl-regexp { color: #d16969; }
.hl-meta { color: #808080; }
.hl-light .hl-keyword { color: #0000ff; }
.hl-light .hl-string { color: #a31515; }
.hl-light .hl-number { color: #098658; }
.hl-light .hl-comment { color: #008000; }
.hl-light .hl-function { color: #795e26; }
.hl-light .hl-tag { color: #800000; }
.hl-light .hl-attr { color: #ff0000; }
.hl-light .hl-built_in { color: #267f99; }

/* 上下页 */
.post-nav-links { display: flex; justify-content: space-between; gap: 16px; margin: 32px 0; padding: 16px 0; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }
.post-nav-links a, .post-nav-links span { flex: 1; font-size: 14px; color: var(--text-soft); }
.post-nav-links .nav-next { text-align: right; }
.post-nav-links .nav-disabled { color: var(--text-mute); opacity: 0.5; }
.post-nav-links a:hover { color: var(--accent); }

/* 评论区 */
.comments-section { margin-top: 40px; padding-top: 24px; border-top: 2px solid var(--border); }
.comments-title { font-size: 18px; margin: 0 0 24px; }
.comment-list { list-style: none; padding: 0; margin: 0; }
.comment-item { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border-soft); }
.comment-avatar { flex-shrink: 0; }
.comment-avatar img { width: 40px; height: 40px; border-radius: 50%; }
.comment-body { flex: 1; min-width: 0; }
.comment-meta { font-size: 13px; color: var(--text-mute); margin-bottom: 4px; }
.comment-author { font-weight: 500; color: var(--text); font-style: normal; margin-right: 12px; }
.comment-time { margin-right: 12px; }
.comment-reply { color: var(--accent); font-size: 12px; }
.comment-content { font-size: 14px; line-height: 1.7; word-wrap: break-word; }
.comment-content p { margin: 0.3em 0; }
.comment-list .comment-list { margin-top: 8px; padding-left: 24px; border-left: 2px solid var(--border-soft); }
.no-comments { color: var(--text-mute); text-align: center; padding: 32px 0; }
.comments-closed { color: var(--text-mute); text-align: center; padding: 16px; background: var(--bg-soft); border-radius: var(--radius); }

/* 评论表单 */
.comment-form-wrap { margin-top: 32px; padding: 20px; background: var(--bg-soft); border-radius: var(--radius); }
.form-title { font-size: 16px; margin: 0 0 16px; }
.logged-in { font-size: 14px; color: var(--text-soft); }
.logged-in .logout { margin-left: 8px; font-size: 12px; color: var(--text-mute); }
.form-row { margin-bottom: 12px; }
.form-row-meta { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.form-input, .form-textarea {
    width: 100%; padding: 10px 12px; font-size: 14px;
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-family: inherit; transition: border-color var(--transition);
}
.form-input:focus, .form-textarea:focus { outline: none; border-color: var(--accent); }
.form-textarea { resize: vertical; line-height: 1.6; }
.form-actions { display: flex; align-items: center; gap: 12px; }
.btn-submit {
    background: var(--accent); color: #fff;
    border: none; padding: 8px 20px; border-radius: var(--radius-sm);
    font-size: 14px; cursor: pointer; transition: background var(--transition);
}
.btn-submit:hover { background: var(--link-hover); }
.form-tip { font-size: 12px; color: var(--text-mute); }

/* 侧边栏 */
.widget { margin-bottom: 24px; padding: 16px; background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius); }
.widget-title { font-size: 14px; font-weight: 600; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-soft); color: var(--text); }
.widget-list { list-style: none; padding: 0; margin: 0; }
.widget-list li { padding: 6px 0; font-size: 14px; color: var(--text-soft); border-bottom: 1px dashed var(--border-soft); }
.widget-list li:last-child { border-bottom: none; }
.widget-list a { color: var(--text-soft); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget-list a:hover { color: var(--accent); }
.widget-list .count { color: var(--text-mute); font-size: 12px; margin-left: 4px; }
.widget-comments .rc-author { display: block; color: var(--text); font-size: 13px; }
.widget-comments .rc-text { font-size: 12px; color: var(--text-mute); }
.search-form { display: flex; gap: 4px; }
.search-input { flex: 1; padding: 8px 10px; font-size: 13px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); }
.search-input:focus { outline: none; border-color: var(--accent); }
.search-btn { padding: 8px 10px; background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); cursor: pointer; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-cloud .tag { font-size: 12px; }

/* 分页 */
.pagination { margin: 32px 0 0; text-align: center; }
.page-nav { list-style: none; padding: 0; display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.page-nav li a, .page-nav li span {
    display: inline-block; padding: 6px 12px;
    background: var(--bg-soft); border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 14px; color: var(--text-soft);
}
.page-nav li a:hover { color: var(--accent); border-color: var(--accent); }
.page-nav li.current span { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 归档 */
.archive-section .page-title { font-size: 24px; margin: 0 0 24px; padding-bottom: 12px; border-bottom: 2px solid var(--border); }
.archive-year { font-size: 20px; margin: 24px 0 8px; color: var(--accent); }
.archive-month { margin: 16px 0 24px; }
.archive-month-title { font-size: 15px; margin: 0 0 8px; color: var(--text-soft); }
.archive-count { color: var(--text-mute); font-size: 13px; }
.archive-list { list-style: none; padding: 0; }
.archive-list li { padding: 4px 0; font-size: 14px; display: flex; gap: 12px; }
.archive-date { color: var(--text-mute); font-family: var(--font-mono); font-size: 13px; min-width: 40px; }
.archive-title-link { color: var(--text-soft); flex: 1; }
.archive-title-link:hover { color: var(--accent); }

/* 友链独立页 */
.friend-links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 16px 0 24px; }
.friend-card { display: flex; gap: 12px; padding: 12px; background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: var(--radius); transition: all var(--transition); }
.friend-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.friend-avatar { flex-shrink: 0; width: 48px; height: 48px; background: var(--accent-soft); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.friend-avatar img { width: 100%; height: 100%; object-fit: cover; }
.friend-initial { font-size: 18px; font-weight: 600; color: var(--accent); }
.friend-info { flex: 1; min-width: 0; }
.friend-name { font-size: 14px; margin: 0 0 2px; color: var(--text); }
.friend-desc { font-size: 12px; color: var(--text-mute); margin: 0; line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.friend-apply { margin-top: 24px; padding: 16px; background: var(--bg-soft); border-left: 3px solid var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.friend-apply h3 { margin: 0 0 8px; font-size: 15px; }
.friend-apply p { margin: 0; font-size: 13px; color: var(--text-soft); }

/* 页脚友链条 */
.friend-links-strip { padding: 16px 0; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.strip-label { font-size: 12px; color: var(--text-mute); flex-shrink: 0; }
.friend-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.friend-list a { font-size: 13px; color: var(--text-soft); }
.friend-list a:hover { color: var(--accent); }

/* 页脚 */
.site-footer { background: var(--bg-soft); border-top: 1px solid var(--border-soft); padding: 24px 0 16px; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding-top: 16px; font-size: 13px; color: var(--text-mute); }
.footer-copyright a { color: var(--text-soft); }
.footer-copyright a:hover { color: var(--accent); }
.footer-actions { display: flex; gap: 12px; align-items: center; }
.footer-rss { display: inline-flex; align-items: center; gap: 4px; color: var(--text-soft); }
.footer-rss:hover { color: var(--accent); }
.back-to-top { display: none; background: var(--bg); color: var(--text-soft); border: 1px solid var(--border); width: 32px; height: 32px; border-radius: var(--radius-sm); cursor: pointer; font-size: 16px; }
.back-to-top.visible { display: inline-flex; align-items: center; justify-content: center; }

/* 404 */
.error-404 { text-align: center; padding: 80px 20px; }
.error-code { font-size: 96px; margin: 0; color: var(--accent); font-weight: 700; line-height: 1; }
.error-msg { font-size: 20px; color: var(--text); margin: 16px 0 8px; }
.error-suggestion { color: var(--text-mute); margin: 0 0 24px; }
.error-actions { display: flex; gap: 12px; justify-content: center; }
.btn-primary, .btn-secondary { padding: 8px 20px; border-radius: var(--radius-sm); font-size: 14px; cursor: pointer; border: 1px solid var(--accent); transition: all var(--transition); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--link-hover); color: #fff; }
.btn-secondary { background: transparent; color: var(--text-soft); border-color: var(--border); }
.btn-secondary:hover { color: var(--text); border-color: var(--text-soft); }

/* 空状态 */
.empty-state { padding: 60px 20px; text-align: center; color: var(--text-mute); }

/* 移动端 */
@media (max-width: 768px) {
    .site-main { padding: 16px 0 40px; }
    .site-main .container { grid-template-columns: 1fr; gap: 24px; }
    .sidebar { position: static; }
    .site-header .container { gap: 12px; }
    .site-nav { gap: 0; }
    .site-nav a { padding: 6px 8px; font-size: 13px; }
    .site-subtitle { display: none; }
    .post-article .post-title { font-size: 22px; }
    .post-content { font-size: 15px; }
    .form-row-meta { grid-template-columns: 1fr; }
    .post-nav-links { flex-direction: column; }
    .post-nav-links .nav-next { text-align: left; }
    .friend-links-grid { grid-template-columns: 1fr; }
    .error-code { font-size: 72px; }
}

/* 打印 */
@media print {
    .site-header, .site-footer, .sidebar, .comments-section, .pagination { display: none; }
    .post-content { font-size: 12pt; line-height: 1.6; }
    body { background: #fff; color: #000; }
}
