/* ============================================
   Qing · 个人名片  样式表
   深色电影感 · 玻璃拟态 · 主色 #4A90D9
   ============================================ */

/* ---------- 基础重置 ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #070b14;          /* 深墨蓝底 */
  --bg-soft: #0c1322;     /* 区块深玻璃底 */
  --fg: #eef3fb;          /* 浅色正文 */
  --fg-soft: #b8c4d8;
  --muted: #8293ab;
  --line: rgba(140, 175, 230, 0.16);
  --accent: #5ea0ec;
  --accent-2: #7db4ff;
  --accent-soft: rgba(94, 160, 236, 0.14);
  --glass: rgba(255, 255, 255, 0.04);
  --glass-strong: rgba(255, 255, 255, 0.07);
  --radius: 14px;
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 18px 54px rgba(94, 160, 236, 0.22);
  --max: 960px;
  /* 自然缓动曲线：ease-out-expo 风格，出场柔和不生硬 */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  /* 标准 material 缓动，适合状态切换 */
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  /* 入场专用：略带回弹感 */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1100px 700px at 80% -10%, rgba(91, 141, 239, 0.10), transparent 60%),
    radial-gradient(900px 600px at -10% 100%, rgba(74, 144, 217, 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--fg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent-2); text-decoration: none; transition: color .3s var(--ease-soft); }
a:hover { color: #a9ccff; }

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- 顶部导航栏（顶栏透明叠在视频上，滚动后转深玻璃） ---------- */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background .4s var(--ease-soft), border-color .4s var(--ease-soft), box-shadow .4s var(--ease-soft);
}
.navbar.scrolled {
  background: rgba(9, 14, 24, 0.72);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom-color: var(--line);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.30);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
}
.brand span { color: var(--accent-2); }

.nav-menu { display: flex; gap: 4px; }
.nav-menu a {
  color: rgba(238, 243, 251, 0.82);
  font-size: 15px;
  padding: 8px 14px;
  border-radius: 8px;
  transition: color .3s var(--ease-soft), background .3s var(--ease-soft);
}
.nav-menu a:hover { color: #fff; background: rgba(255, 255, 255, 0.10); }
.nav-menu a.active { color: #fff; background: rgba(255, 255, 255, 0.14); font-weight: 600; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle span {
  width: 22px; height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform .35s var(--ease-soft), opacity .25s var(--ease-soft);
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- 通用区块 ---------- */
section { padding: 96px 0; scroll-margin-top: 80px; }

.section-title {
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
}
.section-lead { color: var(--muted); margin-bottom: 40px; max-width: 560px; }

/* ---------- 氛围背景（固定在内容与界面层之后） ---------- */
.ambient {
  position: fixed;
  inset: -32px;   /* 外扩一圈，避免视差位移时露出白边 */
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
  will-change: transform;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.9;
}
.blob-1 {
  width: 520px; height: 520px;
  top: -140px; left: -120px;
  background: radial-gradient(circle, rgba(74, 144, 217, 0.28), rgba(74, 144, 217, 0) 70%);
  animation: drift1 26s ease-in-out infinite alternate;
}
.blob-2 {
  width: 580px; height: 580px;
  bottom: -180px; right: -140px;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.22), rgba(124, 92, 255, 0) 70%);
  animation: drift2 32s ease-in-out infinite alternate;
}
.blob-3 {
  width: 460px; height: 460px;
  top: 38%; left: 55%;
  background: radial-gradient(circle, rgba(125, 211, 252, 0.18), rgba(125, 211, 252, 0) 70%);
  animation: drift3 24s ease-in-out infinite alternate;
}
/* 缓慢漂移，alternate 往返构成无缝循环 */
@keyframes drift1 { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(70px, 50px, 0) scale(1.12); } }
@keyframes drift2 { from { transform: translate3d(0,0,0) scale(1.08); } to { transform: translate3d(-80px,-40px,0) scale(0.95); } }
@keyframes drift3 { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(-50px,60px,0) scale(1.15); } }

/* 极淡点阵纹理，增加科技质感 */
.dot-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(rgba(160, 195, 245, 0.10) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, #000 30%, transparent 100%);
          mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, #000 30%, transparent 100%);
}

/* 顶部滚动进度条 */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 3px;
  z-index: 60;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
  /* 极短线性过渡：平滑高频滚动抖动，又不至于追不上滚动位置 */
  transition: transform .08s linear;
}

/* ---------- 首页 / Hero（满版出血视频背景） ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  text-align: center;
  padding: 120px 0 80px;
  overflow: hidden;
}

/* 视频 + 遮罩层：默认透明，视频成功播放后由 body.hero-video-on 淡入 */
.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0;
  transition: opacity 1.2s var(--ease-out);
  background: #0a0f1a;
}
body.hero-video-on .hero-media { opacity: 1; }
/* 循环交接：结尾前缓慢淡出到完全透明，loop 跳回首帧（此时完全不可见），
   再缓慢淡入。淡出/淡入各 1.2s，中间跳帧瞬间被完全遮住，过渡自然 */
body.hero-video-on.hero-loop-fade .hero-media {
  opacity: 0;
  transition: opacity 1.2s var(--ease-soft);
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;        /* 保持比例铺满，允许裁切，绝不拉伸 */
  object-position: center;
}

/* 可读性遮罩：上下压暗、中部透出视频，叠一层淡蓝品牌色；中心暗块盖住视频水印 */
.hero-scrim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(70% 34% at 50% 46%, rgba(7, 11, 20, 0.82), transparent 72%),
    radial-gradient(120% 90% at 50% 42%, rgba(74, 144, 217, 0.16), transparent 62%),
    linear-gradient(180deg, rgba(7, 11, 20, 0.62) 0%, rgba(7, 11, 20, 0.30) 45%, rgba(7, 11, 20, 0.80) 100%);
}

.hero-inner {
  position: relative;
  z-index: 1;             /* 文字与控件叠加在视频之上 */
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* —— 首屏文字（叠在视频之上，统一浅色） —— */
.tagline { color: rgba(255, 255, 255, 0.85); }
.name {
  background: linear-gradient(120deg, #ffffff 15%, #a9ccff 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}
.scroll-hint .mouse { border-color: rgba(255, 255, 255, 0.5); }

.avatar {
  width: 160px; height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #fff;
  box-shadow: 0 12px 40px rgba(74, 144, 217, 0.18),
              0 0 0 10px rgba(74, 144, 217, 0.06);
  margin-bottom: 28px;
  background: var(--bg-soft);
  animation: avatarFloat 6s ease-in-out infinite;
  transition: transform .45s var(--ease-out), box-shadow .45s var(--ease-out);
}
.avatar:hover {
  animation: none;
  transform: scale(1.05);
  box-shadow: 0 18px 50px rgba(74, 144, 217, 0.28),
              0 0 0 14px rgba(74, 144, 217, 0.08);
}
@keyframes avatarFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}

.name {
  font-size: clamp(40px, 8vw, 64px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.25;
  padding-bottom: 0.12em;   /* 给 g 的下伸部分留出空间，避免被背景裁切 */
  margin-bottom: 16px;
}

.tagline {
  font-size: clamp(16px, 2vw, 19px);
  max-width: 520px;
  margin-bottom: 32px;
}

/* ---------- 社交图标（深玻璃圆形按钮） ---------- */
.socials { display: flex; gap: 12px; }
.socials a {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: color .35s var(--ease-soft), border-color .35s var(--ease-soft), background .35s var(--ease-soft), transform .35s var(--ease-out);
}
.socials a:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-3px);
}
.socials a svg { width: 18px; height: 18px; }

/* ---------- SPACE 风格发光星空 CTA（移植自 Uiverse.io / StealthWorm，MIT） ---------- */
.hero-cta { margin-bottom: 30px; }

.space-btn {
  position: relative;
  isolation: isolate;              /* 把负 z-index 层限制在按钮内部，避免压到页面背景 */
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 13rem;
  height: 3rem;
  overflow: hidden;
  border: double 4px transparent;
  border-radius: 5rem;
  cursor: pointer;
  text-decoration: none;
  backdrop-filter: blur(1rem);
  -webkit-backdrop-filter: blur(1rem);
  background-size: 300% 300%;
  background-image: linear-gradient(#212121, #212121),
    linear-gradient(137.48deg, #ffdb3b 10%, #fe53bb 45%, #8f51ea 67%, #0044ff 87%);
  background-origin: border-box;
  background-clip: content-box, border-box;
  animation: spaceGradient 5s ease infinite;
  transition: transform .5s var(--ease-out);
}
.space-btn:hover,
.space-btn:focus,
.space-btn:focus-visible {
  transform: scale(1.08);
  outline: none;
}
.space-btn:focus-visible { box-shadow: 0 0 0 4px rgba(74, 144, 217, 0.35); }
.space-btn:hover .space-stars,
.space-btn:focus .space-stars,
.space-btn:focus-visible .space-stars { z-index: 1; background-color: #212121; }
.space-btn:active {
  border-color: #fe53bb;
  animation: none;
}

.space-btn strong {
  position: relative;
  z-index: 2;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 4px;
  color: #ffffff;
  text-shadow: 0 0 4px #fff;
}

/* 星空层：平时沉在内芯之下，hover 时浮起 */
.space-stars {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  border-radius: 5rem;
  backdrop-filter: blur(1rem);
  -webkit-backdrop-filter: blur(1rem);
  transition: background-color .5s var(--ease-soft), z-index .5s var(--ease-soft);
}

.space-stars-inner {
  position: relative;
  width: 200rem;
  height: 200rem;
  background: transparent;
}
.space-stars-inner::before {
  content: "";
  position: absolute;
  top: 0;
  left: -50%;
  width: 170%;
  height: 500%;
  opacity: .5;
  background-image: radial-gradient(#fff 1px, transparent 1%);
  background-size: 50px 50px;
  animation: spaceStarFly 60s linear infinite;
}
.space-stars-inner::after {
  content: "";
  position: absolute;
  top: -10rem;
  left: -100rem;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(#fff 1px, transparent 1%);
  background-size: 50px 50px;
  animation: spaceStarRotate 90s linear infinite;
}

/* 模糊光晕脉动 */
.space-glow {
  position: absolute;
  z-index: -1;
  display: flex;
  width: 12rem;
  pointer-events: none;
}
.space-circle {
  width: 100%;
  height: 30px;
  filter: blur(2rem);
  animation: spacePulse 4s infinite;
}
.space-circle:nth-of-type(1) { background: rgba(254, 83, 187, 0.636); }
.space-circle:nth-of-type(2) { background: rgba(142, 81, 234, 0.704); }
.space-btn:active .space-circle { background: #fe53bb; }

/* CTA 彩色粒子层：常驻按钮内，z-index 1 位于星空黑底之上、文字之下 */
.cta-particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: 5rem;
  opacity: 0.85;
  transition: opacity .4s var(--ease-soft);
}
.space-btn:hover .cta-particles { opacity: 1; }

@keyframes spaceGradient {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes spaceStarFly {
  from { transform: translateY(0); }
  to   { transform: translateY(-135rem); }
}
@keyframes spaceStarRotate {
  from { transform: rotate(360deg); }
  to   { transform: rotate(0); }
}
@keyframes spacePulse {
  0%   { transform: scale(.75); box-shadow: 0 0 0 0 rgba(0,0,0,.7); }
  70%  { transform: scale(1);   box-shadow: 0 0 0 10px rgba(0,0,0,0); }
  100% { transform: scale(.75); box-shadow: 0 0 0 0 rgba(0,0,0,0); }
}

/* ---------- 滚动提示 ---------- */
.scroll-hint {
  margin-top: 56px;
  display: inline-flex;
}
.scroll-hint .mouse {
  width: 26px; height: 42px;
  border: 2px solid var(--line);
  border-radius: 14px;
  position: relative;
}
.scroll-hint .wheel {
  position: absolute;
  top: 8px; left: 50%;
  width: 4px; height: 8px;
  background: var(--accent);
  border-radius: 2px;
  transform: translateX(-50%);
  animation: wheelMove 1.6s ease-in-out infinite;
}
@keyframes wheelMove {
  0% { opacity: 0; transform: translate(-50%, 0); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, 12px); }
}

/* ---------- 关于我（深玻璃区块） ---------- */
.about {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(14, 21, 36, 0.45) 0%, rgba(12, 18, 30, 0.42) 70%, rgba(14, 21, 36, 0.45) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
/* about 尾部蓝色辉光带：向 contact 平滑过渡的视觉桥梁 */
.about::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 80px;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, rgba(94, 160, 236, 0.15) 50%, rgba(94, 160, 236, 0.08) 100%);
}
/* 空间映射 canvas 背景：呼应 spatial-mapping，深色玻璃上的网格+节点连线 */
.about-mapping {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 1;
}
.about > .container { position: relative; z-index: 1; }
.about-content { max-width: 680px; }
.about-content p { color: var(--fg-soft); margin-bottom: 18px; font-size: 16px; }

.about-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
}
.tag {
  font-size: 13px;
  color: #bcd6fb;
  background: var(--accent-soft);
  border: 1px solid rgba(94, 160, 236, 0.30);
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 500;
}

/* ---------- 联系我 ---------- */
/* 顶部承接 about 尾部的深玻璃色，向下渐变到透明露出 body 底，过渡自然 */
.contact {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(14, 21, 36, 0.45) 0%, rgba(10, 16, 28, 0.35) 40%, transparent 100%);
}
/* 顶部过渡层：与 about 尾部辉光带对接，形成连续蓝色光带 */
.contact-fade-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 80px;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(180deg,
    rgba(94, 160, 236, 0.08) 0%,
    rgba(94, 160, 236, 0.15) 50%,
    transparent 100%);
}
/* 防护网络 canvas 背景：呼应 Guardnet 的 security/privacy 主题 */
.contact-guardnet {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 1;
}
.contact > .container { position: relative; z-index: 1; }
.contact-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.contact-card {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  background: var(--glass-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--fg);
  transition: transform .4s var(--ease-out), box-shadow .4s var(--ease-soft), border-color .4s var(--ease-soft), background .4s var(--ease-soft);
}
.contact-card:hover {
  transform: translateY(-4px);
  background: rgba(94, 160, 236, 0.12);
  box-shadow: var(--shadow-hover);
  border-color: rgba(125, 180, 255, 0.45);
  color: var(--fg);
}

/* 卡片内粒子层：canvas 绝对铺满，内容上浮至其上 */
.card-particles {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
  transition: opacity .4s var(--ease-soft);
}
.contact-card:hover .card-particles { opacity: 1; }
.contact-card > *:not(.card-particles) { position: relative; z-index: 1; }
.contact-icon {
  width: 44px; height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  color: var(--accent-2);
}
.contact-icon svg { width: 20px; height: 20px; }
.contact-label { font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.contact-value { font-size: 15px; font-weight: 600; color: #fff; }

/* ---------- 页脚（深玻璃） ---------- */
.footer {
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(10, 16, 28, 0), rgba(8, 12, 22, 0.85));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 28px; padding-bottom: 28px;
}
.footer-copy { color: var(--muted); font-size: 14px; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--fg-soft); font-size: 14px; transition: color .3s var(--ease-soft); }
.footer-links a:hover { color: var(--accent); }

/* ---------- 滚动淡入（JS 加 .reveal / .in，结束后移除） ---------- */
/* ease-out-expo 出场：起步快、收尾柔，避免生硬定格 */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .8s var(--ease-out), transform .8s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }
/* 交错出场：同类元素逐个入场，节奏更自然 */
.contact-card.reveal:nth-child(2) { transition-delay: .12s; }
.contact-card.reveal:nth-child(3) { transition-delay: .24s; }
.about-content p.reveal:nth-child(2) { transition-delay: .10s; }
.about-content p.reveal:nth-child(3) { transition-delay: .20s; }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .nav-menu {
    position: absolute;
    top: 64px; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(9, 14, 24, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    padding: 8px 16px;
    max-height: 0;
    overflow: hidden;
    transition: max-height .4s var(--ease-soft);
  }
  .nav-menu.open { max-height: 260px; }
  .nav-menu a { padding: 12px 8px; }

  section { padding: 72px 0; }
  .hero { padding-top: 100px; }
  .footer-inner { justify-content: center; text-align: center; flex-direction: column; }

  /* 小屏缩小光斑、降低模糊开销 */
  .blob { filter: blur(36px); }
  .blob-1 { width: 340px; height: 340px; }
  .blob-2 { width: 380px; height: 380px; }
  .blob-3 { width: 300px; height: 300px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
