/**
 * home.css
 * 用途：wuwc 个人网站首页专用样式
 * 核心功能：山水层叠视差布局、入场动画、响应式适配
 * 作者：AI Assistant
 * 创建日期：2026-05-22
 */

/* =============================================
   CSS 变量：统一管理配色，便于后续主题调整
   ============================================= */
:root {
  --sky-top:        #c8dde8;           /* 天空顶部（冷蓝）*/
  --sky-bottom:     #e8d8c0;           /* 天空底部（暖橙）*/
  --mountain-far:   rgba(160,185,200,0.55);
  --mountain-mid:   rgba(100,135,158,0.72);
  --mountain-near:  rgba(45,70,85,0.88);
  --text-primary:   #2c3e4a;
  --text-muted:     rgba(44,62,74,0.62);
  --accent:         #8b6f4e;           /* 暖棕强调色，用于装饰线和激活态 */
  --accent-light:   rgba(139,111,78,0.35);
}

/* =============================================
   Reset：只重置本页面所需的最小集合
   ============================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  /* 首屏完全占满视口，禁止外层滚动 */
  overflow: hidden;
}

/* =============================================
   #page：全屏容器，承载所有山层和内容
   ============================================= */
#page {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  /* 天空渐变：从冷蓝顶部过渡至暖橙底部，模拟黎明山景 */
  background: linear-gradient(
    180deg,
    var(--sky-top)  0%,
    #d8e8f0        28%,
    #e8f0f5        54%,
    var(--sky-bottom) 100%
  );
}

/* =============================================
   山层通用定位
   left/width 溢出 5%，为视差横向位移留出缓冲空间
   ============================================= */
.layer {
  position: absolute;
  left: -5%;
  width: 110%;
  pointer-events: none;          /* 山层不参与鼠标事件 */
  will-change: transform;        /* 提示浏览器该元素将频繁变换 */
  transition: transform 0.15s ease-out;
}

.layer svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* 各层高度和 bottom 值需与 SVG viewBox 及薄雾位置协调 */
.layer-far  { bottom: 118px; height: 220px; }
.layer-mid  { bottom: 68px;  height: 220px; }
.layer-near { bottom: 0;     height: 170px; }

/* =============================================
   薄雾层：水平漂移循环动画，两层相位相反
   ============================================= */
.mist {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
}

.mist-1 {
  bottom: 136px;
  height: 28px;
  background: linear-gradient(transparent, rgba(255,255,255,0.35), transparent);
  filter: blur(5px);
  animation: mistDrift1 8s ease-in-out infinite alternate;
}

.mist-2 {
  bottom: 74px;
  height: 22px;
  background: linear-gradient(transparent, rgba(255,255,255,0.22), transparent);
  filter: blur(7px);
  animation: mistDrift2 12s ease-in-out infinite alternate-reverse;
}

@keyframes mistDrift1 {
  from { transform: translateX(-15px); opacity: 0.7; }
  to   { transform: translateX(15px);  opacity: 1.0; }
}

@keyframes mistDrift2 {
  from { transform: translateX(12px);  opacity: 0.5; }
  to   { transform: translateX(-12px); opacity: 0.9; }
}

/* =============================================
   内容层：头像 + 姓名 + 标语 + 导航，居中悬浮
   translateY(-58%) 而非 -50% 是为了视觉重心偏上
   ============================================= */
.content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -58%);
  text-align: center;
  z-index: 10;
  will-change: transform;
  transition: transform 0.15s ease-out;
}

/* 头像圆框：毛玻璃边框 + 阴影扩散环 */
.avatar-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.85);
  margin: 0 auto 20px;
  overflow: hidden;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    0 4px 20px rgba(0,0,0,0.12),
    0 0 0 6px rgba(255,255,255,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.avatar-ring:hover {
  transform: scale(1.04);
  box-shadow:
    0 8px 30px rgba(0,0,0,0.18),
    0 0 0 8px rgba(255,255,255,0.18);
}

.avatar-ring img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* 姓名：衬线字体，大字间距 */
.name {
  font-family: 'STSong', 'Songti SC', 'SimSun', Georgia, serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 5px;
  color: var(--text-primary);
  /* 白色光晕让文字在山景背景上清晰可读 */
  text-shadow: 0 2px 14px rgba(255,255,255,0.85);
  margin-bottom: 10px;
}

/* 座右铭：细号衬线，低透明度 */
.tagline {
  font-family: 'STSong', 'Songti SC', 'SimSun', Georgia, serif;
  font-size: 13px;
  letter-spacing: 2.5px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* 装饰分隔线：左右渐隐 */
.divider {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-light), transparent);
  margin: 0 auto 20px;
}

/* 导航容器 */
.nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.nav-link {
  font-family: 'STSong', 'Songti SC', 'SimSun', Georgia, serif;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-decoration: none;
  position: relative;
  padding-bottom: 3px;
  transition: color 0.25s ease;
}

/* 导航下划线：从左向右绘制 */
.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

.nav-sep {
  color: var(--accent-light);
  font-size: 10px;
  line-height: 1;
  user-select: none;
}

/* =============================================
   滚动提示：底部鼠标图标 + 上下浮动
   ============================================= */
.scroll-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  animation: floatUpDown 2s ease-in-out infinite;
}

@keyframes floatUpDown {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(-6px); }
}

.scroll-mouse {
  width: 20px;
  height: 32px;
  border: 1.5px solid rgba(44,62,74,0.35);
  border-radius: 10px;
  position: relative;
  margin: 0 auto;
}

.scroll-dot {
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 6px;
  border-radius: 2px;
  background: rgba(44,62,74,0.35);
  animation: scrollDot 2s ease-in-out infinite;
}

@keyframes scrollDot {
  0%, 100% { top: 5px;  opacity: 1; }
  80%       { top: 14px; opacity: 0; }
}

/* =============================================
   Footer：position:fixed 叠加在视口底部
   由近山色向上渐隐，融入山景；浅色文字保证备案可读
   ============================================= */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding: 12px 0 14px;
  text-align: center;
  /* 与近山层同色阶，自下而上渐隐，避免纯白底块 */
  background: linear-gradient(
    to top,
    rgba(35, 55, 70, 0.92) 0%,
    rgba(35, 55, 70, 0.5) 50%,
    transparent 100%
  );
  border-top: none;
}

.footer p {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: 0.5px;
  line-height: 1.9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

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

.footer a:hover {
  color: rgba(255, 255, 255, 0.95);
}

/* =============================================
   入场动画
   策略：元素初始设为 opacity:0，JS 添加 .animate
   类后由 CSS animation forwards 填充最终状态
   ============================================= */

/* 初始隐藏：页面加载瞬间所有动效元素不可见 */
.layer,
.mist,
.content,
.scroll-hint {
  opacity: 0;
}

/* 山层上滑入场 */
@keyframes layerIn {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 薄雾淡入 */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* 内容层：上滑 + 淡入（保持居中 translate，额外叠加 12px 偏移）*/
@keyframes contentIn {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-58% + 12px));
  }
  to {
    opacity: 1;
    transform: translate(-50%, -58%);
  }
}

/* JS 添加 .animate 后触发对应动画 */
.layer-far.animate  { animation: layerIn   0.8s ease-out  0ms   forwards; }
.layer-mid.animate  { animation: layerIn   0.8s ease-out  100ms forwards; }
.layer-near.animate { animation: layerIn   0.8s ease-out  200ms forwards; }
.mist.animate       { animation: fadeIn    0.6s ease-out  400ms forwards; }
.content.animate    { animation: contentIn 0.5s ease-out  600ms forwards; }
.scroll-hint.animate{ animation: fadeIn    0.5s ease-out  900ms forwards; }

/* =============================================
   响应式断点
   ============================================= */

/* 平板（768px – 1023px）：视差强度由 JS 减半，CSS 仅调字号 */
@media (max-width: 1023px) {
  .name    { font-size: 24px; letter-spacing: 4px; }
  .tagline { font-size: 12px; }
}

/* 手机（< 768px）：禁用视差过渡，缩小字号，不影响动画 */
@media (max-width: 767px) {
  .name    { font-size: 20px; letter-spacing: 3px; }
  .tagline { font-size: 11px; letter-spacing: 1.5px; }
  .nav-link{ font-size: 12px; letter-spacing: 1.5px; }

  /* 禁用 JS 通过 style.transform 产生的过渡，避免移动端抖动 */
  .layer,
  .content { transition: none !important; }

  /* 手机端头像略小 */
  .avatar-ring { width: 80px; height: 80px; }
}
