/* === Font faces === */
@font-face {
  font-family: 'Outfit';
  src: url('./_shared/fonts/Outfit-Regular.ttf') format('truetype');
  font-weight: 400;
}
@font-face {
  font-family: 'Outfit';
  src: url('./_shared/fonts/Outfit-Bold.ttf') format('truetype');
  font-weight: 700;
}
@font-face {
  font-family: 'WorkSans';
  src: url('./_shared/fonts/WorkSans-Regular.ttf') format('truetype');
  font-weight: 400;
}
@font-face {
  font-family: 'JetBrainsMono';
  src: url('./_shared/fonts/JetBrainsMono-Regular.ttf') format('truetype');
  font-weight: 400;
}

/* === Theme variables — 空山新雨后 === */
:root {
  /* 夜山新雨：深墨绿底，像雨夜山林 */
  --bg: #0c1610;
  --bg2: #122019;
  --bg3: #1b2c23;
  --ink: #dde8e1;
  --muted: #7e9889;
  --rule: rgba(200,230,210,0.07);
  --accent: #5fae84;
  --accent2: #8ccdaf;
  --gradient: linear-gradient(135deg, #5fae84, #8ccdaf);
  --shadow: 0 8px 32px rgba(0,0,0,0.35);
  --radius: 16px;
  --max: 1100px;
  --font: 'WorkSans', system-ui, sans-serif;
  --font-head: 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrainsMono', monospace;
}
[data-theme="light"] {
  /* 空山新雨后：雾白青翠，雨洗过的天光 */
  --bg: #eef4ee;
  --bg2: #ffffff;
  --bg3: #e1ece4;
  --ink: #1a2b20;
  --muted: #6b8579;
  --rule: rgba(0,0,0,0.07);
  --shadow: 0 8px 32px rgba(60,100,80,0.10);
}

/* === Reset & base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

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

/* === Navbar === */
nav.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
  transition: all 0.3s ease;
}
.nav-inner {
  max-width: var(--max); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.5rem;
}
.nav-logo {
  font-family: var(--font-head); font-weight: 700; font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.nav-logo span { background: var(--gradient); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.nav-links { display: flex; align-items: center; gap: 2rem; }
.nav-links a {
  font-size: 0.9rem; color: var(--muted); font-weight: 500;
  transition: color 0.2s; position: relative;
}
.nav-links a:hover, .nav-links a.active { color: var(--ink); }
.nav-links a::after {
  content: ''; position: absolute; bottom: -4px; left: 0;
  width: 0; height: 2px; background: var(--gradient); transition: width 0.3s;
}
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }
.theme-toggle {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--rule); background: var(--bg2);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; transition: all 0.3s; color: var(--ink);
}
.theme-toggle:hover { border-color: var(--accent); transform: rotate(15deg); }
.nav-mobile { display: none; }

/* === Page hero (sub-pages) === */
.page-hero {
  padding: 9rem 0 3rem;
  position: relative;
  border-bottom: 1px solid var(--rule);
}
.page-hero .section-label { margin-bottom: 0.5rem; }
.page-hero h1 {
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(2rem, 5vw, 3rem); line-height: 1.15;
  letter-spacing: -0.03em; margin-bottom: 0.75rem;
}
.page-hero h1 .grad { background: var(--gradient); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.page-hero p { color: var(--muted); max-width: 560px; font-size: 1.05rem; }

/* === Home hero === */
section.hero {
  min-height: 100vh; display: flex; align-items: center;
  position: relative; overflow: hidden;
  padding-top: 60px;
}
.hero-blob {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.25;
  animation: float 8s ease-in-out infinite;
}
.hero-blob.b1 { width: 400px; height: 400px; background: var(--accent); top: 10%; right: -5%; }
.hero-blob.b2 { width: 350px; height: 350px; background: var(--accent2); bottom: 10%; left: -5%; animation-delay: -3s; }
@keyframes float { 0%,100% { transform: translate(0,0); } 50% { transform: translate(20px,-30px); } }

.hero-content { position: relative; z-index: 1; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.8rem;
  padding: 0.4rem 0.9rem; border-radius: 999px;
  background: var(--bg2); border: 1px solid var(--rule);
  color: var(--muted); margin-bottom: 1.5rem;
}
.hero-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.hero h1 {
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(2.5rem, 7vw, 4.5rem); line-height: 1.1;
  letter-spacing: -0.03em; margin-bottom: 1rem;
}
.hero h1 .grad { background: var(--gradient); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero .tagline {
  font-size: clamp(1.05rem, 2.5vw, 1.3rem); color: var(--muted);
  max-width: 540px; margin-bottom: 2.5rem;
}
.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.8rem 1.6rem; border-radius: 10px;
  font-weight: 600; font-size: 0.95rem; cursor: pointer;
  transition: all 0.25s; border: none;
}
.btn-primary { background: var(--gradient); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(95,174,132,0.4); }
.btn-ghost { background: var(--bg2); color: var(--ink); border: 1px solid var(--rule); }
.btn-ghost:hover { border-color: var(--accent); transform: translateY(-2px); }

/* === Section common === */
section.section { padding: 5rem 0; }
.section-label {
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.5rem;
}
.section-title {
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.5rem); letter-spacing: -0.02em;
  margin-bottom: 2.5rem;
}

/* === About === */
.about-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: 3rem; align-items: start; }
.about-avatar {
  width: 200px; height: 200px; border-radius: 24px;
  background: var(--gradient); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-size: 4rem; font-weight: 700; color: #fff;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.about-avatar::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.3), transparent 60%);
}
.about-text p { margin-bottom: 1rem; color: var(--muted); }
.about-text strong { color: var(--ink); font-weight: 600; }
.about-stats { display: flex; gap: 2.5rem; margin-top: 1.5rem; flex-wrap: wrap; }
.about-stat .num { font-family: var(--font-head); font-size: 1.5rem; font-weight: 700; background: var(--gradient); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.about-stat .label { font-size: 0.8rem; color: var(--muted); }

/* === Skills === */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.skill-card {
  background: var(--bg2); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 1.8rem; transition: all 0.3s;
}
.skill-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }
.skill-card h3 { font-family: var(--font-head); font-size: 1.15rem; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.6rem; }
.skill-card .icon { font-size: 1.4rem; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.skill-tag {
  font-family: var(--font-mono); font-size: 0.78rem;
  padding: 0.3rem 0.7rem; border-radius: 6px;
  background: var(--bg3); color: var(--muted); border: 1px solid var(--rule);
}

/* === Projects === */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; }
.project-card {
  background: var(--bg2); border: 1px solid var(--rule);
  border-radius: var(--radius); overflow: hidden; transition: all 0.3s;
  display: flex; flex-direction: column;
}
.project-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }
.project-thumb {
  height: 160px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-size: 2.5rem; font-weight: 700;
  color: #fff; position: relative; overflow: hidden;
}
.project-thumb.t1 { background: linear-gradient(135deg, #5fae84, #4a9d7a); }
.project-thumb.t2 { background: linear-gradient(135deg, #8ccdaf, #6cae8e); }
.project-thumb.t3 { background: linear-gradient(135deg, #a8d5b5, #7bc4a4); }
.project-thumb.t4 { background: linear-gradient(135deg, #6cae8e, #5fae84); }
.project-body { padding: 1.5rem; flex: 1; display: flex; flex-direction: column; }
.project-body h3 { font-family: var(--font-head); font-size: 1.2rem; margin-bottom: 0.5rem; }
.project-body p { font-size: 0.9rem; color: var(--muted); margin-bottom: 1rem; flex: 1; }
.project-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.project-meta span { font-family: var(--font-mono); font-size: 0.72rem; padding: 0.2rem 0.6rem; border-radius: 5px; background: var(--bg3); color: var(--muted); }
.project-links { display: flex; gap: 1rem; font-size: 0.85rem; }
.project-links a { color: var(--accent); font-weight: 600; transition: opacity 0.2s; }
.project-links a:hover { opacity: 0.7; }

/* === Contact === */
.contact-wrap { text-align: center; max-width: 600px; margin: 0 auto; }
.contact-wrap p { color: var(--muted); margin-bottom: 2rem; font-size: 1.1rem; }
.contact-email {
  display: inline-block; font-family: var(--font-mono); font-size: 1.2rem;
  background: var(--bg2); border: 1px solid var(--rule);
  padding: 0.8rem 1.8rem; border-radius: 12px; margin-bottom: 2rem;
  transition: all 0.3s;
}
.contact-email:hover { border-color: var(--accent); transform: scale(1.03); }
.social-links { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }
.social-link {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--bg2); border: 1px solid var(--rule);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; transition: all 0.3s; cursor: pointer;
}
.social-link:hover { border-color: var(--accent); transform: translateY(-3px); background: var(--bg3); }

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

/* === Scroll reveal === */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* === Responsive === */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-mobile { display: flex; gap: 0.8rem; align-items: center; }
  .about-grid { grid-template-columns: 1fr; gap: 2rem; }
  .about-avatar { margin: 0 auto; }
  .about-stats { justify-content: center; }
}

/* === Meteor shower — 流星雨背景 === */
.meteor-shower {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.meteor {
  position: absolute;
  top: -10%;
  width: 2px;
  height: 80px;
  background: linear-gradient(to bottom, rgba(140,205,175,0.0), rgba(140,205,175,0.6));
  border-radius: 50%;
  opacity: 0;
  animation: meteor-fall linear infinite;
  transform: rotate(25deg);
}
@keyframes meteor-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(25deg);
  }
  10% { opacity: 0.8; }
  80% { opacity: 0.4; }
  100% {
    opacity: 0;
    transform: translate3d(-300px, 120vh, 0) rotate(25deg);
  }
}
/* 12 颗流星错落有致 */
.meteor:nth-child(1)  { left: 8%;  animation-duration: 7s;  animation-delay: 0s;   height: 70px;  }
.meteor:nth-child(2)  { left: 18%; animation-duration: 9s;  animation-delay: 1.5s; height: 90px;  }
.meteor:nth-child(3)  { left: 28%; animation-duration: 6s;  animation-delay: 3s;   height: 60px;  }
.meteor:nth-child(4)  { left: 38%; animation-duration: 8s;  animation-delay: 0.8s; height: 80px;  }
.meteor:nth-child(5)  { left: 48%; animation-duration: 10s; animation-delay: 4s;   height: 100px; }
.meteor:nth-child(6)  { left: 58%; animation-duration: 7.5s;animation-delay: 2.2s; height: 75px;  }
.meteor:nth-child(7)  { left: 68%; animation-duration: 6.5s;animation-delay: 5s;   height: 65px;  }
.meteor:nth-child(8)  { left: 78%; animation-duration: 9.5s;animation-delay: 1s;   height: 85px;  }
.meteor:nth-child(9)  { left: 88%; animation-duration: 7s;  animation-delay: 3.5s; height: 70px;  }
.meteor:nth-child(10) { left: 15%; animation-duration: 8.5s;animation-delay: 6s;   height: 95px;  }
.meteor:nth-child(11) { left: 55%; animation-duration: 6s;  animation-delay: 7s;   height: 55px;  }
.meteor:nth-child(12) { left: 82%; animation-duration: 10s; animation-delay: 2s;   height: 110px; }

/* 浅色模式下流星更淡一些 */
[data-theme="light"] .meteor {
  background: linear-gradient(to bottom, rgba(95,174,132,0.0), rgba(95,174,132,0.5));
}

/* 让正文内容在流星之上 */
nav.navbar, header.page-hero, section.section, footer.footer {
  position: relative;
  z-index: 1;
}
