/* ============================================================
   个人主页样式 - 二次元 × 毛玻璃 × 柔和发光
   配色取自背景视频画面分析：
   深灰紫 #2B2733 / 灰紫 #8D8390 / 雾蓝 #8A91A4
   点缀：外套蓝 #4E86C6 / 眼眸绯红 #E8355F / 落叶黄 #E3B23C
   ============================================================ */

:root {
  --c-bg-deep: #211E2A;
  --c-bg-deeper: #1A1722;
  --c-primary: #4E86C6;
  --c-accent: #E8355F;
  --c-accent-2: #E3B23C;
  --c-violet: #8D7BA8;
  --c-text: #F2EFF5;
  --c-text-muted: #C5BFd1;
  --c-glass: rgba(38, 34, 50, 0.55);
  --c-glass-border: rgba(255, 255, 255, 0.14);
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-glow-blue: 0 0 24px rgba(78, 134, 198, 0.35);
  --shadow-glow-pink: 0 0 24px rgba(232, 53, 95, 0.28);
  --font-main: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", "Source Han Sans SC", system-ui, sans-serif;
  --nav-h: 64px;
  --ease-soft: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  color: var(--c-text);
  background: var(--c-bg-deeper);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

::selection { background: rgba(232, 53, 95, 0.4); }

/* ---------- 背景层 ---------- */
.bg-layer { position: fixed; inset: 0; z-index: -2; overflow: hidden; background: var(--c-bg-deeper); }

.bg-poster {
  position: absolute; inset: 0;
  background: var(--c-bg-deeper) url("../img/poster.jpg") 68% 50% / cover no-repeat;
  transition: opacity 0.8s var(--ease-soft);
}

.bg-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  /* 角色位于画面中央偏右，覆盖时优先保住右侧主体 */
  object-position: 68% 50%;
  opacity: 0;
  transition: opacity 0.9s var(--ease-soft);
}
.bg-video.is-ready { opacity: 1; }

.bg-overlay {
  position: absolute; inset: 0;
  /* 桌面端：左强右弱，文字区压在左侧深色渐变上，右侧角色保持清晰 */
  background:
    linear-gradient(100deg,
      rgba(26, 23, 34, 0.82) 0%,
      rgba(26, 23, 34, 0.62) 34%,
      rgba(26, 23, 34, 0.28) 62%,
      rgba(26, 23, 34, 0.18) 100%),
    linear-gradient(to top,
      rgba(26, 23, 34, 0.55) 0%,
      rgba(26, 23, 34, 0.05) 40%);
}

#fxCanvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* ---------- 自定义光标 ---------- */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0;
  border-radius: 50%; pointer-events: none; z-index: 9999;
  transform: translate(-50%, -50%);
  display: none;
}
.cursor-dot { width: 7px; height: 7px; background: var(--c-accent); }
.cursor-ring {
  width: 34px; height: 34px;
  border: 1.5px solid rgba(78, 134, 198, 0.7);
  transition: width 0.25s var(--ease-soft), height 0.25s var(--ease-soft),
    border-color 0.25s;
}
.cursor-ring.is-hover { width: 52px; height: 52px; border-color: rgba(232, 53, 95, 0.8); }
body.has-cursor { cursor: none; }
body.has-cursor a, body.has-cursor button { cursor: none; }
body.has-cursor .cursor-dot, body.has-cursor .cursor-ring { display: block; }

/* ---------- 导航 ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(16px, 4vw, 48px);
  background: rgba(26, 23, 34, 0.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  transition: background 0.4s;
}
.nav.is-scrolled { background: rgba(26, 23, 34, 0.72); }

.nav-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: 1px; }
.nav-logo img { border-radius: 8px; }

.nav-links { display: flex; gap: clamp(12px, 2.5vw, 32px); }
.nav-links a {
  position: relative; padding: 6px 2px;
  color: var(--c-text-muted); font-size: 15px;
  transition: color 0.3s;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--c-primary), var(--c-accent));
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.35s var(--ease-soft);
}
.nav-links a:hover { color: var(--c-text); }
.nav-links a.active { color: var(--c-text); }
.nav-links a.active::after { transform: scaleX(1); }

.nav-toggle { display: none; flex-direction: column; gap: 5px; padding: 8px; }
.nav-toggle span {
  width: 22px; height: 2px; border-radius: 2px; background: var(--c-text);
  transition: transform 0.3s, opacity 0.3s;
}
.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- 布局通用 ---------- */
.section { position: relative; padding: clamp(72px, 12vh, 130px) 0; }
.container { width: min(1080px, 92vw); margin: 0 auto; }

.section-title {
  display: flex; align-items: center; gap: 14px;
  font-size: clamp(24px, 3.4vw, 34px); font-weight: 700;
  margin-bottom: clamp(28px, 5vh, 48px);
  text-shadow: 0 2px 14px rgba(26, 23, 34, 0.8);
}
.title-deco {
  width: 8px; height: 30px; border-radius: 4px;
  background: linear-gradient(180deg, var(--c-primary), var(--c-accent));
  box-shadow: var(--shadow-glow-blue);
  flex: none;
}

.glass-card {
  background: var(--c-glass);
  border: 1px solid var(--c-glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 40px rgba(10, 8, 18, 0.35);
  padding: clamp(22px, 4vw, 40px);
}

/* ---------- 首屏 ---------- */
.hero {
  min-height: 100svh;
  display: flex; align-items: center;
  padding-top: var(--nav-h);
}
.hero-inner {
  width: min(1080px, 92vw); margin: 0 auto;
  /* 文字区靠左，避开画面右侧的角色主体 */
  max-width: 560px;
  margin-left: max(4vw, calc((100vw - 1080px) / 2));
  margin-right: auto;
}

.hero-avatar { position: relative; width: 120px; height: 120px; margin-bottom: 22px; }
.hero-avatar img {
  width: 120px; height: 120px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: var(--shadow-glow-blue);
}
.hero-avatar-ring {
  position: absolute; inset: -9px; border-radius: 50%;
  border: 1.5px dashed rgba(227, 178, 60, 0.65);
  animation: spin 16s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hero-name {
  font-size: clamp(34px, 6vw, 58px); font-weight: 800; letter-spacing: 2px;
  background: linear-gradient(100deg, #FFFFFF 10%, #BFD6F2 45%, #F0A9BE 90%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 3px 16px rgba(26, 23, 34, 0.7));
}

.hero-typing {
  margin-top: 14px; min-height: 2.2em;
  font-size: clamp(16px, 2.2vw, 21px);
  color: var(--c-text-muted);
  text-shadow: 0 2px 10px rgba(26, 23, 34, 0.9);
}
.caret {
  display: inline-block; width: 2px; height: 1.1em;
  margin-left: 3px; vertical-align: -0.15em;
  background: var(--c-accent);
  animation: blink 0.9s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-actions { display: flex; gap: 16px; margin-top: 34px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 30px; border-radius: 999px;
  font-size: 15px; font-weight: 600; letter-spacing: 1px;
  transition: transform 0.3s var(--ease-soft), box-shadow 0.3s, background 0.3s;
  will-change: transform;
}
.btn-primary {
  color: #fff;
  background: linear-gradient(100deg, var(--c-primary), var(--c-accent));
  box-shadow: var(--shadow-glow-pink);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 0 34px rgba(232, 53, 95, 0.45); }
.btn-ghost {
  color: var(--c-text);
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover { transform: translateY(-3px); background: rgba(255, 255, 255, 0.16); }

.scroll-hint {
  position: absolute; left: 50%; bottom: 28px;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--c-text-muted); font-size: 11px; letter-spacing: 3px;
}
.scroll-hint-line {
  width: 1.5px; height: 42px; overflow: hidden; position: relative;
  background: rgba(255, 255, 255, 0.18); border-radius: 2px;
}
.scroll-hint-line::after {
  content: ""; position: absolute; top: -50%; left: 0;
  width: 100%; height: 50%;
  background: linear-gradient(to bottom, transparent, var(--c-accent));
  animation: drip 1.8s var(--ease-soft) infinite;
}
@keyframes drip { to { top: 110%; } }

/* ---------- 关于我 ---------- */
.about-text { color: var(--c-text-muted); font-size: clamp(15px, 1.8vw, 17px); }
.about-text strong { color: var(--c-text); }

.tag-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.tag {
  padding: 6px 16px; border-radius: 999px; font-size: 13.5px;
  color: var(--c-text);
  background: rgba(78, 134, 198, 0.16);
  border: 1px solid rgba(78, 134, 198, 0.4);
  transition: transform 0.25s var(--ease-soft), box-shadow 0.25s, border-color 0.25s;
}
.tag:nth-child(3n + 2) { background: rgba(232, 53, 95, 0.14); border-color: rgba(232, 53, 95, 0.4); }
.tag:nth-child(3n) { background: rgba(227, 178, 60, 0.12); border-color: rgba(227, 178, 60, 0.4); }
.tag:hover { transform: translateY(-3px); box-shadow: var(--shadow-glow-blue); }

/* ---------- 卡片网格 ---------- */
.card-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card {
  position: relative;
  background: var(--c-glass);
  border: 1px solid var(--c-glass-border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 26px 24px;
  transform-style: preserve-3d;
  transition: box-shadow 0.35s, border-color 0.35s;
  will-change: transform;
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%),
    rgba(78, 134, 198, 0.16), transparent 45%);
  opacity: 0; transition: opacity 0.35s;
  pointer-events: none;
}
.card:hover { border-color: rgba(78, 134, 198, 0.55); box-shadow: var(--shadow-glow-blue); }
.card:hover::before { opacity: 1; }

.card-emoji {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(78, 134, 198, 0.28), rgba(232, 53, 95, 0.24));
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.card h3 { font-size: 18px; margin-bottom: 8px; }
.card p { font-size: 14px; color: var(--c-text-muted); }

/* 作品卡 */
.work-card { overflow: hidden; padding: 0; display: flex; flex-direction: column; }
.work-cover {
  height: 140px;
  background: linear-gradient(120deg, var(--wc1, #4E86C6), var(--wc2, #E8355F));
  position: relative;
  display: flex; align-items: center; justify-content: center;
  font-size: 44px;
}
.work-cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(26, 23, 34, 0.45), transparent 60%);
}
.work-body { padding: 20px 22px 24px; }
.work-body h3 { display: flex; align-items: center; justify-content: space-between; }
.work-link {
  font-size: 13px; color: var(--c-primary);
  transition: color 0.25s;
}
.work-link:hover { color: var(--c-accent); }
.work-tags { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.work-tags span {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--c-text-muted);
}

/* ---------- 联系 ---------- */
.contact-card { text-align: center; }
.contact-hint { color: var(--c-text-muted); margin-bottom: 24px; }
.contact-list { display: flex; justify-content: center; gap: clamp(14px, 3vw, 28px); flex-wrap: wrap; }

.contact-item {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: 108px; padding: 20px 10px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: transform 0.3s var(--ease-soft), border-color 0.3s, background 0.3s;
}
.contact-item:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--c-glass-border);
}
.contact-item .icon-wrap {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(78, 134, 198, 0.25), rgba(232, 53, 95, 0.22));
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--c-text);
  transition: box-shadow 0.3s;
}
.contact-item:hover .icon-wrap { box-shadow: var(--shadow-glow-pink); }
.contact-item img { width: 24px; height: 24px; }
.contact-item span { font-size: 13px; color: var(--c-text-muted); }

/* ---------- 页脚 ---------- */
.footer {
  position: relative; text-align: center;
  padding: 34px 16px 40px;
  color: var(--c-text-muted); font-size: 13.5px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(26, 23, 34, 0.5);
  backdrop-filter: blur(10px);
}
.footer .beian { margin-top: 6px; opacity: 0.75; }
.footer .beian a:hover { color: var(--c-primary); }

/* ---------- 声音开关 ---------- */
.sound-toggle {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--c-glass);
  border: 1px solid var(--c-glass-border);
  backdrop-filter: blur(12px);
  color: var(--c-text);
  transition: transform 0.25s var(--ease-soft), box-shadow 0.25s;
}
.sound-toggle:hover { transform: scale(1.08); box-shadow: var(--shadow-glow-blue); }
.sound-toggle .icon-on { display: none; }
.sound-toggle.is-on .icon-on { display: block; }
.sound-toggle.is-on .icon-off { display: none; }
.sound-toggle.is-on { box-shadow: var(--shadow-glow-pink); }

/* ---------- 滚动渐入 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 0.8s var(--ease-soft), transform 0.8s var(--ease-soft);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: fixed; top: var(--nav-h); right: 0; left: 0;
    flex-direction: column; align-items: center; gap: 4px;
    padding: 14px 0 20px;
    background: rgba(26, 23, 34, 0.92);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transform: translateY(-8px);
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
  }
  .nav-links.is-open { opacity: 1; transform: translateY(0); pointer-events: auto; }
  .nav-links a { padding: 10px; width: 100%; text-align: center; }
}

@media (max-width: 768px) {
  /* 竖屏：角色保持可见（object-position 保右侧主体），内容用毛玻璃承载 */
  .bg-video { object-position: 62% 42%; }
  .bg-poster { background-position: 62% 42%; }
  .bg-overlay {
    background:
      linear-gradient(to bottom,
        rgba(26, 23, 34, 0.42) 0%,
        rgba(26, 23, 34, 0.3) 42%,
        rgba(26, 23, 34, 0.78) 100%);
  }
  .hero { align-items: flex-end; padding-bottom: clamp(56px, 9vh, 90px); }
  .hero-inner {
    margin: 0 auto;
    text-align: center;
    display: flex; flex-direction: column; align-items: center;
    padding: 20px 18px;
    border-radius: var(--radius-lg);
    background: rgba(38, 34, 50, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  .hero-actions { justify-content: center; margin-top: 22px; }
  .hero-avatar, .hero-avatar img { width: 88px; height: 88px; margin-bottom: 14px; }
  .scroll-hint { display: none; }
}

/* ---------- 减少动态 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
