/* ============================================
   周思泽 · 个人主页 样式
   深色程序员风 · 渐变质感 · 响应式
   ============================================ */

:root {
  --bg: #0a0e14;
  --bg-alt: #0e141d;
  --surface: #131a24;
  --surface-2: #182130;
  --border: #1e2a3a;
  --border-strong: #2b3b52;
  --text: #e8eef7;
  --text-muted: #93a1b5;
  --accent: #5b9dff;
  --accent-2: #35d0ba;
  --accent-3: #a78bfa;
  --grad: linear-gradient(120deg, #5b9dff 0%, #35d0ba 55%, #a78bfa 100%);
  --radius: 14px;
  --maxw: 1120px;
  --nav-h: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg);
  /* 极淡的网格纹理：横竖各 1px 细线组成 48px 格子，增加质感但不抢眼 */
  background-image:
    linear-gradient(to right, rgba(91, 157, 255, .035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(91, 157, 255, .035) 1px, transparent 1px);
  background-size: 48px 48px;
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 背景装饰：柔和的彩色光斑 */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(120px);
  opacity: .35;
  pointer-events: none;
}
body::before {
  width: 560px; height: 560px;
  top: -160px; right: -120px;
  background: radial-gradient(circle, #2b5cff66, transparent 70%);
}
body::after {
  width: 520px; height: 520px;
  bottom: -140px; left: -140px;
  background: radial-gradient(circle, #14b8a655, transparent 70%);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; }

::selection { background: #5b9dff44; }

/* ---------- 滚动进度条 ---------- */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  background: var(--grad);
  z-index: 200;
  border-radius: 0 3px 3px 0;
}

/* ---------- 导航 ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 20, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s;
}
.nav.scrolled { border-bottom-color: var(--border); }
.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: .3px;
  font-family: "SFMono-Regular", Consolas, "JetBrains Mono", "Courier New", monospace;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.nav-prompt {
  -webkit-text-fill-color: var(--accent-2);
  margin-right: 7px;
  font-weight: 700;
}
.nav-links { display: flex; gap: 30px; }
.nav-links a {
  color: var(--text-muted);
  font-size: .95rem;
  position: relative;
  padding: 6px 0;
  transition: color .18s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--accent); }
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 2px;
  background: var(--grad);
  border-radius: 2px;
  transition: width .22s ease;
}
.nav-links a.active::after,
.nav-links a:hover::after { width: 100%; }
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle span {
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}

/* ---------- 首屏 ---------- */
.hero {
  position: relative;
  padding: 110px 28px 90px;
  min-height: 86vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}
/* 首屏点阵背景 */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(91,157,255,.14) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse 70% 60% at 60% 40%, #000 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 60% 40%, #000 20%, transparent 70%);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
  align-items: center;
}
.hero-greeting {
  color: var(--accent-2);
  font-size: 1.05rem;
  margin-bottom: 10px;
  letter-spacing: 1px;
}
.hero-name {
  font-size: clamp(2.8rem, 7vw, 4.4rem);
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1.08;
  margin-bottom: 14px;
  background: linear-gradient(120deg, #ffffff 15%, #9fc2ff 55%, #5b9dff 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-title {
  font-size: 1.28rem;
  color: var(--text);
  margin-bottom: 20px;
  font-weight: 600;
}
.hero-title em { font-style: normal; color: var(--accent-2); }
.hero-desc {
  max-width: 560px;
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 34px;
}
.hero-actions { display: flex; gap: 14px; margin-bottom: 26px; flex-wrap: wrap; }
.hero-links { color: var(--text-muted); font-size: .95rem; }
.hero-links a { color: var(--text-muted); transition: color .15s; }
.hero-links a:hover { color: var(--accent); }
.hero-links .sep { margin: 0 8px; color: var(--border-strong); }

/* 终端窗口装饰 */
.hero-terminal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px -20px rgba(0,0,0,.6), 0 0 0 1px #0000;
  overflow: hidden;
}
.terminal-head {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.terminal-head span {
  width: 12px; height: 12px;
  border-radius: 50%;
}
.terminal-head span:nth-child(1) { background: #ff5f57; }
.terminal-head span:nth-child(2) { background: #febc2e; }
.terminal-head span:nth-child(3) { background: #28c840; }
.terminal-body {
  padding: 22px 22px 26px;
  font-family: "SFMono-Regular", Consolas, "JetBrains Mono", "Courier New", monospace;
  font-size: .88rem;
  line-height: 1.9;
  color: #c9d6e8;
  overflow-x: auto;
}
.terminal-body .t-prompt { color: var(--accent-2); }
.terminal-body .t-cmd { color: var(--text); }
.terminal-body .t-out { color: var(--text-muted); }
.terminal-body .t-accent { color: var(--accent); }
.cursor {
  display: inline-block;
  width: 9px; height: 1.2em;
  background: var(--accent-2);
  vertical-align: -3px;
  margin-left: 2px;
  animation: blink 1.1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: 10px;
  font-weight: 600;
  font-size: .95rem;
  border: 1px solid transparent;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--grad);
  color: #04101c;
  box-shadow: 0 6px 20px -6px #5b9dff88;
}
.btn-primary:hover { box-shadow: 0 10px 28px -6px #5b9dffbb; transform: translateY(-1px); }
.btn-ghost { border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

/* ---------- 区块通用 ---------- */
.section { padding: 92px 28px; }
.section-alt { background: var(--bg-alt); }
.section-inner { max-width: var(--maxw); margin: 0 auto; }
.section-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 44px; }
.section-num {
  font-family: Consolas, monospace;
  color: var(--accent-2);
  font-size: .95rem;
  font-weight: 700;
}
.section-title {
  font-size: 1.9rem;
  font-weight: 700;
  position: relative;
}
.section-title::after {
  content: "";
  position: absolute;
  left: 0; bottom: -12px;
  width: 44px; height: 3px;
  background: var(--grad);
  border-radius: 2px;
}

/* ---------- 关于我 ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
}
.about-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  transition: border-color .2s, transform .2s;
}
.about-card:hover { border-color: var(--border-strong); }
.about-card p { color: var(--text-muted); margin-bottom: 15px; }
.about-card p:last-child { margin-bottom: 0; }
.about-highlights h3 { font-size: 1.05rem; margin-bottom: 16px; color: var(--text); }
.highlight-list { list-style: none; }
.highlight-list li {
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.highlight-list li::before {
  content: "▹";
  color: var(--accent-2);
}
.highlight-list li:last-child { border-bottom: none; }

/* ---------- 技能 ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px 44px;
}
.skill { display: grid; grid-template-columns: 190px 1fr; align-items: center; gap: 18px; }
.skill-name { font-size: .95rem; color: var(--text); }
.skill-bar {
  height: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.skill-bar i {
  display: block;
  height: 100%;
  width: 0;                 /* 初始为 0，滚动进入时由 JS 填到目标宽度 */
  background: var(--grad);
  border-radius: 99px;
  transition: width 1.1s cubic-bezier(.22,.9,.36,1);
}
.skill.in-view .skill-bar i { width: var(--w, 70%); }

/* ---------- 项目 ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
}
.project {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.project:hover {
  transform: translateY(-5px);
  border-color: #5b9dff88;
  box-shadow: 0 18px 40px -18px #5b9dff55;
}
.project-featured {
  border-color: transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--grad) border-box;
  border: 1px solid transparent;
}
.project-tag {
  position: absolute;
  top: 22px; right: 22px;
  background: var(--grad);
  color: #04101c;
  font-size: .74rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 99px;
}
.project-title { font-size: 1.28rem; margin-bottom: 12px; }
.project-desc { color: var(--text-muted); font-size: .95rem; margin-bottom: 18px; flex: 1; }
.project-tech { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.project-tech li {
  font-size: .78rem;
  color: var(--accent-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px 12px;
  background: #35d0ba14;
}
.project-meta { font-size: .85rem; color: var(--text-muted); margin-bottom: 16px; }
.project-link {
  font-weight: 600;
  font-size: .95rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.project-link:hover { gap: 10px; }
.project-link { transition: gap .15s; }

/* ---------- 教育 ---------- */
.edu-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  display: flex;
  gap: 28px;
  position: relative;
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.edu-card:hover { border-color: var(--border-strong); box-shadow: 0 14px 34px -20px #0009; }
/* 左侧渐变装饰条 */
.edu-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--grad);
}
.edu-badge {
  flex-shrink: 0;
  width: 62px; height: 62px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.edu-badge svg { width: 30px; height: 30px; stroke: var(--accent); }
.edu-main { flex: 1; min-width: 0; }
.edu-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.edu-school { font-size: 1.35rem; margin-bottom: 4px; }
.edu-major { color: var(--text); }
.edu-year {
  color: var(--accent-2);
  font-weight: 600;
  font-size: .86rem;
  font-family: Consolas, monospace;
  padding: 6px 14px;
  border: 1px solid #35d0ba44;
  border-radius: 99px;
  background: #35d0ba14;
  white-space: nowrap;
}
.edu-courses-label {
  display: block;
  color: var(--text-muted);
  font-size: .86rem;
  margin-bottom: 10px;
}
.course-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.course-tags li {
  font-size: .85rem;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  background: var(--surface-2);
  transition: border-color .15s, color .15s;
}
.course-tags li:hover { border-color: var(--accent); color: var(--accent); }
.edu-note { color: var(--text-muted); font-size: .9rem; margin-top: 16px; }

/* ---------- 联系 ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.contact-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.contact-item:hover {
  border-color: #5b9dff88;
  transform: translateY(-4px);
  box-shadow: 0 16px 36px -18px #5b9dff55;
}
.contact-icon {
  width: 44px; height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-bottom: 6px;
}
.contact-icon svg { width: 22px; height: 22px; stroke: var(--accent); }
.contact-label { color: var(--text-muted); font-size: .84rem; }
.contact-value { color: var(--text); font-weight: 600; word-break: break-all; }

/* ---------- 页脚 ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 34px 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
}
.footer-beian { margin-top: 6px; }
.footer-beian a { color: var(--text-muted); transition: color .15s; }
.footer-beian a:hover { color: var(--text); }

/* ---------- 回到顶部 ---------- */
.back-top {
  position: fixed;
  right: 26px; bottom: 26px;
  width: 46px; height: 46px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: all .25s;
  z-index: 120;
}
.back-top.show { opacity: 1; visibility: visible; transform: none; }
.back-top:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 滚动入场动画（仅 JS 启用时生效） ---------- */
.js .project,
.js .about-card,
.js .edu-card,
.js .contact-item,
.js .skill {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .55s ease, transform .55s ease;
}
.js .in-view {
  opacity: 1;
  transform: none;
}

/* ---------- 响应式 ---------- */
@media (max-width: 880px) {
  .hero-inner { grid-template-columns: 1fr; gap: 40px; }
  .hero-terminal { max-width: 520px; }
  .about-grid,
  .projects-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .edu-card { flex-direction: column; gap: 12px; }
  .hero { padding: 80px 24px 64px; min-height: auto; }

  .nav-links {
    position: fixed;
    top: var(--nav-h); left: 0; right: 0;
    background: var(--bg);
    flex-direction: column;
    gap: 0;
    border-bottom: 1px solid var(--border);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 16px 28px; border-top: 1px solid var(--border); }
  .nav-toggle { display: flex; }
}

@media (max-width: 480px) {
  .skill { grid-template-columns: 1fr; gap: 8px; }
}
