/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3a5f70;
    --secondary-color: #e05e5e;
    --accent-color: #f4d35e;
    --light-color: #f8f9fa;
    --dark-color: #2d3142;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Noto Serif SC', serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: var(--light-color);
    overflow-x: hidden;
}

/* 字体设置 */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Ma Shan Zheng', cursive;
    font-weight: 400;
    margin-bottom: 1rem;
}

/* 导航栏样式 */
.header {
    background-color: rgba(58, 95, 112, 0.95);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: 30px; /* 进一步减小导航栏高度从40px到30px */
    display: flex;
    align-items: center;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.1rem 2%; /* 减小内边距 */
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--light-color);
}

.logo span {
    color: var(--light-color);
    font-size: 0.7rem; /* 进一步减小字体大小 */
    font-weight: bold;
    letter-spacing: 0.05em;
}

.nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    height: 100%;
}

.nav-links li {
    margin-left: 0.6rem; /* 进一步减小间距 */
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-links a {
    color: var(--light-color);
    text-decoration: none;
    font-size: 0.6rem; /* 进一步减小字体大小 */
    position: relative;
    transition: var(--transition);
    padding: 0.2rem 0.5rem;
    white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent-color);
}

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

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

/* 移动端菜单按钮 */
.menu-toggle {
    display: none;
    cursor: pointer;
}

.bar {
    display: block;
    width: 24px; /* 减小汉堡菜单大小 */
    height: 2px; /* 减小汉堡菜单线条高度 */
    margin: 5px auto;
    background-color: var(--light-color);
    transition: var(--transition);
}

/* 英雄区域 */
.hero-section {
    height: 80vh; /* 从100vh减少到80vh，减少顶部和底部留白 */
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('https://images.unsplash.com/photo-1526304640581-d334cdbbf45e?ixlib=rb-4.0.3&auto=format&fit=crop&w=1950&q=80');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 5%;
    margin-top: 0;
}

.hero-content {
    max-width: 800px;
    color: var(--light-color);
}

.hero-content h1 {
    font-size: 3rem; /* 略微减小字体大小 */
    margin-bottom: 0.8rem; /* 减少底部边距 */
    line-height: 1.2;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-content p {
    font-size: 1.1rem; /* 略微减小字体大小 */
    margin-bottom: 1.5rem; /* 减少底部边距 */
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    font-size: 1rem;
    text-decoration: none;
    border-radius: 50px;
    transition: var(--transition);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
}

.primary-btn {
    background-color: var(--secondary-color);
    color: var(--light-color);
    border: 2px solid var(--secondary-color);
    margin-right: 1rem;
}

.primary-btn:hover {
    background-color: transparent;
    color: var(--secondary-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(224, 94, 94, 0.3);
}

.secondary-btn {
    background-color: transparent;
    color: var(--light-color);
    border: 2px solid var(--light-color);
}

.secondary-btn:hover {
    background-color: var(--light-color);
    color: var(--dark-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* 预览区域 */
.gallery-preview {
    padding: 3rem 5%; /* 从5rem减少到3rem，减少上下留白 */
    background-color: var(--light-color);
    text-align: center;
}

.gallery-preview h2 {
    font-size: 2.2rem; /* 略微减小字体大小 */
    margin-bottom: 2rem; /* 从3rem减少到2rem */
    color: var(--primary-color);
}

.preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem; /* 从2rem减少到1.5rem */
    max-width: 1200px;
    margin: 0 auto;
}

.preview-card {
    position: relative;
    height: 250px; /* 从300px减少到250px，减少高度 */
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

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

.preview-img {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: var(--transition);
}

.painting-preview {
    background-image: url('https://images.unsplash.com/photo-1518998053901-5348d3961a04?ixlib=rb-4.0.3&auto=format&fit=crop&w=1350&q=80');
}

.poem-preview {
    background-image: url('https://images.unsplash.com/photo-1518744386048-64324297ae19?ixlib=rb-4.0.3&auto=format&fit=crop&w=1350&q=80');
}

.photo-preview {
    background-image: url('https://images.unsplash.com/photo-1528728329032-2972f65dfb3f?ixlib=rb-4.0.3&auto=format&fit=crop&w=1355&q=80');
}

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

.preview-card h3 {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    color: var(--light-color);
    padding: 1.5rem;
    font-size: 1.5rem;
    margin: 0;
}

/* 作品网格样式 */
.works-grid {
    padding: 3rem 5%; /* 从5rem减少到3rem，减少上下留白 */
    background-color: var(--light-color);
}

.works-grid h2 {
    text-align: center;
    font-size: 2.2rem; /* 略微减小字体大小 */
    margin-bottom: 2rem; /* 从3rem减少到2rem */
    color: var(--primary-color);
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.work-item {
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.work-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.work-img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: var(--transition);
}

.work-item:hover .work-img {
    transform: scale(1.05);
}

.work-content {
    padding: 1.5rem;
}

.work-content h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.work-content p {
    color: var(--dark-color);
    margin-bottom: 1rem;
}

/* 诗作样式 */
.poem-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.poem-item {
    background-color: white;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

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

.poem-title {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 1rem;
    text-align: center;
}

.poem-content {
    font-style: italic;
    line-height: 1.8;
    color: var(--dark-color);
    text-align: center;
    white-space: pre-line;
}

.poem-author {
    text-align: right;
    margin-top: 1rem;
    color: var(--secondary-color);
    font-weight: bold;
}

/* 关于页面样式 */
.about-section {
    padding: 5rem 5%;
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
}

.about-section h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--primary-color);
}

.about-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.about-image {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 2rem;
    border: 5px solid var(--primary-color);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.about-text {
    text-align: left;
    line-height: 1.8;
    margin-bottom: 2rem;
}

.about-text p {
    margin-bottom: 1rem;
}

/* 页脚样式 */
.footer {
    background-color: var(--primary-color);
    color: var(--light-color);
    padding: 1.5rem 5%; /* 减少padding使布局更紧凑 */
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
    /* 进一步减小移动设备上的导航栏高度 */
    .header {
        height: 30px; /* 从35px进一步减小到30px */
    }
    
    .menu-toggle {
        display: block;
        width: 18px; /* 从20px减小到18px */
        height: 14px; /* 减小高度 */
    }
    
    .menu-toggle .bar {
        height: 1.2px; /* 从1.5px减小到1.2px */
        margin: 2.5px auto; /* 减小间距 */
    }

    /* 调整导航链接的定位和尺寸 */
    .nav-links {
        position: absolute;
        top: 30px; /* 与header固定高度保持一致 */
        left: 0;
        width: 100%;
        background-color: var(--primary-color);
        flex-direction: column;
        align-items: center;
        padding: 0.5rem 0; /* 进一步减小内边距从0.6rem到0.5rem */
        transform: translateY(-150%);
        transition: var(--transition);
        opacity: 0;
        z-index: -1;
    }

    .nav-links.active {
        transform: translateY(0);
        opacity: 1;
    }

    /* 减小菜单项间距和字体大小 */
    .nav-links li {
        margin: 0.3rem 0; /* 进一步减小间距从0.4rem到0.3rem */
        height: auto;
    }

    .nav-links a {
        font-size: 0.6rem; /* 进一步减小字体大小从0.65rem到0.6rem */
        padding: 0.2rem 0.6rem; /* 进一步减小内边距 */
    }
    
    /* 调整移动设备上的logo大小 */
    .logo span {
        font-size: 0.7rem; /* 从0.8rem减小到0.7rem */
    }
    
    /* 减小导航容器内边距 */
    .nav-container {
        padding: 0.1rem 2%; /* 进一步减小水平内边距从3%到2% */
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .cta-buttons {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .primary-btn {
        margin-right: 0;
    }

    .preview-container {
        grid-template-columns: 1fr;
    }
    
    .grid-container {
        grid-template-columns: 1fr;
        max-width: 100%;
    }
}

@media screen and (max-width: 480px) {
    .hero-content h1 {
        font-size: 2rem;
    }

    .gallery-preview h2,
    .works-grid h2,
    .about-section h2 {
        font-size: 2rem;
    }
}

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

.hero-content,
.gallery-preview h2,
.about-section h2 {
    animation: fadeIn 1s ease-out;
}

.preview-card,
.work-item,
.poem-item {
    animation: fadeIn 0.5s ease-out;
    animation-fill-mode: both;
}

.preview-card:nth-child(1),
.work-item:nth-child(1),
.poem-item:nth-child(1) {
    animation-delay: 0.1s;
}

.preview-card:nth-child(2),
.work-item:nth-child(2),
.poem-item:nth-child(2) {
    animation-delay: 0.2s;
}

.preview-card:nth-child(3),
.work-item:nth-child(3),
.poem-item:nth-child(3) {
    animation-delay: 0.3s;
}