/* style.css - 博客统一样式文件 */
/* 紫色和绿色配色方案 */

/* CSS变量定义 */
:root {
    --primary-color: #8e44ad;    /* 紫色 */
    --secondary-color: #2c3e50;  /* 深蓝灰 */
    --accent-color: #27ae60;     /* 绿色 */
    --light-color: #f5f7fa;
    --dark-color: #34495e;
    --text-color: #2c3e50;
    --text-light: #7f8c8d;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f9f9f9;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition);
}

a:hover {
    color: var(--accent-color);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 头部样式 */
header {
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}
.logo {
    display: flex;
    align-items: center;
    height: 40px; /* 设置logo容器的高度 */
}
.logo img {
    height: 100%; /* 图片高度与容器高度一致 /
    width: auto; / 宽度自适应 */
}
.logo-container {
    display: flex;
    align-items: center;
}

.company-logo {
    height: 50px;
    width: auto;
    transition: var(--transition);
}

nav ul {
    display: flex;
}

nav li {
    margin-left: 1.5rem;
}

nav a {
    color: var(--dark-color);
    font-weight: 500;
    position: relative;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: var(--transition);
}

nav a:hover::after,
nav a.active::after {
    width: 100%;
}

nav a.active {
    color: var(--primary-color);
}

/* 页面内容样式 */
.page-content {
    padding: 2rem 0;
}

/* 英雄区域样式 */
.hero {
    background: linear-gradient(135deg, rgba(142, 68, 173, 0.8), rgba(39, 174, 96, 0.7)),
                url('https://images.unsplash.com/photo-1517077304055-6e89abbf09b0?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80');
    background-size: cover;
    background-position: center;
    color: white;
    padding: 10rem 0 6rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    animation: fadeInDown 1s ease;
}

.hero p {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    animation: fadeInUp 1s ease 0.3s both;
}

.hero-btns {
    display: flex;
    justify-content: center;
    gap: 1rem;
    animation: fadeInUp 1s ease 0.6s both;
}

.btn {
    display: inline-block;
    padding: 0.8rem 1.8rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background-color: #219653;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background-color: transparent;
    color: white;
    border: 2px solid white;
}

.btn-secondary:hover {
    background-color: white;
    color: var(--secondary-color);
    transform: translateY(-3px);
}

/* 动画定义 */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 特色区域样式 */
.features {
    padding: 5rem 0;
    background-color: white;
}

.section-title {
    font-size: 2.2rem;
    margin-bottom: 3rem;
    color: var(--secondary-color);
    text-align: center;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background-color: var(--primary-color);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
}

.feature-card {
    background-color: white;
    padding: 2.5rem 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
}

.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.feature-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: white;
    font-size: 2rem;
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.feature-card p {
    color: var(--text-light);
}

/* 文章卡片通用样式 */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.post-card {
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.post-image {
    height: 200px;
    overflow: hidden;
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.post-card:hover .post-image img {
    transform: scale(1.05);
}

.post-content {
    padding: 1.5rem;
}

.post-category {
    display: inline-block;
    background-color: var(--light-color);
    color: var(--text-light);
    font-size: 0.8rem;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    margin-bottom: 0.8rem;
}

.post-title {
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
    color: var(--secondary-color);
}

.post-excerpt {
    color: var(--text-light);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* 精选文章区域 */
.featured-posts {
    padding: 5rem 0;
    background-color: #f5f7fa;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.view-all {
    color: var(--primary-color);
    font-weight: 500;
    display: flex;
    align-items: center;
}

.view-all i {
    margin-left: 0.5rem;
    transition: var(--transition);
}

.view-all:hover i {
    transform: translateX(5px);
}

/* 列表页样式 */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    color: var(--secondary-color);
}

.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.category {
    background-color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.category.active {
    background-color: var(--primary-color);
    color: white;
}

.search-box {
    display: flex;
    margin: 1rem 0;
}

.search-box input {
    padding: 0.7rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    width: 250px;
}

.search-box button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0 1rem;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    cursor: pointer;
}

.list-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.list-post-card {
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.list-post-card:hover {
    transform: translateY(-5px);
}

.list-post-image {
    height: 200px;
    overflow: hidden;
}

.list-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.list-post-card:hover .list-post-image img {
    transform: scale(1.05);
}

.list-post-content {
    padding: 1.5rem;
}

.list-post-title {
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
    color: var(--secondary-color);
}

.pagination {
    display: flex;
    justify-content: center;
    margin-top: 3rem;
}

.pagination a {
    display: inline-block;
    padding: 0.7rem 1rem;
    margin: 0 0.3rem;
    background-color: white;
    border-radius: var(--border-radius);
    color: var(--dark-color);
    transition: var(--transition);
}

.pagination a.active {
    background-color: var(--primary-color);
    color: white;
}

.pagination a:hover:not(.active) {
    background-color: var(--light-color);
}

/* 详情页样式 */
.article-header {
    margin-bottom: 2rem;
}

.article-title {
    font-size: 2.2rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.article-meta {
    display: flex;
    align-items: center;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.article-meta span {
    margin-right: 1.5rem;
    display: flex;
    align-items: center;
}

.article-meta i {
    margin-right: 0.5rem;
}

.article-image {
    height: 400px;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 2rem;
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-content {
    background-color: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.article-content p {
    margin-bottom: 1.5rem;
}

.article-content h2 {
    font-size: 1.6rem;
    color: var(--secondary-color);
    margin: 2rem 0 1rem;
}

.article-content h3 {
    font-size: 1.3rem;
    color: var(--secondary-color);
    margin: 1.5rem 0 1rem;
}

.article-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--text-light);
}

.article-content pre {
    background-color: var(--light-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
    margin: 1.5rem 0;
}

.article-content code {
    background-color: var(--light-color);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 2rem 0;
}

.tag {
    background-color: var(--light-color);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-light);
}

.article-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

.nav-btn {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.5rem;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.nav-btn:hover {
    background-color: var(--light-color);
}

.nav-btn.prev i {
    margin-right: 0.5rem;
}

.nav-btn.next i {
    margin-left: 0.5rem;
}

/* 侧边栏样式 */
.sidebar {
    margin-top: 3rem;
}

.sidebar-widget {
    background-color: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 2rem;
}

.widget-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
    position: relative;
    padding-bottom: 0.5rem;
}

.widget-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 2px;
    background-color: var(--primary-color);
}

.popular-posts li {
    display: flex;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.popular-posts li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.popular-post-img {
    width: 80px;
    height: 60px;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-right: 1rem;
}

.popular-post-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popular-post-content h4 {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.popular-post-content span {
    font-size: 0.8rem;
    color: var(--text-light);
}

.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* 统计区域 */
.stats {
    padding: 4rem 0;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    text-align: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.stat-item {
    padding: 1.5rem;
}

.stat-number {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 通讯订阅区域 */
.newsletter {
    padding: 5rem 0;
    background-color: white;
    text-align: center;
}

.newsletter-content {
    max-width: 600px;
    margin: 0 auto;
}

.newsletter h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.newsletter p {
    color: var(--text-light);
    margin-bottom: 2rem;
}

.newsletter-form {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
}

.newsletter-form input {
    flex: 1;
    padding: 0.9rem 1.2rem;
    border: 2px solid #ddd;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    font-size: 1rem;
}

.newsletter-form button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0 1.5rem;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.newsletter-form button:hover {
    background-color: #7d3c98;
}

/* 页脚样式 */
footer {
    background-color: var(--secondary-color);
    color: white;
    padding: 4rem 0 1.5rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2.5rem;
    margin-bottom: 2.5rem;
}

.footer-widget h3 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.8rem;
}

.footer-widget h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 2px;
    background-color: var(--primary-color);
}

.footer-links li {
    margin-bottom: 0.8rem;
}

.footer-links a {
    color: #bdc3c7;
    transition: var(--transition);
}

.footer-links a:hover {
    color: white;
    padding-left: 5px;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.social-links a {
    display: inline-block;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    text-align: center;
    line-height: 40px;
    color: white;
    transition: var(--transition);
}

.social-links a:hover {
    background-color: var(--primary-color);
    transform: translateY(-3px);
}

.copyright {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #bdc3c7;
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 992px) {
    .posts-grid,
    .list-posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }

    .article-image {
        height: 300px;
    }

    .hero h1 {
        font-size: 2.8rem;
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        text-align: center;
    }

    nav ul {
        margin-top: 1rem;
    }

    .hero {
        padding: 8rem 0 4rem;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .hero p {
        font-size: 1.1rem;
    }

    .hero-btns {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .btn {
        width: 200px;
    }

    .filter-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-box {
        width: 100%;
        margin-top: 1rem;
    }

    .search-box input {
        width: 100%;
    }

    .article-title {
        font-size: 1.8rem;
    }

    .article-content {
        padding: 1.5rem;
    }

    .article-navigation {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-btn {
        justify-content: center;
    }

    .section-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .newsletter-form {
        flex-direction: column;
        gap: 1rem;
    }

    .newsletter-form input,
    .newsletter-form button {
        border-radius: var(--border-radius);
        width: 100%;
    }
}

@media (max-width: 576px) {
    .posts-grid,
    .list-posts-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 7rem 0 3rem;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .article-image {
        height: 200px;
    }

    .article-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .article-meta span {
        margin-bottom: 0.5rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}
