/* =========================================
   1. Design Token & Themes
   ========================================= */
:root {
  /* 基础参数 */
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-md: 16px;
  --radius-full: 999px;
  --container-width: 1024px;
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --ease-standard: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-emphasis: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 180ms;
  --duration-base: 480ms;
  
  /* [Light Mode] 默认日间模式变量 */
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.8);
  --bg-hover: #f1f5f9;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-invert: #ffffff;
  
  --primary: #2563eb;       /* 核心蓝 */
  --primary-glow: rgba(37, 99, 235, 0.2);
  
  --border-light: rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  --gradient-title: linear-gradient(135deg, #0f172a 0%, #3b82f6 100%);
  --decoration-blob: #e2e8f0;
}

/* [Dark Mode] 深色模式变量覆盖 */
[data-theme="dark"] {
  --bg-body: #1b1b1d;       /* 纯净中性暗背景 */
  --bg-card: #242526;       /* 轻微抬升层级 */
  --bg-glass: rgba(27, 27, 29, 0.82);
  --bg-hover: #2d2f31;
  
  --text-main: #e8e9ea;
  --text-muted: #b0b3b8;
  
  --primary: #78a8f8;
  --primary-glow: rgba(120, 168, 248, 0.24);
  
  --border-light: rgba(227, 227, 227, 0.14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.32);
  --shadow-card: 0 8px 20px rgba(0, 0, 0, 0.22);
  --shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.30);
  
  --gradient-title: linear-gradient(135deg, #f1f2f4 0%, #9abcf2 100%);
  --decoration-blob: #2a2c2e;
}

/* =========================================
   2. Global Reset & Layout
   ========================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  width: 100%;
  max-width: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  /* 关键：平滑过渡背景色和文字颜色 */
  transition: background-color 0.4s ease, color 0.4s ease;
  max-width: 100%;
  overflow-x: hidden;
}

@supports (overflow: clip) {
  html,
  body {
    overflow-x: clip;
  }
}

/* 新增：全局图片约束，防止图片撑破布局 */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

a { text-decoration: none; color: inherit; transition: var(--transition-base); }
ul { list-style: none; }

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

.section-padding { padding: 64px 0; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.column { flex-direction: column; }

/* 滚动条美化 */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 4px; opacity: 0.5; }

/* =========================================
   3. Navigation (Glassmorphism)
   ========================================= */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  transition: background-color 0.4s ease, border-color 0.4s ease;
}

.nav-container {
  height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-main);
}

.logo-dot {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--primary);
}

.nav-actions { display: flex; align-items: center; gap: 24px; }

.nav-links { display: flex; gap: 18px; }
.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-fast) var(--ease-standard);
}
.nav-links a:hover, .nav-links a.active { color: var(--primary); }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }

.nav-controls { display: flex; align-items: center; gap: 12px; }

/* 按钮通用样式 */
.control-btn {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard);
  display: flex;
  align-items: center;
  justify-content: center;
}

.control-btn:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  color: var(--primary);
}

/* 主题切换按钮特殊处理 */
.theme-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
}

.theme-toggle i {
  position: absolute;
  transition: transform 420ms var(--ease-emphasis), opacity 320ms var(--ease-standard);
}

/* 图标切换动画逻辑 */
[data-theme="light"] .moon-icon { transform: translateY(20px) rotate(90deg); opacity: 0; }
[data-theme="light"] .sun-icon { transform: translateY(0) rotate(0); opacity: 1; }
[data-theme="dark"] .sun-icon { transform: translateY(-20px) rotate(-90deg); opacity: 0; }
[data-theme="dark"] .moon-icon { transform: translateY(0) rotate(0); opacity: 1; }

/* =========================================
   4. Hero Section / Intro
   ========================================= */
.intro {
  padding: 84px 0 44px;
  position: relative;
  text-align: center;
}

.intro-container {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 60px;
}

.intro-left {
  display: flex;
  flex-direction: column;
  text-align: center;
  flex-shrink: 0;
  align-items: flex-start;
  padding-left: 80px;
}

.intro-left > *:not(.intro-subtitle) {
  align-self: center;
}

.intro-right {
  flex: 1;
  text-align: left;
  padding-top: 20px;
  padding-left: 100px;
}

.family-title {
  font-size: 1.3rem;
  color: var(--text-main);
  margin-bottom: 20px;
  font-weight: 600;
}

.family-members {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.family-member {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: transform var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard);
}

.family-member:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-card);
}

.family-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
  flex-shrink: 0;
}

.family-info {
  flex: 1;
}

.family-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.family-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

@media (max-width: 768px) {
  .intro-container {
    flex-direction: column;
    align-items: center;
  }
  
  .intro-right {
    text-align: center;
    width: 100%;
  }
  
  .family-member {
    flex-direction: column;
    text-align: center;
  }
}

/* 背景装饰球 */
.bg-decoration {
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, var(--decoration-blob) 0%, transparent 70%);
  opacity: 0.5;
  z-index: -1;
  pointer-events: none;
}

.avatar-container {
  position: relative;
  margin-bottom: 18px;
  opacity: 0;
  animation: intro-fade-up 620ms var(--ease-emphasis) 120ms forwards;
}

.avatar {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-card);
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.avatar-glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--primary);
  filter: blur(25px);
  opacity: 0.4;
  z-index: 1;
  transform: scale(0.9);
  transition: opacity 0.3s;
}
.avatar-container:hover .avatar-glow { opacity: 0.7; }

.gradient-text {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--text-main);
  letter-spacing: -1px;
  opacity: 0;
  animation: intro-fade-up 620ms var(--ease-emphasis) 210ms forwards;
}

.subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 700px;
  margin: 0 auto;
  opacity: 0;
  animation: intro-fade-up 620ms var(--ease-emphasis) 300ms forwards;
}

.intro-contact-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
  opacity: 0;
  animation: intro-fade-up 620ms var(--ease-emphasis) 390ms forwards;
}

.intro-subtitle {
  text-align: left;
  margin-top: 8px;
  opacity: 0;
  animation: intro-fade-up 620ms var(--ease-emphasis) 280ms forwards;
}

.intro-subtitle p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 4px;
}

.info-label {
  display: inline-block;
  width: 80px;
  color: var(--text-muted);
}

.info-value {
  color: var(--text-main);
}

.edu-value {
  display: block;
  padding-left: 80px;
  margin-top: -22px;
}

.intro-contact-link {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
}

.intro-contact-link i {
  font-size: 1.1rem;
}

.intro-contact-link:hover {
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* =========================================
   5. Projects Grid & Detail Images
   ========================================= */
h2 {
  font-size: 2rem;
  text-align: center;
  margin-bottom: 32px;
  color: var(--text-main);
  position: relative;
  display: inline-block;
  width: 100%;
}
/* 标题下划线 */
h2::after {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  background: var(--primary);
  margin: 12px auto 0;
  border-radius: 2px;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 24px;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: transform var(--duration-base) var(--ease-standard), box-shadow var(--duration-base) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
  transform: translateZ(0); 
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
  border-color: var(--primary-glow);
}

.project-card .project-info {
  padding: 24px;
}

.project-card .project-info h3 {
  font-size: 1.15rem;
  color: var(--text-main);
  min-height: 2.3em;
  line-height: 1.4;
  margin-bottom: 8px;
}

.project-role {
  display: inline-block;
  font-size: 0.8rem;
  padding: 4px 12px;
  background: var(--primary);
  color: var(--text-invert);
  border-radius: 20px;
  margin-bottom: 8px;
}

.project-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 12px;
}

.project-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.project-card .project-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
}

/* 首页项目卡片缩略图 - 优化适配 */
.project-thumbnail {
  width: 100%;
  height: 220px;           /* 调整高度，显示更佳 */
  object-fit: cover;       /* 填满容器，防止拉伸 */
  object-position: center; /* 居中裁剪 */
  border-bottom: 1px solid var(--border-light);
  transition: transform var(--duration-base) var(--ease-standard);
  background-color: var(--bg-hover);
}

.card:hover .project-thumbnail { transform: scale(1.02); }

.project-thumbnail-wrapper { overflow: hidden; }

.project-info { padding: 24px; }

.project-info h3 {
  font-size: 1.25rem;
  margin-bottom: 8px;
  color: var(--text-main);
}

.project-info p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-link {
  font-weight: 600;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.project-link::after { content: '→'; transition: transform 0.2s; }
.project-link:hover::after { transform: translateX(4px); }

/* 子页面：详情大图样式 (新增) */
.project-detail-card { padding: 40px; }

.detail-container {
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

.detail-toc {
  position: sticky;
  top: 100px;
  width: 180px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
}

.toc-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.toc-item {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 6px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
  transition: all 0.2s;
}

.toc-item:hover {
  color: var(--primary);
  background: var(--bg-hover);
}

.toc-item.active {
  color: var(--primary);
  background: var(--bg-hover);
  font-weight: 500;
}

.detail-header {
  max-width: 800px;
  margin: 0 auto 20px;
}

.detail-header h2 {
  font-size: 1.5rem;
  color: var(--text-main);
  margin-bottom: 12px;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.detail-role {
  font-size: 0.85rem;
  padding: 4px 12px;
  background: var(--primary);
  color: var(--text-invert);
  border-radius: 20px;
}

.detail-date {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.project-detail-desc {
  max-width: 800px;
  margin: 30px auto;
  line-height: 1.8;
  color: var(--text-muted);
}

.project-detail-desc h3 {
  font-size: 1.1rem;
  color: var(--text-main);
  margin: 24px 0 12px;
  border-left: 3px solid var(--primary);
  padding-left: 12px;
}

.project-detail-desc p {
  margin-bottom: 12px;
}

.detail-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 16px 0;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.detail-image:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-card);
}

.detail-image-wrapper {
  position: relative;
  display: inline-block;
  margin: 16px 0;
  width: 48%;
  vertical-align: top;
}

.detail-image-sm {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.detail-image-sm:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-card);
}

.detail-image-wrapper::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 4px 0 0 0;
  pointer-events: none;
}

.detail-zoom-icon {
  position: absolute;
  bottom: 4px;
  right: 4px;
  color: white;
  font-size: 12px;
  z-index: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.link-hint {
  background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  margin: 10px 0;
  text-align: center;
  display: inline-block;
  color: white;
}

.link-hint i {
  margin-right: 4px;
  color: white;
}

.link-hint a {
  color: white !important;
  font-weight: 500;
  font-size: 0.8rem;
  text-decoration: none;
  transition: opacity 0.2s;
}

.link-hint-text {
  background: var(--bg-hover);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  margin: 16px 0;
  border-left: 3px solid var(--primary);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.link-hint-text i {
  margin-right: 8px;
  color: var(--primary);
}

.link-hint a:hover {
  opacity: 0.85;
  text-decoration: underline;
}

.project-img {
  display: block;
  width: 100%;             /* 强制宽度撑满容器 */
  max-width: 100%;         /* 防止超出父容器 */
  height: auto;            /* 高度自动，保持比例 */
  object-fit: contain;     /* 保证图片内容完整显示 */
  border-radius: var(--radius-md);
  margin: 32px auto;       /* 上下增加间距 */
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
}

/* =========================================
   6. Documents & Buttons
   ========================================= */
.publish-links-wrapper { text-align: center; margin-top: 40px; }

.publish-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  background: var(--bg-card);
  padding: 12px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.publish-link {
  padding: 10px 24px;
  border-radius: var(--radius-full);
  font-weight: 500;
  color: var(--text-muted);
  transition: transform var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard);
  display: flex;
  align-items: center;
  gap: 8px;
}

.publish-link:hover {
  background: var(--bg-hover);
  color: var(--primary);
  transform: translateY(-1px);
}

@keyframes intro-fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================
   7. Footer
   ========================================= */

footer {
  text-align: center;
  padding: 30px;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  background: var(--bg-body);
}

/* =========================================
   8. Mobile Responsive
   ========================================= */
@media (max-width: 768px) {
  .nav-links { display: none; } /* 暂时简化手机端 */
  .container { padding: 0 16px; }
  
  .section-padding { padding: 48px 0; }
  .intro { padding-top: 56px; }
  .gradient-text { font-size: 2.2rem; }
  .nav-actions { gap: 12px; }
  .nav-controls { gap: 8px; }
  .control-btn { padding: 6px 10px; }
  .logo { font-size: 1.1rem; }
  .project-detail-card { padding: 24px 18px; }

  /* 手机端图片适配 */
  .avatar {
    width: 120px;
    height: 120px;
  }
  .project-thumbnail {
    height: 180px;
  }
  .project-img {
    margin: 20px auto;
    border-radius: 8px;
  }
  
  .publish-links {
    flex-direction: column;
    border-radius: var(--radius-md);
    width: 100%;
  }
  
  .intro-contact-links {
    gap: 10px;
    margin-top: 18px;
  }

  .timeline-container {
    padding-left: 24px;
  }

  .timeline-dot {
    left: -28px;
  }
}


/* Paste this AFTER your existing CSS */

/* =========================================
   9. Open Source Section (New)
   ========================================= */
.opensource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 20px;
}

.os-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: transform var(--duration-base) var(--ease-standard), box-shadow var(--duration-base) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.os-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: var(--shadow-card);
}

.os-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.os-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.os-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  flex-grow: 1;
}

.os-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.os-tag {
  font-size: 0.75rem;
  padding: 4px 10px;
  background: var(--bg-hover);
  color: var(--text-muted);
  border-radius: 20px;
}

.os-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.os-btn {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.os-btn:hover { text-decoration: underline; }

/* =========================================
   9.1 Certificates Section
   ========================================= */
.certificates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 20px;
}

.cert-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: transform var(--duration-base) var(--ease-standard), box-shadow var(--duration-base) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
  display: flex;
  flex-direction: column;
}

.cert-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: var(--shadow-card);
}

.cert-image-wrapper {
  overflow: hidden;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  position: relative;
}

.cert-image {
  width: 100%;
  height: 120px;
  object-fit: contain;
  background: var(--bg-hover);
}

.cert-image-wrapper .zoom-icon {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px 0 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
}

.cert-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}

.cert-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.cert-level {
  font-size: 0.75rem;
  padding: 4px 10px;
  background: var(--primary);
  color: var(--text-invert);
  border-radius: 20px;
  white-space: nowrap;
}

.cert-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.cert-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  opacity: 0.7;
}

/* =========================================
   9.2 Portfolio Section
   ========================================= */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 20px;
}

.portfolio-card {
  display: flex;
  flex-direction: column;
}

.os-image-wrapper {
  overflow: hidden;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.os-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.portfolio-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  margin-top: 12px;
}

/* =========================================
   10. Timeline Section (New)
   ========================================= */
.timeline-container {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  padding-left: 30px;
}

/* Vertical Line */
.timeline-container::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-light);
}

.timeline-item {
  position: relative;
  margin-bottom: 28px;
}

.timeline-dot {
  position: absolute;
  left: -35px; /* Adjust based on padding */
  top: 5px;
  width: 12px;
  height: 12px;
  background: var(--bg-body);
  border: 2px solid var(--primary);
  border-radius: 50%;
  z-index: 1;
}

.timeline-date {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
  display: block;
}

.timeline-content p {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.timeline-header h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text-main);
}

.timeline-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 0.9rem;
  transition: color 0.2s, transform 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timeline-toggle:hover {
  color: var(--primary);
}

.timeline-toggle i {
  transition: transform 0.3s ease;
}

.timeline-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  opacity: 0;
  margin-top: 0;
}

.timeline-detail p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin: 8px 0;
  white-space: pre-wrap;
}

.timeline-item.expanded .timeline-detail {
  max-height: 800px;
  opacity: 1;
  margin-top: 12px;
}

/* =========================================
   11. Tech Stack Section (New)
   ========================================= */
.skills-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 24px;
}

.skill-category h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--text-main);
  border-left: 3px solid var(--primary);
  padding-left: 12px;
}

.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.skill-badge {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
}

.skill-badge:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.reveal {
  opacity: 0;
  transform: translateY(16px);
  filter: blur(2px);
  transition: opacity var(--duration-base) var(--ease-standard), transform var(--duration-base) var(--ease-standard), filter var(--duration-base) var(--ease-standard);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

@media (prefers-reduced-motion: reduce) {
  .avatar-container,
  .gradient-text,
  .subtitle,
  .intro-contact-links {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .reveal {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }
}

/* 修复主题切换按钮的点击响应 */
.theme-toggle {
  cursor: pointer;
  z-index: 10; /* 提高层级 */
  /* 确保按钮有足够空间容纳图标 */
  width: 40px; 
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 防止图标拦截鼠标事件，确保点击穿透到 button */
.theme-toggle i {
  pointer-events: none; 
}

/* 确保导航栏层级够高 */
nav {
  z-index: 1000;
}

/* ... Previous CSS ... */

/* =========================================
   12. Project Tags (New)
   ========================================= */
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px; /* Space between tags and 'View Details' link */
  margin-top: -12px;   /* Pull closer to description */
}

.project-tag {
  font-size: 0.75rem;
  padding: 3px 10px;
  background: var(--bg-hover);
  color: var(--primary);
  border-radius: 4px;
  font-weight: 500;
  border: 1px solid var(--border-light);
}

/* Adjust paragraph margin in project info to accommodate tags */
.project-info p {
  margin-bottom: 16px; 
}

/* =========================================
   13. Modal / Lightbox
   ========================================= */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
   padding-top: 60px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9);
}

.modal-content {
  margin: auto;
  display: block;
  width: auto;
  max-width: 90%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10000;
}

.modal-close:hover,
.modal-close:focus {
  color: #bbb;
}

.cert-image,
.os-image {
  cursor: pointer;
}
