/* =========================================
   全局变量与基础设置
========================================= */
:root {
    /* 亮色模式（默认） */
    --bg-main: #F5F2EA;
    --bg-card: #FFFFFF;
    --text-main: #1A1A1A;
    --text-sec: #8A8A8A;
    --accent: #3B82F6;
    --border: #E5E5E5;
    
    --btn-bg: #1A1A1A;
    --btn-text: #FFFFFF;
    --btn-hover: #333333;
    
    --shadow: 0 4px 20px rgba(0,0,0,0.06);
    --shadow-hover: 0 12px 30px rgba(0,0,0,0.12);
    
    --footer-bg: #EDE8D9;
    
    /* 留言墙莫兰迪色系 */
    --note-pink: #FADCD9;
    --note-green: #D4E9C7;
    --note-blue: #D6E8F5;
    
    /* 尺寸规范 */
    --max-width: 1280px;
    --radius-card: 16px;
    --radius-btn: 24px;
    --radius-img: 12px;
}

/* 深色模式 */
[data-theme="dark"] {
    --bg-main: #1A1A1A;
    --bg-card: #2A2A2A;
    --text-main: #FFFFFF;
    --text-sec: #A0A0A0;
    --border: #444444;
    
    --btn-bg: #FFFFFF;
    --btn-text: #1A1A1A;
    --btn-hover: #F5F5F5;
    
    --shadow: 0 4px 20px rgba(0,0,0,0.3);
    --shadow-hover: 0 12px 30px rgba(0,0,0,0.5);
    
    --footer-bg: #111111;
    
    /* 深色模式下的莫兰迪色需降低饱和度与亮度 */
    --note-pink: #4A3A3A;
    --note-green: #3A4A3A;
    --note-blue: #3A4A5A;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.8;
    font-size: 16px;
    transition: background-color 0.3s, color 0.3s;
}

/* =========================================
   通用组件与排版
========================================= */
.section-container {
    max-width: var(--max-width);
    margin: 100px auto;
    padding: 0 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 48px;
}

.section-title {
    font-size: 40px;
    font-weight: bold;
    line-height: 1.2;
    margin-bottom: 8px;
}

.section-subtitle {
    font-size: 18px;
    color: var(--text-sec);
}

.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-card);
    padding: 32px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.primary-btn {
    display: inline-block;
    background-color: var(--btn-bg);
    color: var(--btn-text);
    padding: 12px 32px;
    border-radius: var(--radius-btn);
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
    border: none;
    cursor: pointer;
}

.primary-btn:hover {
    background-color: var(--btn-hover);
    transform: scale(1.02);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.icon-btn:hover {
    background-color: rgba(128, 128, 128, 0.1);
}

.rounded-btn {
    border: 1px solid var(--border);
    background: var(--bg-card);
    width: 48px;
    height: 48px;
}

.rounded-btn:hover {
    background-color: var(--text-main);
    color: var(--bg-card);
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    background-color: rgba(128, 128, 128, 0.1);
    border-radius: 12px;
    font-size: 13px;
    color: var(--text-sec);
    margin-right: 8px;
    margin-bottom: 8px;
}

/* 滚动动画初始状态 */
.fade-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================
   1. 顶部导航栏
========================================= */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(245, 242, 234, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] #navbar {
    background-color: rgba(26, 26, 26, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 16px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    width: 40px;
    height: 40px;
    background-color: var(--text-main);
    color: var(--bg-card);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 32px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    position: relative;
    padding-bottom: 4px;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent);
    transition: width 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.nav-actions {
    display: flex;
    gap: 16px;
}

/* =========================================
   2. Hero 首屏区
========================================= */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0;
    padding-top: 80px; /* 抵消导航栏高度 */
}

.hero-content {
    flex: 1;
    padding-right: 40px;
}

.hero-content h1 {
    font-size: clamp(60px, 8vw, 100px);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}

.hero-content h2 {
    font-size: 48px;
    margin-bottom: 40px;
}

.hero-content .slogan {
    font-size: 24px;
    font-weight: 500;
    color: var(--accent);
    margin-bottom: 16px;
}

.hero-content .subtitle {
    font-size: 20px;
    color: var(--text-sec);
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.hero-image img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-img);
    box-shadow: var(--shadow);
    max-height: 70vh;
    object-fit: cover;
}

/* =========================================
   3. 关于我 + 快捷链接区
========================================= */
#stats-links {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 32px;
}

.stats-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stats-card h3 {
    font-size: 20px;
    color: var(--text-sec);
    margin-bottom: 16px;
}

.stat-number {
    font-size: 48px;
    font-weight: bold;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 8px;
}

.banner-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(255,255,255,0.5) 100%);
}

[data-theme="dark"] .banner-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(42,42,42,0.5) 100%);
}

.banner-content h3 {
    font-size: 28px;
    margin-bottom: 8px;
}

.banner-content p {
    color: var(--text-sec);
}

/* =========================================
   4. 摄影图库区
========================================= */
.gallery-controls {
    display: flex;
    gap: 16px;
}

.gallery-main {
    display: flex;
    padding: 0;
    overflow: hidden;
    margin-bottom: 24px;
}

.gallery-img-container {
    width: 65%;
    background-color: #000;
    position: relative;
    aspect-ratio: 4/3;
}

.gallery-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.5s ease;
}

.gallery-info {
    width: 35%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.gallery-info h3 {
    font-size: 32px;
    margin-bottom: 16px;
}

.photo-meta {
    font-size: 14px;
    color: var(--text-sec);
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.photo-desc {
    color: var(--text-main);
    font-size: 16px;
}

.gallery-thumbnails {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.thumb-item {
    aspect-ratio: 16/9;
    border-radius: var(--radius-img);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    border: 2px solid transparent;
    transition: border-color 0.3s, transform 0.3s;
}

.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.thumb-item:hover img {
    transform: scale(1.05);
}

.thumb-item.active {
    border-color: var(--accent);
}

.thumb-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    transition: background 0.3s;
}

.thumb-item.active::after,
.thumb-item:hover::after {
    background: transparent;
}

/* =========================================
   5. 博客文章区
========================================= */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
}

.article-card {
    display: flex;
    text-decoration: none;
    color: inherit;
    padding: 24px;
}

.article-thumb {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-img);
    overflow: hidden;
    flex-shrink: 0;
    margin-right: 24px;
}

.article-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-content h3 {
    font-size: 22px;
    margin-bottom: 8px;
    transition: color 0.3s;
}

.article-card:hover h3 {
    color: var(--accent);
}

.article-date {
    font-size: 13px;
    color: var(--text-sec);
    margin-bottom: 8px;
}

.article-desc {
    font-size: 14px;
    color: var(--text-sec);
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.meta-icons {
    display: flex;
    gap: 16px;
    color: var(--text-sec);
    font-size: 13px;
}

.meta-icons span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* =========================================
   6. 个人简历区
========================================= */
.resume-header {
    display: flex;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border);
}

.resume-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 32px;
    border: 4px solid var(--bg-main);
}

.resume-title h3 {
    font-size: 32px;
    margin-bottom: 8px;
}

.resume-title p {
    font-size: 18px;
    color: var(--text-sec);
}

.resume-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-bottom: 40px;
}

.resume-col h4 {
    font-size: 20px;
    margin-bottom: 24px;
    color: var(--accent);
}

.resume-col ul {
    list-style: none;
}

.resume-col li {
    margin-bottom: 24px;
}

.resume-col li strong {
    display: block;
    font-size: 18px;
    margin-bottom: 4px;
}

.resume-col li p {
    color: var(--text-sec);
    font-size: 14px;
}

.resume-col li p.desc {
    margin-top: 8px;
    color: var(--text-main);
}

.skills-tags {
    display: flex;
    flex-wrap: wrap;
}

.skills-tags .tag {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-size: 14px;
    padding: 8px 16px;
}

.resume-footer {
    text-align: center;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

/* =========================================
   7. 留言墙
========================================= */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.note-card {
    padding: 24px;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
    color: #1A1A1A; /* 保持文字深色以保证可读性 */
    transition: transform 0.3s;
}

[data-theme="dark"] .note-card {
    color: #FFFFFF;
}

.note-card:hover {
    transform: translateY(-4px) rotate(-1deg);
}

.note-card:nth-child(even):hover {
    transform: translateY(-4px) rotate(1deg);
}

.note-date {
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 16px;
}

.note-content {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 24px;
    min-height: 80px;
}

.note-author {
    font-size: 14px;
    font-weight: bold;
    text-align: right;
}

/* =========================================
   8. 底部 Footer
========================================= */
footer {
    background-color: var(--footer-bg);
    padding: 60px 40px;
    margin-top: 100px;
}

.footer-container {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-info p {
    color: var(--text-main);
    margin-bottom: 8px;
}

.footer-info .icp {
    font-size: 14px;
    color: var(--text-sec);
}

.footer-socials {
    display: flex;
    gap: 24px;
}

.footer-socials a {
    color: var(--text-main);
    transition: color 0.3s;
}

.footer-socials a:hover {
    color: var(--accent);
}

/* =========================================
   响应式布局 (Mobile)
========================================= */
@media (max-width: 768px) {
    .section-container {
        padding: 0 20px;
        margin: 60px auto;
    }
    
    .nav-links {
        display: none; /* 移动端可以考虑隐藏或做汉堡菜单 */
    }
    
    .hero {
        flex-direction: column-reverse;
        text-align: center;
        padding-top: 100px;
    }
    
    .hero-content {
        padding-right: 0;
        margin-top: 40px;
    }
    
    .hero-image {
        justify-content: center;
    }
    
    #stats-links {
        grid-template-columns: 1fr;
    }
    
    .banner-card {
        flex-direction: column;
        text-align: center;
        gap: 24px;
    }
    
    .gallery-main {
        flex-direction: column;
    }
    
    .gallery-img-container,
    .gallery-info {
        width: 100%;
    }
    
    .gallery-info {
        padding: 24px;
    }
    
    .gallery-thumbnails {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .resume-columns {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .resume-header {
        flex-direction: column;
        text-align: center;
    }
    
    .resume-avatar {
        margin-right: 0;
        margin-bottom: 24px;
    }
    
    .notes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-container {
        flex-direction: column;
        text-align: center;
        gap: 24px;
    }
}

@media (max-width: 480px) {
    .notes-grid {
        grid-template-columns: 1fr;
    }
    
    .article-card {
        flex-direction: column;
    }
    
    .article-thumb {
        width: 100%;
        height: 200px;
        margin-right: 0;
        margin-bottom: 16px;
    }
}