/* ===== Base ===== */
body {
  background: #020617;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  /* 6.2 iOS 安全区域（刘海屏/底部横条） */
  padding-bottom: env(safe-area-inset-bottom);
  /* 6.2 橡皮筋滚动优化 */
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

/* 6.2 取消 iOS 点击高亮 */
* {
  -webkit-tap-highlight-color: transparent;
}

/* 6.1 防止 iOS 输入框字体自动放大 */
input, select, textarea {
  font-size: 16px;
}

/* ===== Particles Layer ===== */
#particles-js {
  position: fixed;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#particles-js::after {
  content: "";
  position: absolute;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.12), transparent);
  top: 20%;
  left: 30%;
  filter: blur(140px);
  pointer-events: none;
}

/* ===== Content Layer ===== */
.content {
  position: relative;
  z-index: 10;
}

/* ===== Header ===== */
.header-blur {
  background: rgba(2, 6, 23, 0.7);
  /* 6.2 backdrop-filter webkit 前缀 */
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  /* 6.2 sticky webkit 前缀 */
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 50;
}

/* ===== 3.1 移动端抽屉菜单 ===== */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(2, 6, 23, 0.97);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  z-index: 40;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  padding-top: 80px;
}

.mobile-menu.open {
  transform: translateX(0);
}

.mobile-nav-link {
  font-size: 1.1rem;
  color: #d1d5db;
  display: block;
  min-height: 44px;
  line-height: 44px;
  padding: 0 1rem;
}

.mobile-nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.05);
  border-radius: 0.75rem;
}

/* 汉堡菜单动画 */
#menu-toggle.active .hamburger-line:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
#menu-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
}
#menu-toggle.active .hamburger-line:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ===== Glassmorphism Card ===== */
.card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  /* 6.2 backdrop-filter webkit 前缀 */
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* 6.4 仅桌面端（支持 hover 的设备）启用悬浮效果 */
@media (hover: hover) {
  .card:hover {
    transform: translateY(-6px);
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.12);
  }
}

/* ===== Gradient Button ===== */
.btn-gradient {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  display: inline-block;
}

@media (hover: hover) {
  .btn-gradient:hover {
    box-shadow: 0 0 24px rgba(99, 102, 241, 0.4);
    transform: scale(1.05);
  }
}

/* ===== Language Buttons ===== */
.lang-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #9ca3af;
  transition: all 0.2s;
  cursor: pointer;
}

.lang-btn:hover,
.lang-btn.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.5);
  color: #fff;
}

/* ===== 3.2 导航高亮 ===== */
.nav-link {
  position: relative;
  color: #d1d5db;
  transition: color 0.2s;
}

.nav-link.active {
  color: #fff;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border-radius: 1px;
}

/* ===== Hero Float Animation ===== */
#title {
  animation: float 7s ease-in-out infinite;
  /* 3.3 动画性能提示 */
  will-change: transform;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* 3.3 无障碍：对 reduced-motion 用户关闭动画 */
@media (prefers-reduced-motion: reduce) {
  #title {
    animation: none;
    will-change: auto;
  }
  .card, .btn-gradient, .mobile-menu {
    transition: none;
  }
}

/* ===== 3.2 回到顶部按钮 ===== */
.back-to-top {
  position: fixed;
  bottom: calc(2rem + env(safe-area-inset-bottom));
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 99;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.3s, transform 0.3s;
  border: none;
  box-shadow: 0 4px 16px rgba(59,130,246,0.3);
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== 6.5 极窄屏保护（320px iPhone SE等） ===== */
@media (max-width: 360px) {
  #title {
    font-size: 2.5rem;
    line-height: 1.2;
  }
  .px-10 {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .px-8 {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* ===== 6.5 横屏模式优化 ===== */
@media (orientation: landscape) and (max-height: 500px) {
  #hero {
    margin-top: 4rem;
    padding-bottom: 2rem;
  }
  #title {
    font-size: 2.8rem;
  }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: #020617;
}
::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.4);
  border-radius: 3px;
}

/* ===== Smooth scroll ===== */
html {
  scroll-behavior: smooth;
}
