:root {
    --primary-color: #3a7bd5;
    --secondary-color: #4b6cb7;
    --text-color: #333;
    --light-text: #777;
    --background: #ffffff;
    --light-bg: #f9f9f9;
    --border-color: #e0e0e0;
    --transition: all 0.3s ease-in-out;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background);
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 标题样式 */
header {
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    transition: var(--transition);
}

header h1:hover {
    color: var(--secondary-color);
    transform: translateY(-2px);
}

header p {
    color: var(--light-text);
    font-size: 1.2rem;
}

/* 导航栏样式 */
/* 导航栏样式 - 固定在顶部 */
nav {
    text-align: center;
    background-color: var(--light-bg);
    border-radius: 0 0 6px 6px;
    padding: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background-color: rgba(249, 249, 249, 0.95);
}

/* 滚动时导航栏样式变化 */
nav.scrolled {
    padding: 0.7rem 1rem;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 2rem;
}

nav li {
    position: relative;
}

nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: var(--transition);
}

nav a:hover {
    color: var(--primary-color);
    background-color: rgba(74, 144, 226, 0.1);
}

nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -3px;
    left: 50%;
    background-color: var(--primary-color);
    transition: var(--transition);
}

nav a:hover::after {
    width: 100%;
    left: 0;
}

/* 为固定导航栏添加空间 */
body {
    padding-top: 0;
}

/* 主内容区域 - Markdown 兼容 */
.content {
    background-color: var(--background);
    padding-left: 15%;
    padding-right: 15%;
    padding-top: 4rem;
    padding-bottom: 8rem;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* 标题居中样式 */
h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.8rem;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

/* 确保内容部分的 h2 也应用这些样式 */
.content h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.8rem;
}

.content h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

/* 尾注部分的 h2 也居中 */
.footnotes h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

/* Markdown 样式 */
.content h1,
.content h2,
.content h3,
.content h4,
.content h5,
.content h6 {
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    color: var(--primary-color);
}

.content h1 {
    font-size: 2.2rem;
}

.content h2 {
    font-size: 1.8rem;
}

.content h3 {
    font-size: 1.5rem;
}

.content h4 {
    font-size: 1.3rem;
}

.content h5 {
    font-size: 1.1rem;
}

.content h6 {
    font-size: 1rem;
}

.content p {
    margin-bottom: 1.2rem;
    line-height: 1.8;
}

.content ul,
.content ol {
    margin-bottom: 1.2rem;
    padding-left: 2rem;
}

.content li {
    margin-bottom: 0.5rem;
}

.content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    font-style: italic;
    color: var(--light-text);
    margin: 1.5rem 0;
}

.content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1rem 0;
    transition: var(--transition);
}

.content img:hover {
    transform: scale(1.01);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.content code {
    background-color: var(--light-bg);
    padding: 2px 5px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.content pre {
    background-color: var(--light-bg);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.content pre code {
    background-color: transparent;
    padding: 0;
}

.section-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin: 2rem 0;
    justify-content: center;
}

.section-card {
    display: flex;
    flex-direction: column;
    background-color: var(--background);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    flex: 1 1 300px;
    max-width: 350px;
    transition: var(--transition);
    border-top: 4px solid var(--primary-color);
    position: relative;
    overflow: hidden;
}

.section-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.section-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, transparent 100%);
    opacity: 0;
    transition: var(--transition);
    z-index: 0;
}

.section-card:hover::before {
    opacity: 0.05;
}

.section-card * {
    position: relative;
    z-index: 1;
}

.section-card h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    color: var(--primary-color);
}

.section-card p {
    margin-bottom: 1rem;
    color: var(--text-color);
    font-size: 0.8rem;
}

.section-card img {
    width: 100%;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.section-card .card-content {
    flex-grow: 1;
    /* 添加这个类来包裹卡片内容 */
    margin-bottom: 1rem;
}

.section-card .card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    bottom: 0;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--light-text);
}

/* 卡片链接按钮 */
.section-card .card-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    font-weight: 500;
    transition: var(--transition);
    margin-top: 0.5rem;
}

.section-card .card-link:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .section-cards {
        flex-direction: column;
        align-items: center;
    }

    .section-card {
        max-width: 100%;
    }
}

.content a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px dashed var(--primary-color);
    transition: var(--transition);
}

.content a:hover {
    color: var(--secondary-color);
    border-bottom: 1px solid var(--secondary-color);
}

.content hr {
    border: 0;
    height: 1px;
    background-color: var(--border-color);
    margin: 2rem 0;
}

.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.content th,
.content td {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

.content th {
    background-color: var(--light-bg);
}

.content tr:nth-child(even) {
    background-color: var(--light-bg);
}

/* 网页尾注样式 */
.footnotes {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.footnotes h2 {
    font-size: 1.6rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.footnotes ol {
    list-style-position: inside;
    padding-left: 0;
}

.footnotes li {
    margin-bottom: 1rem;
    padding: 0.8rem 1.2rem;
    background-color: var(--light-bg);
    border-radius: 6px;
    transition: var(--transition);
    position: relative;
}

.footnotes li:target {
    background-color: rgba(74, 144, 226, 0.1);
    box-shadow: 0 0 0 2px var(--primary-color);
    animation: highlight-footnote 2s ease-in-out;
}

@keyframes highlight-footnote {

    0%,
    100% {
        background-color: rgba(74, 144, 226, 0.1);
    }

    50% {
        background-color: rgba(74, 144, 226, 0.2);
    }
}

.footnotes li::before {
    counter-increment: footnote;
    content: attr(id);
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--primary-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

.footnotes p {
    display: inline;
    margin-left: 1rem;
}

/* 尾注参考链接样式 */
.footnote-ref {
    vertical-align: super;
    font-size: 0.75em;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: bold;
    margin: 0 2px;
    padding: 0 3px;
    border-radius: 3px;
    transition: var(--transition);
    border: none;
}

.footnote-ref:hover {
    background-color: rgba(74, 144, 226, 0.15);
    color: var(--primary-color);
}

/* 返回链接样式 */
.footnote-backref {
    text-decoration: none;
    font-size: 0.85em;
    margin-left: 0.5rem;
    color: var(--primary-color);
    background-color: rgba(74, 144, 226, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    transition: var(--transition);
    border: none;
}

.footnote-backref:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* 尾注中的链接样式 */
.footnotes a:not(.footnote-backref) {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px dashed var(--primary-color);
    transition: var(--transition);
}

.footnotes a:not(.footnote-backref):hover {
    color: var(--secondary-color);
    border-bottom: 1px solid var(--secondary-color);
}

/* 参考文献列表 */
.references {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.references h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.references ul {
    list-style: none;
    padding-left: 0;
}

.references li {
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 3px solid var(--primary-color);
    background-color: var(--light-bg);
    border-radius: 0 4px 4px 0;
    transition: var(--transition);
}

.references li:hover {
    transform: translateX(5px);
    background-color: rgba(74, 144, 226, 0.1);
}

.references .author {
    font-weight: bold;
}

.references .title {
    font-style: italic;
}

.references .source {
    color: var(--light-text);
}

/* Footer 样式 */
footer {
    margin-top: 3rem;
    padding: 2rem 0;
    background-color: var(--light-bg);
    border-top: 1px solid var(--border-color);
    text-align: center;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

footer p {
    color: var(--light-text);
    margin: 0.5rem 0;
    font-size: 0.95rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

footer a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* 社交媒体链接样式 */
.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(58, 123, 213, 0.1);
    color: var(--primary-color);
    transition: var(--transition);
}

.social-links a:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 联系信息样式 */
.contact-info {
    margin: 1rem 0;
    padding: 0.5rem;
    font-style: italic;
}

/* 版权信息 */
.copyright {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 0.85rem;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    z-index: 100;
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}

.back-to-top:hover {
    background-color: var(--secondary-color);
    transform: translateY(-5px);
}

/* 响应式调整 */
@media (max-width: 768px) {
    footer {
        padding: 1.5rem 1rem;
    }

    .back-to-top {
        right: 1rem;
        bottom: 1rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content>* {
    animation: fadeIn 0.5s ease-out forwards;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    nav ul {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }

    header h1 {
        font-size: 2rem;
    }
}