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

body,
html {
    height: 100%;
    font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f0f0f0;
    background-image: radial-gradient(circle, #fff 10%, transparent 20%),
        radial-gradient(circle, #fff 10%, transparent 20%);
    background-size: 50px 50px;
    background-position: 0 0, 25px 25px;
}

body {
    display: flex;
    flex-direction: column;
}

.container {
    flex: 1;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.container h1 {
    text-align: center;
}

.container ul {
    margin-inline-start: 1.5em;
}

section {
    margin: 20px 0;
    /* 外边距：上下20px，左右自动 */
    padding: 10px;
    /* 内边距：10px */
    background-color: #f9f9f973;
    /* 背景颜色 */
    border-radius: 8px;
    /* 圆角边框 */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    /* 轻微的阴影效果 */
}

/* 标题样式 */
section h2 {
    font-size: 24px;
    /* 字体大小 */
    color: #333;
    /* 字体颜色 */
    border-bottom: 2px solid #e0e0e0;
    /* 底部边框 */
    padding-bottom: 10px;
    /* 底部内边距 */
    margin-bottom: 15px;
    /* 底部外边距 */
}

/* 文本样式 */
section p {
    font-family: Arial, sans-serif;
    /* 字体族 */
    font-size: 16px;
    /* 字体大小 */
    line-height: 1.6;
    /* 行高 */
    color: #555;
    /* 字体颜色 */
    margin-bottom: 15px;
    /* 段落下方间距 */
}

/* 代码块样式 */
section code {
    display: block;
    color: #ccc;
    /* 背景颜色 */
    padding: 2px 4px;
    /* 内边距 */
    border-radius: 3px;
    /* 圆角 */
    font-family: 'Courier New', monospace;
    /* 等宽字体 */
    color: #e74c3c;
    /* 字体颜色 */
}


section pre {
    background-color: #333;
    margin: 10px 0;
    /* 背景颜色 */
    padding: 10px;
    /* 内边距 */
    border-radius: 5px;
    /* 圆角 */
    overflow-x: auto;
    /* 横向滚动条 */
    color: #333;
    /* 字体颜色 */
    white-space: pre-wrap;
    /* 自动换行 */
    margin-bottom: 15px;
    /* 底部外边距 */
}

/* 列表样式 */
section ul,
section ol {
    margin: 15px 0;
    /* 外边距 */
    padding-left: 20px;
    /* 左内边距 */
    list-style-position: inside;
    /* 列表项内嵌 */
}

section li {
    margin-bottom: 10px;
    /* 列表项间距 */
}

/* 链接样式 */
section a {
    color: #3498db;
    /* 链接颜色 */
    text-decoration: none;
    /* 去除下划线 */
}

section a:hover {
    text-decoration: underline;
    /* 悬停时下划线 */
}

main {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    align-content: center;
}

/* 欢迎区域和文章内容区域 */
.welcome-section,
.blog-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1), 0 15px 25px rgba(0, 0, 0, 0.2);
    margin: 20px;
    width: calc(100% - 40px);
    max-width: 800px;
}

/* 文章列表样式 */
.blog-post {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1), 0 15px 25px rgba(0, 0, 0, 0.2);
    margin: 20px;
    width: calc(100% - 40px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.blog-post h2 {
    margin-bottom: 15px;
    font-size: 2rem;
    color: #4CAF50;
    text-shadow: 1px 2px 3px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.blog-post p {
    font-size: 1.2rem;
    line-height: 1.6;
    text-align: justify;
}

/* 文章悬停效果 */
.blog-post:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15), 0 15px 30px rgba(0, 0, 0, 0.25);
}

/* 阅读更多按钮 */
.read-more {
    display: inline-block;
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border-radius: 25px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.read-more:hover {
    background-color: #26A65B;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.read-more:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: inherit;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.3s ease;
}

.read-more:hover:after {
    transform: translate(-50%, -50%) scale(1);
}

/* 页头样式 */
header {
    background-color: #4CAF50;
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    animation: headerAnim 2s infinite alternate;
}

@keyframes headerAnim {
    from {
        background-color: #4CAF50;
    }

    to {
        background-color: #26A65B;
    }
}

header h1 {
    margin: 0;
    font-size: 2.5rem;
    text-shadow: 2px 4px 6px rgba(0, 0, 0, 0.3);
}

/* 导航栏样式 */
nav ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    background-color: #37474F;
    text-align: center;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

nav ul li {
    display: inline-block;
}

nav ul li a {
    display: block;
    color: white;
    padding: 15px 20px;
    text-decoration: none;
    font-size: 1.2rem;
    position: relative;
}

nav ul li a:after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background: #4CAF50;
    left: 0;
    bottom: 0;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease-out;
}

nav ul li a:hover:after {
    transform: scaleX(1);
    transform-origin: left;
}

nav ul li a:hover {
    background-color: #5E737B;
    color: #4CAF50;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.3);
}

/* 页脚样式 */
footer {
    background-color: #4CAF50;
    color: white;
    text-align: center;
    padding: 20px 0;
    border-radius: 30px 30px 0 0;
    box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
    margin-top: auto;
}

footer:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.2), transparent);
    opacity: 0.3;
    z-index: -1;
    border-radius: inherit;
}

footer p {
    margin: 0;
    font-size: 1.1rem;
    text-shadow: 1px 2px 3px rgba(0, 0, 0, 0.3);
}

/* 响应式布局 */
@media (max-width: 992px) {
    .blog-post {
        width: calc(100% - 40px);
    }

    nav ul li a {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .blog-post h2 {
        font-size: 1.8rem;
    }

    .blog-post p {
        font-size: 1rem;
    }

    .read-more {
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    header h1 {
        font-size: 1.5rem;
    }

    nav ul li a {
        padding: 10px;
        font-size: 1rem;
    }

    .blog-post {
        margin: 10px;
    }

    .blog-post h2 {
        font-size: 1.5rem;
    }

    .blog-post p {
        font-size: 0.9rem;
    }

    .read-more {
        font-size: 0.9rem;
        padding: 8px 15px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 应用动画到每个博客文章 */
.blog-post {
    animation: fadeIn 0.5s ease-out forwards;
}

/* 给每个偶数文章添加不同的延迟，制造交错效果 */
.blog-post:nth-child(even) {
    animation-delay: 0.2s;
}

/* 给每个奇数文章添加不同的延迟，制造交错效果 */
.blog-post:nth-child(odd) {
    animation-delay: 0.4s;
}

/* 背景图片伪元素 */
.blog-post:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.1;
    z-index: 0;
}

footer p.footer-links img {
    vertical-align: middle;
    height: 40px;
}

pre {
    background: #333;
    padding: 10px;
    border-radius: 5px;
    position: relative;
    margin: 10px 0;
}

pre code {
    display: block;
    color: #ccc;
}