/* ============================================================
   SweetHouse · 个人主页
   极光渐变背景 / 水波纹按钮 / 磁吸交互 / 明暗模式 / 移动端适配
   ============================================================ */

/* ---------- 变量与主题 ---------- */
:root {
  --aurora-opacity: 0.85;
  --text: #e8ecff;
  --text-dim: rgba(232, 236, 255, 0.72);
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
  --accent: #7dd8ff;
  --accent-2: #b18cff;
  --btn-primary-text: #0a1030;
  --nav-h: 64px;
}
html[data-theme="light"] {
  --aurora-opacity: 0.55;
  --text: #1c2340;
  --text-dim: rgba(28, 35, 64, 0.68);
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.75);
  --glass-shadow: 0 8px 32px rgba(60, 80, 160, 0.14);
  --accent: #2f7fe0;
  --accent-2: #8a4fd8;
  --btn-primary-text: #ffffff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); }

body {
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  background: #0b1026;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.6s ease, color 0.6s ease;
}
html[data-theme="light"] body { background: #faf6ef; }

::selection { background: rgba(125, 216, 255, 0.35); }

/* ============================================================
   1. 极光背景 —— Canvas 实时渲染，光团持续流动、互相溶解
   ============================================================ */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  /* 底色渐变，衬托光团 */
  background:
    radial-gradient(ellipse 80% 55% at 70% -10%, rgba(88, 60, 160, 0.25), transparent 60%),
    linear-gradient(180deg, #0b1026 0%, #101636 55%, #0d1230 100%);
  transition: background 0.6s ease;
}
html[data-theme="light"] .aurora {
  background:
    radial-gradient(ellipse 80% 55% at 70% -10%, rgba(255, 220, 190, 0.30), transparent 60%),
    linear-gradient(180deg, #fdf9f2 0%, #faf6ef 55%, #f7f1e8 100%);
}

.aurora-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* 细腻噪点，让光更有质感 */
.aurora-noise {
  position: absolute; inset: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.aurora-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 120% 90% at 50% 40%, transparent 55%, rgba(5, 8, 24, 0.45) 100%);
}
html[data-theme="light"] .aurora-vignette {
  background: radial-gradient(ellipse 120% 90% at 50% 40%, transparent 70%, rgba(200, 160, 130, 0.10) 100%);
}

/* ============================================================
   通用：毛玻璃卡片
   ============================================================ */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: var(--glass-shadow);
  border-radius: 20px;
  transition: background 0.6s ease, border-color 0.6s ease;
}

/* ============================================================
   导航
   ============================================================ */
.nav {
  position: fixed;
  top: 14px; left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: min(1080px, calc(100% - 24px));
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-radius: 999px;
}
.nav-logo {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 17px;
  color: var(--text); text-decoration: none;
}
.logo-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px var(--accent);
  animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.35); opacity: 0.75; } }

.nav-links { display: flex; gap: 6px; }
.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14.5px;
  padding: 8px 14px;
  border-radius: 999px;
  transition: color 0.25s, background 0.25s;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text);
  background: rgba(125, 216, 255, 0.14);
}
html[data-theme="light"] .nav-links a:hover,
html[data-theme="light"] .nav-links a.active { background: rgba(47, 127, 224, 0.12); }

.nav-actions { display: flex; align-items: center; gap: 10px; }

/* 主题切换按钮：太阳 / 月亮 */
.theme-toggle {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text);
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.4s;
}
.theme-toggle:hover { transform: scale(1.12) rotate(15deg); }
.icon-wrap { position: relative; width: 20px; height: 20px; display: block; }
.icon { position: absolute; inset: 0; width: 20px; height: 20px; transition: opacity 0.4s, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.icon-moon { opacity: 1; transform: rotate(0) scale(1); }
.icon-sun  { opacity: 0; transform: rotate(-90deg) scale(0.4); }
html[data-theme="light"] .icon-moon { opacity: 0; transform: rotate(90deg) scale(0.4); }
html[data-theme="light"] .icon-sun  { opacity: 1; transform: rotate(0) scale(1); }

/* 移动端菜单按钮 */
.menu-toggle {
  display: none;
  flex-direction: column; justify-content: center; gap: 5px;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  cursor: pointer; padding: 0 10px;
}
.menu-toggle span {
  display: block; height: 2px; width: 100%;
  background: var(--text); border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: calc(var(--nav-h) + 40px) 20px 60px;
  gap: 18px;
}
.hero-eyebrow { font-size: 15px; color: var(--text-dim); letter-spacing: 2px; }
.hero-title {
  font-size: clamp(34px, 7vw, 68px);
  font-weight: 700;
  line-height: 1.2;
  max-width: 18em;
}
.gradient-text {
  background: linear-gradient(90deg, #7dd8ff, #b18cff 35%, #ff8ac2 65%, #b18cff 85%, #7dd8ff);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shine 8s linear infinite;
}
@keyframes shine { to { background-position: 200% center; } }

.hero-sub {
  font-size: clamp(15px, 2.2vw, 19px);
  color: var(--text-dim);
  max-width: 34em;
}

.hero-cta { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }

/* ============================================================
   2 & 4. 按钮：水波纹 + 磁吸
   ============================================================ */
.btn {
  position: relative;
  overflow: hidden;               /* 水波纹裁剪 */
  display: inline-flex;
  align-items: center;
  padding: 14px 30px;
  border-radius: 999px;
  border: none;
  font-size: 15.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  will-change: transform;         /* 磁吸位移 */
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn-primary {
  color: var(--btn-primary-text);
  background: linear-gradient(135deg, #7dd8ff, #b18cff);
  box-shadow: 0 6px 24px rgba(125, 216, 255, 0.35);
}
.btn-primary:hover { box-shadow: 0 10px 34px rgba(177, 140, 255, 0.5); }
.btn-ghost {
  color: var(--text);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
}
.btn-ghost:hover { background: rgba(125, 216, 255, 0.12); }

/* 水波纹元素（JS 注入） */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.18) 55%, transparent 70%);
  transform: scale(0);
  animation: ripple 0.65s ease-out forwards;
  pointer-events: none;
}
.btn-ghost .ripple {
  background: radial-gradient(circle, rgba(125,216,255,0.45) 0%, rgba(125,216,255,0.15) 55%, transparent 70%);
}
@keyframes ripple {
  to { transform: scale(2.6); opacity: 0; }
}

/* 滚动提示 */
.scroll-hint {
  position: absolute; bottom: 26px; left: 50%;
  width: 24px; height: 40px;
  border: 2px solid var(--text-dim);
  border-radius: 14px;
  transform: translateX(-50%);
}
.scroll-hint span {
  position: absolute; top: 7px; left: 50%;
  width: 4px; height: 8px;
  margin-left: -2px;
  background: var(--text-dim);
  border-radius: 2px;
  animation: scrollHint 1.8s ease-in-out infinite;
}
@keyframes scrollHint {
  0% { opacity: 0; transform: translateY(0); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(14px); }
}

/* ============================================================
   Section 通用
   ============================================================ */
.section {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 90px 0 30px;
}
.section-title {
  font-size: clamp(26px, 4vw, 36px);
  margin-bottom: 36px;
}
.section-title em {
  font-style: normal;
  font-size: 0.55em;
  color: var(--text-dim);
  margin-left: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* ---------- 关于我 ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 24px;
  align-items: stretch;
}
.about-card { padding: 32px; }
.avatar-wrap {
  width: 96px; height: 96px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)) border-box;
  margin-bottom: 18px;
}
.avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }
.about-card h3 { font-size: 20px; margin-bottom: 10px; }
.about-card p { color: var(--text-dim); line-height: 1.9; font-size: 15px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.tag {
  font-size: 13px;
  padding: 5px 13px;
  border-radius: 999px;
  background: rgba(125, 216, 255, 0.12);
  border: 1px solid rgba(125, 216, 255, 0.25);
  color: var(--text);
}
html[data-theme="light"] .tag { background: rgba(47, 127, 224, 0.1); border-color: rgba(47, 127, 224, 0.25); }

.about-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.stat {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 26px 12px;
  text-align: center;
}
.stat b {
  font-size: clamp(28px, 4vw, 40px);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat span { font-size: 13.5px; color: var(--text-dim); margin-top: 6px; }

/* ---------- 作品集：3. 图片悬停放大 ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.gallery-item {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  isolation: isolate;          /* 防止图片放大后溢出圆角影响 z-index */
}
.gallery-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), filter 0.4s;
  will-change: transform;
}
.gallery-item:hover img { transform: scale(1.18); filter: brightness(1.08); }
.gallery-item::after {           /* 悬停渐变遮罩，让文字更清晰 */
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(8, 10, 30, 0.85) 100%);
  opacity: 0;
  transition: opacity 0.4s;
}
.gallery-item:hover::after { opacity: 1; }
.gallery-item figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 18px;
  z-index: 1;
  transform: translateY(12px);
  opacity: 0;
  transition: transform 0.45s, opacity 0.45s;
  color: #fff;
}
.gallery-item:hover figcaption { transform: translateY(0); opacity: 1; }
.gallery-item figcaption b { display: block; font-size: 17px; margin-bottom: 3px; }
.gallery-item figcaption span { font-size: 13px; opacity: 0.82; }

/* ---------- 技能 ---------- */
.skills {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.skill { padding: 22px 26px; }
.skill b { display: block; margin-bottom: 12px; font-size: 15.5px; }
.bar {
  height: 8px; border-radius: 999px;
  background: rgba(125, 216, 255, 0.14);
  overflow: hidden;
}
.bar i {
  display: block; height: 100%;
  width: var(--w);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.skill.visible .bar i { transform: scaleX(1); }

/* ---------- 联系 ---------- */
.contact { padding: 46px 30px; text-align: center; }
.contact > p { color: var(--text-dim); margin-bottom: 22px; font-size: 16px; }
.domain-line { margin-top: 20px; font-size: 14px; color: var(--text-dim); letter-spacing: 1px; }

/* 复制成功的提示气泡 */
.toast {
  position: fixed;
  bottom: 30px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(20, 26, 60, 0.92);
  color: #fff;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s, transform 0.35s;
  z-index: 200;
  border: 1px solid rgba(125, 216, 255, 0.3);
  backdrop-filter: blur(10px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.footer {
  text-align: center;
  padding: 60px 20px 40px;
  color: var(--text-dim);
  font-size: 13.5px;
}

/* ============================================================
   入场动画
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ============================================================
   移动端适配
   ============================================================ */
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .skills { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  :root { --nav-h: 58px; }
  .nav { top: 10px; padding: 0 12px; }
  .nav-logo { font-size: 15.5px; }

  /* 折叠菜单 */
  .menu-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: calc(100% + 10px);
    left: 0; right: 0;
    flex-direction: column;
    background: rgba(16, 22, 54, 0.92);           /* 不透明底，光晕透不过来 */
    backdrop-filter: blur(24px) saturate(1.3);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    padding: 10px;
    gap: 4px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
  }
  html[data-theme="light"] .nav-links {
    background: rgba(252, 249, 243, 0.96);
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 12px 40px rgba(120, 90, 60, 0.18);
  }
  .nav-links.open { opacity: 1; visibility: visible; transform: translateY(0); }
  .nav-links a { padding: 13px 18px; font-size: 15px; }

  .hero { padding-top: calc(var(--nav-h) + 24px); }
  .hero-cta .btn { width: min(280px, 78vw); justify-content: center; }

  .gallery { grid-template-columns: 1fr; }
  .gallery-item { aspect-ratio: 16 / 10; }

  /* 触屏上：图片信息常显（因为没有 hover） */
  .gallery-item::after,
  .gallery-item figcaption { opacity: 1; transform: none; }

  .section { padding: 64px 0 16px; }
  .about-card { padding: 26px 22px; }
  .contact { padding: 36px 20px; }
  .footer { padding: 44px 16px 32px; }
}

/* 触屏设备：关掉磁吸（JS 里也会判断），按钮保持弹性反馈 */
@media (hover: none) {
  .magnetic { transform: none !important; }
  .btn:active { transform: scale(0.96); }
  .theme-toggle:active { transform: scale(0.9); }
}
