/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", sans-serif;
}

/* 基础样式 */
body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部导航样式 */
header {
    background-color: #2c3e50;
    padding: 20px 0;
    position: sticky;
    top: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header .container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header .container::after {
    display: none;
}

.logo {
    color: white;
    font-size: 24px;
    font-weight: bold;
    display: inline-block;
    /* CSS变形 */
    transform: skewX(-5deg);
    transition: all 0.3s ease;
}

.logo:hover {
    transform: skewX(5deg) scale(1.05);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: white;
    margin: 5px 0;
    border-radius: 2px;
    transition: all 0.3s ease;
}

nav {
    float: right;
}

nav ul {
    list-style: none;
}

nav ul li {
    display: inline-block;
    margin-left: 30px;
}

nav ul li a {
    color: white;
    text-decoration: none;
    font-size: 16px;
    padding: 8px 12px;
    border-radius: 4px;
    /* 过渡效果 */
    transition: all 0.3s ease;
}

nav ul li a:hover,
nav ul li a.active {
    background-color: #3498db;
    transform: translateY(-3px);
}

/* 清除浮动 */
.clearfix::after {
    content: "";
    display: block;
    clear: both;
}

/*  banner样式 */
.banner {
    height: 400px;
    background-size: cover;
    background-position: center;
    position: relative;
    color: white;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-content {
    animation: fadeIn 1.5s ease; /* 关键帧动画 */
}

.banner h2 {
    font-size: 48px;
    margin-bottom: 20px;
}

.banner p {
    font-size: 20px;
    max-width: 800px;
}

/* 关键帧动画定义 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 内容区域样式 */
.content {
    padding: 60px 0;
}

.section-title {
    text-align: center;
    margin-bottom: 40px;
    font-size: 32px;
    color: #2c3e50;
    position: relative;
}

.section-title::after {
    content: "";
    width: 80px;
    height: 3px;
    background-color: #3498db;
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
}

/* 卡片样式 */
.card-box {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
}

.card {
    width: 350px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}

.card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card-body {
    padding: 20px;
}

.card-body h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: #2c3e50;
}

.card-body p {
    color: #666;
    margin-bottom: 15px;
}

.btn {
    display: inline-block;
    padding: 8px 16px;
    background-color: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.btn:hover {
    background-color: #2980b9;
    transform: translateX(5px);
}

/* 底部样式 */
footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 30px 0;
    margin-top: 40px;
}

footer p {
    margin: 5px 0;
}

/* 文章分类标签 */
.card-tag {
    display: inline-block;
    background-color: #3498db;
    color: white;
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 12px;
    margin-bottom: 10px;
}

.section-desc {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    margin-top: -30px;
    font-size: 15px;
}

/* ========== 文章内容 - Typora风格 ========== */

.article-content {
    font-family: -apple-system, "Segoe UI", Roboto, "PingFang SC", "思源黑体", "Noto Sans SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.75;
    color: #333;
    background: #ffffff;
    max-width: 860px;
    margin: 0 auto;
    padding: 40px 48px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    overflow-wrap: break-word;
    word-break: break-word;
}

.article-content > *:first-child {
    margin-top: 0;
}

/* 标题 */
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    font-weight: 600;
    line-height: 1.4;
    color: #2c3e50;
    margin-top: 1.6em;
    margin-bottom: 0.6em;
}

.article-content h1 {
    font-size: 2em;
    padding-bottom: 0.3em;
    border-bottom: 2px solid #eaecef;
}

.article-content h2 {
    font-size: 1.6em;
    padding-bottom: 0.25em;
    border-bottom: 1px solid #eaecef;
}

.article-content h3 {
    font-size: 1.35em;
}

.article-content h4 {
    font-size: 1.2em;
}

.article-content h5 {
    font-size: 1.1em;
}

.article-content h6 {
    font-size: 1em;
    color: #999;
}

/* 段落 */
.article-content p {
    margin-top: 0;
    margin-bottom: 0.8em;
    color: #333;
}

/* 链接 */
.article-content a {
    color: #3498db;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.article-content a:hover {
    color: #2980b9;
    border-bottom-color: #2980b9;
}

/* 行内代码 */
.article-content code {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.88em;
    background-color: #f3f4f6;
    color: #e74c3c;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    word-break: break-word;
}

/* 代码块 */
.article-content pre {
    background-color: #282c34;
    color: #abb2bf;
    padding: 20px 24px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.2em 0;
    font-size: 14px;
    line-height: 1.6;
}

.article-content pre code {
    background: none;
    color: inherit;
    padding: 0;
    border: none;
    border-radius: 0;
    font-size: inherit;
}

/* 引用块 */
.article-content blockquote {
    border-left: 4px solid #d0d7de;
    background-color: #f6f8fa;
    padding: 12px 20px;
    margin: 1.2em 0;
    color: #6a737d;
    border-radius: 0 4px 4px 0;
}

.article-content blockquote p {
    color: #6a737d;
    margin-bottom: 0.4em;
}

.article-content blockquote p:last-child {
    margin-bottom: 0;
}

/* 表格 */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2em 0;
    font-size: 0.95em;
    display: block;
    overflow-x: auto;
}

.article-content table th,
.article-content table td {
    border: 1px solid #dfe2e5;
    padding: 8px 14px;
    text-align: left;
}

.article-content table th {
    background-color: #f6f8fa;
    font-weight: 600;
    color: #2c3e50;
}

.article-content table tr:nth-child(even) {
    background-color: #fafbfc;
}

.article-content table tr:hover {
    background-color: #f0f7ff;
}

/* 图片 */
.article-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.2em auto;
    border-radius: 4px;
}

/* 列表 */
.article-content ul,
.article-content ol {
    margin: 0.8em 0;
    padding-left: 2em;
}

.article-content li {
    margin-bottom: 0.3em;
    color: #333;
}

.article-content li > p {
    margin-bottom: 0.4em;
}

/* 分割线 */
.article-content hr {
    border: none;
    border-top: 1px solid #eaecef;
    margin: 2em 0;
}

/* 高亮标记 */
.article-content mark {
    background-color: #fff3b0;
    padding: 1px 4px;
    border-radius: 3px;
    color: #333;
}

/* 导航按钮 */
.article-nav {
    margin-top: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.btn-nav {
    flex: 1;
    text-align: center;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-nav:first-child {
    margin-right: auto;
}

.btn-nav:last-child {
    margin-left: auto;
}

.btn-disabled {
    opacity: 0;
    pointer-events: none;
}

/* 关于我页面样式 */
.about-info {
    display: flex;
    align-items: center;
    gap: 40px;
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.avatar {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid #3498db;
    transition: transform 0.5s ease;
}

.avatar:hover {
    transform: rotate(360deg);
}

.about-text h3 {
    font-size: 28px;
    margin-bottom: 20px;
    color: #2c3e50;
}

.about-text p {
    font-size: 16px;
    line-height: 1.8;
    color: #666;
    margin-bottom: 15px;
}

/* 相册页面样式 */
.gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.gallery-img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 8px;
    transition: all 0.4s ease;
    cursor: pointer;
}

.gallery-img:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

/* 留言板样式 */
.message-form {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #2c3e50;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: #3498db;
    outline: none;
}

.submit-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    background-color: #2980b9;
    transform: scale(1.05);
}

/* ========== 响应式适配 ========== */

/* 平板适配 (<=1024px) */
@media screen and (max-width: 1024px) {
    .container {
        padding: 0 15px;
    }

    .banner h2 {
        font-size: 36px;
    }

    .banner p {
        font-size: 18px;
    }

    .card {
        width: 300px;
    }

    .gallery {
        gap: 15px;
    }

    .gallery-img {
        height: 250px;
    }

    .about-info {
        gap: 30px;
        padding: 30px;
    }

    .avatar {
        width: 160px;
        height: 160px;
    }
}

/* 手机适配 (<=768px) */
@media screen and (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    header {
        position: relative;
    }

    header .container {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
    }

    nav {
        float: none;
        display: none;
        width: 100%;
        order: 3;
        padding-top: 10px;
    }

    nav.open {
        display: block;
    }

    nav ul li {
        display: block;
        margin-left: 0;
        margin-top: 5px;
    }

    nav ul li a {
        display: block;
        padding: 10px 12px;
    }

    .banner {
        height: 500px;
        background-size: cover;
        background-position: center;
        padding: 60px 20px 40px;
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
    }
    
    .banner-content {
        text-align: center;
        width: 100%;
    }

    .banner h2 {
        font-size: 28px;
    }

    .banner p {
        font-size: 16px;
        padding: 0 15px;
    }

    .section-title {
        font-size: 26px;
    }

    .card-box {
        gap: 20px;
    }

    .card {
        width: 100%;
        max-width: 400px;
    }

    .gallery {
        grid-template-columns: 1fr;
    }

    .gallery-img {
        height: 250px;
    }

    .about-info {
        flex-direction: column;
        text-align: center;
        padding: 25px;
    }

    .avatar {
        width: 150px;
        height: 150px;
    }

    .about-text h3 {
        font-size: 24px;
    }

    .message-form {
        padding: 25px;
    }

    .content {
        padding: 40px 0;
    }

    .article-content {
        padding: 24px 20px;
        font-size: 15px;
    }

    .article-content h1 {
        font-size: 1.6em;
    }

    .article-content h2 {
        font-size: 1.35em;
    }

    .article-content h3 {
        font-size: 1.2em;
    }

    .article-content pre {
        padding: 14px 16px;
        font-size: 13px;
    }

    .article-content table {
        font-size: 14px;
    }

    .article-content table th,
    .article-content table td {
        padding: 6px 10px;
    }

    .section-desc {
        margin-top: -20px;
        font-size: 14px;
    }
}

/* 小屏手机 (<=480px) */
@media screen and (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    header {
        padding: 15px 0;
    }

    .logo {
        font-size: 20px;
    }

    .banner {
        height: 250px;
    }

    .banner h2 {
        font-size: 22px;
        margin-bottom: 12px;
    }

    .banner p {
        font-size: 14px;
    }

    .section-title {
        font-size: 22px;
        margin-bottom: 25px;
    }

    .card-body {
        padding: 15px;
    }

    .card-body h3 {
        font-size: 18px;
    }

    .gallery-img {
        height: 200px;
    }

    .about-info {
        padding: 20px;
    }

    .about-text p {
        font-size: 14px;
    }

    .message-form {
        padding: 20px;
    }

    .form-group input,
    .form-group textarea {
        font-size: 14px;
        padding: 10px;
    }

    .article-content {
        padding: 16px 12px;
        font-size: 14px;
    }

    .article-content h1 {
        font-size: 1.4em;
    }

    .article-content pre {
        padding: 12px;
        font-size: 12px;
    }

    footer {
        padding: 20px 0;
    }

    footer p {
        font-size: 14px;
    }
}