:root {
  --bg: #0a0e17;
  --bg-soft: #101624;
  --bg-card: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e6edf7;
  --text-dim: #93a0b5;
  --accent: #38d9ff;
  --accent-2: #7c5cff;
  --gradient: linear-gradient(135deg, var(--accent), var(--accent-2));
  --radius: 14px;
  --font: "Inter", "Noto Sans SC", -apple-system, sans-serif;
  --mono: "JetBrains Mono", monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

body.light {
  --bg: #f5f7fb;
  --bg-soft: #eef1f8;
  --bg-card: rgba(0, 0, 0, 0.02);
  --border: rgba(0, 0, 0, 0.08);
  --text: #1a2233;
  --text-dim: #55627a;
  --accent: #0ea5e9;
  --accent-2: #7c5cff;
}

#particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.container {
  width: min(1080px, 90%);
  margin: 0 auto;
}

/* ---------- 导航 ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 14, 23, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s ease;
}

body.light .nav {
  background: rgba(245, 247, 251, 0.8);
}

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

.logo {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  font-size: 1.1rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  gap: 28px;
}

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--accent);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px 0 80px;
}

.hero-glow {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 640px;
  height: 640px;
  background: radial-gradient(circle, rgba(56, 217, 255, 0.18), rgba(124, 92, 255, 0.12) 40%, transparent 65%);
  filter: blur(60px);
  z-index: -1;
}

.hero-eyebrow {
  font-family: var(--mono);
  color: var(--accent);
  letter-spacing: 0.2em;
  margin-bottom: 12px;
}

.hero-title {
  font-size: clamp(3rem, 9vw, 5.5rem);
  font-weight: 700;
  line-height: 1.1;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.hero-type {
  font-family: var(--mono);
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  color: var(--text-dim);
  min-height: 2em;
}

.cursor {
  color: var(--accent);
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.hero-desc {
  margin: 24px 0 36px;
  color: var(--text-dim);
  font-size: 1.05rem;
}

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

.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 8px 24px rgba(56, 217, 255, 0.25);
}

.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--accent);
}

.hero-scroll {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.scroll-line {
  width: 1px;
  height: 40px;
  background: var(--border);
  position: relative;
  overflow: hidden;
}

.scroll-line::after {
  content: "";
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--accent);
  animation: scroll 2s ease-in-out infinite;
}

@keyframes scroll {
  to { top: 100%; }
}

/* ---------- 通用 section ---------- */
.section {
  padding: 100px 0;
  position: relative;
  z-index: 1;
}

.section-alt {
  background: var(--bg-soft);
}

.section-title {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  margin-bottom: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.num {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 1.1rem;
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 56px;
  align-items: center;
}

.avatar-frame {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  padding: 12px;
  background: var(--bg-card);
}

.avatar-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gradient);
  opacity: 0.06;
  pointer-events: none;
}

.avatar-frame img {
  width: 100%;
  display: block;
  border-radius: 10px;
}

.about-text h3 {
  font-size: 1.4rem;
  margin-bottom: 16px;
}

.about-text p {
  color: var(--text-dim);
  margin-bottom: 14px;
}

.about-text strong {
  color: var(--text);
}

.about-info {
  list-style: none;
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.about-info li {
  color: var(--text-dim);
  font-size: 0.92rem;
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform 0.25s, border-color 0.25s;
}

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

.skill-cat {
  font-size: 1.05rem;
  margin-bottom: 20px;
  color: var(--accent);
}

.skill-bar {
  margin-bottom: 16px;
}

.bar-label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

body.light .bar {
  background: rgba(0, 0, 0, 0.06);
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gradient);
  border-radius: 4px;
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.skill-tags span {
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  transition: all 0.2s;
}

.skill-tags span:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(56, 217, 255, 0.2);
}

/* ---------- Projects ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  opacity: 0;
  transform: translateY(24px);
}

.project-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 12px 32px rgba(56, 217, 255, 0.12);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.project-icon {
  font-size: 1.8rem;
}

.project-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.8rem;
  transition: color 0.2s;
}

.project-links a:hover {
  color: var(--accent);
}

.project-card h3 {
  font-size: 1.15rem;
}

.project-card p {
  color: var(--text-dim);
  font-size: 0.92rem;
  flex-grow: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-tags span {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  border: 1px solid rgba(56, 217, 255, 0.3);
  padding: 4px 10px;
  border-radius: 6px;
}

/* ---------- Contact ---------- */
.contact-lead {
  color: var(--text-dim);
  margin-bottom: 40px;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.25s, border-color 0.25s;
}

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

.contact-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 12px;
}

.contact-card h4 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.contact-card p {
  color: var(--text-dim);
  font-size: 0.82rem;
  font-family: var(--mono);
  word-break: break-all;
}

/* ---------- 照片墙 ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.gallery-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  margin: 0;
  cursor: pointer;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.gallery-item:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 12px 32px rgba(56, 217, 255, 0.12);
}

.gallery-item img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 28px 14px 12px;
  font-size: 0.88rem;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.65), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-item:hover figcaption {
  opacity: 1;
}

.gallery-item img.error {
  object-fit: cover;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.88rem;
  position: relative;
  z-index: 1;
}

/* ---------- 入场动画 ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-inner > * {
  animation: fadeUp 0.8s ease both;
}

.hero-inner > *:nth-child(2) { animation-delay: 0.1s; }
.hero-inner > *:nth-child(3) { animation-delay: 0.2s; }
.hero-inner > *:nth-child(4) { animation-delay: 0.3s; }
.hero-inner > *:nth-child(5) { animation-delay: 0.4s; }

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

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

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; }
  .skills-grid, .projects-grid, .gallery-grid { grid-template-columns: 1fr 1fr; }
  .contact-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .nav-links { gap: 14px; }
  .nav-links a { font-size: 0.85rem; }
  .skills-grid, .projects-grid, .gallery-grid, .contact-grid { grid-template-columns: 1fr; }
  .about-info { grid-template-columns: 1fr; }
  .section { padding: 72px 0; }
}

/* ---------- 灯箱 ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 12, 0.92);
  backdrop-filter: blur(8px);
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.lightbox figcaption {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-dim);
  font-size: 0.9rem;
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 28px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
}

.lightbox-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}