:root {
  --bg: #06070c;
  --bg-soft: #0c0f18;
  --card: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.09);
  --text: #e8eaf2;
  --muted: #8a90a6;
  --accent: #6ee7ff;
  --accent-2: #a78bfa;
  --accent-3: #34d399;
  --glow: radial-gradient(circle at center, rgba(110, 231, 255, 0.16), transparent 68%);
  --max: 1120px;
}

body.light {
  --bg: #f7f8fb;
  --bg-soft: #ffffff;
  --card: rgba(15, 20, 40, 0.02);
  --border: rgba(15, 20, 40, 0.1);
  --text: #101422;
  --muted: #5a6076;
  --accent: #0891b2;
  --accent-2: #7c3aed;
  --accent-3: #059669;
  --glow: radial-gradient(circle at center, rgba(8, 145, 178, 0.1), transparent 68%);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Space Grotesk", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.65;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

::selection { background: rgba(110, 231, 255, 0.28); color: #fff; }

.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

body.light .grid-bg {
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.045) 1px, transparent 1px);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 25%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 25%, transparent 78%);
}

.cursor-glow {
  position: fixed;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: var(--glow);
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: opacity 0.4s ease;
  z-index: 1;
  opacity: 0;
}

@media (hover: hover) { .cursor-glow { opacity: 1; } }

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(20px, 5vw, 56px);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.nav.scrolled { border-bottom-color: var(--border); }

.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.5px;
}

.logo span { color: var(--accent); }

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

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  letter-spacing: 0.3px;
  position: relative;
  transition: color 0.25s ease;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -5px;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { width: 100%; }

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: rotate(-12deg); }

main { position: relative; z-index: 2; }

.hero {
  position: relative;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(150px, 24vh, 240px) clamp(20px, 5vw, 48px) clamp(90px, 14vh, 140px);
}

.hero::before {
  content: "";
  position: absolute;
  top: 12%;
  left: 50%;
  width: min(720px, 90vw);
  height: min(720px, 90vw);
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(110, 231, 255, 0.12), rgba(167, 139, 250, 0.07) 42%, transparent 68%);
  filter: blur(30px);
  z-index: -1;
  pointer-events: none;
}

.eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(52px, 11vw, 112px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  font-weight: 700;
  background: linear-gradient(120deg, var(--text) 20%, var(--accent) 55%, var(--accent-2) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 22px;
}

.role {
  font-size: clamp(18px, 2.4vw, 24px);
  color: var(--text);
  font-weight: 500;
  margin-bottom: 18px;
}

.tagline {
  color: var(--muted);
  font-size: clamp(15px, 1.6vw, 18px);
  max-width: 560px;
  margin-bottom: 40px;
}

.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 46px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease, border-color 0.22s ease;
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #06070c;
  box-shadow: 0 12px 32px rgba(110, 231, 255, 0.22);
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(110, 231, 255, 0.32); }

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

.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

.hero-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: var(--muted);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-3);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(70px, 10vh, 110px) clamp(20px, 5vw, 48px);
  border-top: 1px solid var(--border);
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-size: clamp(24px, 3.4vw, 34px);
  letter-spacing: -0.02em;
  margin-bottom: 44px;
}

.num {
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  color: var(--accent);
  letter-spacing: 0.1em;
}

.about-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: clamp(28px, 6vw, 72px);
  align-items: start;
}

.about-text p { color: var(--muted); margin-bottom: 18px; max-width: 52ch; }
.about-text p:last-child { margin-bottom: 0; }

.facts {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.facts li {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.facts li:hover { border-color: color-mix(in srgb, var(--accent) 50%, transparent); transform: translateY(-3px); }
.facts strong { font-size: 26px; letter-spacing: -0.02em; }
.facts span { color: var(--muted); font-size: 13px; }

.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.skill-card {
  border: 1px solid var(--border);
  background: linear-gradient(160deg, var(--card), transparent);
  border-radius: 16px;
  padding: 26px 28px;
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.skill-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.skill-card h3 { font-size: 17px; margin-bottom: 10px; letter-spacing: 0.02em; }
.skill-card p { color: var(--muted); font-family: "JetBrains Mono", monospace; font-size: 13px; line-height: 1.8; }

.projects { display: flex; flex-direction: column; }

.project {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 30px 8px;
  border-top: 1px solid var(--border);
  transition: padding-left 0.3s ease, background 0.3s ease;
}

.project:last-child { border-bottom: 1px solid var(--border); }

.project:hover { padding-left: 20px; background: linear-gradient(90deg, rgba(110, 231, 255, 0.05), transparent 60%); }

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

.project-index { font-family: "JetBrains Mono", monospace; font-size: 13px; color: var(--muted); }

.project-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 20px;
  transition: color 0.25s ease, transform 0.25s ease;
}

.project:hover .project-link { color: var(--accent); transform: translate(3px, -3px); }

.project h3 { font-size: clamp(22px, 3vw, 28px); letter-spacing: -0.02em; }
.project p { color: var(--muted); max-width: 62ch; }

.tags { list-style: none; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

.tags li {
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  padding: 4px 12px;
  border-radius: 999px;
}

.contact { text-align: left; }

.contact-text { color: var(--muted); max-width: 48ch; margin-bottom: 30px; }

.mail {
  display: inline-block;
  font-size: clamp(24px, 5vw, 46px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.25s ease, border-color 0.25s ease;
  word-break: break-all;
}

.mail:hover { color: var(--accent); border-bottom-color: var(--accent); }

.socials { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 40px; }

.socials a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  border: 1px solid var(--border);
  padding: 9px 18px;
  border-radius: 10px;
  transition: color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.socials a:hover { color: var(--text); border-color: var(--accent); transform: translateY(-2px); }

.footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 34px 20px 44px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 12.5px;
  letter-spacing: 0.03em;
}

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

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

@media (max-width: 760px) {
  .about-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
