/*
Theme Name: Aura
Theme URI: https://example.com/aura
Author: XiaoQ
Description: 现代时尚的 Typecho 主题，支持深色模式、移动端底部导航、文章封面图
Version: 1.0.0
*/

/* ========== 基础变量 ========== */
:root {
    --bg-primary: rgba(255,255,255,0.1);;
    --bg-secondary: #f8f9fa;
    --bg-card:rgba(255,255,255,0.1);
    --bg-hover: #f1f3f5;
    --text-primary: #1a1a2e;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-light: #fffaf3;
    --border: #e9ecef;
    --shadow: 0 0px 0px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
    --radius: 16px;
    --radius-sm: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    --max-width: 1200px;
    --header-height: 64px;
    --mobile-nav-height: 64px;
}

[data-theme="dark"] {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16162a;
    --bg-hover: #252545;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-light: rgba(99, 102, 241, 0.15);
    --border: #2d2d44;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.4);
}

/* ========== 重置与基础 ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

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

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* a标签 */
a {
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
}

/* input、按钮所有可点击元素 */
input,button,textarea,select {
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
}


/* ========== 头部导航 ========== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(var(--bg-primary), 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    transition: var(--transition);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.site-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.site-logo span {
    color: var(--accent);
}

.site-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: none;
}

@media (min-width: 768px) {
    .site-desc {
        display: block;
    }
}

/* 桌面导航 */
.desktop-nav {
    display: none;
    align-items: center;
    gap: 8px;
}

@media (min-width: 768px) {
    .desktop-nav {
        display: flex;
    }
}

.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
}

.nav-link:hover, .nav-link.active {
    color: var(--accent);
    background: var(--accent-light);
}

/* 头部操作区 */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 1.1rem;
}

.icon-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
    transform: scale(1.05);
}

/* 搜索弹窗 */
.search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-box {
    width: 90%;
    max-width: 600px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: translateY(-20px);
    transition: var(--transition);
}

.search-overlay.active .search-box {
    transform: translateY(0);
}

.search-input-wrap {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.search-input-wrap i {
    color: var(--text-muted);
    font-size: 1.2rem;
}

#search-input {
    flex: 1;
    border: none;
    background: none;
    font-size: 1.1rem;
    color: var(--text-primary);
    outline: none;
}

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

.search-close {
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

.search-result-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.search-result-item:hover {
    background: var(--bg-hover);
}

.search-result-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-secondary);
}

.search-result-info h4 {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}

.search-result-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* ========== 主体内容 ========== */
.site-main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: calc(var(--header-height) + 32px) 24px 32px;
    min-height: calc(100vh - var(--header-height));
}

@media (max-width: 767px) {
    .site-main {
        padding: calc(var(--header-height) + 16px) 16px calc(var(--mobile-nav-height) + 24px);
    }
}

/* 页面标题 */
.page-header {
    margin-bottom: 32px;
    text-align: center;
}

.page-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ========== 文章卡片网格 ========== */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    
}

@media (max-width: 640px) {
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* 文章卡片 */
.post-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.post-card-thumb {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    overflow: hidden;
    background: var(--bg-secondary);
}

.post-card-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.post-card:hover .post-card-thumb img {
    transform: scale(1.05);
}

.post-card-category {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--accent);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 2;
}

.post-card-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 10px;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-excerpt {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.post-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ========== 文章详情页 ========== */
.post-single {
    max-width: 800px;
    margin: 0 auto;
}

.post-header {
    margin-bottom: 40px;
    text-align: center;
}

.post-header .post-title {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.post-header .post-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    flex-wrap: wrap;
}

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

.post-cover {
    width: 100%;
    height: 238px;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 40px;
    box-shadow: var(--shadow-lg);
}

.post-cover img {
    width: 100%;
    height: auto;
}

.post-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.post-content h2, .post-content h3, .post-content h4 {
    margin-top: 2em;
    margin-bottom: 0.8em;
    font-weight: 700;
    color: var(--text-primary);
}

.post-content h2 {
    font-size: 1.6rem;
    padding-bottom: 0.3em;
    border-bottom: 2px solid var(--border);
}

.post-content h3 {
    font-size: 1.3rem;
}

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

.post-content img {
    border-radius: var(--radius-sm);
    margin: 2em 0;
    box-shadow: var(--shadow);
}

.post-content blockquote {
    border-left: 4px solid var(--accent);
    padding: 1em 1.5em;
    margin: 1.5em 0;
    background: var(--bg-secondary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
    font-style: italic;
}

.post-content code {
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: "SF Mono", Monaco, monospace;
    font-size: 0.9em;
    color: var(--accent);
}

.post-content pre {
   /* background: #1e1e2e;
    color: #333;*/
    padding: 20px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 1.5em 0;
}

.post-content pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.post-content pre {
    max-width: 100% !important;
    overflow-x: auto !important;
}


.post-content ul, .post-content ol {
    margin: 1em 0;
    padding-left: 1.5em;
}

.post-content li {
    margin-bottom: 0.5em;
}

.post-content a {
    border-bottom: 2px solid var(--accent-light);
}

.post-content a:hover {
    border-bottom-color: var(--accent);
}

/* 文章底部 */
.post-footer {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 32px;
}

.tag {
    padding: 6px 14px;
    background: var(--bg-secondary);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.tag:hover {
    background: var(--accent);
    color: white;
}

.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.post-nav-item {
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.post-nav-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.post-nav-item.prev {
    text-align: left;
}

.post-nav-item.next {
    text-align: right;
}

.post-nav-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

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

/* 防止代码块撑开整个布局 */
.post-main {
    min-width: 0;
    overflow-x: hidden;
}

.post-content {
    min-width: 0;
    overflow-x: hidden;
}

.post-content pre {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    white-space: pre;
}

.post-content pre code {
    white-space: pre;
    word-break: normal;
    overflow-wrap: normal;
}


/* ========== 评论区 ========== */
.comments-area {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

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

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

.comment-item {
    padding: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-author {
    font-weight: 600;
    color: var(--text-primary);
}

.comment-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.comment-content {
    color: var(--text-secondary);
    line-height: 1.6;
    padding-left: 52px;
}

/* 评论表单 */
.respond {
    margin-top: 32px;
    padding: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.respond:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.respond-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.comment-form {
    display: grid;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-input, .form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.form-input:focus, .form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

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

.submit-btn {
    padding: 12px 32px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    justify-self: start;
}

.submit-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* ========== 分页 ========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 48px;
}

.page-btn, .page-num {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
}

.page-btn:hover, .page-num:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.page-num.current {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ========== 移动端底部导航 ========== */
.mobile-nav {
    position: fixed;
    bottom: 10px;
    left: 18px;
    right: 18px;
    border-radius:25px;
    height: var(--mobile-nav-height);
    background: rgba(var(--bg-primary), 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
}

@media (min-width: 768px) {
    .mobile-nav {
        display: none;
    }
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    padding: 8px 16px;
    transition: var(--transition);
    position: relative;
}

.mobile-nav-item i {
    font-size: 1.3rem;
}

.mobile-nav-item.active {
    color: var(--accent);
}

.mobile-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--accent);
    border-radius: 0 0 4px 4px;
}

/* ========== 页脚 ========== */
.site-footer {
    text-align: center;
    padding: 40px 24px;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border);
    margin-top: 60px;
}

@media (max-width: 767px) {
    .site-footer {
        margin-bottom: var(--mobile-nav-height);
    }
}

.site-footer a {
    color: var(--text-secondary);
}

/* ========== 404 页面 ========== */
.error-404 {
    text-align: center;
    padding: 100px 24px;
}

.error-code {
    font-size: 8rem;
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
    opacity: 0.3;
    margin-bottom: 16px;
}

.error-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.error-desc {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* ========== 动画 ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-card, .post-single > * {
    animation: fadeInUp 0.6s ease forwards;
}

/* 返回顶部 */
.back-to-top {
    position: fixed;
    bottom: calc(var(--mobile-nav-height) + 20px);
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

@media (min-width: 768px) {
    .back-to-top {
        bottom: 30px;
    }
}

/* 加载骨架屏 */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-hover) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========== 归档页 ========== */
.archive-page { max-width: var(--max-width); margin: 0 auto; padding: 0 24px 60px; }
.archive-header { text-align: center; margin-bottom: 48px; padding: 40px 24px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.archive-header h1 { font-size: 1.8rem; font-weight: 800; color: var(--text-primary); margin-bottom: 8px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.archive-header h1 i { color: var(--accent); }
.archive-header p { color: var(--text-secondary); font-size: 0.95rem; }

.archive-timeline { max-width: 800px; margin: 0 auto; position: relative; padding-left: 24px; }
.archive-year { display: flex; align-items: center; gap: 16px; margin: 40px 0 24px; position: relative; }
.archive-year:first-child { margin-top: 0; }
.year-badge { font-size: 1.4rem; font-weight: 800; color: var(--accent); background: var(--accent-light); padding: 8px 20px; border-radius: var(--radius-sm); flex-shrink: 0; z-index: 2; }
.year-line { flex: 1; height: 2px; background: linear-gradient(90deg, var(--accent-light), transparent); border-radius: 2px; }

.archive-item { display: flex; align-items: flex-start; gap: 20px; padding: 14px 0; position: relative; padding-left: 24px; border-left: 2px solid var(--border); margin-left: 32px; margin-bottom: 4px; }
.archive-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--bg-card); border: 3px solid var(--accent); position: absolute; left: -7px; top: 22px; transition: var(--transition); z-index: 2; }
.archive-item:hover .archive-dot { background: var(--accent); transform: scale(1.3); }
.archive-date { display: flex; flex-direction: column; align-items: center; min-width: 40px; flex-shrink: 0; margin-top: 4px; }
.date-m { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; }
.date-d { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
.archive-card { flex: 1; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 20px; transition: var(--transition); text-decoration: none; color: var(--text-primary); display: block; }
.archive-card:hover { border-color: var(--accent); transform: translateX(6px); box-shadow: var(--shadow); }
.archive-card h4 { font-size: 1rem; font-weight: 600; margin-bottom: 8px; line-height: 1.4; color: var(--text-primary); }
.archive-meta { display: flex; gap: 16px; font-size: 0.8rem; color: var(--text-muted); }
.archive-meta span { display: flex; align-items: center; gap: 4px; }

@media (max-width: 640px) {
    .archive-item { margin-left: 0; padding-left: 16px; gap: 12px; }
    .archive-dot { display: none; }
    .archive-card { padding: 14px 16px; }
    .archive-card:hover { transform: translateX(3px); }
    .archive-header h1 { font-size: 1.4rem; }
}


/* 独立页面 */
.page-content {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

@media (max-width: 640px) {
    .page-content {
        padding: 24px;
    }
}

/* ========== 图片懒加载 ========== */
.post-card-thumb,
.post-cover {
    background: var(--bg-secondary);
}

img.lazyload,
img.lazyloading {
    opacity: 0;
    transition: opacity 0.5s ease;
}

img.lazyloaded {
    opacity: 1;
}

/* ========== 懒加载兜底修复 ========== */
img.lazyloaded,
img:not([data-src]) {
    opacity: 1 !important;
}

img.lazyload:not(.lazyloaded) {
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* ========== 首页轮播图 ========== */
.carousel-section {
    margin-top: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.carousel-section:hover {
    border-color: var(--accent);
}

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

.carousel-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.carousel-header h3 i {
    color: var(--accent);
}

.carousel-container {
    position: relative;
    width: 100%;
    height: 340px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.carousel-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.7s ease, visibility 0.7s ease;
    z-index: 1;
}

.carousel-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

.carousel-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.carousel-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.3) 50%, rgba(0,0,0,0.1) 100%);
    z-index: 1;
}

.carousel-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 36px;
    color: white;
    z-index: 2;
}

.carousel-tag {
    display: inline-block;
    padding: 4px 14px;
    background: var(--accent);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.carousel-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    line-height: 1.3;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
    max-width: 80%;
}

.carousel-excerpt {
    font-size: 0.9rem;
    opacity: 0.85;
    margin-bottom: 18px;
    line-height: 1.6;
    max-width: 70%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.carousel-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: white;
    color: var(--text-primary);
    border-radius: 24px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.carousel-btn:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    opacity: 0;
}

.carousel-container:hover .carousel-arrow {
    opacity: 1;
}

.carousel-arrow:hover {
    background: rgba(255,255,255,0.35);
    transform: translateY(-50%) scale(1.1);
}

.carousel-prev { left: 16px; }
.carousel-next { right: 16px; }

.carousel-dots {
    display: flex;
    align-items: center;
    gap: 8px;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.carousel-dot.active {
    background: var(--accent);
    width: 24px;
    border-radius: 4px;
}

/* 移动端轮播 */
@media (max-width: 640px) {
    .carousel-container {
        height: 280px;
    }
    .carousel-content {
        padding: 24px;
    }
    .carousel-title {
        font-size: 1.15rem;
        max-width: 100%;
    }
    .carousel-excerpt {
        max-width: 100%;
        -webkit-line-clamp: 1;
        font-size: 0.85rem;
    }
    .carousel-arrow {
        opacity: 1;
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }
    .carousel-btn {
        padding: 8px 18px;
        font-size: 0.8rem;
    }
}


/* ========== 文章页左右布局 ========== */
.post-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
    align-items: start;
    max-width: var(--max-width);
    margin: 0 auto;
}

/* 覆盖原来的居中限制 */
.post-layout .post-single {
    max-width: none;
    margin: 0;
}

.post-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: calc(var(--header-height) + 24px);
}

/* 侧边栏通用卡片 */
.post-sidebar .widget {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.post-sidebar .widget:hover {
    border-color: var(--accent);
}

/* 作者卡片 */
.author-widget:hover .author-stats {
    border-top-color: var(--accent);
}
.author-card {
    text-align: center;
}

.author-card img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 12px;
    border: 3px solid var(--accent-light);
    padding: 3px;
    background: var(--bg-card);
}

.author-card h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.author-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.author-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.author-stats span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.author-stats strong {
    display: block;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 2px;
}

/* 目录 TOC */
.toc-widget {
    max-height: 400px;
    overflow-y: auto;
}

.toc-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toc-nav li a {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: var(--transition);
    line-height: 1.4;
}

.toc-nav li.toc-h3 a {
    padding-left: 24px;
    font-size: 0.85rem;
}

.toc-nav li a:hover,
.toc-nav li a.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

/* 侧边栏文章列表 */
.post-sidebar .widget-posts {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.post-sidebar .widget-post-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    color: var(--text-primary);
}

.post-sidebar .widget-post-item:hover {
    background: var(--bg-hover);
}

.post-sidebar .widget-post-thumb,
.post-sidebar .widget-post-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    flex-shrink: 0;
    overflow: hidden;
}

.post-sidebar .widget-post-thumb {
    object-fit: cover;
    background: var(--bg-secondary);
}

.post-sidebar .widget-post-icon {
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 1.1rem;
}

.post-sidebar .widget-post-body {
    flex: 1;
    min-width: 0;
}

.post-sidebar .widget-post-body h4 {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.post-sidebar .widget-post-body span {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 侧边栏标签 */
.post-sidebar .widget-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.post-sidebar .widget-tag {
    padding: 6px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.post-sidebar .widget-tag:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* 移动端适配 */
@media (max-width: 1024px) {
    .post-layout {
        grid-template-columns: 1fr;
    }
    
    .post-sidebar {
        position: static;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 16px;
        margin-top: 40px;
    }
    
    .toc-widget {
        display: none !important; /* 移动端隐藏目录，节省空间 */
    }
}

@media (max-width: 640px) {
    .post-sidebar {
        grid-template-columns: 1fr;
    }
}


/* ========== 侧边菜单外层容器 ========== */
.sidebar-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}
.sidebar-menu.active {
    opacity: 1;
    pointer-events: auto;
}

/* 遮罩 */
.menu-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

/* 侧边面板 - 弹性布局 + 固定最大宽度，不会被内容撑开 */
.menu-wrap {
    position: absolute;
    top: 0;
    right: 0;
    width: min(320px, 85vw);
    max-width: 320px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: -6px 0 30px rgba(0,0,0,0.08);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    /* 弹性上下布局 */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar-menu.active .menu-wrap {
    transform: translateX(0);
}

/* 头部区域：固定高度，禁止压缩 */
.menu-head {
    flex-shrink: 0;
    padding: 28px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}
.menu-head h3 {
    margin: 0;
    color: var(--primary);
    font-size: 20px;
    font-weight: 500;
}
.menu-close {
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.menu-close:hover {
    background: var(--bg);
    color: var(--accent);
}

/* 滚动区域：自动占满剩余高度，超出滚动 */
.menu-inner {
    max-height: 75vh;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
}
/* 美化滚动条 */
.menu-inner::-webkit-scrollbar {
    width: 4px;
}
.menu-inner::-webkit-scrollbar-track {
    background: transparent;
}
.menu-inner::-webkit-scrollbar-thumb {
    background: rgba(201, 169, 110, 0.35);
    border-radius: 4px;
}
.menu-inner .author-card {
    grid-column: 1 / -1
}

/* ========== 列表模式 menu-list ========== */
.menu-list {
    padding: 20px 0;
}
.menu-list .menu-link {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 12px;
    padding: 16px 18px;
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: var(--transition);
    background: transparent;
    border: 1px solid transparent;
}
.menu-list .menu-link i {
    font-size: 20px;
    width: 26px;
    text-align: center;
    color: var(--text-secondary);
    transition: var(--transition);
}
.menu-list .menu-link:hover {
    background-color: rgba(201, 169, 110, 0.08);
    color: var(--accent);
}
.menu-list .menu-link:hover i {
    color: var(--accent);
    transform: translateX(3px);
}
.menu-list .menu-link.active {
    background-color: rgba(201, 169, 110, 0.12);
    color: var(--accent);
}
.menu-list .menu-link.active i {
    color: var(--accent);
}

/* ========== 网格卡片模式 menu-grid ========== */
.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 20px;
}
.menu-grid .menu-link {
    margin: 0 !important;
    border-radius: 16px;
    padding: 22px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    transition: var(--transition);
}
.menu-grid .menu-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.menu-grid .menu-link.active {
    border-color: var(--accent);
}
/* pc移动隐藏盒子样式 */
@media (min-width: 921px) {
    .app-show {
        display: none !important;
        pointer-events: none;
    }
}

/* 只在手机端显示侧边栏 */
@media (max-width: 920px) {
    .app-hide {
        display: none;
    }
}

/* 双栏布局 */
.double-widget-grid{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin: 40px 0;
}

/* 移动端自动变成单列 */
@media (max-width: 768px){
    .double-widget-grid{
        grid-template-columns: 1fr;
    }
}

.double-widget-grid .widget{
    padding: 20px;
    border-radius: 12px;
}


/* 侧边面板暗黑美化 */
[data-theme="dark"] .menu-wrap {
    background: rgba(18, 18, 22, 0.93);
    box-shadow: -6px 0 30px rgba(0, 0, 0, 0.35);
}
[data-theme="dark"] .menu-head {
    border-bottom: 1px solid var(--border);
}

/* 作者卡片文字 */
[data-theme="dark"] .author-card h4 {
    color: var(--text);
}
[data-theme="dark"] .author-desc,
[data-theme="dark"] .author-stats {
    color: var(--text-secondary);
}

/* 列表导航样式 */
[data-theme="dark"] .menu-list .menu-link {
    color: var(--text);
}
[data-theme="dark"] .menu-list .menu-link i {
    color: var(--text-secondary);
}
[data-theme="dark"] .menu-list .menu-link:hover {
    background-color: rgba(201, 169, 110, 0.09);
}

/* 网格卡片样式 */
[data-theme="dark"] .menu-grid .menu-link {
    background-color: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}
[data-theme="dark"] .menu-grid .menu-link i {
    color: var(--text-secondary);
}

/* 滚动条深色优化 */
[data-theme="dark"] .menu-inner::-webkit-scrollbar-thumb {
    background: rgba(201, 169, 110, 0.3);
}

/* 遮罩深色微调 */
[data-theme="dark"] .menu-mask {
    background: rgba(0, 0, 0, 0.35);
}
/* 暗黑模式：列表导航 hover + 选中激活变色 */
[data-theme="dark"] .menu-list .menu-link:hover {
    background-color: rgba(201, 169, 110, 0.15);
    color: var(--accent);
}
[data-theme="dark"] .menu-list .menu-link:hover i {
    color: var(--accent);
}
[data-theme="dark"] .menu-list .menu-link.active {
    background-color: rgba(201, 169, 110, 0.18);
    color: var(--accent);
}
[data-theme="dark"] .menu-list .menu-link.active i {
    color: var(--accent);
}

/* 网格卡片 hover + active 深色模式变色 */
[data-theme="dark"] .menu-grid .menu-link:hover {
    border-color: var(--accent);
    color: var(--accent);
    background-color: rgba(201, 169, 110, 0.08);
}
[data-theme="dark"] .menu-grid .menu-link.active {
    border-color: var(--accent);
    color: var(--accent);
}
[data-theme="dark"] .menu-grid .menu-link.active i {
    color: var(--accent);
}



*,
*::before,
*::after {
    box-sizing: border-box !important;
}

/* ==========文章双栏布局，minmax(0,1fr)是grid必写，少这个必炸========== */


@media(max-width:1024px){
    .post-layout{
        grid-template-columns: minmax(0,1fr);
    }
    .post-sidebar{
        grid-template-columns: minmax(0,1fr);
    }
}




