/* 全局样式 */
:root {
  --primary-color: #2563eb;
  --secondary-color: #3b82f6;
  --text-color: #1f2937;
  --bg-color: #f0f7ff;
  --nav-bg: rgba(255, 255, 255, 0.8);
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
}

/* 暗色主题 */
[data-theme="dark"] {
  --primary-color: #60a5fa;
  --secondary-color: #3b82f6;
  --text-color: #f3f4f6;
  --bg-color: #111827;
  --nav-bg: rgba(17, 24, 39, 0.8);
  --card-bg: #1f2937;
  --border-color: #374151;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, sans-serif;
  color: var(--text-color);
  background-color: var(--bg-color);
  line-height: 1.6;
}

/* 导航栏样式 */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  padding: 1rem 2rem;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  z-index: 1000;
  border-bottom: 1px solid var(--border-color);
  height: 70px; /* 确保导航栏高度固定 */
  gap: 2rem;
}

.logo {
  margin-right: auto;
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-links a {
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.nav-links a:hover {
  color: var(--primary-color);
}

/* 项目卡片样式 */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3rem; /* 增加行间距，从2rem改为3rem */
  margin-top: 2rem;
  align-items: start; /* 确保每行的起始位置对齐 */
}

.project-card {
  background: var(--card-bg);
  border-radius: 1rem;
  padding: 2rem;
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  height: auto; /* 改为auto，让卡片高度自适应内容 */
}

/* 响应式布局 */
@media (max-width: 768px) {
  .projects-grid {
    grid-template-columns: 1fr; /* 在移动端改为单列 */
  }
}

/* 美化项目卡片 */
.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* 项目图片样式 */
.project-image {
  width: 100%;
  height: 200px;  /* 固定高度 */
  object-fit: contain;  /* 改为 contain 而不是 cover */
  background: var(--card-bg);  /* 添加背景色 */
  border-radius: 0.5rem;
  margin: 1rem 0;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .project-image {
    height: 180px;  /* 移动端稍微降低高度 */
  }
}

@media (max-width: 480px) {
  .project-image {
    height: 150px;  /* 更小屏幕进一步降低高度 */
  }
}

/* 语言切换按钮 */
.lang-switch {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background: transparent;
  color: var(--text-color);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-switch:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.lang-divider {
  color: var(--border-color);
  font-weight: 300;
}

/* 主题切换按钮 */
.theme-toggle {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background: transparent;
  color: var(--text-color);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .navbar {
    padding: 1rem;
  }
  
  .nav-links {
    display: none;
  }
}

/* 内容区域样式 */
main {
    padding-top: 120px; /* 增加上边距，从80px改为120px */
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 2rem;
    padding-right: 2rem;
}

section {
    scroll-margin-top: 100px;
    margin-bottom: 6rem; /* 增加模块之间的间距 */
}

.section-title {
    margin-bottom: 3rem; /* 增加标题和内容的间距 */
}

/* 项目卡片额外样式 */
.tech-stack {
  margin-top: auto; /* 将技术栈推到卡片底部 */
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tech-stack span {
  background: var(--tag-bg);
  padding: 0.3rem 0.8rem;
  border-radius: 2rem;
  font-size: 0.9rem;
}

.project-links {
    display: flex;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.project-links a {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.project-links a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.project-links a::after {
    content: " →";
    margin-left: 0.5rem;
    transition: transform 0.3s ease;
}

.project-links a:hover::after {
    transform: translateX(3px);
}

/* 技能网格 */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.skill-category {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.skill-category h3 {
    margin-top: 0;
    color: var(--primary-color);
}

/* 联系方式样式 */
.contact-info {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    margin-top: 2rem;
}

.contact-info a {
    color: var(--primary-color);
    text-decoration: none;
}

/* 移动端样式优化 */
@media (max-width: 768px) {
    .nav-links.show {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--nav-bg);
        padding: 1rem;
        backdrop-filter: blur(10px);
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .skills-grid {
        grid-template-columns: 1fr;
    }
}

/* About section 样式 */
.profile-container {
    display: flex;
    gap: 2rem;
    align-items: center;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.profile-image-wrapper {
    flex-shrink: 0;  /* 防止图片被压缩 */
}

.profile-image {
    width: 200px;
    height: 200px;
    border-radius: 1rem;
    object-fit: cover;
}

.profile-content {
    flex: 1;
}

.profile-name {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: var(--text-color);
}

.profile-title {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 2rem;
}

.profile-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profile-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-color);
    border-radius: 0.5rem;
}

.item-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.item-text {
    font-size: 1rem;
    color: var(--text-color);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .profile-container {
        flex-direction: column;
        padding: 1rem;
    }

    .profile-image-wrapper {
        width: 150px;  /* 移动端缩小头像 */
        height: 150px;
    }

    .profile-image {
        width: 100%;
        height: 100%;
    }

    .profile-content {
        text-align: center;
        width: 100%;
    }

    .profile-items {
        align-items: center;
    }
}

/* 更小屏幕的适配 */
@media (max-width: 480px) {
    .profile-image-wrapper {
        width: 120px;
        height: 120px;
    }

    .profile-name {
        font-size: 1.5rem;
    }

    .profile-title {
        font-size: 1rem;
    }
}

/* 移动端菜单按钮样式 */
.mobile-menu {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-color);
}

/* 响应式导航栏 */
@media (max-width: 768px) {
    .mobile-menu {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--nav-bg);
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        backdrop-filter: blur(10px);
        border-bottom: 1px solid var(--border-color);
    }

    .nav-links.show {
        display: flex;
    }

    .navbar {
        justify-content: space-between;
    }
}

/* 语言切换按钮和主题切换按钮容器 */
.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* About section 补充样式 */
.about-text {
    margin-top: 2rem;
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-color);
    max-width: 800px;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

/* 语言切换相关样式 */
.content[data-lang] {
    display: none;
}

/* 默认显示英文 */
.content[data-lang="en"] {
    display: block;
}

/* 当HTML的lang属性为zh时显示中文 */
html[lang="zh"] .content[data-lang="zh"] {
    display: block;
}

html[lang="zh"] .content[data-lang="en"] {
    display: none;
}

.tech-stack-title {
    font-size: 0.9rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* 新增项目高亮样式 */
.project-card.featured {
  border: 2px solid var(--primary-color);
  position: relative;
  overflow: hidden;
}

.project-card.featured::before {
  content: "NEW";
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--primary-color);
  color: white;
  padding: 0.3rem 0.6rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  font-weight: bold;
  z-index: 1;
}

/* 项目卡片动画效果增强 */
.project-card.featured:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}