/* Modern Academic Blog Style */
/* Color Palette:
   - Primary: #2c3e50 (dark blue-gray)
   - Secondary: #34495e (medium blue-gray) 
   - Accent: #3498db (bright blue)
   - Success: #27ae60 (green)
   - Warning: #f39c12 (orange)
   - Background: #f8f9fa (light gray)
   - Text: #2c3e50 (dark gray)
*/

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
    background-color: #f0f2f5;
    color: #2c3e50;
    line-height: 1.7;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding: 2rem 0;
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #2c3e50;
    color: white;
    padding: 8px;
    z-index: 1000;
    text-decoration: none;
    border-radius: 4px;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 6px;
}

/* Main Container */
div#main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Main Content Container */
.main-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    min-height: calc(100vh - 4rem);
}

/* Header */
#header {
    background: linear-gradient(135deg, #1a252f 0%, #2c3e50 50%, #34495e 100%);
    color: #ffffff;
    padding: 4rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    min-height: 200px;
    /* 确保背景始终可见 */
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.2);
}

#header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.05)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.05)"/><circle cx="50" cy="50" r="0.5" fill="rgba(255,255,255,0.03)"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

.header-content {
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 0 auto;
}

.header-title {
    margin: 0 0 1rem 0;
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: #ffffff !important;
    /* 增强标题文字可读性 */
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.6), 0 1px 3px rgba(0, 0, 0, 0.4);
    position: relative;
}

.header-title a {
    color: #ffffff !important;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    display: inline-block;
    /* 增强文字可读性 */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
    font-weight: 900;
}

.header-title a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    transform: translateX(-50%);
    transition: width 0.3s ease;
    border-radius: 2px;
}

.header-title a:hover::after {
    width: 100%;
}

.header-title a:hover {
    transform: translateY(-2px);
    color: #ffffff !important;
    /* 悬停时保持强对比度 */
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.7), 0 2px 4px rgba(0, 0, 0, 0.5);
}

.header-subtitle {
    margin: 0 0 1.5rem 0;
    font-size: 1.2rem;
    font-weight: 500;
    color: #ffffff !important;
    opacity: 0.95;
    line-height: 1.4;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    /* 增强副标题可读性 */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.2);
}

.header-accent {
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #3498db, #2ecc71, #e74c3c);
    margin: 0 auto;
    border-radius: 2px;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
    animation: pulse 2s ease-in-out infinite alternate;
}

@keyframes pulse {
    from {
        opacity: 0.8;
        transform: scaleX(1);
    }
    to {
        opacity: 1;
        transform: scaleX(1.1);
    }
}

/* Content Layout */
.content-wrapper {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
    padding: 2rem;
    max-width: 100%;
    overflow: hidden;
}

/* Sidebar */
#sidebar {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 2rem;
    border: 1px solid #d0d7de;
}

/* Profile Section */
.profile-section {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #d0d7de;
}

.profile-avatar-link {
    display: inline-block;
    transition: transform 0.3s ease;
}

.profile-avatar-link:hover {
    transform: scale(1.05);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #3498db;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.25);
    transition: all 0.3s ease;
    margin: 0 auto;
    display: block;
}

.profile-avatar:hover {
    border-color: #2980b9;
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.35);
}

.profile-info {
    margin-top: 1rem;
}

.profile-name {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.2;
}

/* Navigation Header */
.nav-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #d0d7de;
}

.nav-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-subtitle {
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 500;
    background: #f8f9fa;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    border: 1px solid #d0d7de;
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border: 1px solid #d0d7de;
    border-radius: 8px;
    text-decoration: none;
    color: #495057;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(135deg, #3498db, #2980b9);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.3s ease;
}

.nav-item:hover::before {
    transform: scaleY(1);
}

.nav-item:hover {
    background: linear-gradient(135deg, #ffffff, #f1f8ff);
    border-color: #3498db;
    color: #2c3e50;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
}

.nav-icon {
    font-size: 1.1rem;
    opacity: 0.8;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.nav-item:hover .nav-icon {
    opacity: 1;
    transform: scale(1.1);
}

.nav-text {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.external-icon {
    font-size: 0.8rem;
    opacity: 0.6;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.nav-item:hover .external-icon {
    opacity: 1;
    transform: rotate(15deg) scale(1.1);
}

/* Active Navigation Item */
.nav-item-active {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb) !important;
    border-color: #1976d2 !important;
    color: #1565c0 !important;
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.25) !important;
    transform: translateX(4px);
}

.nav-item-active::before {
    transform: scaleY(1) !important;
    background: linear-gradient(135deg, #1976d2, #1565c0) !important;
    width: 4px;
}

.nav-item-active .nav-icon {
    opacity: 1;
    color: #1565c0;
    transform: scale(1.1);
}

.nav-item-active .nav-text {
    color: #1565c0;
    font-weight: 700;
}

.nav-item-active .external-icon {
    opacity: 1;
    color: #1565c0;
}

/* Content Area */
#content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    min-height: 500px;
    border: 1px solid #d0d7de;
    /* 强制换行和处理溢出 */
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: auto;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: #2c3e50;
    margin-bottom: 1rem;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

h1 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid #3498db;
}

h2 {
    font-size: 1.6rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #34495e;
}

h3 {
    font-size: 1.3rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #495057;
}

h4 {
    font-size: 1.1rem;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

h5 {
    font-size: 1rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

h6 {
    font-size: 0.9rem;
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* Paragraphs */
p {
    margin-bottom: 1rem;
    color: #495057;
    font-size: 1rem;
    line-height: 1.7;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Links */
a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
    word-wrap: break-word;
    word-break: break-all;
    overflow-wrap: break-word;
}

a:hover {
    color: #2980b9;
}

/* Lists */
ul, ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

ul li, ol li {
    margin-bottom: 0.5rem;
    color: #495057;
    line-height: 1.6;
}

/* Content Lists (for backward compatibility with regular lists) */
#content ul:not(.posts-list) {
    list-style: disc;
    padding-left: 1.5rem;
}

#content ol:not(.posts-list) {
    list-style: decimal;
    padding-left: 1.5rem;
}

/* Code Blocks */
code {
    background-color: #f1f3f4;
    color: #e74c3c;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    font-size: 0.875em;
    font-weight: 500;
    word-wrap: break-word;
    word-break: break-all;
    overflow-wrap: break-word;
}

pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
    line-height: 1.5;
    position: relative;
    /* 处理代码块溢出 */
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
    max-width: 100%;
    box-sizing: border-box;
}

/* 只对独立的pre元素（不在sourceCode容器内的）应用左边框 */
pre:not(.sourceCode) {
    border-left: 4px solid #3498db;
}

pre code {
    background-color: transparent;
    color: #2c3e50;
    padding: 0;
    font-size: 0.875rem;
    border-radius: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
}

/* Copy Button for Code Blocks */
.copy-button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.copy-button:hover {
    background: #2980b9;
}

.copy-button:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 1rem 0;
    display: block;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background-color: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    /* 处理表格溢出 */
    table-layout: fixed;
    word-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #d0d7de;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

tr:hover {
    background-color: #f8f9fa;
}

/* Blockquotes */
blockquote {
    border-left: 4px solid #3498db;
    margin: 1rem 0;
    padding: 1rem 1.5rem;
    background-color: #f8f9fa;
    border-radius: 0 6px 6px 0;
    font-style: italic;
    color: #495057;
}

/* Post/Category Card Layouts */
.posts-grid, .categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.post-card, .category-card {
    background: white;
    border-radius: 12px;
    padding: 1.75rem;
    border-left: 4px solid #3498db;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    border: 2px solid #d0d7de;
    position: relative;
    overflow: hidden;
}

.post-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.post-card:hover::before {
    opacity: 1;
}

.post-card:hover, .category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border-color: #3498db;
}

.post-card h2, .category-card h2 {
    margin: 0;
    font-size: 1.2rem;
    border-bottom: none;
    padding-bottom: 0;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.post-card h3, .category-card h3 {
    margin: 0;
    font-size: 1.1rem;
    border-bottom: none;
    padding-bottom: 0;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

/* Year group headers */
.year-header {
    font-size: 2rem;
    font-weight: 700;
    color: #27ae60;
    margin: 2.5rem 0 1.5rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid #27ae60;
    text-align: left;
}

.post-card a, .category-card a {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 600;
    display: block;
    position: relative;
}

.post-card a:hover, .category-card a:hover {
    color: #3498db;
}

.post-card a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #3498db;
    transition: width 0.3s ease;
}

.post-card a:hover::after {
    width: 100%;
}

/* Post card metadata */
.post-meta {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e9ecef;
    font-size: 0.875rem;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
}

.post-category-tag {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid #bbdefb;
}

.post-date {
    font-size: 0.875rem;
    color: #7f8c8d;
    font-weight: 500;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

/* Post History */
.post-history {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid #d0d7de;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
}

.post-history::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3498db, #9b59b6, #f39c12, #e74c3c);
    background-size: 300% 300%;
    animation: gradientShift 5s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.history-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #d0d7de;
}

.history-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-desc {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
    background: #f8f9fa;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    border: 1px solid #e9ecef;
}

.version-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.version-item {
    background: #ffffff;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    padding: 1.25rem;
    transition: all 0.3s ease;
    position: relative;
}

.version-item:hover {
    border-color: #3498db;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.1);
    transform: translateY(-2px);
}

.version-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.version-badge {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

.version-time {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.version-hash-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.hash-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.version-hash {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    font-size: 0.8rem;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: #ecf0f1;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border: 1px solid #34495e;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    word-break: break-all;
    white-space: normal;
}

.version-hash:hover {
    background: linear-gradient(135deg, #34495e, #2c3e50);
    box-shadow: 0 4px 12px rgba(44, 62, 80, 0.4);
    transform: scale(1.02);
}

.version-hash::before {
    content: '🔑';
    margin-right: 0.5rem;
    opacity: 0.7;
}

/* Article Header */
.article-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #d0d7de;
    flex-wrap: wrap;
    gap: 1rem;
}

.article-title-section {
    flex: 1;
    min-width: 0;
}

.article-title {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 1rem 0;
    line-height: 1.3;
}

/* Article Meta Information */
.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 0.75rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6c757d;
}

.meta-icon {
    font-size: 1rem;
}

.meta-label {
    font-weight: 500;
    color: #495057;
}

.meta-value {
    font-weight: 600;
    color: #2c3e50;
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #d0d7de;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
}

.article-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    cursor: pointer;
}

.pdf-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.pdf-btn:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
    color: white;
}

.source-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.source-btn:hover {
    background: linear-gradient(135deg, #2980b9, #1f5f87);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
    color: white;
}

/* Article Content */
.article-content {
    margin-bottom: 2rem;
}

/* Article Footer */
.article-footer {
    border-top: 1px solid #e9ecef;
    padding-top: 2rem;
}

/* Section Subtitle */
.section-subtitle {
    font-size: 1.1rem;
    color: #6c757d;
    margin-bottom: 2rem;
    font-style: italic;
}

/* Recent Posts (New Post Page) */
.recent-posts-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.recent-post-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    border: 1px solid #d0d7de;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.recent-post-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #3498db, #2980b9);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.recent-post-item:hover::before {
    transform: scaleY(1);
}

.recent-post-item:hover {
    box-shadow: 0 4px 20px rgba(52, 152, 219, 0.15);
    transform: translateY(-2px);
}

.post-abstract {
    margin: 0.75rem 0;
    color: #6c757d;
    font-size: 0.95rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-content {
    flex: 1;
}

.post-content h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.post-content h3 a {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.3s ease;
}

.post-content h3 a:hover {
    color: #3498db;
}

.post-meta-simple {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: #6c757d;
}

.post-full-date {
    font-weight: 500;
}

.post-weekday {
    font-style: italic;
    opacity: 0.8;
}

.view-more {
    text-align: center;
    margin-top: 2rem;
}

.view-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
    transition: all 0.3s ease;
}

.view-more-btn:hover {
    background: linear-gradient(135deg, #2980b9, #1f5f87);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
    color: white;
}

/* Archive Page */
.archive-year-section {
    margin-bottom: 3rem;
}

.archive-year-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #d0d7de;
}

.year-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50;
    background: linear-gradient(135deg, #3498db, #2980b9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.post-count {
    font-size: 1rem;
    color: #6c757d;
    font-weight: 500;
    background: #f8f9fa;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    border: 1px solid #d0d7de;
}

.archive-posts-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.archive-post-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    padding: 1.5rem 2rem;
    background: white;
    border-radius: 12px;
    border: 1px solid #d0d7de;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.archive-post-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #3498db, #2980b9, #9b59b6);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.archive-post-item:hover::before {
    transform: scaleX(1);
}

.archive-post-item:hover {
    box-shadow: 0 4px 20px rgba(52, 152, 219, 0.15);
    transform: translateY(-2px);
}



.archive-post-content {
    flex: 1;
}

.archive-post-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.archive-post-title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.archive-post-title a {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.3s ease;
}

.archive-post-title a:hover {
    color: #3498db;
}

.archive-post-date {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
}



.archive-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.archive-read-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.archive-read-btn:hover {
    background: linear-gradient(135deg, #2980b9, #1f5f87);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
    color: white;
}

/* Build Logs */
.build-logs {
    margin: 1.5rem 0;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    overflow: hidden;
}

.build-logs summary {
    padding: 1rem;
    background-color: #f8f9fa;
    cursor: pointer;
    font-weight: 600;
    user-select: none;
}

.build-logs summary:hover {
    background-color: #e9ecef;
}

.logs-content {
    margin: 0;
    padding: 1rem;
    background-color: #2c3e50;
    color: #ecf0f1;
    border: none;
    border-radius: 0;
    max-height: 300px;
    overflow-y: auto;
    font-size: 0.875rem;
}

/* Back to Top Button */
#back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

#back-to-top:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
}

#back-to-top:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Footer */
#footer {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
    font-size: 0.875rem;
    border-top: 1px solid #e9ecef;
    background-color: #f8f9fa;
}

#footer a {
    color: #3498db;
    text-decoration: none;
}

#footer a:hover {
    color: #2980b9;
}

/* MonoPy branding in footer */
#footer b {
    color: #2c3e50;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    background: linear-gradient(135deg, #3498db, #9b59b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    position: relative;
}

#footer b::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, #3498db, #9b59b6);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#footer b:hover::after {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 1rem 0;
    }
    
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1.5rem;
    }
    
    #header {
        padding: 3rem 1.5rem;
    }
    
    .header-title {
        font-size: 2.2rem !important;
        margin-bottom: 0.75rem !important;
        color: #ffffff !important;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.4) !important;
    }

    .header-subtitle {
        font-size: 1rem !important;
        margin-bottom: 1rem !important;
        color: #ffffff !important;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
    }

    .header-accent {
        width: 60px !important;
        height: 3px !important;
    }
    
    #sidebar {
        position: static;
        order: 2;
        padding: 1rem;
    }
    
    .profile-avatar {
        width: 70px;
        height: 70px;
        border-width: 2px;
    }
    
    .profile-name {
        font-size: 1rem;
    }
    
    /* Navigation 响应式 */
    .nav-header {
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }
    
    .nav-header h2 {
        font-size: 1.1rem;
    }
    
    .nav-subtitle {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
    }
    
    .nav-menu {
        gap: 0.6rem;
    }
    
    .nav-item {
        padding: 0.75rem 0.875rem;
        gap: 0.6rem;
    }
    
    .nav-item:hover {
        transform: translateX(2px);
    }
    
    .nav-text {
        font-size: 0.85rem;
    }
    
    /* Active navigation responsive */
    .nav-item-active {
        transform: translateX(2px);
    }
    
    #content {
        order: 1;
        padding: 1.5rem;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.4rem;
    }
    
    h3 {
        font-size: 1.2rem;
    }
    
    .posts-grid, .categories-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .post-card, .category-card {
        padding: 1.25rem;
        border-radius: 8px;
    }
    
    .post-card h2, .category-card h2 {
        font-size: 1.1rem;
    }
    
    .article-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .article-title {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }
    
    .article-meta {
        gap: 1rem;
    }
    
    .meta-item {
        font-size: 0.8rem;
    }
    
    .meta-value {
        padding: 0.2rem 0.4rem;
        font-size: 0.8rem;
    }
    
    .article-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    .action-btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }
    
    /* Version History 响应式 */
    .post-history {
        padding: 1.5rem;
        margin: 1.5rem 0;
    }
    
    .history-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .history-header h2 {
        font-size: 1.2rem;
    }
    
    .version-item {
        padding: 1rem;
    }
    
    .version-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .version-hash-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .version-hash {
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
        white-space: normal;
        word-break: break-all;
    }
    
    /* Recent Posts 响应式 */
    .recent-post-item {
        padding: 1.25rem;
    }
    
    .post-meta-simple {
        flex-direction: column;
        gap: 0.5rem;
        font-size: 0.85rem;
    }
    
    /* Archive 响应式 */
    .archive-post-item {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1.5rem;
    }
    
    .archive-post-header {
        gap: 0.75rem;
    }
    
    .archive-post-title {
        font-size: 1.2rem;
    }
    
    .archive-post-date {
        font-size: 0.85rem;
    }
    
    .archive-actions {
        align-self: stretch;
    }
    
    .archive-read-btn {
        text-align: center;
        justify-content: center;
    }
    
    #back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.5rem 0;
    }
    
    #main {
        padding: 0 0.5rem;
    }
    
    .content-wrapper {
        padding: 1rem;
    }
    
    #header {
        padding: 2.5rem 1rem;
    }
    
    .header-title {
        font-size: 1.8rem !important;
        margin-bottom: 0.5rem !important;
        color: #ffffff !important;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.4) !important;
    }

    .header-subtitle {
        font-size: 0.9rem !important;
        margin-bottom: 0.75rem !important;
        color: #ffffff !important;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
    }

    .header-accent {
        width: 50px !important;
        height: 2px !important;
    }
    
    #sidebar {
        padding: 0.75rem;
    }
    
    .profile-avatar {
        width: 60px;
        height: 60px;
        border-width: 2px;
    }
    
    .profile-name {
        font-size: 0.95rem;
    }
    
    /* Navigation 小屏幕优化 */
    .nav-header {
        margin-bottom: 0.75rem;
        padding-bottom: 0.5rem;
    }
    
    .nav-header h2 {
        font-size: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .nav-subtitle {
        font-size: 0.7rem;
        padding: 0.15rem 0.5rem;
    }
    
    .nav-menu {
        gap: 0.5rem;
    }
    
    .nav-item {
        padding: 0.6rem 0.75rem;
        gap: 0.5rem;
        border-radius: 6px;
    }
    
    .nav-icon {
        font-size: 1rem;
    }
    
    .nav-text {
        font-size: 0.8rem;
    }
    
    .external-icon {
        font-size: 0.75rem;
    }
    
    /* Active navigation small screen */
    .nav-item-active {
        transform: translateX(1px);
    }
    
    #content {
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    pre {
        padding: 0.75rem;
    }
    
    .copy-button {
        top: 0.25rem;
        right: 0.25rem;
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
    }
    
    /* Version History 小屏幕优化 */
    .post-history {
        padding: 1rem;
        margin: 1rem 0;
        border-radius: 8px;
    }
    
    .history-header h2 {
        font-size: 1.1rem;
    }
    
    .history-desc {
        font-size: 0.8rem;
        padding: 0.2rem 0.6rem;
    }
    
    .version-item {
        padding: 0.75rem;
    }
    
    .version-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
    }
    
    .version-time {
        font-size: 0.8rem;
    }
    
    .hash-label {
        font-size: 0.8rem;
    }
    
    .version-hash {
        font-size: 0.7rem;
        padding: 0.3rem 0.5rem;
    }
    
    /* Recent Posts 小屏幕优化 */
    .recent-post-item {
        padding: 1rem;
    }
    
    .post-content h3 {
        font-size: 1.2rem;
    }
    
    .post-meta-simple {
        font-size: 0.8rem;
    }
    
    .view-more-btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.9rem;
    }
    
    /* Archive 小屏幕优化 */
    .archive-year-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .year-number {
        font-size: 2rem;
    }
    
    .archive-post-item {
        padding: 1.25rem;
        gap: 0.75rem;
    }
    
    .archive-post-title {
        font-size: 1.1rem;
    }
    
    .archive-post-date {
        font-size: 0.8rem;
    }
    
    .archive-read-btn {
        padding: 0.6rem 1.25rem;
        font-size: 0.85rem;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Focus Styles for Accessibility */
a:focus, button:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* 数学公式换行和溢出处理 */
.katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    word-wrap: break-word;
    margin: 1rem 0;
}

.katex {
    font-size: 1em !important;
    word-wrap: break-word;
    word-break: break-word;
}

/* 表格容器，处理横向滚动 */
.table-container {
    overflow-x: auto;
    margin: 1.5rem 0;
    max-width: 100%;
}

/* 长单词和URL的特殊处理 */
article span,
article div {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* 特殊处理非常长的文本 */
article * {
    max-width: 100%;
    box-sizing: border-box;
}

/* 列表项的换行处理 */
ul li, ol li {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* 引用块的换行处理 */
blockquote {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Print Styles */
@media print {
    #sidebar {
        display: none;
    }
    
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    #header {
        background: none;
        color: black;
        box-shadow: none;
    }
    
    #content {
        box-shadow: none;
        padding: 0;
    }
    
    a {
        color: black;
        text-decoration: underline;
    }
    
    #back-to-top {
        display: none;
    }
    
    .copy-button {
        display: none;
    }
}