﻿/* common.css - 共享样式 */
/* 重置样式和基础设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1a73e8;
    --secondary-color: #34a853;
    --accent-color: #ea4335;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --background: #ffffff;
    --surface: #f8f9fa;
    --border: #dadce0;
    --shadow: 0 1px 3px rgba(0,0,0,0.12);
    --radius: 8px;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: opacity 0.3s;
}

/* 响应式容器 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 网格系统 */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col-12 { width: 100%; padding: 0 15px; }
.col-md-8 { width: 66.6667%; padding: 0 15px; }
.col-md-4 { width: 33.3333%; padding: 0 15px; }


/* 基础排版 */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn:hover {
    background-color: #0d62d9;
    text-decoration: none;
    color: white;
}

/* 卡片组件 */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

/* 导航栏基础样式 */
.site-header {
    background: white;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    position: relative;
}
.logo-nav {
	display: flex;
}
.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1002;
}

.logo:hover {
    text-decoration: none;
    opacity: 0.9;
}

.lang-link {
    margin-left: 20px;
    color: #555;
    text-decoration: none;
    display: flex;
	align-items: center;
	gap: 10px;
}

.lang-link:hover {
    color: #000;
    text-decoration: underline;
}

/* 桌面导航菜单 */
.desktop-nav {
    margin-left: auto;
}

.nav-menu {
    display: flex;
    gap: 30px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    color: var(--text-primary);
    font-weight: 500;
    text-decoration: none;
    padding: 8px 0;
    position: relative;
    transition: color 0.2s;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.nav-link:after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    bottom: 0;
    left: 0;
    transition: width 0.3s;
}

.nav-link:hover:after {
    width: 100%;
}

/* 当前页面高亮 */
.nav-link.active {
    color: var(--primary-color);
    font-weight: 600;
}

/* 移动端菜单按钮 */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-primary);
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s;
    z-index: 1001;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
}

.menu-toggle:hover {
    background-color: var(--surface);
}

/* 移动端菜单样式 */
@media (max-width: 820px) {
    /* 隐藏桌面导航 */
    .desktop-nav {
        display: none;
    }
    /* 显示移动端菜单按钮 */
    .menu-toggle {
        display: flex;
    }
    .col-md-8, .col-md-4 {
        width: 100%;
    }
	.col-md-4 {margin-top:20px;}
    .container {
        padding: 0 15px;
    }
    .footer-content {
        flex-direction: column;
    }
    .footer-section {
        width: 100%;
    }
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.25rem; }
    .header-content {
        padding: 10px 0;
    }
    .logo {
        font-size: 1.5rem;
    }
    .related-articles-grid {
        grid-template-columns: 1fr;
    }
}

/* 页脚样式 */
.site-footer {
    background: var(--surface);
    padding: 40px 0;
    margin-top: 60px;
    border-top: 1px solid var(--border);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 30px;
}

.footer-section {
    flex: 1;
    min-width: 250px;
}

.footer-section h4 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
width: 25%;
  float: left;
}

.footer-section a {
    color: var(--text-secondary);
}

.footer-section a:hover {
    color: var(--primary-color);
}

.copyright {
    text-align: center;
    padding-top: 20px;
    margin-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* 文章列表项 */
.article-item {
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
    transition: background-color 0.2s;
}

.article-item:hover {
    background-color: var(--surface);
    padding-left: 10px;
    padding-right: 10px;
    margin-left: -10px;
    margin-right: -10px;
    border-radius: var(--radius);
}

.article-item:last-child {
    border-bottom: none;
}

.article-meta {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.article-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.category {
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.article-title {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.article-excerpt {
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.6;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.tag {
    display: inline-block;
    background: var(--surface);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.tag:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
}

/* 面包屑导航 */
.breadcrumb {
    padding: 15px 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.breadcrumb a {
    color: var(--text-secondary);
}

.breadcrumb a:hover {
    color: var(--primary-color);
}

.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%; /* 默认隐藏在屏幕右侧 */
    width: 300px;
    max-width: 85%;
    height: 100vh;
    background: white;
    z-index: 2000;
    transition: right 0.3s ease; /* 平滑滑动 */
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    overflow-y: auto; /* 允许内部滚动 */
    display: flex;
    flex-direction: column; /* 垂直布局 */
    padding: 0; /* 移除旧的padding，由内部元素控制 */
}

.mobile-nav.active {
    right: 0; /* 滑动进入视口 */
}

/* 移动菜单头部 */
.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.mobile-menu-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* 确保关闭按钮可见且可点击 */
.close-menu {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
    /* 移除 absolute 定位，使用flex布局 */
    position: relative;
    top: auto;
    right: auto;
}

.close-menu:hover {
    background-color: var(--surface);
}

/* 移动菜单列表 */
.mobile-nav .nav-menu {
    flex: 1; /* 占据剩余空间 */
    list-style: none;
    padding: 20px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0; /* 由li的边框分隔 */
}

.mobile-nav .nav-menu li {
    width: 100%;
}

.mobile-nav .nav-link {
    display: block;
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
    width: 100%;
    text-align: left;
    color: var(--text-primary);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s, background-color 0.2s;
}

.mobile-nav .nav-link:hover,
.mobile-nav .nav-link.active {
    color: var(--primary-color);
    background-color: var(--surface);
    text-decoration: none;
}

/* 移动菜单页脚 */
.mobile-nav-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* 防止body滚动 */
body.menu-open {
    overflow: hidden;
}
    /* 相关文章区域 */
    .related-articles-section {
        margin-top: 60px;
        padding-top: 30px;
        border-top: 2px solid var(--border);
    }
    
    .related-articles-section h3 {
        margin-bottom: 20px;
        color: var(--primary-color);
    }
/* 相关文章 */
.related-articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.related-article-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.related-article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}

.related-article-card h4 {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.related-article-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
    line-height: 1.5;
}
/* 侧边栏样式 */
.hot-articles,
.related-articles {
    list-style: none;
}

.hot-articles li,
.related-articles li {
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s;
    padding-left: 10px;
    padding-right: 10px;
    border-radius: 4px;
}

.hot-articles li:hover,
.related-articles li:hover {
    background-color: var(--surface);
}

.hot-articles li:last-child,
.related-articles li:last-child {
    border-bottom: none;
}

.hot-articles a,
.related-articles a {
    display: block;
    text-decoration: none;
}

.hot-title,
.related-title {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.hot-views,
.related-desc {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
}