/* css/styles.css */

/* CSS变量 */
:root {
  --primary-color: #3b82f6;
  --secondary-color: #6b7280;
  --background-color: #f9fafb;
  --text-color: #333;
  --link-color: #3b82f6;
  --header-link-hover-bg: #f0f0f0;
  --header-height: 50px; /* 新增高度变量 */
  /* 悬停时淡灰色背景 */
  --button-hover-color: #a1a1aa;
  --button-color: #6b7280;
  --button-shadow-color: #d1d5db;
}

html {
  overflow-y: scroll; /* 始终显示滚动条占位 */
}

/* 基础样式 */
body {
  padding: env(safe-area-inset-top) 
           env(safe-area-inset-right) 
           env(safe-area-inset-bottom) 
           env(safe-area-inset-left);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  font-family: 'Noto Sans SC', Arial, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
}

/* 通用基础样式 */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: calc(var(--header-height) + 20px) 20px 20px; /* 动态计算 */
  animation: fadeIn 1.5s ease-in;
  justify-content: center;
  align-items: center;
  text-align: center;
}

/* 新增首页专用样式 */
.index-main {
  justify-content: center;
  align-items: center;
  text-align: center;
}

/* 新增简历页专用样式 */
.profile-main {
  max-width: 960px;
  margin: 0 auto;
  align-items: flex-start;
  text-align: left;
}

/* 新增简历页细节优化 */
.profile-main .section-content {
  width: 100%;
  padding: 0 15px;
}

.profile-main h1 {
  text-align: left;
  margin-bottom: 15px;
  font-size: 2.2em;
}

.profile-main h2 {
  border-bottom: none;
  padding-bottom: 0;
  margin: 25px 0 15px;
}

.profile-main .contact-info {
  align-items: flex-start;
  margin-bottom: 20px;
}

header {
  position: fixed;
  height: var(--header-height); /* 使用变量 */
  /* 新增iOS适配 */
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
  top: 0;
  left: 0; /* 或 right:0 根据布局需求 */
  width: 100%;
  z-index: 1000; /* 确保高于页面其他内容 */
  /* 阴影优化 */
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  background-color: #ffffff;
  padding: 15px 20px;
  border-bottom: none;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  cursor: pointer;
}

/* Header 整体点击跳转主页 */
header a {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background-color 0.3s ease, transform 0.2s ease;
  background-color: transparent;
  /* 默认透明 */
  box-shadow: none;
}

header a:hover {
  background-color: var(--header-link-hover-bg);
  /* 悬停时淡灰色背景 */
}

.header-logo {
  max-width: 40px;
  /* 统一Logo大小 */
  height: auto;
}

.header-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  line-height: 1;
  gap: 2px;
}

.title-zh {
  font-size: 1.15em;
  font-weight: 700;
  color: #111827;
  letter-spacing: 0.1em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.title-en {
  font-size: 0.65em;
  font-weight: 500;
  color: #6b7280;
  letter-spacing: 0.05em;
  text-transform: capitalize;
}

.main-button {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background-color 0.3s ease, transform 0.2s ease;
  background-color: transparent;
  box-shadow: 0 0 5px var(--button-shadow-color);
}

.main-button:hover {
  background-color: var(--header-link-hover-bg);
  /* 悬停时淡灰色背景 */
}

.main-button-icon {
  height: 1.5em; /* 与文字字体大小同步 */
  width: auto; /* 保持原始宽高比 */
  max-width: 40px; /* 限制最大宽度 */
  object-fit: contain; /* 完整显示不拉伸 */
}

.main-button-text {
  font-size: 1.5em;
  /* 统一字体大小 */
  font-weight: bold;
  line-height: 1; /* 控制文字行高，避免额外高度 */
  color: #111827;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.logo {
  max-width: 150px;
  /* 统一Logo大小 */
  height: auto;
  margin-bottom: 20px;
  animation: bounceIn 1s ease-in-out;
}

@keyframes bounceIn {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }

  60% {
    transform: scale(1.1);
    opacity: 1;
  }

  100% {
    transform: scale(1);
  }
}

h1 {
  text-align: center;
  margin-bottom: 20px;
  font-size: 2.5em;
  color: #111827;
}

h2 {
  margin-top: 30px;
  margin-bottom: 10px;
  border-bottom: 2px solid #3b82f6;
  display: inline-block;
  padding-bottom: 5px;
  font-size: 1.8em;
  color: #111827;
}

h3 {
  margin-top: 20px;
  margin-bottom: 10px;
  color: #3b82f6;
  font-size: 1.4em;
}

ul {
  list-style-type: disc;
  padding-left: 40px;
  line-height: 1.6;
}

.section-content {
  margin-bottom: 20px;
}

.section-content ul {
  padding-left: 1.5em;
  border-left: 2px solid #eee;
}

.tech-tags span {
  display: inline-block;
  padding: 3px 8px;
  margin: 3px;
  background: #f3f4f6;
  border-radius: 4px;
}

.contact-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 30px;
}

.contact-info a {
  color: var(--link-color);
  text-decoration: none;
  font-size: 1.1em;
}

.contact-info a:hover {
  text-decoration: underline;
}

footer {
  background-color: #ffffff;
  padding: 15px 20px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  font-size: 0.9em;
  gap: 10px;
}

/* 统一的版权和备案信息样式 */
.footer-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* 网站 Logo 样式 */
.footer-logo {
  max-width: 40px;
  /* 统一大小 */
  height: auto;
}

/* 公安备案图标样式，与文字大小相同 */
.public-security-icon {
  height: 1em;
  width: auto;
  margin-left: 5px;
  vertical-align: middle;
  display: inline-block;
}

/* 新增footer-group类，用于将ICP和网安备案信息分组 */
.footer-group {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  justify-content: center;
}

/* 新增链接内的flex布局，确保图标与文字对齐 */
.footer-group .public-security a {
  display: flex;
  align-items: center;
  gap: 5px;
}

a {
  color: var(--link-color);
  /* 链接颜色 */
  text-decoration: none;
}

a:hover {
  text-decoration: none;
  /* 移除下划线 */
}

/* 响应式设计 */
@media (max-width: 768px) {
  .header-title {
    font-size: 1.3em;
  }

  main {
    padding: 15px;
  }

  h1 {
    font-size: 2em;
  }

  h2 {
    font-size: 1.5em;
  }

  h3 {
    font-size: 1.2em;
  }

  ul {
    padding-left: 30px;
  }

  .profile-main {
    padding: 15px;
  }
  
  .profile-main h1 {
    font-size: 1.8em;
  }

  .profile-main h2 {
    font-size: 1.4em;
  }

  .section-content ul {
    padding-left: 1em;
    border-left: none;
  }

  /* 确保ICP和网安备案信息在小屏幕上保持在同一行 */
  .footer-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .footer-group .footer-item {
    flex: 1 1 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  header {
    padding: 10px 12px; /* 缩小内边距 */
    gap: 6px; /* 缩小元素间距 */
  }

  header a { padding: 4px 8px; }

  .header-title {
    font-size: 1.2em;
  }

  main {
    padding: 10px;
  }

  h1 {
    font-size: 1.8em;
  }

  h2 {
    font-size: 1.3em;
  }

  h3 {
    font-size: 1em;
  }

  ul {
    padding-left: 25px;
  }

  /* 确保ICP和网安备案信息在小屏幕上保持在同一行 */
  .footer-group {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .footer-group .footer-item {
    flex: 1 1 100%;
    justify-content: center;
  }
}