:root {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --text-muted: #a0aec0;
    --border-color: #e2e8f0;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --shadow-color-hover: rgba(0, 0, 0, 0.12);
    --nav-link-color: #2d3748;
    --nav-link-border: #2d3748;
    --nav-link-hover-bg: #2d3748;
    --nav-link-hover-text: #ffffff;
    --input-bg: #ffffff;
    --input-border: #e2e8f0;
    --input-focus-border: #cbd5e0;
    --input-focus-shadow: rgba(102, 126, 234, 0.2);
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #252525;
    --text-primary: #f8f9fa;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    --border-color: #4a4a4a;
    --shadow-color: rgba(0, 0, 0, 0.2);
    --shadow-color-hover: rgba(0, 0, 0, 0.3);
    --nav-link-color: #f8f9fa;
    --nav-link-border: #f8f9fa;
    --nav-link-hover-bg: #f8f9fa;
    --nav-link-hover-text: #1a1a1a;
    --input-bg: #252525;
    --input-border: #4a4a4a;
    --input-focus-border: #718096;
    --input-focus-shadow: rgba(248, 249, 250, 0.2);
}

body {
    font-family: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
}

header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--bg-secondary);
    box-shadow: 0 2px 10px var(--shadow-color);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s ease, border-color 0.3s ease;
}

nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

nav a {
    color: var(--nav-link-color);
    text-decoration: none;
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    transition: all 0.3s ease;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

nav a:hover {
    background: var(--nav-link-hover-bg);
    color: var(--nav-link-hover-text);
    transform: translateY(-2px);
}

.theme-toggle-button {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--nav-link-color);
    cursor: pointer;
    border-radius: 25px;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.theme-toggle-button:hover {
    background: var(--nav-link-hover-bg);
    color: var(--nav-link-hover-text);
}

[data-theme="dark"] .sun-icon {
    display: none;
}

[data-theme="light"] .moon-icon {
    display: none;
}

main {
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* 文章列表样式 */
.posts-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

.post-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: 0 4px 20px var(--shadow-color);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex; /* Change to flex */
    flex-direction: column; /* Arrange content vertically */
    color: inherit;
    overflow: hidden; /* Keep content within rounded corners */
    position: relative;
}

.folder-container {
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: 0 4px 20px var(--shadow-color);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.folder-title {
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    cursor: pointer;
}

.folder-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.folder-content .post-card {
    margin-bottom: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .posts-container,
    .folder-content {
        grid-template-columns: 1fr;
    }
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px var(--shadow-color-hover);
    border-color: var(--input-focus-border);
}

.post-card-image {
    width: 100%;
    height: 200px; /* Or a fixed height you prefer */
    object-fit: cover;
}

.post-card-content {
    padding: 1.8rem;
    flex-grow: 1; /* Allow content to fill remaining space */
}

.post-title {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--text-primary);
    margin: 0 0 0.8rem 0;
    line-height: 1.4;
}

.post-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.tags-container {
    margin-top: 10px;
}

.tag,
.post-date {
    display: inline-block;
    background-color: var(--tag-background-color);
    color: var(--tag-text-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    margin-right: 5px;
    margin-bottom: 5px;
}

.post-date {
    background-color: var(--date-background-color);
    color: var(--date-text-color);
}

.tag:hover {
    background-color: var(--nav-link-hover-bg);
    color: var(--nav-link-hover-text);
}

.post-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 1rem;
}

footer {
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

/* 移动端适配 */
@media (max-width: 768px) {
    header {
        padding: 1rem;
    }

    nav {
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    nav a {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    main {
        padding: 1.5rem;
    }
    
    .post-card {
        padding: 1.5rem;
        margin: 0 0.5rem;
    }
    
    .post-title {
        font-size: 1.2rem;
    }

    .posts-container {
        grid-template-columns: 1fr;
    }
}

/* 页面标题样式 */
.page-title {
    text-align: center;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 2rem 0 3rem 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 空状态提示 */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-style: italic;
}




.image-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem; /* Adjust the gap as needed */
    justify-content: center;
    margin: 2rem 0;
}

.gallery-item {
    flex: 1 1 calc(50% - 1rem); /* Two items per row with gap */
    max-width: calc(50% - 1rem);
    box-sizing: border-box;
    text-align: center;
}

.gallery-item img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#search-input {
    flex-grow: 1;
    padding: 0.8rem 1.2rem;
    border: 1px solid var(--input-border);
    border-radius: 25px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--input-bg);
    color: var(--text-primary);
}


#search-input:focus {
    outline: none;
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px var(--input-focus-shadow);
}

/* Article and Weekly Content Image Style */
.content-image {
    width: calc(100% + 4rem); /* Make image wider than content area */
    margin: 1rem -2rem; /* Use negative margin to expand into padding */
    max-width: none;
    height: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer; /* Indicates the image is clickable */
    transition: transform 0.2s ease;
}

.content-image:hover {
    transform: scale(1.02);
}

/* Lightbox styles */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
}

.pagination-button {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-button:hover {
    background: var(--nav-link-hover-bg);
    color: var(--nav-link-hover-text);
    border-color: var(--nav-link-hover-bg);
}

.pagination-button.active {
    background: var(--nav-link-hover-bg);
    color: var(--nav-link-hover-text);
    border-color: var(--nav-link-hover-bg);
}

.lightbox-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.lightbox-image {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    box-shadow: 0 0 35px rgba(0,0,0,0.6);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.lightbox-overlay.visible .lightbox-image {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 3rem;
    color: white;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.2s ease;
}

.lightbox-close:hover {
    transform: scale(1.1);
}