/* ============================================================
   个人主页 — 主样式表
   包含：CSS Reset / 布局 / 组件 / 动画 / 响应式 / 双主题变量
   ============================================================ */

/* --------------------------------------------------------
   0. 主题变量（日间/夜间）
   默认深色主题 — Landing 页本身是深色设计
   -------------------------------------------------------- */
:root,
[data-theme="dark"] {
  --landing-modal-bg: #ffffff;
  --landing-modal-text: #1a1a2e;
  --landing-modal-text-secondary: #444;
  --landing-input-bg: #f5f5f7;
  --landing-input-border: #e0e0e0;
  --landing-input-focus-bg: #ffffff;
  --landing-btn-primary-bg: #1a1a2e;
  --landing-btn-primary-text: #ffffff;
  --landing-btn-primary-hover: #2a2a4e;
  --landing-close-color: #888;
  --landing-close-hover-bg: rgba(0,0,0,0.06);
  --landing-close-hover-color: #333;
  --landing-error-bg: #fff5f5;
  --landing-error-text: #c53030;
  --landing-error-border: #fed7d7;
  --landing-hint-color: #aaa;
}

[data-theme="light"] {
  --landing-modal-bg: #ffffff;
  --landing-modal-text: #1a1a2e;
  --landing-modal-text-secondary: #444;
  --landing-input-bg: #f5f5f7;
  --landing-input-border: #e0e0e0;
  --landing-input-focus-bg: #ffffff;
  --landing-btn-primary-bg: #1a1a2e;
  --landing-btn-primary-text: #ffffff;
  --landing-btn-primary-hover: #2a2a4e;
  --landing-close-color: #888;
  --landing-close-hover-bg: rgba(0,0,0,0.06);
  --landing-close-hover-color: #333;
  --landing-error-bg: #fff5f5;
  --landing-error-text: #c53030;
  --landing-error-border: #fed7d7;
  --landing-hint-color: #aaa;
}

/* --------------------------------------------------------
   1. CSS Reset & 基础设定
   -------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  /* 平滑滚动（当锚点跳转时） */
  scroll-behavior: smooth;
}

body {
  /* 系统字体栈 — 中文优先 */
  font-family:
    "PingFang SC",
    "Microsoft YaHei",
    "Hiragino Sans GB",
    "WenQuanYi Micro Hei",
    system-ui,
    -apple-system,
    sans-serif;
  font-weight: 400;
  line-height: 1.6;
  color: #ffffff;
  background: #121521;  /* 深渊底色，与暗色主题统一 */
  overflow: hidden;      /* 全屏设计，禁止主页面滚动 */
  height: 100vh;
  /* 消除移动端点击 300ms 延迟 */
  touch-action: manipulation;
}

/* --------------------------------------------------------
   2. 背景层
   -------------------------------------------------------- */
#bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;

  /* 多层背景：
     第一层（最上层）：用户背景图片（若加载失败则透明，下层渐变可见）
     第二、三、四层：CSS 渐变作为降级底色 */
  background-image:
    url('../assets/bg.jpg'),
    radial-gradient(ellipse at 20% 50%, rgba(30, 40, 80, 0.8) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(20, 50, 70, 0.7) 0%, transparent 60%),
    linear-gradient(135deg, #0a0a2e 0%, #16213e 50%, #0f3460 100%);
  background-size: cover, auto, auto, auto;
  background-position: center, center, center, center;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
  /* 纯色兜底 */
  background-color: #0a0a1a;

  /* Ken Burns 缓慢缩放 — 呼吸感 */
  animation: bg-zoom 30s ease-in-out infinite alternate;
}

@keyframes bg-zoom {
  0%   { transform: scale(1); }
  100% { transform: scale(1.08); }
}

/* --------------------------------------------------------
   3. 半透明遮罩
   -------------------------------------------------------- */
#overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: rgba(18, 21, 33, 0.45);
  /* 微妙呼吸效果 — 暗紫调 */
  animation: overlay-breathe 10s ease-in-out infinite alternate;
}

@keyframes overlay-breathe {
  0%   { background: rgba(18, 21, 33, 0.38); }
  100% { background: rgba(22, 18, 35, 0.55); }
}

/* --------------------------------------------------------
   4. 主内容区
   -------------------------------------------------------- */
#hero {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 2rem;
  text-align: center;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* ---- 头像 ---- */
.avatar {
  width: 80px;
  height: 80px;
  margin-bottom: 1.5rem;
  color: rgba(255, 255, 255, 0.8);
  /* 初始动画状态 */
  opacity: 0;
  transform: scale(0.5);
}

.hero-content.animate .avatar {
  animation: avatar-pop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes avatar-pop {
  0%   { opacity: 0; transform: scale(0.3); }
  100% { opacity: 1; transform: scale(1); }
}

/* ---- 标题 ---- */
.title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
  /* 初始动画状态 */
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.hero-content.animate .title {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.15s;
}

/* ---- 副标题 ---- */
.subtitle {
  font-size: clamp(0.95rem, 2vw, 1.25rem);
  font-weight: 300;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 2.5rem;
  /* 初始动画状态 */
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.hero-content.animate .subtitle {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.3s;
}

/* ---- 按钮组 ---- */
.actions {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  justify-content: center;
  /* 初始动画状态 */
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.hero-content.animate .actions {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.45s;
}

/* ---- 按钮基础样式 ---- */
.actions button {
  position: relative;
  padding: 0.75rem 2.25rem;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 500;
  letter-spacing: 0.15em;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  /* 触摸优化 */
  touch-action: manipulation;
  /* 过渡 */
  transition:
    background 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease,
    transform 0.2s ease,
    box-shadow 0.3s ease;
}

.actions button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

/* 主要按钮 — 登录 */
.btn-primary {
  background: rgba(255, 255, 255, 0.95);
  color: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.95);
}

.btn-primary:hover {
  background: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35), 0 0 20px rgba(217,140,179,0.25);
}

.btn-primary:active {
  transform: translateY(0) scale(0.97);
}

/* 次要按钮 — 了解更多 */
.btn-secondary {
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.7);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.btn-secondary:active {
  transform: translateY(0) scale(0.97);
}

/* --------------------------------------------------------
   5. 页脚
   -------------------------------------------------------- */
.hero-footer {
  position: absolute;
  bottom: 1.5rem;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.45);
  /* 初始动画状态 */
  opacity: 0;
  transition: opacity 0.8s ease;
}

#hero.animate-footer .hero-footer {
  opacity: 1;
  transition-delay: 0.8s;
}

.hero-footer a {
  color: rgba(255, 255, 255, 0.45);
  text-decoration: none;
  transition: color 0.2s ease;
}

.hero-footer a:hover {
  color: rgba(255, 255, 255, 0.8);
}

.social-links {
  display: flex;
  gap: 1.25rem;
}

/* --------------------------------------------------------
   6. 登录弹窗
   -------------------------------------------------------- */

/* ---- 模态容器 — 默认隐藏 ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
}

.modal.hidden {
  display: none;
}

/* ---- 遮罩 ---- */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  /* 初始透明，由 .active 控制 */
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.active .modal-backdrop {
  opacity: 1;
}

/* ---- 弹窗卡片 ---- */
.modal-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 400px;
  max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  color: #1a1a2e;
  border-radius: 16px;
  padding: 2rem;
  border: 1px solid rgba(212,175,55,0.25);
  box-shadow:
    0 24px 80px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.9);

  /* 关闭 → 打开 的弹性动画由 active 触发 */
  opacity: 0;
  transition:
    opacity 0.3s ease,
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: center center;
}

[data-theme="dark"] .modal-card {
  background: rgba(14,10,22,0.88);
  backdrop-filter: blur(28px) saturate(1.5);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
  color: #F1F3F5;
  border: 1px solid rgba(189,102,255,0.25);
  box-shadow:
    0 24px 80px rgba(0,0,0,0.75),
    0 0 40px rgba(189,102,255,0.10),
    inset 0 1px 0 rgba(189,102,255,0.14);
}
[data-theme="dark"] .modal-card::after {
  content:'';position:absolute;top:0;left:0;right:0;height:1px;
  border-radius:16px 16px 0 0;pointer-events:none;
  background:linear-gradient(90deg,transparent,rgba(189,102,255,0.35) 40%,rgba(217,140,179,0.30) 60%,transparent);
}

.modal.active .modal-card {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ---- 弹窗头部 ---- */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
  color: inherit;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #888;
  cursor: pointer;
  border-radius: 50%;
  transition:
    color 0.2s ease,
    background 0.2s ease;
}

.modal-close:hover {
  color: #333;
  background: rgba(0, 0, 0, 0.06);
}

.modal-close:focus-visible {
  outline: 2px solid #1a1a2e;
  outline-offset: 2px;
}

/* ---- 表单 ---- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: #444;
  margin-bottom: 0.4rem;
}

.form-group input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: #1a1a2e;
  background: #f5f5f7;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.form-group input::placeholder {
  color: #aaa;
}

.form-group input:focus {
  border-color: #334;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

/* ---- 错误提示 ---- */
.form-error {
  background: #fff5f5;
  color: #c53030;
  font-size: 0.85rem;
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  border: 1px solid #fed7d7;
}

.form-error.hidden {
  display: none;
}

/* ---- 提交按钮 ---- */
.btn-submit {
  width: 100%;
  padding: 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #ffffff;
  background: #1a1a2e;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 1rem;
  touch-action: manipulation;
  transition:
    background 0.25s ease,
    transform 0.15s ease,
    box-shadow 0.2s ease;
}

.btn-submit:hover {
  background: #2a2a4e;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.btn-submit:active {
  transform: scale(0.98);
}

.btn-submit:focus-visible {
  outline: 2px solid #1a1a2e;
  outline-offset: 2px;
}

/* ---- 弹窗页脚 ---- */
.modal-footer {
  text-align: center;
  margin-top: 1.5rem;
}

.modal-footer .hint {
  font-size: 0.78rem;
  color: #aaa;
}

/* --------------------------------------------------------
   7. 响应式设计
   -------------------------------------------------------- */

/* 移动端 / 小屏 */
@media (max-width: 479px) {
  .hero-content {
    width: 100%;
    padding: 0 0.5rem;
  }

  .avatar {
    width: 60px;
    height: 60px;
    margin-bottom: 1rem;
  }

  .subtitle {
    letter-spacing: 0.12em;
    margin-bottom: 2rem;
  }

  .actions {
    flex-direction: column;
    gap: 0.85rem;
    width: 100%;
    max-width: 280px;
  }

  .actions button {
    width: 100%;
    padding: 0.75rem 1.5rem;
  }

  .hero-footer {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
    bottom: 1rem;
    padding: 0 1rem;
  }

  .social-links {
    gap: 1rem;
  }

  /* 移动端弹窗全屏显示 */
  .modal-card {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    padding: 1.5rem;
  }

  .modal.active .modal-card {
    transform: translate(-50%, -50%) scale(1);
  }
}

/* 平板 */
@media (min-width: 480px) and (max-width: 767px) {
  .actions button {
    padding: 0.7rem 1.75rem;
  }

  .modal-card {
    width: 380px;
  }
}

/* 大桌面 */
@media (min-width: 1200px) {
  .title {
    font-size: 3.75rem;
  }

  .subtitle {
    font-size: 1.35rem;
  }

  .actions button {
    padding: 0.85rem 2.75rem;
    font-size: 1rem;
  }
}

/* --------------------------------------------------------
   8. 无障碍：减少动效
   -------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* --------------------------------------------------------
   9. body 弹窗打开时禁止滚动
   -------------------------------------------------------- */
body.modal-open {
  overflow: hidden;
}
