/* --- START OF FILE styles.css --- */

:root {
    --primary-color: #2563eb;
    --background-color: #fff;
    --text-color: #333;
    --link-color: #2563eb;
    --card-bg: #fff;
    --border-color: #e5e7eb;
    --hover-color: #f3f4f6;
    --transition: all 0.3s ease;
}

/* 暗色主题 */
[data-theme="dark"] {
    --primary-color: #60a5fa;
    --background-color: #111827;
    --text-color: #e5e7eb;
    --link-color: #60a5fa;
    --card-bg: #1f2937;
    --border-color: #374151;
    --hover-color: #374151;
}

/* 全局样式 */
body {
    background: url('1.jpg') center/cover fixed;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    cursor: url('cur/1.ani'), auto;
}

/* ---
应用鼠标指针到特定元素
--- */
a, button, .nav-item, .archive-item, .category-item, .tag-item, .github-btn {
    cursor: url('cur/2.ani'), pointer;
}

input, textarea {
    cursor: url('cur/3.ani'), text;
}


/* 深色遮罩 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: -1;
}

/* 导航栏样式 */
.site-header {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    height: 70px;
    display: flex;
    align-items: center;
}

.site-header.hidden {
    transform: translateY(-100%);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.logo-img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.logo-text {
    font-size: 1.3rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

/* --- 新导航样式 --- */
.main-nav {
    display: flex;
    gap: 1.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    position: relative;
    white-space: nowrap; /* 防止文字换行 */
}

.nav-item i {
    font-size: 1.1rem;
    margin-right: 0.6rem;
}

.nav-item span { /* This might be .nav-text now */
    font-weight: 500;
}
.nav-item .nav-text {
    font-weight: 500;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* 激活状态样式 */
.nav-item.active {
    color: #fff;
    background: rgba(74, 144, 226, 0.3);
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.4);
    font-weight: 600;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 3px;
    background: #4a90e2;
    border-radius: 2px;
    opacity: 1;
}
/* --- 导航样式结束 --- */


/* 进度条样式 */
.progress-bar {
    background: rgba(255, 255, 255, 0.1);
}

.progress-fill {
    background: #4a90e2;
    height: 100%;
    width: 0;
    transition: width 0.3s ease;
}

/* 阅读进度条 */
.reading-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.reading-progress .progress-bar {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
}

.progress-number {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    min-width: 3rem;
    text-align: right;
}

/* 文章卡片 */
.post-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: var(--transition);
    background: var(--card-bg);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.post-meta {
    color: #666;
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

.read-more {
    color: var(--link-color);
    text-decoration: none;
    font-weight: bold;
}

.post-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.post-card:hover .post-image img {
    transform: scale(1.05);
}

/* 标签样式 */
.tags-container {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.tag {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.tag.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 搜索框 */
.search-container {
    position: relative;
    margin: 2rem 0;
}

.search-container input {
    width: 100%;
    padding: 1rem 3rem 1rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-color);
}

.search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-color);
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--primary-color);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    opacity: 0;
    transition: var(--transition);
    z-index: 99;
}

.back-to-top.visible {
    opacity: 1;
}

/* 响应式设计增强 */
@media (max-width: 768px) {
    .main-nav {
        gap: 0.8rem;
    }
    .nav-item {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }
    .nav-item i {
        font-size: 1rem;
        margin-right: 0.4rem;
    }
    .logo-text {
        font-size: 1.1rem;
    }
    .logo-img {
        width: 32px;
        height: 32px;
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
    background: rgba(74, 144, 226, 0.5);
    border-radius: 4px;
}

/* 尾栏样式 重构 */
.footer {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    padding: 1.5rem 0;
    margin-top: auto; /* 关键：这会将 footer 推到 Flex 容器的底部 */
    text-align: center;
    flex-shrink: 0;
    width: 100%;
}

/* 针对新的 main 标签 class 进行调整 */
.page-main-content { /* 使用你为 main 标签设置的新 class */
    flex-grow: 1; /* 让 main 区域尽可能占据剩余空间，将 footer 推到底部 */
    padding-bottom: 3rem; /* 增加底部填充，确保 footer 与内容有间距 */
    /* 添加一些水平居中和最大宽度以适应你的内容布局 */
    max-width: 1200px; /* 根据你的 header-container 设置 */
    margin: 0 auto; /* 水平居中 */
    width: 100%; /* 确保占据可用宽度 */
    box-sizing: border-box; /* 确保 padding 不会增加总宽度 */
    padding-left: 1rem; /* 左右内边距与 header 保持一致 */
    padding-right: 1rem;
}


/* 这里是你的旧的 main 样式，如果它不再对应 HTML 中的 <main> 元素，则应删除或修改 */
/* 注意：你之前有两个 <main>，现在合并后，这些旧的样式如果指向的是你期望的整体内容区域，
   就应该修改为针对 .page-main-content。如果它们是内部布局的一部分，
   请根据新的 HTML 结构进行调整。 */
/* 如果 main.main-content 是用来包裹 content-wrapper 的，那么现在 content-wrapper 应该拥有它的布局属性 */
/* .main-content {
    flex-grow: 1;
    padding-bottom: 0;
} */
/* 
   如果你的 .content-wrapper 想要保持原有的边距和布局，
   可能需要把原 main.main-content 的一些样式迁移过来。
   从你的图片看，主体内容区域（文章列表和侧边栏）有一个固定的宽度并居中，
   这个样式应该属于 .content-wrapper
*/
.content-wrapper {
    display: flex;
    justify-content: space-between;
    gap: 2rem; /* 侧边栏和文章列表之间的间距 */
    margin-top: 2rem; /* 主内容区顶部间距 */
    /* 移除 max-width 和 margin auto，因为现在由 .page-main-content 控制 */
}


.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.footer-text {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.footer-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #4a90e2;
}

/* 加载动画样式 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-content {
    text-align: center;
}

.loading-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
    animation: logoFloat 2s ease-in-out infinite;
}

.loading-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
    margin-top: 1rem;
    position: relative;
}

.loading-text::after {
    content: '...';
    display: inline-block;
    width: 20px;
    text-align: left;
    animation: dotPulse 1.5s infinite;
}

@keyframes logoFloat {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes dotPulse {
    0% {
        content: '.';
    }
    33% {
        content: '..';
    }
    66% {
        content: '...';
    }
}

/* 萤火虫动画 */
:root {
    --firefly-color: rgba(255, 255, 150, 0.7);
    --firefly-size: 5px;
    --firefly-count: 17;
}

.fireflies-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.firefly {
    position: absolute;
    width: var(--firefly-size);
    height: var(--firefly-size);
    background: var(--firefly-color);
    border-radius: 50%;
    filter: blur(1px);
    animation: float 15s infinite linear, glow 2s infinite ease-in-out;
}

@keyframes float {
    0%,
    100% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(100px, 100px);
    }
    50% {
        transform: translate(-50px, 200px);
    }
    75% {
        transform: translate(-100px, 50px);
    }
}

@keyframes glow {
    0%,
    100% {
        opacity: 0.3;
        box-shadow: 0 0 10px var(--firefly-color);
    }
    50% {
        opacity: 1;
        box-shadow: 0 0 20px var(--firefly-color),
            0 0 30px var(--firefly-color);
    }
}

/* 响应式媒体查询 */
@media (max-width: 768px) {
    .footer-links {
        flex-direction: column;
        gap: 0.5rem;
    }
    .footer-links span {
        display: none;
    }
    .footer-content {
        text-align: center;
    }

    /* 调整小屏幕下主内容区的左右间距 */
    .page-main-content {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .content-wrapper {
        flex-direction: column; /* 侧边栏和文章列表垂直堆叠 */
        gap: 1rem;
    }

    .sidebar {
        width: 100%; /* 侧边栏占据全宽 */
        margin-top: 1rem;
    }

    /* Adjust hero section for mobile */
    .hero-section {
        padding: 4rem 1rem;
    }
    .site-title {
        font-size: 2rem;
    }
    .typed-text {
        font-size: 1rem;
    }
    .stat-count {
        font-size: 1.5rem;
    }
    .stat-label {
        font-size: 0.8rem;
    }
    .site-header-inner {
        padding: 0.5rem 1rem;
    }
    .main-nav {
        gap: 0.5rem; /* Reduce gap between icons */
    }
    .nav-item {
        padding: 0.5rem; /* Make the touch target a square */
        border-radius: 50%; /* Make it circular */
        flex-direction: column; /* 强制堆叠，即使文字显示 */
        justify-content: center;
        gap: 2px;
    }
    .nav-item i {
        font-size: 1.2rem; /* Slightly larger icon */
        margin-right: 0; /* No margin as text is hidden */
    }
    .nav-item .nav-text {
        display: none !important; /* Force hide the text */
    }

}

/* Hamburger Menu & Mobile Sidebar */
#hamburger-menu {
    cursor: pointer;
    display: none; /* Hidden by default, shown in media query */
    padding: 0.5rem;
    border-radius: 50%;
}

#hamburger-menu i {
    font-size: 1.2rem;
    color: #fff; /* Make it stand out */
    margin: 0;
}

#mobile-sidebar {
    position: fixed;
    top: 0;
    right: -340px; /* Start off-screen, wider */
    width: 320px; /* Wider */
    height: 100%;
    background-color: #1a1a1a;
    z-index: 2000;
    transition: right 0.3s ease-in-out;
    box-shadow: -5px 0 15px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
}

#mobile-sidebar.is-open {
    right: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #333;
}

.sidebar-header h3 {
    margin: 0;
    color: #fff;
}

#close-sidebar-btn {
    background: none;
    border: none;
    color: #ccc;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.sidebar-content {
    padding: 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem; /* Add space between cards */
}

/* Fix for profile card stats layout inside mobile sidebar */
#mobile-sidebar .profile-stats {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

#mobile-sidebar .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#sidebar-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 1024px) { /* Show hamburger on tablets and below */
    .sidebar,
    .archive-sidebar {
        display: none !important; /* Force hide the original sidebars */
    }
    #hamburger-menu {
        display: flex; /* Show the hamburger menu */
        align-items: center;
        justify-content: center;
    }
    .content-wrapper {
        grid-template-columns: 1fr; /* Make article list full width */
    }
}

/* --- Skeleton Loading --- */
.skeleton {
    opacity: 0.7;
    animation: skeleton-loading 1s linear infinite alternate;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-color: rgba(255, 255, 255, 0.05);
    }
    100% {
        background-color: rgba(255, 255, 255, 0.15);
    }
}

.skeleton-text {
    width: 100%;
    height: 1em;
    margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
    margin-bottom: 0;
}

.skeleton-text-short {
    width: 60%;
}


.site-info-card .site-stats li {
    display: block;
    margin-bottom: 0.5rem; /* Add some space between items */
}