/* =============== 全局重置与变量 =============== */
:root {
  /* 浅色主题 */
  --bg-light: #f8f9fa;
  --text-light: #212529;
  --card-bg-light: rgba(255, 255, 255, 0.7);
  --nav-bg-light: rgba(255, 255, 255, 0.8);

  /* 深色主题 */
  --bg-dark: #1e1e1e;
  --text-dark: #e0e0e0;
  --card-bg-dark: rgba(30, 30, 30, 0.6);
  --nav-bg-dark: rgba(30, 30, 30, 0.8);

  /* 主色（JetBrains Purple） */
  --primary: #6f42c1;
  --primary-hover: #5a32a3;

  /* 其他 */
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "HarmonyOS Sans SC", "JetBrains Mono", -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  transition: background-color var(--transition), color var(--transition);
}

/* =============== 主题控制 =============== */
body.theme-light {
  background-color: var(--bg-light);
  color: var(--text-light);
}

body.theme-dark {
  background-color: var(--bg-dark);
  color: var(--text-dark);
}

/* 自动模式：默认跟随系统 */
@media (prefers-color-scheme: light) {
  body.theme-auto {
    background-color: var(--bg-light);
    color: var(--text-light);
  }
}
@media (prefers-color-scheme: dark) {
  body.theme-auto {
    background-color: var(--bg-dark);
    color: var(--text-dark);
  }
}

/* =============== 布局 =============== */
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* =============== 导航栏 =============== */
.glass-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
body.theme-light .glass-nav,
body.theme-auto:has(#theme-toggle[aria-label="浅色"]) .glass-nav {
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

.glass-nav .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.logo {
  font-size: 1.5rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--primary), #4a2b8e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

nav a, .header-actions a {
  margin-left: 1.5rem;
  text-decoration: none;
  color: inherit;
  opacity: 0.85;
  transition: opacity 0.2s;
}
nav a:hover, .header-actions a:hover {
  opacity: 1;
}

/* =============== Hero =============== */
.hero {
  padding: 6rem 0 4rem;
  text-align: center;
}
.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}
.hero p {
  font-size: 1.2rem;
  opacity: 0.8;
}

/* =============== 作品区 =============== */
.filter-tabs {
  display: flex;
  gap: 1rem;
  margin: 2rem 0;
  justify-content: center;
}
.filter-tabs button {
  background: transparent;
  border: 1px solid currentColor;
  padding: 0.5rem 1.2rem;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition);
}
.filter-tabs button.active,
.filter-tabs button:hover {
  background: var(--primary);
  color: white;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
}

.project-card {
  padding: 1.5rem;
  border-radius: var(--radius);
  transition: transform 0.3s, box-shadow 0.3s;
}
.project-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
}

.card-image-placeholder {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 1rem;
  opacity: 0.7;
}

.project-card h3 {
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
}
.project-card p {
  margin-bottom: 1rem;
  opacity: 0.85;
  font-size: 0.95rem;
}

.project-card img{
  width: 64px;
  height: auto;
  border-radius: 25%;
}

.btn-primary {
  display: inline-block;
  background: var(--primary);
  color: white;
  text-decoration: none;
  padding: 0.5rem 1.2rem;
  border-radius: 6px;
  transition: background 0.2s;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

/* =============== 关于 =============== */
.about-section {
  padding: 3rem 0;
  margin-bottom: 3rem;
}
.code-snippet {
  display: block;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9rem;
}
body.theme-dark .code-snippet,
body.theme-auto:has(#theme-toggle[aria-label="深色"]) .code-snippet {
  background: rgba(255, 255, 255, 0.1);
}

/* =============== 页脚 =============== */
footer {
  padding: 2rem 0;
  text-align: center;
  opacity: 0.7;
  font-size: 0.9rem;
}
.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem 0;
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  text-decoration: none;
  color: inherit;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.footer-links a:hover {
  opacity: 1;
}

/* =============== 主题切换按钮 =============== */
#theme-toggle {
  position: fixed;
  top: 1.2rem;
  right: 1.2rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--card-bg-dark);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-dark);
  font-size: 1rem;
  cursor: pointer;
  z-index: 99;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
body.theme-light #theme-toggle,
body.theme-auto:has(#theme-toggle[aria-label="浅色"]) #theme-toggle {
  background: var(--card-bg-light);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--text-light);
}

/* =============== 响应式 =============== */
@media (max-width: 768px) {
  .glass-nav .container {
    flex-direction: column;
    gap: 1rem;
  }
  nav {
    display: flex;
    gap: 1.5rem;
  }
  .hero h1 {
    font-size: 2rem;
  }
  .projects-grid {
    grid-template-columns: 1fr;
  }
}