/* style.css */

/* 1. CSS 变量定义 */
:root {
    /* 暗色模式变量 (默认) */
    --color-background: #1A202C;
    --color-surface: #2D3748;
    --color-primary-text: #E2E8F0;
    --color-secondary-text: #A0AEC0;
    --color-accent: #38B2AC;
    --color-border: #4A5568;

    /* 亮色模式变量 */
    --light-bg: #F7FAFC;
    --light-surface: #FFFFFF;
    --light-text-primary: #2D3748;
    --light-text-secondary: #718096;
    --light-accent: #2B6CB0;
    --light-border: #E2E8F0;

    /* 字体变量 */
    --font-primary: 'Playfair Display', serif;
    --font-secondary: 'Lato', sans-serif;
    --font-mono: 'Roboto Mono', monospace;
}

body.light-mode {
    --color-background: var(--light-bg);
    --color-surface: var(--light-surface);
    --color-primary-text: var(--light-text-primary);
    --color-secondary-text: var(--light-text-secondary);
    --color-accent: var(--light-accent);
    --color-border: var(--light-border);
}

/* 2. 全局重置与基础样式 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body { background-color: var(--color-background); color: var(--color-primary-text); font-family: var(--font-secondary); line-height: 1.6; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; transition: background-color 0.3s ease, color 0.3s ease; }
h1, h2, h3 { font-family: var(--font-primary); line-height: 1.2; margin-bottom: 1rem; }
h1 { font-size: clamp(3rem, 10vw, 5rem); }
h2 { font-size: clamp(2rem, 6vw, 2.5rem); }
h3 { font-size: 1.5rem; }
p { color: var(--color-secondary-text); margin-bottom: 1rem; }
a { color: var(--color-accent); text-decoration: none; transition: color 0.3s ease; }
a:hover { opacity: 0.8; }
section { padding: 4rem 0; }
.container { width: 90%; max-width: 1200px; margin: 0 auto; }

/* 3. 主题切换按钮 */
.theme-toggle-btn { position: fixed; top: 20px; right: 20px; z-index: 1000; background: var(--color-surface); border: 1px solid var(--color-border); width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background-color 0.3s ease, border-color 0.3s ease; }
.theme-toggle-btn.moon { display: none; }
.light-mode.theme-toggle-btn.sun { display: none; }
.light-mode.theme-toggle-btn.moon { display: block; }

/* 4. 英雄区域 */
.hero { position: relative; min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 1rem; overflow: hidden; }
.hero-content { position: relative; z-index: 2; max-width: 800px; }
.hero-title { margin-bottom: 0.5rem; }
.hero-subtitle { font-size: clamp(1.2rem, 4vw, 1.75rem); color: var(--color-accent); font-family: var(--font-mono); margin-bottom: 1.5rem; }
.hero-description { max-width: 600px; margin: 0 auto 2rem auto; font-size: 1.1rem; }
.btn { display: inline-block; padding: 0.75rem 1.5rem; border-radius: 5px; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; transition: all 0.3s ease; margin: 0.5rem; }
.btn-primary { background-color: var(--color-accent); color: var(--color-background); }
.btn-primary:hover { opacity: 0.8; transform: translateY(-3px); box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
.btn-secondary { border: 2px solid var(--color-accent); color: var(--color-accent); }
.btn-secondary:hover { background-color: var(--color-accent); color: var(--color-background); transform: translateY(-3px); }
#particles-js { position: absolute; width: 100%; height: 100%; top: 0; left: 0; z-index: 1; }

/* 5. 便当网格 */
.bento-grid { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
.bento-box { background-color: var(--color-surface); border-radius: 12px; padding: 1.5rem; border: 1px solid var(--color-border); transition: all 0.3s ease; }
.bento-box:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.25); }
.timeline-item { position: relative; padding-left: 1.5rem; border-left: 2px solid var(--color-accent); }
.timeline-item:not(:last-child) { margin-bottom: 1.5rem; }
.timeline-item::before { content: ''; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background-color: var(--color-accent); }
.timeline-item h4 { font-size: 1.1rem; margin-bottom: 0.25rem; }
.timeline-item p { font-size: 0.9rem; margin-bottom: 0; color: var(--color-secondary-text); }
.box-courses ul { list-style: none; columns: 2; gap: 1rem; }
.box-courses li { padding-left: 1rem; position: relative; }
.box-courses li::before { content: '›'; position: absolute; left: 0; color: var(--color-accent); }
.skills-grid { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.skills-grid span { background-color: rgba(56, 178, 172, 0.15); color: var(--color-accent); padding: 0.25rem 0.75rem; border-radius: 20px; font-size: 0.9rem; font-family: var(--font-mono); }
.light-mode.skills-grid span { background-color: rgba(43, 108, 176, 0.1); }

/* 6. 项目展示 */
.project-filters { display: flex; justify-content: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 2rem; }
.filter-btn { background: none; border: 1px solid var(--color-border); color: var(--color-secondary-text); padding: 0.5rem 1rem; border-radius: 20px; cursor: pointer; transition: all 0.3s ease; }
.filter-btn:hover { background-color: var(--color-surface); color: var(--color-primary-text); }
.filter-btn.active { background-color: var(--color-accent); color: var(--color-background); border-color: var(--color-accent); }
.project-gallery { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.project-card { background-color: var(--color-surface); border-radius: 8px; overflow: hidden; border: 1px solid var(--color-border); transition: all 0.4s ease; }
.project-card.hide { transform: scale(0.8); opacity: 0; width: 0; height: 0; padding: 0; margin: 0; overflow: hidden; font-size: 0; }
.project-card img { width: 100%; height: 200px; object-fit: cover; display: block; }
.project-info { padding: 1.5rem; }
.project-info h3 { font-size: 1.25rem; }
.project-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }
.project-tags span { background-color: rgba(56, 178, 172, 0.15); color: var(--color-accent); padding: 0.2rem 0.6rem; border-radius: 15px; font-size: 0.8rem; font-family: var(--font-mono); }
.light-mode.project-tags span { background-color: rgba(43, 108, 176, 0.1); }
.project-links a { margin-right: 1rem; font-weight: bold; }

/* 7. 资质凭证 */
.credentials-container { display: grid; grid-template-columns: 1fr; gap: 3rem; max-width: 900px; margin: 0 auto; }
.credential-list h3 { border-bottom: 2px solid var(--color-accent); padding-bottom: 0.5rem; margin-bottom: 1.5rem; }
.credential-item { background-color: var(--color-surface); padding: 1.5rem; border-radius: 8px; border-left: 4px solid var(--color-accent); }
.credential-item:not(:last-child) { margin-bottom: 1.5rem; }
.credential-item h4 { font-size: 1.1rem; margin-bottom: 0.5rem; font-family: var(--font-secondary); font-weight: bold; }
.credential-item p { font-size: 0.9rem; margin-bottom: 0.25rem; }

/* 8. 页脚 */
.site-footer { background-color: var(--color-surface); text-align: center; padding: 3rem 1rem; margin-top: 4rem; }
.footer-email { display: inline-block; margin: 1.5rem 0; font-size: 1.2rem; font-weight: bold; padding: 0.5rem 1rem; border: 1px solid transparent; transition: all 0.3s ease; }
.footer-email:hover { border-color: var(--color-accent); border-radius: 5px; }
.footer-social { margin-bottom: 2rem; }
.footer-social a { display: inline-block; margin: 0 1rem; color: var(--color-secondary-text); }
.footer-social a:hover { color: var(--color-primary-text); transform: scale(1.2); }
.footer-copyright p { font-size: 0.8rem; color: var(--color-secondary-text); opacity: 0.7; margin: 0; }

/* 9. 滚动动画 */
.animated-element { opacity: 0; transform: translateY(30px); transition: opacity 0.6s ease-out, transform 0.6s ease-out; }
.animated-element.is-visible { opacity: 1; transform: translateY(0); }

/* 10. 响应式布局 */
@media (min-width: 768px) {
   .bento-grid { grid-template-columns: repeat(2, 1fr); }
   .box-about { grid-column: span 2; }
   .project-gallery { grid-template-columns: repeat(2, 1fr); }
   .credentials-container { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1024px) {
   .bento-grid { grid-template-columns: repeat(4, 1fr); }
   .box-about { grid-column: span 2; grid-row: span 2; }
   .box-education { grid-column: span 2; }
   .box-experience { grid-column: span 2; }
   .box-courses { grid-column: span 2; }
   .box-skills { grid-column: span 2; }
   .project-gallery { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}