/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.8;
    color: #333;
    background-color: #f5f7fa;
}

a {
    color: #4a6cf7;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #3451b2;
    text-decoration: underline;
}

/* 容器 - 自适应不同屏幕 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* 头部 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 60px 0;
    text-align: center;
}

header h1 {
    font-size: 2.8em;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

header h1 a {
    color: white;
    text-decoration: none;
}

header .subtitle {
    font-size: 1.2em;
    opacity: 0.9;
    font-weight: 300;
}

/* 导航 */
nav {
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 8px;
    padding: 12px 0;
    justify-content: center;
}

nav a {
    color: #555;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

nav a:hover,
nav a.active {
    background: #4a6cf7;
    color: white;
    text-decoration: none;
}

/* 主布局 */
main {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 40px;
    padding: 40px 0;
}

/* 文章详情页布局 */
body.article-page .article-main {
    display: block;
    max-width: 900px;
    margin: 0 auto;
}

body.article-page .article-detail {
    max-width: 100%;
    padding: 48px;
}

/* 大屏幕 */
@media (min-width: 1400px) {
    body.article-page .article-main {
        max-width: 1000px;
    }
    body.article-page .article-detail {
        padding: 60px 80px;
    }
}

/* 平板 */
@media (max-width: 768px) {
    body.article-page .article-detail {
        padding: 32px;
    }
}

/* 手机 */
@media (max-width: 575px) {
    body.article-page .article-detail {
        padding: 24px;
    }
}

/* 文章列表 */
.articles-list {
    min-width: 0;
}

.articles-list h2 {
    font-size: 1.6em;
    font-weight: 600;
    margin-bottom: 30px;
    color: #1a1a2e;
}

.article-card {
    background: white;
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border: 1px solid #eee;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.article-card h3 {
    font-size: 1.35em;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.4;
}

.article-card h3 a {
    color: #1a1a2e;
}

.article-card h3 a:hover {
    color: #4a6cf7;
}

.article-meta {
    font-size: 0.9em;
    color: #888;
    margin-bottom: 16px;
}

.article-excerpt {
    color: #666;
    font-size: 1em;
    line-height: 1.7;
    margin-bottom: 16px;
}

.article-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    background: #f0f4ff;
    color: #4a6cf7;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
}

/* 侧边栏 */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.widget {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #eee;
}

.widget h3 {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1a1a2e;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f4ff;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tags .tag {
    background: #f0f4ff;
    color: #4a6cf7;
}

#article-count {
    font-weight: 700;
    color: #4a6cf7;
    font-size: 1.2em;
}

/* 页脚 */
footer {
    background: #1a1a2e;
    color: #888;
    text-align: center;
    padding: 40px 0;
    margin-top: 60px;
}

footer p {
    margin: 8px 0;
    font-size: 0.95em;
}

/* 文章详情页 */
.article-detail {
    background: white;
    border-radius: 16px;
    padding: 48px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #eee;
}

.article-detail h1 {
    font-size: 2.2em;
    font-weight: 700;
    margin-bottom: 16px;
    color: #1a1a2e;
    line-height: 1.3;
}

.article-detail .article-meta {
    font-size: 0.95em;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.article-detail .content {
    line-height: 1.9;
    font-size: 1.05em;
}

.article-detail .content h2 {
    font-size: 1.5em;
    font-weight: 600;
    margin: 36px 0 18px;
    color: #1a1a2e;
}

.article-detail .content h3 {
    font-size: 1.2em;
    font-weight: 600;
    margin: 28px 0 14px;
    color: #2d2d44;
}

.article-detail .content h4 {
    font-size: 1.1em;
    font-weight: 600;
    margin: 24px 0 12px;
    color: #444;
}

.article-detail .content p {
    margin-bottom: 18px;
    color: #444;
}

.article-detail .content code {
    background: #f5f7ff;
    color: #4a6cf7;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
    font-weight: 500;
}

.article-detail .content pre {
    background: #1a1a2e;
    color: #e0e0e0;
    padding: 24px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 24px 0;
    border: 1px solid #2d2d44;
}

.article-detail .content pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: 0.9em;
    line-height: 1.6;
}

.article-detail .content ul,
.article-detail .content ol {
    margin: 20px 0;
    padding-left: 28px;
}

.article-detail .content li {
    margin-bottom: 10px;
    color: #444;
}

.article-detail .content blockquote {
    border-left: 4px solid #4a6cf7;
    padding: 16px 20px;
    margin: 24px 0;
    background: #f5f7ff;
    border-radius: 0 8px 8px 0;
    color: #555;
}

.article-detail .content table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
}

.article-detail .content table th,
.article-detail .content table td {
    border: 1px solid #e0e0e0;
    padding: 12px 16px;
    text-align: left;
}

.article-detail .content table th {
    background: #f5f7ff;
    font-weight: 600;
}

.article-detail .content table tr:hover {
    background: #fafafa;
}

.article-detail .content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
}

.article-detail .content hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 32px 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    color: #4a6cf7;
    font-weight: 500;
    font-size: 0.95em;
}

.back-link:hover {
    color: #3451b2;
}

/* 响应式设计 */

/* 大屏幕 (1400px以上) */
@media (min-width: 1400px) {
    .container {
        max-width: 1280px;
    }
    
    .article-detail {
        padding: 60px 80px;
    }
}

/* 笔记本电脑 (1024px - 1399px) */
@media (max-width: 1199px) {
    .container {
        max-width: 960px;
    }
    
    main {
        grid-template-columns: 1fr 280px;
        gap: 32px;
    }
    
    .article-detail {
        padding: 40px;
    }
    
    .article-detail h1 {
        font-size: 2em;
    }
}

/* 平板 (768px - 1023px) */
@media (max-width: 1023px) {
    .container {
        max-width: 720px;
    }
    
    main {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .sidebar {
        order: -1;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    header h1 {
        font-size: 2.2em;
    }
    
    header {
        padding: 50px 0;
    }
    
    .article-card {
        padding: 24px;
    }
    
    .article-detail {
        padding: 32px;
    }
    
    .article-detail h1 {
        font-size: 1.8em;
    }
}

/* 大手机 (576px - 767px) */
@media (max-width: 767px) {
    .container {
        padding: 0 20px;
    }
    
    main {
        padding: 24px 0;
    }
    
    .sidebar {
        grid-template-columns: 1fr;
    }
    
    header {
        padding: 40px 0;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    header .subtitle {
        font-size: 1.1em;
    }
    
    nav ul {
        gap: 4px;
    }
    
    nav a {
        padding: 8px 14px;
        font-size: 0.95em;
    }
    
    .article-card {
        padding: 20px;
        border-radius: 12px;
    }
    
    .article-card h3 {
        font-size: 1.2em;
    }
    
    .article-detail {
        padding: 24px;
        border-radius: 12px;
    }
    
    .article-detail h1 {
        font-size: 1.6em;
    }
    
    .article-detail .content {
        font-size: 1em;
    }
    
    .article-detail .content pre {
        padding: 16px;
        font-size: 0.9em;
    }
}

/* 小手机 (575px以下) */
@media (max-width: 575px) {
    .container {
        padding: 0 16px;
    }
    
    header {
        padding: 32px 0;
    }
    
    header h1 {
        font-size: 1.5em;
    }
    
    header .subtitle {
        font-size: 1em;
    }
    
    nav a {
        padding: 8px 12px;
        font-size: 0.9em;
    }
    
    .article-card {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .article-detail {
        padding: 20px;
    }
    
    .article-detail h1 {
        font-size: 1.4em;
    }
    
    .articles-list h2 {
        font-size: 1.3em;
    }
    
    .widget {
        padding: 20px;
    }
    
    footer {
        padding: 30px 0;
    }
}

/* 平滑动画 */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
    
    .article-card,
    nav a {
        transition: all 0.2s ease;
    }
}

/* 打印样式 */
@media print {
    nav,
    .sidebar,
    footer {
        display: none;
    }
    
    .article-detail {
        box-shadow: none;
        border: none;
    }
    
    main {
        display: block;
    }
}
