/*
Theme Name: ClassicBlog-latest
Theme URI: https://example.com/clearblog
Author: Your Name
Author URI: https://example.com
Description: 一个简洁、现代的WordPress博客主题。支持响应式布局、自定义菜单、小工具和全宽页面模板。
Version: 1.0.0
License: GPL v2 or later
Text Domain: clearblog
*/

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-bg: #f5f6fa;
    --color-text: #1a1a2e;
    --color-text-muted: #6b7280;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-border: #e2e4ea;
    --color-code-bg: #eef0f5;
    --color-card-bg: #ffffff;
    --color-footer-bg: #1a1a2e;
    --color-footer-text: #e5e7eb;
    --color-header-bg: rgba(245,246,250,0.95);
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Consolas', monospace;
    --max-width: 720px;
    --max-width-wide: 1200px;
    --gap: 24px;
    --radius: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --color-input-bg: #ffffff;
}

/* ===== 暗色模式 ===== */
html.dark-mode {
    --color-bg: #18181b;
    --color-text: #e4e4e7;
    --color-text-muted: #a1a1aa;
    --color-primary: #10b981;
    --color-primary-hover: #34d399;
    --color-border: #3f3f46;
    --color-code-bg: #27272a;
    --color-card-bg: #27272a;
    --color-footer-bg: #09090b;
    --color-footer-text: #a1a1aa;
    --color-header-bg: rgba(24,24,27,0.95);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
    --color-input-bg: #27272a;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

.site-content {
    flex: 1;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.5em;
    color: var(--color-text);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }

p { margin-bottom: 1.25em; }

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

code, pre {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

code {
    background: var(--color-code-bg);
    padding: 2px 6px;
    border-radius: 4px;
}

pre {
    background: var(--color-code-bg);
    padding: 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 1.5em;
    line-height: 1.5;
}

/* Prism 代码块 — 完全自主样式，不依赖 prism.min.css */
pre[class*="language-"],
pre.wp-block-code {
    position: relative;
    margin: 1em 0 1.5em;
    padding: 1em;
    padding-top: 3em !important;
    padding-bottom: 1.6em !important;
    background: var(--color-code-bg);
    overflow-x: auto;
    line-height: 1.5;
    tab-size: 4;
    hyphens: none;
    border-radius: 8px !important;
}

pre[class*="language-"] code,
pre.wp-block-code code {
    background: none;
    padding: 0;
    color: inherit;
    text-shadow: none;
}

/* Prism 工具栏容器 */
.code-toolbar {
    position: relative;
}

.code-toolbar > .toolbar {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    opacity: 1;
}

/* 工具栏中的每一项 */
.code-toolbar > .toolbar > .toolbar-item {
    display: inline-flex;
}

/* 语言标签（span.toolbar-item.language-label — 直接是 toolbar-item 自身）*/
.code-toolbar > .toolbar > .toolbar-item.language-label {
    font-size: 0.7rem;
    padding: 2px 8px;
    background: var(--color-border);
    color: var(--color-text-muted);
    border-radius: 4px;
    font-family: var(--font-sans);
    letter-spacing: 0.03em;
    line-height: normal;
}

/* 语言标签内嵌 span（兼容 Prism 的 registerButton 方式）*/
.code-toolbar > .toolbar > .toolbar-item > span {
    font-size: 0.7rem;
    padding: 2px 8px;
    background: var(--color-border);
    color: var(--color-text-muted);
    border-radius: 4px;
    box-shadow: none;
    font-family: var(--font-sans);
    letter-spacing: 0.03em;
}

/* 复制按钮 */
.code-toolbar > .toolbar > .toolbar-item > button {
    font-size: 0.7rem;
    padding: 2px 8px;
    background: var(--color-border);
    color: var(--color-text-muted);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: none;
    font-family: var(--font-sans);
    line-height: normal;
    border: none;
    overflow: visible;
}

.code-toolbar > .toolbar > .toolbar-item > button:hover {
    background: var(--color-primary);
    color: #fff;
}

/* Prism token 颜色 —— 亮色模式 */
.token.cdata,
.token.comment,
.token.doctype,
.token.prolog,
.token.punctuation {
    color: #708090;
    border-bottom: none;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
    color: #905;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
    color: #690;
}

.token.atrule,
.token.attr-value,
.token.keyword {
    color: #07a;
}

.token.class-name,
.token.function {
    color: #dd4a68;
}

.token.regex,
.token.important,
.token.variable {
    color: #e90;
}

.token.entity,
.token.operator,
.token.url {
    color: #9a6e3a;
}

.token.bold,
.token.important {
    font-weight: 700;
}

.token.italic {
    font-style: italic;
}

.token.entity {
    cursor: help;
}

.token.namespace {
    opacity: 0.7;
}

pre.code-expanded {
    max-height: none;
    overflow: auto;
}


blockquote {
    border-left: 4px solid var(--color-primary);
    margin: 1.5em 0;
    padding: 0.75em 1.25em;
    background: var(--color-code-bg);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--color-text-muted);
    font-style: italic;
}

img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

ul, ol {
    margin-bottom: 1.25em;
    padding-left: 1.5em;
}

li { margin-bottom: 0.25em; }

/* ===== Layout ===== */
.site-header {
    border-bottom: 1px solid var(--color-border);
    padding: 0 var(--gap);
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
    background: var(--color-header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* #page 不再包裹 header，所以 min-height 需要扣除 header 高度 */
#page {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 80px);
    overflow: visible;
}

.header-inner {
    max-width: var(--max-width-wide);
    margin: 0 auto;
    display: flex;
    align-items: center;
    min-height: 64px;
    gap: 12px;
}

.main-nav {
    margin-left: auto;
}

.site-title {
    font-size: 1.375rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.site-title a {
    color: var(--color-text);
    text-decoration: none;
}

.site-title a:hover { color: var(--color-primary); }

.site-description {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-left: 8px;
}

/* Navigation */
.main-nav ul {
    list-style: none;
    display: flex;
    gap: 28px;
    padding: 0;
    margin: 0;
}

.main-nav a {
    color: var(--color-text-muted);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: color 0.2s;
    text-decoration: none;
    position: relative;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-primary);
    transition: width 0.2s;
}

.main-nav a:hover {
    color: var(--color-text);
    text-decoration: none;
}

.main-nav a:hover::after { width: 100%; }

/* 管理栏偏移 */
.admin-bar .site-header {
    top: 32px;
}
@media (max-width: 782px) {
    .admin-bar .site-header {
        top: 46px;
    }
}

/* ===== 顶部搜索栏 ===== */
.header-search {
    flex-shrink: 1;
    min-width: 0;
    max-width: 200px;
    margin-left: auto;
}

.header-search-form {
    display: flex;
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
    background: var(--color-code-bg);
}

.header-search-form:focus-within {
    border-color: var(--color-primary);
}

.header-search-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    padding: 6px 10px;
    color: var(--color-text);
}

.header-search-input::placeholder {
    color: var(--color-text-muted);
}

.header-search-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    transition: color 0.2s;
}

.header-search-btn:hover {
    color: var(--color-primary);
}

.header-search-btn svg {
    display: block;
}

.main-nav .current-menu-item a,
.main-nav .current_page_item a {
    color: var(--color-text);
}

.main-nav .current-menu-item a::after,
.main-nav .current_page_item a::after {
    width: 100%;
}

/* Menu Toggle (Mobile) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    color: var(--color-text);
}

/* ===== 亮色/暗色切换按钮 ===== */
.theme-toggle {
    position: absolute;
    top: 8px;
    right: 12px;
    z-index: 101;
    flex-shrink: 0;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    transition: all 0.2s;
    line-height: 1;
}

.theme-toggle:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.theme-toggle svg {
    display: block;
}

/* 亮色模式显示太阳，暗色模式显示月亮 */
html:not(.dark-mode) .theme-toggle .moon-icon,
html.dark-mode .theme-toggle .sun-icon {
    display: none;
}

/* ===== Main Content Area ===== */
.site-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 48px var(--gap) 64px;
}

.site-content.wide {
    max-width: var(--max-width-wide);
}

/* ===== Posts (Home/Archive) ===== */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.post-card {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0;
    transition: box-shadow 0.25s, transform 0.2s;
}

.post-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.post-card-inner {
    display: flex;
    gap: 20px;
    padding: 20px 24px;
}

/* 缩略图 */
.post-card-thumb {
    flex-shrink: 0;
    width: 140px;
    height: 140px;
    border-radius: 8px;
    overflow: hidden;
}

.post-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 8px;
}

/* 卡片正文区域 */
.post-card-body {
    flex: 1;
    min-width: 0;
}

.post-card .entry-title {
    font-size: 1.25rem;
    margin-bottom: 4px;
}

.post-card .entry-title a {
    color: var(--color-text);
    text-decoration: none;
}

.post-card .entry-title a:hover { color: var(--color-primary); }

.post-meta {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-bottom: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.post-meta span::after { content: '·'; margin-left: 8px; color: var(--color-border); }
.post-meta span:last-child::after { content: none; }

.post-thumbnail {
    margin-bottom: 16px;
}

.post-thumbnail img {
    width: 100%;
    border-radius: 8px;
}

.entry-summary {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    line-height: 1.6;
}

.entry-summary p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.post-list {
    gap: 20px;
}

/* ===== Single Post / Page ===== */
.entry-header {
    margin-bottom: 32px;
}

.entry-header .entry-title {
    font-size: 2.25rem;
    margin-bottom: 12px;
}

.entry-header .post-meta {
    font-size: 0.875rem;
}

/* ===== 文章内容 + 目录侧栏（双栏布局） ===== */
.post-content-wrap {
    display: block;
    max-width: var(--max-width-wide);
    margin-left: calc(-1 * (var(--max-width-wide) - var(--max-width)) / 2);
    margin-right: calc(-1 * (var(--max-width-wide) - var(--max-width)) / 2);
}
.post-content-wrap .entry-content {
    margin: 0 auto;
    max-width: calc(var(--max-width-wide) - var(--toc-width, 220px) - 8px);
}

.post-content-wrap.with-toc {
    display: grid;
    grid-template-columns: var(--toc-width, 220px) 8px 1fr;
    max-width: var(--max-width-wide);
    margin-left: calc(-1 * (var(--max-width-wide) - var(--max-width)) / 2);
    margin-right: calc(-1 * (var(--max-width-wide) - var(--max-width)) / 2);
}

/* 拖拽手柄 */
.toc-resize-handle {
    cursor: col-resize;
    position: relative;
    background: transparent;
    transition: background 0.15s;
    user-select: none;
    -webkit-user-select: none;
}

.toc-resize-handle::after {
    content: '';
    position: absolute;
    top: 16px;
    bottom: 16px;
    left: 50%;
    width: 2px;
    background: var(--color-border);
    border-radius: 2px;
    transform: translateX(-50%);
    transition: background 0.2s, opacity 0.2s;
}

.toc-resize-handle:hover::after,
.toc-resize-handle.dragging::after {
    background: var(--color-primary);
    opacity: 0.6;
}

.toc-resize-handle.dragging {
    background: rgba(37, 99, 235, 0.08);
}

/* 拖拽时禁止选中文字 */
.toc-resizing {
    user-select: none !important;
    -webkit-user-select: none !important;
}

/* 目录侧栏 */
.toc-sidebar {
    position: relative;
}

.post-toc {
    position: sticky;
    top: 112px;
    max-height: calc(100vh - 144px);
    overflow-y: auto;
    font-size: 0.875rem;
    padding-right: 8px;
}

.post-toc::-webkit-scrollbar {
    width: 4px;
}

.post-toc::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.toc-header {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-primary);
}

.toc-title {
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 8px 0;
    color: var(--color-text);
}

/* 深度筛选按钮组 */
.toc-depths {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.toc-depth-btn {
    font-family: inherit;
    font-size: 0.6875rem;
    padding: 2px 8px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.6;
}

.toc-depth-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.toc-depth-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

/* 折叠动画 */
.toc-list > li {
    transition: opacity 0.2s ease;
}

.toc-list > li.toc-hidden {
    display: none;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* 嵌套子列表缩进 */
.toc-list .toc-list {
    padding-left: 16px;
    margin: 4px 0 2px 0;
}

.toc-list li {
    margin: 0;
    padding: 0;
    border: none;
}

/* 每项容器：toggle + 链接 同行 */
.toc-item-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 4px;
}

/* 展开/折叠按钮 */
.toc-toggle {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 5px;
    padding: 0;
    border: none;
    background: none;
    color: var(--color-text-muted);
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}

.toc-toggle:hover {
    color: var(--color-primary);
}

/* 无子节点的占位空白，保持对齐 */
.toc-toggle-spacer {
    flex-shrink: 0;
    width: 12px;
    height: 16px;
    margin-top: 5px;
    display: inline-block;
}

.toc-list a {
    display: block;
    padding: 5px 0;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.8125rem;
    line-height: 1.5;
    transition: color 0.2s;
}

.toc-list a:hover {
    color: var(--color-primary);
    text-decoration: none;
}

/* 当前活跃标题高亮 */
.toc-list a.active {
    color: var(--color-primary);
    font-weight: 600;
}

/* 各层级字号递减 */
.toc-h2 a { font-size: 0.8125rem; }
.toc-h3 a { font-size: 0.78125rem; }
.toc-h4 a { font-size: 0.75rem; }
.toc-h5 a { font-size: 0.71875rem; }
.toc-h6 a { font-size: 0.6875rem; }

/* 带目录时内容区与手柄保持距离 */
.with-toc .entry-content {
    min-width: 0;
    padding-left: 16px;
    max-width: none;
    margin: 0;
}

.entry-content {
    font-size: 1.0625rem;
    line-height: 1.8;
}

.entry-content p {
    margin-bottom: 1.5em;
}

.entry-content h2 { margin-top: 2em; }
.entry-content h3 { margin-top: 1.5em; }

/* 标题锚点悬停指示 */
.entry-content h2[id]::before,
.entry-content h3[id]::before {
    content: '#';
    margin-right: 6px;
    color: var(--color-border);
    font-weight: 400;
    transition: color 0.2s;
}

.entry-content h2[id]:hover::before,
.entry-content h3[id]:hover::before {
    color: var(--color-primary);
}

.entry-content img {
    margin: 1.5em 0;
    border-radius: var(--radius);
}

.entry-content .wp-block-image {
    margin: 1.5em 0;
}

.entry-content .wp-block-image figcaption {
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 8px;
}

/* Tags */
.tags {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    display: inline-block;
    background: var(--color-code-bg);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    transition: background 0.2s;
    text-decoration: none;
}

.tag:hover {
    background: var(--color-primary);
    color: #fff;
    text-decoration: none;
}

/* Post Navigation */
.post-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
    gap: var(--gap);
}

.post-navigation a {
    flex: 1;
    padding: 16px 20px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.post-navigation a:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.nav-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.nav-title {
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.9375rem;
}

/* ===== Comments ===== */
.comments-area-wrapper {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
}

/* 评论折叠按钮 */
.comments-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: var(--color-code-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--color-text);
    transition: all 0.2s;
}

.comments-toggle:hover {
    border-color: var(--color-primary);
    background: #e8f0fe;
}

.comments-toggle-icon {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    transition: transform 0.2s;
}

.comments-toggle-text {
    font-weight: 600;
}

.comments-toggle-count {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-left: auto;
}

/* 合并评论区原有样式，但压缩间距 */
.comments-area-collapsible {
    padding-top: 20px;
}

.comments-area {
    font-size: 0.875rem;
}

.comments-title {
    font-size: 1.0625rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.comment-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.comment {
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

.comment:last-child { border-bottom: none; }

.comment-body {
    font-size: 0.875rem;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.comment-author .avatar {
    border-radius: 50%;
    width: 32px;
    height: 32px;
}

.comment-author .fn {
    font-weight: 600;
    font-style: normal;
    font-size: 0.875rem;
}

.comment-author .says {
    display: none;
}

.comment-metadata {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.comment-content {
    margin-top: 6px;
    line-height: 1.6;
}

.comment-content p {
    margin-bottom: 0.75em;
}

.reply {
    margin-top: 6px;
}

.reply a {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

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

/* 嵌套评论缩进 */
.children {
    list-style: none;
    padding-left: 24px;
    margin: 0;
}

.comment-respond {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.comment-reply-title {
    font-size: 0.9375rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.comment-form label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    transition: border-color 0.2s, background 0.2s;
    background: var(--color-input-bg);
    color: var(--color-text);
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 15%, transparent);
}

.comment-form textarea {
    min-height: 100px;
    resize: vertical;
}

.comment-form .submit {
    background: var(--color-primary);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.comment-form .submit:hover {
    background: var(--color-primary-hover);
}

/* 评论表单的字段间距压缩 */
.comment-form .comment-form-comment,
.comment-form .comment-form-author,
.comment-form .comment-form-email,
.comment-form .comment-form-url {
    margin-bottom: 12px;
}

.comment-form .form-submit {
    margin-top: 4px;
}

.logged-in-as {
    font-size: 0.8125rem;
    margin-bottom: 12px;
}

/* ===== Sidebar / Widgets ===== */
.with-sidebar {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 48px;
    max-width: var(--max-width-wide);
    margin: 0 auto;
    padding: 48px var(--gap) 64px;
}

.site-main { min-width: 0; }

.sidebar {
    font-size: 0.875rem;
}

.sidebar .widget {
    margin-bottom: 32px;
    padding: 20px 24px 4px;
    background: var(--color-code-bg);
    border-radius: var(--radius);
}

.sidebar .widget-title {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--color-border);
}

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

.sidebar li {
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border);
}

.sidebar li:last-child { border-bottom: none; }

.sidebar a {
    color: var(--color-text);
}

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

/* ===== 代码折叠：渐变融合按钮 ===== */
pre.code-collapsed {
    max-height: calc(12 * 1.5em + 1em) !important;
    overflow: hidden !important;
    margin-bottom: 0 !important;
    transition: max-height 0.35s ease !important;
}

/* 按钮以负 margin-top 向上重叠 pre 底部，形成渐变过渡 */
.code-expand-btn {
    position: relative !important;
    z-index: 3 !important;
    display: block !important;
    width: 100% !important;
    margin-top: -1.6em !important;
    padding: 1.6em 0.8em 0.4em 0.8em !important;
    text-align: center !important;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        var(--color-code-bg) 45%,
        var(--color-code-bg) 100%
    ) !important;
    border: none !important;
    border-radius: 0 0 8px 8px !important;
    cursor: pointer !important;
    color: var(--color-primary) !important;
    font-family: var(--font-sans) !important;
    font-size: 0.8125rem !important;
    line-height: 1.2 !important;
    transition: color 0.2s !important;
    pointer-events: auto !important;
}

.code-expand-btn:hover {
    color: var(--color-primary-hover) !important;
}

pre.code-expanded {
    max-height: none !important;
    overflow: auto !important;
    margin-bottom: 1.5em !important;
    padding-bottom: 2.5em !important;
}

/* === Prism 行号 === */
pre[class*="language-"].line-numbers,
pre.wp-block-code.line-numbers {
    padding-left: 3.5em !important;
    padding-bottom: 1.6em;
    position: relative;
}

pre.line-numbers .line-numbers-rows {
    position: absolute;
    pointer-events: none;
    top: 1.6em;
    left: 0.5em;
    width: 2.7em;
    text-align: right;
    padding-right: 0.4em;
    border-right: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: inherit;
    line-height: inherit;
    user-select: none;
    -webkit-user-select: none;
    overflow: visible;
}

.line-numbers-rows > span {
    display: block;
    counter-increment: linenumber;
    font-size: 0.9em;
    line-height: 1.5;
}

.line-numbers-rows > span::before {
    content: counter(linenumber);
    display: block;
    padding-right: 0.5em;
}
/* ===== 分页栏 ===== */
.clearblog-pagination-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 40px;
    padding: 16px 0;
    border-top: 1px solid var(--color-border);
}
.clearblog-pagination-bar .pagination-info {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    flex: 1;
    min-width: 140px;
}
.clearblog-pagination-bar .pagination-links {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}
.clearblog-pagination-bar .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    font-size: 0.875rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}
.clearblog-pagination-bar .page-numbers:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.clearblog-pagination-bar .page-numbers.current {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    pointer-events: none;
}
.clearblog-pagination-bar .page-numbers.dots {
    border: none;
    min-width: auto;
    pointer-events: none;
    color: var(--color-text-muted);
}
.clearblog-pagination-bar .pagination-per-page select {
    font-family: inherit;
    font-size: 0.8125rem;
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-card-bg);
    color: var(--color-text);
    cursor: pointer;
}
.clearblog-pagination-bar .pagination-per-page select:hover {
    border-color: var(--color-primary);
}

/* ===== Footer


pre[class*="language-"], pre.wp-block-code {
    padding-top: 1.6em !important;
    padding-bottom: 0.8em !important;
    white-space: pre !important;
    overflow-x: auto !important;
}
pre[class*="language-"] code, pre.wp-block-code code {
    white-space: pre !important;
}
pre.code-expanded + .code-expand-btn,
.code-toolbar:has(pre.code-expanded) + .code-expand-btn {
    margin-top: 0 !important;
    padding-top: 0.8em !important;
    background: var(--color-code-bg) !important;
    border-radius: 0 0 8px 8px !important;
    z-index: auto !important;
}

/* ===== ��ҳ/�鵵�����沼�� + ����� ===== */
body.archive {
    display: block !important;
    width: 100% !important;
    padding: 0px !important;
    background: var(--color-bg) !important;
}
/* ��ҳ�������� position: fixed */
body.home .site-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 100 !important;
    width: 100% !important;
}
/* 登录时首页标题栏避开 WordPress 工具条 */
body.home.admin-bar .site-header {
    top: 32px !important;
}
@media (max-width: 782px) {
    body.home.admin-bar .site-header {
        top: 46px !important;
    }
}
body.home #page {
    padding-top: 80px !important;
}
body.home.admin-bar #page {
    padding-top: 112px !important;
}
@media (max-width: 782px) {
    body.home.admin-bar #page {
        padding-top: 126px !important;
    }
}
body.home .site-content {
    max-width: var(--max-width-wide) !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 40px !important;
    align-items: flex-start !important;
}
body.archive .site-content {
    max-width: var(--max-width-wide) !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 40px !important;
}
body.home .site-content {
    flex-direction: row !important;
}
body.home .content-area {
    flex: 1 !important;
    min-width: 0 !important;
}
body.home .post-list {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 24px !important;
}
body.archive .post-list {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 24px !important;
    width: 100% !important;
}
body.archive .page-header {
    width: 100% !important;
}
body.archive .page-title {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    margin-bottom: 8px !important;
}
body.archive .archive-description {
    color: var(--color-text-muted) !important;
    font-size: 0.9375rem !important;
}
body.home .post-card-inner,
body.archive .post-card-inner,
body.search .post-card-inner {
    flex-direction: row !important;
    padding: 0 !important;
    gap: 0 !important;
}
body.home .post-card-thumb,
body.archive .post-card-thumb,
body.search .post-card-thumb {
    width: 280px !important;
    min-height: 200px !important;
    flex-shrink: 0 !important;
    border-radius: var(--radius) 0 0 var(--radius) !important;
}
body.home .post-card-thumb img,
body.archive .post-card-thumb img,
body.search .post-card-thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: var(--radius) 0 0 var(--radius) !important;
}
body.home .post-card-body,
body.archive .post-card-body,
body.search .post-card-body {
    padding: 16px 20px !important;
}
@media (max-width: 782px) {
    body.archive .post-list {
        grid-template-columns: 1fr !important;
    }
}

/* ===== ��ҳ/�鵵��ҳ����ʽ ===== */
.site-footer {
    border-top: 1px solid var(--color-border) !important;
    padding: 10px var(--gap) !important;
    background: var(--color-card-bg) !important;
}
.site-footer .footer-bottom {
    max-width: var(--max-width-wide) !important;
    margin: 0 auto !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
}
.site-footer .footer-copyright {
    font-size: 0.8125rem !important;
    color: var(--color-text-muted) !important;
}
.site-footer .footer-copyright a {
    color: var(--color-text) !important;
    text-decoration: none !important;
}
.site-footer .footer-copyright a:hover {
    color: var(--color-primary) !important;
}

/* ===== ��ҳ����� ===== */
body.home .sidebar {
    width: 300px !important;
    flex-shrink: 0 !important;
    position: sticky !important;
    top: 96px !important;
    align-self: flex-start !important;
}
body.home .sidebar .widget {
    margin-bottom: 32px !important;
    font-size: 0.875rem !important;
}
body.home .sidebar .widget-title {
    font-size: 1rem !important;
    font-weight: 700 !important;
    margin-bottom: 14px !important;
    padding-bottom: 8px !important;
    border-bottom: 2px solid var(--color-primary) !important;
}
body.home .sidebar ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}
body.home .sidebar ul li {
    padding: 6px 0 !important;
    border-bottom: 1px solid var(--color-border) !important;
}
body.home .sidebar ul li:last-child {
    border-bottom: none !important;
}
body.home .sidebar ul li a {
    color: var(--color-text) !important;
    text-decoration: none !important;
}
body.home .sidebar ul li a:hover {
    color: var(--color-primary) !important;
}
body.home .sidebar .widget_tag_cloud .tag-cloud-link {
    display: inline-block !important;
    padding: 4px 10px !important;
    margin: 0 4px 8px 0 !important;
    border: 1px solid var(--color-border) !important;
    border-radius: 4px !important;
    font-size: 0.8125rem !important;
    color: var(--color-text-muted) !important;
    text-decoration: none !important;
}
body.home .sidebar .widget_tag_cloud .tag-cloud-link:hover {
    border-color: var(--color-primary) !important;
    color: var(--color-primary) !important;
}
body.home .sidebar .search-form input[type="search"] {
    width: 100% !important;
    padding: 10px 12px !important;
    border: 1px solid var(--color-border) !important;
    border-radius: 6px !important;
    font-size: 0.875rem !important;
    background: var(--color-card-bg) !important;
}
body.home .sidebar .search-form input[type="submit"] {
    display: none !important;
}
/* ===== �鵵/����/��ǩҳ�������������ҳһ�£�===== */
body.archive .site-content {
    max-width: var(--max-width-wide) !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 40px !important;
    align-items: flex-start !important;
}
body.archive .content-area {
    flex: 1 !important;
    min-width: 0 !important;
}
body.archive .sidebar {
    width: 300px !important;
    flex-shrink: 0 !important;
    position: sticky !important;
    top: 96px !important;
    align-self: flex-start !important;
}
body.archive .sidebar .widget {
    margin-bottom: 32px !important;
    font-size: 0.875rem !important;
}
body.archive .sidebar .widget-title {
    font-size: 1rem !important;
    font-weight: 700 !important;
    margin-bottom: 14px !important;
    padding-bottom: 8px !important;
    border-bottom: 2px solid var(--color-primary) !important;
}
body.archive .sidebar ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}
body.archive .sidebar ul li {
    padding: 6px 0 !important;
    border-bottom: 1px solid var(--color-border) !important;
}
body.archive .sidebar ul li:last-child {
    border-bottom: none !important;
}
body.archive .sidebar ul li a {
    color: var(--color-text) !important;
    text-decoration: none !important;
}
body.archive .sidebar ul li a:hover {
    color: var(--color-primary) !important;
}
body.archive .sidebar .widget_tag_cloud .tag-cloud-link {
    display: inline-block !important;
    padding: 4px 10px !important;
    margin: 0 4px 8px 0 !important;
    border: 1px solid var(--color-border) !important;
    border-radius: 4px !important;
    font-size: 0.8125rem !important;
    color: var(--color-text-muted) !important;
    text-decoration: none !important;
}
body.archive .sidebar .widget_tag_cloud .tag-cloud-link:hover {
    border-color: var(--color-primary) !important;
    color: var(--color-primary) !important;
}

/* ===== �������ҳ�����沼�֣�����ҳ/�鵵һ�£�===== */
body.search .site-content {
    max-width: var(--max-width-wide) !important;
    width: 100% !important;
    display: block !important;
    margin: 0 auto !important;
}
body.search .content-area {
    width: 100% !important;
}

/* ===== ��ǰѡ�з���/��ǩ���� ===== */
body.home .sidebar .current-cat > a,
body.archive .sidebar .current-cat > a {
    color: var(--color-primary) !important;
    font-weight: 600 !important;
}
body.home .sidebar .widget_tag_cloud .current-tag,
body.archive .sidebar .widget_tag_cloud .current-tag {
    background: var(--color-primary) !important;
    color: #fff !important;
    pointer-events: none !important;
    border-color: var(--color-primary) !important;
}


body.home .sidebar .widget_tag_cloud .current-tag .tag-count,
body.archive .sidebar .widget_tag_cloud .current-tag .tag-count {
    color: #fff !important;
    font-weight: 600 !important;
    opacity: 0.9 !important;
}
body.home .sidebar .current-cat .count,
body.archive .sidebar .current-cat .count {
    color: var(--color-primary) !important;
    font-weight: 600 !important;
}

/* ===== ǿ�Ʒ���������ܱ�ǩ������ʽӰ�� ===== */
.sidebar .cat-item,
.sidebar .widget_categories .cat-item {
    color: var(--color-text) !important;
}
body.home .sidebar .widget_tag_cloud .tag-cloud-link.current-tag:hover,
body.archive .sidebar .widget_tag_cloud .tag-cloud-link.current-tag:hover {
    background: var(--color-primary) !important;
    color: #fff !important;
    border-color: var(--color-primary) !important;
}
body.home .sidebar .widget_tag_cloud .current-tag:hover .tag-count,
body.archive .sidebar .widget_tag_cloud .current-tag:hover .tag-count {
    color: #fff !important;
}

@media (max-width: 782px) {


    body.home .site-content {
        flex-direction: column !important;
    }
    body.home .sidebar {
        width: 100% !important;
        position: static !important;
        margin-top: 40px !important;
    }
}
/* ===== ����Ŀ¼������/�����л� ===== */
.post-toc.toc-nowrap .toc-list {
    white-space: nowrap !important;
}
.post-toc.toc-nowrap .toc-list > ul {
    overflow-x: auto !important;
    overflow-y: hidden !important;
}
.post-toc.toc-nowrap .toc-list ul ul,
.post-toc.toc-nowrap .toc-list li {
    white-space: nowrap !important;
}
.toc-wrap-toggle {
    font-family: inherit;
    cursor: pointer !important;
}
.post-toc:not(.toc-nowrap) .toc-wrap-toggle {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: #fff !important;
}

/* ===== Post Stats Bar (Views / Likes / Bookmarks) ===== */
.post-stats-bar {
    display: flex;
    align-items: center;
    gap: 24px;
    margin: 28px 0;
    padding: 16px 20px;
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    flex-wrap: wrap;
}

.stat-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.stat-item svg {
    flex-shrink: 0;
}

.stat-label {
    font-size: 0.8125rem;
}

.stat-number {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--color-text);
    min-width: 1.2em;
    text-align: center;
}

.stat-btn {
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px 8px;
    border-radius: 6px;
    font-family: inherit;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1;
}

.stat-btn:hover {
    background: var(--color-code-bg);
    color: var(--color-primary);
}

.stat-btn:active {
    transform: scale(0.95);
}

.stat-btn.active {
    color: #e74c3c;
}

.stat-btn.active svg {
    fill: currentColor;
}

#clearblog-bookmark-btn.active {
    color: #f39c12;
}

#clearblog-bookmark-btn.active svg {
    fill: currentColor;
}

.stat-bookmarks-link {
    margin-left: auto;
    font-size: 0.8125rem;
    color: var(--color-primary) !important;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.stat-bookmarks-link:hover {
    background: var(--color-code-bg);
    text-decoration: none;
}


/* Meta section stats */
.meta-views-stat,
.meta-likes-stat,
.meta-bookmarks-stat {
    font-size: 0.8125rem;
}
.meta-views-stat .stat-icon,
.meta-likes-stat .stat-icon,
.meta-bookmarks-stat .stat-icon {
    font-size: 0.85rem;
}
.meta-likes-stat,
.meta-bookmarks-stat {
    cursor: default;
}

/* ===== 评论图片上传 ===== */
.comment-form-image {
    margin-bottom: 12px;
}

.comment-form-image label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.comment-image-upload-area {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.comment-image-upload-area input[type="file"] {
    font-size: 0.8125rem;
    font-family: var(--font-sans);
    color: var(--color-text);
    cursor: pointer;
}

.comment-image-upload-area input[type="file"]::file-selector-button {
    padding: 6px 14px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-code-bg);
    color: var(--color-text);
    font-size: 0.8125rem;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: background 0.2s;
    margin-right: 8px;
}

.comment-image-upload-area input[type="file"]::file-selector-button:hover {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.comment-image-hint {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.comment-image-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-code-bg);
}

.comment-image-preview img {
    max-width: 120px;
    max-height: 80px;
    border-radius: 4px;
    object-fit: cover;
}

.comment-image-remove {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.comment-image-remove:hover {
    color: #ef4444;
    background: rgba(239,68,68,0.1);
}

/* 评论中展示的图片 */
.comment-image-attachment {
    margin: 12px 0 4px;
}

.comment-image-attachment img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    object-fit: contain;
    box-shadow: var(--shadow-sm);
}

/* ===== 评论点赞/踩按钮 ===== */
.comment-vote-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
}

.vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4;
}

.vote-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 8%, transparent);
}

.vote-btn.active {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 12%, transparent);
}

.vote-btn .vote-count {
    font-weight: 700;
    min-width: 1em;
    text-align: center;
}

.vote-down {
    font-size: 0.65rem;
}

.vote-down.active {
    border-color: #ef4444;
    color: #ef4444;
    background: color-mix(in srgb, #ef4444 10%, transparent);
}

.vote-down:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: color-mix(in srgb, #ef4444 8%, transparent);
}

/* ===== 浮动收藏按钮（右下角） ===== */
.floating-bookmarks-btn {
    position: fixed;
    bottom: 20px;
    right: 12px;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    color: var(--color-text-muted);
    text-decoration: none;
    box-shadow: var(--shadow-md);
    transition: all 0.25s;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.floating-bookmarks-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.floating-bookmarks-btn:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-lg);
}

.floating-bookmarks-label {
    display: none;
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    padding: 4px 10px;
    background: var(--color-text);
    color: var(--color-bg);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    pointer-events: none;
}

.floating-bookmarks-btn:hover .floating-bookmarks-label {
    display: block;
}

@media (max-width: 480px) {
    .floating-bookmarks-btn {
        bottom: 16px;
        right: 8px;
        width: 36px;
        height: 36px;
    }
    .floating-bookmarks-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* ===== 底部区域（标签、工具条、导航、评论区）自然继承 entry-content 布局 ===== */
/* 无需额外宽高/边距处理，自动与正文对齐 */

/* 移动端导航纵向堆叠 */
@media (max-width: 640px) {
    .post-navigation {
        flex-direction: column;
    }
}

/* ===== 右侧分类与标签面板 ===== */
.post-content-wrap.with-right-panel {
    max-width: 1532px;
    margin-left: calc(-1 * (1532px - var(--max-width)) / 2);
    margin-right: calc(-1 * (1532px - var(--max-width)) / 2);
    display: grid;
    grid-template-columns: 1fr 32px 300px;
}

.post-content-wrap.with-toc.with-right-panel {
    grid-template-columns: var(--toc-width, 220px) 8px 1fr 32px 300px;
}

/* 右侧面板 */
.right-panel {
    grid-column: -2 / -1;
    align-self: start;
    position: sticky;
    top: 96px;
    font-size: 0.8125rem;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.right-panel-widget {
    background: var(--color-code-bg);
    border-radius: var(--radius);
    padding: 20px 24px 10px;
}

.right-panel-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-primary);
    color: var(--color-text);
}

.right-panel ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.right-panel ul ul {
    padding-left: 16px;
}

.right-panel ul ul li:last-child,
.sidebar ul ul li:last-child,
body.home .sidebar ul ul li:last-child,
body.archive .sidebar ul ul li:last-child {
    padding-bottom: 0 !important;
}

.right-panel ul li {
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border);
    line-height: 1.5;
}

.right-panel ul li:last-child {
    border-bottom: none;
}

.right-panel ul li a {
    color: var(--color-text);
    text-decoration: none;
    transition: color 0.2s;
}

.right-panel ul li a:hover {
    color: var(--color-primary);
}

.right-panel ul li .count {
    color: var(--color-text-muted);
    font-size: 0.75rem;
    margin-left: 4px;
}

.right-panel-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.right-panel-tags a {
    display: inline-block;
    padding: 3px 10px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 0.75rem !important;
    color: var(--color-text-muted) !important;
    text-decoration: none;
    transition: all 0.2s;
    line-height: 1.5;
}

.right-panel-tags a:hover {
    border-color: var(--color-primary);
    color: var(--color-primary) !important;
}

@media (max-width: 782px) {
    .post-content-wrap.with-right-panel,
    .post-content-wrap.with-toc.with-right-panel {
        display: block !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    .right-panel {
        position: static;
        max-height: none;
        margin-top: 32px;
    }
}
