/* ========== 全局重置 ========== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0a0a;
  --bg-card: #141414;
  --bg-card-hover: #1a1a1a;
  --text: #e8e8e8;
  --text-muted: #888;
  --accent: #6c63ff;
  --accent-light: #8b83ff;
  --border: #222;
  --nav-height: 60px;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  font-family: 'Microsoft YaHei', 'PingFang SC', -apple-system, sans-serif;
  background: transparent;
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  isolation: isolate;
}

/* 极光流动背景 */
.aurora-bg {
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  z-index: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(108, 99, 255, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(39, 174, 96, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(168, 85, 247, 0.09) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 60%, rgba(30, 132, 73, 0.07) 0%, transparent 40%);
  animation: aurora 20s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes aurora {
  0%   { transform: translate(0, 0)     rotate(0deg); }
  33%  { transform: translate(5%, -3%)   rotate(3deg); }
  66%  { transform: translate(-3%, 5%)   rotate(-2deg); }
  100% { transform: translate(2%, -2%)   rotate(1deg); }
}

/* ========== 导航栏 ========== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: background 0.3s, backdrop-filter 0.3s;
}

.nav--scrolled {
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav__links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav__link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  transition: color 0.3s;
  position: relative;
}

.nav__link:hover,
.nav__link.active {
  color: var(--text);
}

.nav__link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

/* ========== 移动端汉堡按钮（桌面隐藏） ========== */
.nav__toggle {
  display: none;
  position: absolute;
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  z-index: 101;
}

.nav__toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav__toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle.active span:nth-child(2) { opacity: 0; }
.nav__toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ========== 通用 Section ========== */
section {
  scroll-margin-top: var(--nav-height);
}
section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem 2rem;
  position: relative;
}

.section__inner {
  max-width: 1000px;
  width: 100%;
}

.section__title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 3rem;
  position: relative;
  display: inline-block;
}

.section__title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

/* ========== 淡入动画 ========== */
.fade-in {
  opacity: 0;
  transition: opacity 0.8s ease;
}

.fade-in.visible {
  opacity: 1;
}

/* ========== 滚动进度条 ========== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #6c63ff, #a855f7, #27ae60);
  z-index: 300;
  border-radius: 0 2px 2px 0;
  transition: width 0.1s linear;
}

/* ========== 鼠标光晕（桌面） ========== */
.cursor-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(108,99,255,0.18), rgba(168,85,247,0.08) 40%, transparent 65%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.45s ease;
  mix-blend-mode: screen;
}

/* ========== 错落进场 ========== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(.2,.7,.3,1), transform 0.7s cubic-bezier(.2,.7,.3,1);
  transition-delay: calc(var(--i, 0) * 90ms);
}

.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* 标题下划线进入时展开 */
.section__title::after {
  width: 0;
  transition: width 0.8s ease 0.35s;
}

.section__inner.visible .section__title::after {
  width: 40px;
}

/* ========== 时间线增强 ========== */
.timeline::before {
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 1.1s ease 0.2s;
}

.section__inner.visible .timeline::before {
  transform: scaleY(1);
}

.timeline__item::before {
  box-shadow: 0 0 0 0 rgba(108,99,255,0.5);
}

.section__inner.visible .timeline__item::before {
  animation: node-pop 0.6s ease both;
}

@keyframes node-pop {
  0%   { transform: translateX(-5px) scale(0.4); }
  60%  { transform: translateX(-5px) scale(1.25); }
  100% { transform: translateX(-5px) scale(1); }
}

/* ========== 项目图标 hover ========== */
.project-card__icon {
  transition: transform 0.35s cubic-bezier(.2,.7,.3,1);
}

.project-card:hover .project-card__icon {
  transform: scale(1.18) rotate(-6deg);
}

/* ========== 回到顶部按钮 ========== */
.to-top {
  position: fixed;
  right: 1.8rem;
  bottom: 1.8rem;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(20, 20, 20, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 150;
  opacity: 0;
  transform: translateY(22px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease, background 0.3s, border-color 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.to-top.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.to-top:hover {
  background: rgba(108, 99, 255, 0.18);
  border-color: var(--accent);
  transform: translateY(-3px);
}

/* ========== Hero 区域 ========== */
.hero {
  display: block !important;
  position: relative;
  padding: 0;
  overflow: hidden;
  height: 100vh;
}

.hero__canvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
}

.hero__scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-muted);
  font-size: 1.2rem;
  text-decoration: none;
  animation: float 2s ease-in-out infinite;
  z-index: 2;
}

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

/* ========== 灵感提示框 ========== */
.hero__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.hint-box {
  position: absolute;
  bottom: 30%;
  left: 80px;
  display: flex;
  align-items: center;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 1.1rem;
  color: #888;
  pointer-events: auto;
}

.hint-box__prompt {
  color: #6a9955;
  font-size: 1.1rem;
}

.hint-box__text {
  display: inline-block;
  color: #d4d4d4;
}

.hint-box__text .char {
  display: inline-block;
  transition: all 0.15s;
}

/* 崩坏动画：从左往右依次化成灰 */
.hint-box__text .char.crumble {
  animation: crumble 0.4s ease-in forwards;
}

@keyframes crumble {
  0%   { opacity: 1; transform: translate(0, 0) scale(1); filter: blur(0); }
  50%  { opacity: 0.5; transform: translate(2px, -6px) scale(0.8); filter: blur(1px); }
  100% { opacity: 0; transform: translate(6px, 14px) scale(0.3); filter: blur(3px); }
}

/* 光标闪烁 */
.hint-box__cursor {
  color: #d4d4d4;
  font-size: 1.1rem;
  animation: blink 1s step-end infinite;
  margin-left: 2px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* ========== 关于我 ========== */
.about__grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 3rem;
  align-items: start;
}

.about__avatar {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 3px solid var(--border);
}

.about__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.about__text p {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.about__text p:first-child {
  font-size: 1.1rem;
  color: var(--text);
}

/* ========== 技能兴趣 ========== */
.skills__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.skill-item {
  margin-bottom: 1.5rem;
}

.skill-item__label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.skill-bar {
  height: 26px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 13px;
  overflow: hidden;
  position: relative;
}

.skill-bar__progress {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #1a7a3a, #2ecc71, #27ae60, #1e8449);
  background-size: 200% 100%;
  border-radius: 13px;
  transition: width 1.4s ease;
  position: relative;
  box-shadow: inset 0 -2px 4px rgba(0,0,0,0.3), inset 0 2px 4px rgba(255,255,255,0.15);
}


/* 气泡容器 */
.skill-bar__bubbles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

/* 气泡 */
.skill-bar__bubbles .bubble {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  will-change: transform, opacity;
}

/* 大气泡 */
.skill-bar__bubbles .bubble:nth-child(odd) {
  width: 12px;
  height: 12px;
  background: rgba(255,255,255,0.25);
  border: 1px solid rgba(255,255,255,0.2);
}

/* 小气泡 */
.skill-bar__bubbles .bubble:nth-child(even) {
  width: 7px;
  height: 7px;
  background: rgba(39,174,96,0.4);
}

/* 每条进度条用 --d 偏移延迟，五条各不相同 */
.skill-bar__bubbles .bubble:nth-child(1)  { top: 30%; animation: bubble-drift 5s  calc(var(--d, 0s) + 2s)  infinite; }
.skill-bar__bubbles .bubble:nth-child(2)  { top: 60%; animation: bubble-drift 6s  calc(var(--d, 0s) + 4s)  infinite; }
.skill-bar__bubbles .bubble:nth-child(3)  { top: 20%; animation: bubble-drift 5.5s calc(var(--d, 0s) + 3s)  infinite; }
.skill-bar__bubbles .bubble:nth-child(4)  { top: 70%; animation: bubble-drift 6.5s calc(var(--d, 0s) + 5s)  infinite; }
.skill-bar__bubbles .bubble:nth-child(5)  { top: 45%; animation: bubble-drift 5s  calc(var(--d, 0s) + 6s)  infinite; }
.skill-bar__bubbles .bubble:nth-child(6)  { top: 55%; animation: bubble-drift 6s  calc(var(--d, 0s) + 8s)  infinite; }

@keyframes bubble-drift {
  0%   { left: -3%;  opacity: 0; transform: translateY(0); }
  8%   { opacity: 0.6; }
  92%  { opacity: 0.3; }
  100% { left: 103%; opacity: 0; transform: translateY(-6px); }
}

/* 悬停文字 */
.skill-bar__hover-text {
  position: absolute;
  top: 0;
  left: 12px;
  height: 100%;
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.05em;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 2;
  pointer-events: none;
  white-space: nowrap;
}

.skill-bar:hover .skill-bar__progress {
  filter: blur(3px);
}

.skill-bar:hover .skill-bar__bubbles {
  opacity: 0;
}

.skill-bar:hover .skill-bar__hover-text {
  opacity: 1;
}

.interests__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

.tag {
  padding: 0.4rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: all 0.3s;
}

.tag:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(108, 99, 255, 0.1);
}

/* ========== 项目作品 ========== */
.projects__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.3s;
  cursor: default;
}

.project-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-4px);
}

.project-card__icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.project-card__title {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.project-card__desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.project-card__tags {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.project-card__tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  background: rgba(108, 99, 255, 0.1);
  color: var(--accent-light);
  border-radius: 4px;
}

/* ========== 时间线 ========== */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline__item {
  position: relative;
  padding-bottom: 2.5rem;
  padding-left: 2rem;
}

.timeline__item::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: 0.4rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateX(-5px);
}

.timeline__date {
  font-size: 0.85rem;
  color: var(--accent-light);
  margin-bottom: 0.3rem;
}

.timeline__title {
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}

.timeline__desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ========== 联系方式 ========== */
.contact__grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 1.5rem;
  justify-content: center;
}

.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem 1.5rem;
  text-align: center;
  transition: all 0.3s;
  text-decoration: none;
  color: var(--text);
  width: 320px;
  display: block;
}

.contact-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
}

.contact-card__icon {
  font-size: 2rem;
  margin-bottom: 0.8rem;
}

.contact-card__label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.contact-card__value {
  font-size: 0.95rem;
}

.contact-card__value a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.3s;
}

.contact-card__value a:hover {
  color: var(--accent-light);
}

.contact-card__code {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 12px 14px;
  margin-top: 8px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.8;
  text-align: left;
  overflow: visible;
}

.contact-card__code .code-line {
  display: block;
  padding: 2px 0;
  white-space: nowrap;
}

.contact-card__code a {
  color: #ce9178;
  text-decoration: none;
}

.contact-card__code a:hover {
  text-decoration: underline;
}

/* ========== Footer ========== */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ========== 响应式 / 移动端适配 ========== */
@media (max-width: 768px) {
  /* —— 导航：折叠为汉堡下拉菜单 —— */
  .nav__toggle { display: flex; }

  .nav__links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 0;
    background: rgba(10, 10, 10, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    transform: translateY(-150%);
    transition: transform 0.35s ease;
  }

  .nav__links--open { transform: translateY(0); }

  .nav__link {
    padding: 0.9rem 1.5rem;
    font-size: 1rem;
  }

  .nav__link.active::after { display: none; }

  .nav__link.active {
    color: var(--accent-light);
    background: rgba(108, 99, 255, 0.08);
  }

  /* —— Section 间距收窄 —— */
  section { padding: 5rem 1.5rem; }
  .hero { padding: 0; height: 100vh; }
  .section__title { font-size: 1.6rem; }

  /* —— 关于我：头像居中 —— */
  .about__grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .about__avatar {
    margin: 0 auto;
    width: 150px;
    height: 150px;
  }

  /* —— 技能：单列 —— */
  .skills__grid { grid-template-columns: 1fr; }

  /* —— 项目：单列 —— */
  .projects__grid { grid-template-columns: 1fr; }

  /* —— 联系：卡片堆叠 + 长文本允许换行 —— */
  .contact__grid { flex-wrap: wrap; }

  .contact-card {
    width: 100%;
    padding: 1.5rem 1.2rem;
  }

  .contact-card__code {
    white-space: normal;
    word-break: break-all;
    font-size: 0.8rem;
  }

  .contact-card__code .code-line { white-space: normal; }

  /* —— 灵感提示框：靠左更紧凑 —— */
  .hint-box {
    left: 20px;
    bottom: 26%;
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  section { padding: 4.5rem 1.2rem; }
  .section__title { font-size: 1.4rem; margin-bottom: 2rem; }
  .about__avatar { width: 120px; height: 120px; }
  .hint-box { left: 16px; bottom: 24%; font-size: 0.9rem; }
  .skill-bar__hover-text { font-size: 0.7rem; }
  .to-top { right: 1rem; bottom: 1rem; width: 42px; height: 42px; }
}

/* 触屏设备隐藏鼠标光晕 */
@media (hover: none) {
  .cursor-glow { display: none; }
}
