/* ========================================
   唐仔仔的技术博客 - 主样式表
   ======================================== */

/* CSS变量定义 */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --accent-color: #06b6d4;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-dark: #0f172a;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s ease;
}

/* 重置样式 */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   头部导航
   ======================================== */
.header {
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.nav {
    display: flex;
    gap: 32px;
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 8px 0;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* 移动端菜单按钮 */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

/* ========================================
   主要内容区
   ======================================== */
.main {
    min-height: calc(100vh - 64px - 200px);
    padding: 40px 0;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 40px;
}

/* ========================================
   文章卡片
   ======================================== */
.article-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.article-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.article-header {
    margin-bottom: 20px;
}

.article-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.4;
}

.article-title a {
    color: var(--text-primary);
}

.article-title a:hover {
    color: var(--primary-color);
}

.article-meta {
    display: flex;
    gap: 16px;
    color: var(--text-light);
    font-size: 0.875rem;
    flex-wrap: wrap;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.article-summary {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.8;
}

.article-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 0.875rem;
    transition: var(--transition);
}

.tag:hover {
    background: var(--primary-color);
    color: white;
}

/* ========================================
   侧边栏
   ======================================== */
.sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.widget {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.widget-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

/* 个人简介 */
.profile-widget {
    text-align: center;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
}

.profile-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.profile-bio {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* 搜索框 */
.search-form {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
}

/* 标签云 */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-cloud .tag {
    font-size: 0.8125rem;
}

/* 归档列表 */
.archive-list {
    list-style: none;
}

.archive-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.archive-item:last-child {
    border-bottom: none;
}

.archive-link {
    color: var(--text-secondary);
}

.archive-link:hover {
    color: var(--primary-color);
}

.archive-count {
    background: var(--bg-secondary);
    color: var(--text-light);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
}

/* ========================================
   文章详情页
   ======================================== */
.article-detail {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-sm);
}

.article-detail .article-title {
    font-size: 2rem;
    margin-bottom: 20px;
}

.article-content {
    font-size: 1.0625rem;
    line-height: 1.9;
    color: var(--text-primary);
}

.article-content h2,
.article-content h3,
.article-content h4 {
    margin-top: 40px;
    margin-bottom: 16px;
    font-weight: 600;
}

.article-content h2 {
    font-size: 1.75rem;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.article-content h3 {
    font-size: 1.375rem;
}

.article-content p {
    margin-bottom: 20px;
}

.article-content ul,
.article-content ol {
    margin-bottom: 20px;
    padding-left: 24px;
}

.article-content li {
    margin-bottom: 8px;
}

.article-content code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    color: var(--accent-color);
}

.article-content pre {
    background: var(--bg-dark);
    color: #e2e8f0;
    padding: 20px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: 20px;
}

.article-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.article-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 20px;
    margin: 20px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.article-content img {
    border-radius: var(--radius-md);
    margin: 20px 0;
}

/* ========================================
   关于我页面
   ======================================== */
.about-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 48px;
    box-shadow: var(--shadow-sm);
}

.about-header {
    text-align: center;
    margin-bottom: 48px;
}

.about-avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    color: white;
    font-size: 4rem;
    font-weight: 700;
}

.about-name {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.about-title {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
}

.about-content h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.about-content p {
    margin-bottom: 20px;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* 技能展示 */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.skill-card {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: var(--radius-md);
    text-align: center;
}

.skill-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.skill-name {
    font-weight: 600;
    margin-bottom: 8px;
}

.skill-level {
    color: var(--text-light);
    font-size: 0.875rem;
}

/* 联系方式 */
.contact-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 32px;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: var(--transition);
}

.contact-link:hover {
    background: var(--primary-color);
    color: white;
}

/* ========================================
   分页
   ======================================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--primary-color);
    color: white;
}

.pagination .active {
    background: var(--primary-color);
    color: white;
}

.pagination .disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   页脚
   ======================================== */
.footer {
    background: var(--bg-dark);
    color: var(--text-light);
    padding: 48px 0 24px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 32px;
}

.footer-section h4 {
    color: white;
    margin-bottom: 16px;
    font-size: 1.125rem;
}

.footer-section p,
.footer-section a {
    color: var(--text-light);
    line-height: 1.8;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.875rem;
}

.icp-number {
    margin-top: 8px;
    font-size: 0.8125rem;
}

.icp-number a {
    color: rgba(255, 255, 255, 0.7);
    transition: var(--transition);
}

.icp-number a:hover {
    color: white;
    text-decoration: underline;
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 24px;
    }
    
    .widget {
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {
    .nav {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        flex-direction: column;
        padding: 20px;
        box-shadow: var(--shadow-md);
        gap: 0;
    }
    
    .nav.active {
        display: flex;
    }
    
    .nav-link {
        padding: 12px 0;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-link:last-child {
        border-bottom: none;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .article-card {
        padding: 24px;
    }
    
    .article-detail {
        padding: 24px;
    }
    
    .article-detail .article-title {
        font-size: 1.5rem;
    }
    
    .about-section {
        padding: 32px 24px;
    }
    
    .about-avatar {
        width: 120px;
        height: 120px;
        font-size: 3rem;
    }
    
    .contact-links {
        flex-direction: column;
    }
    
    .skills-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .main {
        padding: 24px 0;
    }
    
    .article-title {
        font-size: 1.25rem;
    }
    
    .article-meta {
        font-size: 0.75rem;
    }
    
    .widget {
        padding: 20px;
    }
}
