/* --- 颜色和主题变量 --- */
:root {
  --bg-gradient: linear-gradient(0deg, #20b57d 40%, #258ec5 60%);
  --text-color: #fff;
  --link-accent-color: #25c5b0;
  --link-bg-hover: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] {
  --bg-gradient: linear-gradient(0deg, #1a3c34 40%, #1e4a6b 60%);
  --text-color: #e0e0e0;
  --link-accent-color: #30e0c8;
  --link-bg-hover: rgba(0, 0, 0, 0.2);
}

/* --- 全局和基础样式 --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: "微软雅黑", "Oswald", sans-serif;
  color: var(--text-color);
  background: var(--bg-gradient);
  overflow-x: hidden;
  animation: fadeIn 0.5s ease-out;
  user-select: none;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 15px;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: var(--bg-gradient);
  background-size: 200% 200%;
  z-index: -1;
  animation: bg-gradient-flow 12s infinite linear;
}

@keyframes bg-gradient-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 650px;
  min-height: auto;
  padding: 20px 0 30px; /* 调整了 padding-bottom 为 bio 提供空间 */
  text-align: center;
}

.logo img {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px solid var(--text-color);
  transition: transform 0.4s ease;
  cursor: pointer;
  margin-bottom: 25px; /* 从 30px 调整为 25px */
}

.logo img:hover {
  transform: scale(1.1) rotate(360deg);
}

/* 个人简介样式 */
.bio {
  font-family: "微软雅黑", sans-serif;
  font-size: clamp(14px, 2.2vw, 16px);
  line-height: 1.6;
  color: var(--text-color);
  opacity: 0.9;
  max-width: 500px;
  margin-left: auto; /* 与 max-width 配合居中 */
  margin-right: auto; /* 与 max-width 配合居中 */
  margin-bottom: 40px;
  padding: 0 15px;
  text-align: center;
}

nav {
  width: 100%;
}

.links {
  list-style: none;
  padding: 0;
}

.links li {
  margin-bottom: 12px;
  position: relative;
  perspective: 1000px;
}

.links a {
  font-family: 'Oswald', sans-serif;
  font-size: clamp(20px, 4vw, 34px);
  font-weight: 500;
  color: var(--text-color);
  text-decoration: none;
  text-transform: uppercase;
  padding: 8px 15px;
  display: inline-block;
  position: relative;
  transition: color 0.3s ease;
  letter-spacing: 0.5px; /* 从 1px 改为 0.5px 以适应图标 */
  outline: none;
}

.links a .link-text {
  display: inline-block;
  transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
  transform-style: preserve-3d;
}

/* 新增：导航链接图标样式 */
.links a .link-text .icon {
  display: inline-block;
  margin-right: 0.4em;
  /* font-size: 0.9em; /* 如果希望图标略小，可以取消注释这行 */
  /* vertical-align: middle; /* 如果需要微调垂直对齐 */
}


.links a::before,
.links a::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0%;
  height: 2px;
  background-color: var(--link-accent-color);
  transition: width 0.4s ease-out;
}

.links a::before {
  top: -2px;
}

.links a::after {
  bottom: -2px;
}

.links a:hover .link-text,
.links a:focus .link-text {
  transform: translateY(-6px);
}

.links a:hover::before,
.links a:focus::before,
.links a:hover::after,
.links a:focus::after {
  width: 80%;
}

.links a:active .link-text {
  transform: translateY(-3px);
}

/* 子菜单样式 */
.submenu-container {
  perspective: 1000px;
}

.submenu {
  list-style: none;
  padding: 0;
  margin-top: 8px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-15px) rotateX(-25deg);
  transform-origin: top center;
  background: rgba(0,0,0,0.1);
  border-radius: 6px;
  transition: max-height 0.4s ease-out, opacity 0.4s ease-out, transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), padding 0.4s ease-out;
}

.submenu.active {
  max-height: 280px;
  opacity: 1;
  transform: translateY(0) rotateX(0deg);
  padding: 12px;
  margin: 8px 0;
}

.submenu li {
  margin-bottom: 8px;
}

.submenu li:last-child {
  margin-bottom: 0;
}

.submenu a {
  font-family: 'Oswald', sans-serif;
  font-size: clamp(15px, 2.5vw, 20px);
  font-weight: 400;
  color: var(--text-color);
  text-decoration: none;
  text-transform: uppercase;
  padding: 6px 12px;
  display: block;
  border-radius: 4px;
  transition: background-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
  text-align: center;
}

.submenu a:hover,
.submenu a:focus {
  background-color: var(--link-bg-hover);
  color: var(--link-accent-color);
  transform: translateX(4px);
}

/* 主题切换按钮 */
.theme-toggle {
  position: fixed;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-color);
  transition: background 0.3s, transform 0.3s ease;
  z-index: 100;
  font-size: 1.1em;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* Footer */
footer {
  position: fixed;
  bottom: 15px;
  text-align: center;
  color: var(--text-color);
  font-size: clamp(11px, 1.4vw, 13px);
  opacity: 0.8;
  font-family: "微软雅黑", sans-serif;
}

footer a {
  color: inherit;
  text-decoration: none;
  font-weight: bold;
}

footer a:hover {
  text-decoration: underline;
  color: var(--link-accent-color);
}

/* 动画 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 响应式调整 */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  main {
    max-width: 90%;
    padding: 15px 0 20px; /* 调整 padding-bottom */
  }
  .logo img {
    width: 75px;
    height: 75px;
    margin-bottom: 20px; /* 调整 bio 上方间距 */
  }
  .bio {
    font-size: clamp(13px, 2vw, 15px);
    margin-bottom: 30px;
  }
  .links a {
    font-size: clamp(18px, 5vw, 30px);
    padding: 6px 10px;
  }
  .links li {
    margin-bottom: 10px;
  }
  .submenu.active {
    padding: 10px;
  }
  .submenu a {
    font-size: clamp(14px, 3.5vw, 18px);
  }
  .theme-toggle {
    top: 10px;
    right: 10px;
    padding: 7px;
    font-size: 1em;
  }
  footer {
    bottom: 10px;
    font-size: clamp(10px, 1.3vw, 12px);
  }
}

@media (max-width: 480px) {
  .logo img {
    width: 65px;
    height: 65px;
    margin-bottom: 15px; /* 调整 bio 上方间距 */
  }
  .bio {
    font-size: clamp(12px, 2.5vw, 14px);
    margin-bottom: 25px;
  }
  .links a {
    font-size: clamp(17px, 6vw, 26px);
    letter-spacing: 0.5px;
  }
  .links a .link-text .icon {
    margin-right: 0.3em; /* 略微减小图标与文字间距 */
  }
  .links li {
    margin-bottom: 8px;
  }
  .links a::before,
  .links a::after {
    height: 1px;
    top: -1px;
    bottom: -1px;
  }
  .submenu a {
    font-size: clamp(13px, 3vw, 16px);
  }
}