/* ============ 变量与主题 ============ */
:root {
  --font-sans: "Inter", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --container: 1100px;

  /* 深色主题（默认） */
  --bg: #0b1020;
  --bg-soft: #10172e;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.1);
  --text: #e6e9f2;
  --text-muted: #9aa3b8;
  --text-soft: #c3c9db;
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --accent-3: #a855f7;
  --gradient: linear-gradient(120deg, #6366f1 0%, #22d3ee 50%, #a855f7 100%);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --nav-bg: rgba(11, 16, 32, 0.72);
}

[data-theme="light"] {
  --bg: #f7f8fc;
  --bg-soft: #eef0f8;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --border: rgba(15, 23, 42, 0.1);
  --text: #141a2e;
  --text-muted: #5b6478;
  --text-soft: #3a4358;
  --shadow: 0 20px 50px rgba(30, 40, 90, 0.12);
  --nav-bg: rgba(247, 248, 252, 0.8);
}

/* ============ 基础 ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

::selection { background: var(--accent); color: #fff; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(120, 130, 160, 0.4); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120, 130, 160, 0.6); }

/* ============ 导航 ============ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.nav-inner {
  max-width: var(--container); margin: 0 auto; padding: 0 24px;
  height: 64px; display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; }
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--gradient); box-shadow: 0 0 14px var(--accent);
}
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  padding: 8px 14px; border-radius: 8px; font-size: 0.95rem; font-weight: 500;
  color: var(--text-muted); transition: color var(--transition), background var(--transition);
}
.nav-links a:hover { color: var(--text); background: var(--bg-card); }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn, .lang-btn {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  border: 1px solid var(--border); color: var(--text-muted);
  transition: all var(--transition);
}
.lang-btn { width: auto; padding: 0 12px; font-size: 0.85rem; font-weight: 700; }
.icon-btn:hover, .lang-btn:hover { color: var(--text); background: var(--bg-card); border-color: var(--accent); }
.icon-sun { display: none; }
[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }

.menu-btn { display: none; flex-direction: column; gap: 5px; }
.menu-btn span { width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: var(--transition); }

/* ============ Hero ============ */
.hero { position: relative; min-height: 100vh; display: flex; align-items: center; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; z-index: 0; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.55; }
.orb-1 { width: 420px; height: 420px; background: var(--accent); top: -120px; right: -80px; animation: float 12s ease-in-out infinite; }
.orb-2 { width: 340px; height: 340px; background: var(--accent-2); bottom: -100px; left: -100px; animation: float 14s ease-in-out infinite reverse; }
.orb-3 { width: 260px; height: 260px; background: var(--accent-3); top: 40%; left: 55%; animation: float 16s ease-in-out infinite; opacity: 0.35; }
.grid-overlay {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px),
                    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 40%, transparent 100%);
  opacity: 0.5;
}
@keyframes float { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(30px, -40px) scale(1.08); } }

.hero-inner { position: relative; z-index: 1; max-width: var(--container); margin: 0 auto; padding: 120px 24px 80px; }
.hero-eyebrow { font-size: 1.1rem; color: var(--text-soft); margin-bottom: 8px; }
.hero-title {
  font-size: clamp(3rem, 8vw, 5.5rem); font-weight: 900; line-height: 1.05; letter-spacing: -0.02em;
  background: var(--gradient); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 18px;
}
.hero-role { font-family: var(--font-mono); font-size: clamp(1.1rem, 2.6vw, 1.5rem); color: var(--text-soft); margin-bottom: 20px; min-height: 2em; }
.role-prefix { margin-right: 6px; }
.cursor { display: inline-block; color: var(--accent-2); animation: blink 0.9s steps(1) infinite; font-weight: 400; }
@keyframes blink { 50% { opacity: 0; } }

.hero-desc { max-width: 560px; color: var(--text-muted); font-size: 1.1rem; margin-bottom: 34px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 34px; }
.hero-socials { display: flex; gap: 12px; }
.social-link {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  border: 1px solid var(--border); color: var(--text-muted);
  transition: all var(--transition); background: var(--bg-card);
}
.social-link:hover { color: #fff; background: var(--accent); border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 10px 24px rgba(99, 102, 241, 0.4); }

.scroll-hint {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 1;
  color: var(--text-muted); animation: bounce 2s infinite;
}
@keyframes bounce { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 10px); } }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 13px 26px;
  border-radius: 12px; font-weight: 700; font-size: 1rem; transition: all var(--transition);
}
.btn-primary { background: var(--gradient); color: #fff; background-size: 200% 200%; box-shadow: 0 10px 28px rgba(99, 102, 241, 0.35); }
.btn-primary:hover { background-position: 100% 50%; transform: translateY(-2px); box-shadow: 0 16px 36px rgba(99, 102, 241, 0.5); }
.btn-ghost { border: 1px solid var(--border); color: var(--text); background: var(--bg-card); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--bg-card-hover); }

/* ============ Section ============ */
.section { padding: 110px 0; }
.section-alt { background: var(--bg-soft); }
.section-head { margin-bottom: 56px; }
.section-tag {
  display: inline-block; padding: 5px 14px; border-radius: 999px; font-size: 0.82rem; font-weight: 700;
  color: var(--accent); background: rgba(99, 102, 241, 0.12); margin-bottom: 14px;
  border: 1px solid rgba(99, 102, 241, 0.25);
}
.section-title { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -0.01em; }

/* ============ 关于 ============ */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: center; }
.about-text p { color: var(--text-muted); margin-bottom: 16px; font-size: 1.05rem; }
.about-facts { list-style: none; margin: 24px 0 30px; display: grid; gap: 12px; }
.about-facts li { display: flex; align-items: center; gap: 12px; color: var(--text-soft); }
.fact-ico { font-size: 1.3rem; }
.about-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 44px 32px; text-align: center; box-shadow: var(--shadow); transition: transform var(--transition);
}
.about-card:hover { transform: translateY(-6px); }
.avatar { font-size: 4.5rem; margin-bottom: 18px; }
.about-card h3 { font-size: 1.2rem; margin-bottom: 12px; }
.about-card p { color: var(--text-muted); font-size: 0.95rem; }

/* ============ 技能 ============ */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.skill-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; transition: all var(--transition);
}
.skill-card:hover { background: var(--bg-card-hover); border-color: var(--accent); transform: translateY(-4px); }
.skill-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.skill-ico { font-size: 1.7rem; }
.skill-name { font-weight: 700; }
.skill-bar { height: 7px; background: var(--border); border-radius: 99px; overflow: hidden; }
.skill-fill { height: 100%; width: 0; background: var(--gradient); border-radius: 99px; transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1); }
.skill-pct { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); }

/* ============ 作品 ============ */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.project-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: all var(--transition); display: flex; flex-direction: column;
}
.project-card:hover { transform: translateY(-6px); border-color: var(--accent); box-shadow: var(--shadow); }
.project-cover {
  height: 180px; display: grid; place-items: center; font-size: 3.4rem;
  background: var(--gradient); background-size: 200% 200%;
}
.project-body { padding: 24px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.project-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { font-size: 0.72rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: rgba(99, 102, 241, 0.12); color: var(--accent); border: 1px solid rgba(99,102,241,0.22); }
.project-body h3 { font-size: 1.2rem; }
.project-body p { color: var(--text-muted); font-size: 0.94rem; flex: 1; }
.project-links { display: flex; gap: 16px; margin-top: 6px; }
.project-links a { font-weight: 600; font-size: 0.92rem; color: var(--accent); display: inline-flex; align-items: center; gap: 5px; }
.project-links a:hover { text-decoration: underline; }

/* ============ 联系 ============ */
.contact-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 40px; align-items: start; }
.contact-info > p { color: var(--text-muted); margin-bottom: 26px; }
.contact-item {
  display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border); margin-bottom: 14px; transition: all var(--transition);
}
.contact-item:hover { border-color: var(--accent); transform: translateX(4px); }
.contact-ico { font-size: 1.6rem; }
.contact-item small { display: block; color: var(--text-muted); font-size: 0.8rem; }
.contact-item strong { font-size: 1rem; word-break: break-all; }
.contact-form { display: flex; flex-direction: column; gap: 16px; }
.contact-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.92rem; font-weight: 600; color: var(--text-soft); }
.contact-form input, .contact-form textarea {
  font-family: inherit; font-size: 1rem; color: var(--text);
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 13px 15px; transition: all var(--transition); resize: vertical;
}
.contact-form input:focus, .contact-form textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.form-note { font-size: 0.9rem; min-height: 1.4em; }
.form-note.ok { color: #34d399; }
.form-note.err { color: #f87171; }

/* ============ 页脚 ============ */
.footer { border-top: 1px solid var(--border); padding: 40px 0; }
.footer-inner { text-align: center; }
.footer p { color: var(--text-muted); font-size: 0.92rem; }
.footer-sub { margin-top: 6px; font-size: 0.8rem; opacity: 0.7; }

/* ============ 动效 ============ */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ============ 响应式 ============ */
@media (max-width: 820px) {
  .nav-links { display: none; }
  .menu-btn { display: flex; margin-left: auto; }
  .nav-links.open {
    display: flex; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--border); padding: 12px 24px 20px; gap: 4px;
  }
  .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .hero-inner { padding-top: 100px; }
}
