/* 全局样式和变量 */
:root {
    --primary-color: #008080; /* 青绿色，主色调 */
    --secondary-color: #20B2AA; /* 浅青绿色，用于辅助元素 */
    --accent-color: #00CED1; /* 深青绿色，强调色 */
    --text-color: #333; /* 主要文本颜色 */
    --light-text: #666; /* 次要文本颜色 */
    --background-color: #F0F8FF; /* 淡青色背景，模拟宣纸质感 */
    --white: #FFFFFF; /* 白色 */
    --section-padding: 80px 0;
    --container-width: 1200px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    overflow-x: hidden;
}

.container {
    width: 90%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* 按钮样式 */
.btn-primary {
    display: inline-block;
    padding: 12px 28px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background-color: #6b0000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.3);
}

.btn-secondary {
    display: inline-block;
    padding: 10px 24px;
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.3);
}

/* 标题样式 */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 20px;
    color: var(--primary-color);
}

h1 {
    font-size: 2.8rem;
    margin-bottom: 24px;
}

h2 {
    font-size: 2.2rem;
    position: relative;
    padding-bottom: 12px;
    margin-bottom: 40px;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 4px;
    background-color: var(--accent-color);
}

h3 {
    font-size: 1.8rem;
    margin-bottom: 24px;
}

h4 {
    font-size: 1.4rem;
    margin-bottom: 16px;
}

/* 段落样式 */
p {
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.8;
}

/* 列表样式 */
ul, ol {
    margin-bottom: 20px;
    padding-left: 20px;
}

li {
    margin-bottom: 8px;
    line-height: 1.6;
}

/* 首页横幅样式 */
.hero {
    background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('https://picsum.photos/id/10/1920/1080');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--white);
    text-align: center;
    padding: 180px 0;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    color: var(--white);
    font-size: 3.2rem;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* 梁姓起源模块样式 */
.origin-section {
    padding: var(--section-padding);
    background-color: var(--white);
}

.origin-content {
    max-width: 1000px;
    margin: 0 auto;
}

.origin-content p {
    margin-bottom: 20px;
    line-height: 1.8;
}

/* 梁姓发展历史模块样式 */
.development-section {
    padding: var(--section-padding);
    background-color: var(--background-color);
}

.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto 60px;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background-color: var(--primary-color);
    transform: translateX(-50%);
}

.timeline-item {
    position: relative;
    margin-bottom: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timeline-item:nth-child(odd) .timeline-content {
    order: 1;
}

.timeline-item:nth-child(even) .timeline-content {
    order: 3;
}

.timeline-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 20px;
    height: 20px;
    background-color: var(--accent-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.timeline-date {
    flex: 1;
    text-align: right;
    padding-right: 40px;
    font-weight: 600;
    color: var(--primary-color);
}

.timeline-item:nth-child(even) .timeline-date {
    text-align: left;
    padding-right: 0;
    padding-left: 40px;
}

.timeline-content {
    flex: 1;
    background-color: var(--white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.migration-content {
    max-width: 800px;
    margin: 0 auto;
}

/* 梁字书写演化模块样式 */
.evolution-section {
    padding: var(--section-padding);
    background-color: var(--background-color);
}

.evolution-content {
    max-width: 1000px;
    margin: 0 auto;
}

.evolution-stages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.stage-item {
    background-color: var(--white);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    text-align: center;
}

.stage-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.stage-image {
    margin-bottom: 20px;
}

.stage-image img {
    max-width: 100%;
    height: 150px;
    object-fit: contain;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 10px;
}

.stage-info h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.evolution-significance {
    margin-top: 40px;
    padding: 25px;
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 梁姓族谱信息模块样式 */
.genealogy-section {
    padding: var(--section-padding);
    background-color: var(--white);
}

.genealogy-overview {
    max-width: 800px;
    margin: 0 auto 40px;
}

.genealogy-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 60px;
}

.stat-item {
    background-color: var(--background-color);
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.stat-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.stat-label {
    font-size: 1.1rem;
    color: var(--light-text);
}

.genealogy-content {
    max-width: 800px;
    margin: 0 auto;
}

/* 关于模块样式 */
.about-section {
    padding: var(--section-padding);
    background-color: var(--background-color);
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

/* 页脚样式 */
footer {
    background-color: var(--text-color);
    color: var(--white);
    padding: 60px 0 30px;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 40px;
}

.footer-logo {
    display: flex;
    align-items: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 20px;
}

.footer-logo i {
    margin-right: 10px;
    color: var(--accent-color);
}

.footer-bottom {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.copyright {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

/* 返回顶部按钮样式 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.3);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: #6b0000;
    transform: translateY(-3px);
}

/* 响应式设计 */
@media (max-width: 1200px) {
    :root {
        --container-width: 1000px;
    }
    
    .hero h1 {
        font-size: 2.8rem;
    }
}

@media (max-width: 992px) {
    :root {
        --container-width: 90%;
    }
    
    .hero {
        padding: 150px 0;
    }
    
    .hero h1 {
        font-size: 2.4rem;
    }
    
    .timeline::before {
        left: 30px;
    }
    
    .timeline-item {
        flex-direction: column;
        align-items: flex-start;
        padding-left: 70px;
        position: relative;
    }
    
    .timeline-item:nth-child(odd) .timeline-content,
    .timeline-item:nth-child(even) .timeline-content {
        order: 2;
        width: 100%;
    }
    
    .timeline-dot {
        left: 30px;
        transform: translateX(-50%);
    }
    
    .timeline-date {
        position: absolute;
        left: 70px;
        top: 0;
        width: auto;
        padding-right: 0;
        text-align: left;
    }
    
    .timeline-item:nth-child(even) .timeline-date {
        padding-left: 0;
    }
    
    /* 优化演化模块在中等屏幕上的布局 */
    .evolution-stages {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    :root {
        --container-width: 95%;
        --section-padding: 60px 0;
    }
    
    h1 {
        font-size: 2.2rem;
    }
    
    h2 {
        font-size: 1.8rem;
    }
    
    h3 {
        font-size: 1.5rem;
    }
    
    .hero {
        padding: 120px 0;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    /* 优化时间线在小屏幕上的布局 */
    .timeline {
        max-width: 100%;
    }
    
    .timeline-item {
        padding-left: 50px;
        margin-bottom: 30px;
    }
    
    .timeline-date {
        left: 50px;
        font-size: 0.9rem;
    }
    
    .timeline-content {
        padding: 15px;
    }
    
    /* 优化演化模块在小屏幕上的布局 */
    .evolution-stages {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* 优化族谱统计在小屏幕上的布局 */
    .genealogy-stats {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
        margin-bottom: 40px;
    }
    
    .stat-item {
        padding: 20px;
    }
    
    .stat-number {
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    :root {
        --container-width: 100%;
        --section-padding: 40px 0;
    }
    
    .container {
        padding: 0 10px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.3rem;
    }
    
    .hero {
        padding: 100px 0;
    }
    
    .hero h1 {
        font-size: 1.6rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    /* 优化族谱统计在超小屏幕上的布局 */
    .genealogy-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .era-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .events-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .genealogy-list {
        grid-template-columns: 1fr;
    }
}

/* 超链接样式 */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
}

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

a:visited {
    color: var(--secondary-color);
}

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

.copyright a {
    color: rgba(255, 255, 255, 0.8);
}

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