:root {
  --bg: #ffffff;
  --bg-soft: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --text: #18181b;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.10);
  --radius: 16px;
  --nav-h: 68px;
}

[data-theme="dark"] {
  --bg: #0b0d12;
  --bg-soft: #11141b;
  --surface: #151922;
  --surface-2: #1c2130;
  --text: #ececf1;
  --text-muted: #9aa3b2;
  --border: #262c3a;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.55);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 10px);
}

body {
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---------- 导航栏 ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background 0.3s ease;
}

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

.nav__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav__logo {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 1.2rem;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav__links {
  display: flex;
  gap: 28px;
}

.nav__links a {
  font-size: 0.92rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.nav__links a:hover {
  color: var(--text);
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

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

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.icon-sun {
  display: none;
}

[data-theme="dark"] .icon-moon {
  display: none;
}

[data-theme="dark"] .icon-sun {
  display: block;
}

.nav__burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.nav__burger span {
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav__burger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav__burger.open span:nth-child(2) {
  opacity: 0;
}

.nav__burger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- 英雄区 ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding-top: var(--nav-h);
}

.hero__bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.45;
  animation: float 12s ease-in-out infinite;
}

.orb--1 {
  width: 420px;
  height: 420px;
  top: -120px;
  left: -100px;
  background: #6366f1;
}

.orb--2 {
  width: 380px;
  height: 380px;
  bottom: -100px;
  right: -80px;
  background: #8b5cf6;
  animation-delay: -4s;
}

.orb--3 {
  width: 220px;
  height: 220px;
  top: 40%;
  left: 55%;
  background: #22d3ee;
  opacity: 0.25;
  animation-delay: -8s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(30px, -30px); }
}

.hero__inner {
  position: relative;
  text-align: center;
  z-index: 1;
  padding: 60px 24px;
}

.hero__avatar {
  width: 96px;
  height: 96px;
  margin: 0 auto 28px;
  border-radius: 50%;
  padding: 4px;
  background: linear-gradient(135deg, var(--primary), #22d3ee);
}

.hero__avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--primary);
}

.hero__greeting {
  font-size: 1rem;
  color: var(--text-muted);
  letter-spacing: 2px;
}

.hero__name {
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1.1;
  margin: 6px 0 10px;
}

.hero__dot {
  color: var(--primary);
}

.hero__role {
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(1.05rem, 3vw, 1.4rem);
  color: var(--primary);
  min-height: 1.8em;
  margin-bottom: 16px;
}

.hero__role::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 4px;
  background: var(--primary);
  vertical-align: text-bottom;
  animation: blink 0.9s steps(2) infinite;
}

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

.hero__bio {
  max-width: 560px;
  margin: 0 auto 32px;
  color: var(--text-muted);
  font-size: 1.02rem;
}

.hero__actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

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

.btn--primary {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #fff;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

.btn--primary:hover {
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.45);
}

.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

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

.hero__socials {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 36px;
}

.hero__socials a {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-muted);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.hero__socials a:hover {
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-3px);
}

.hero__socials svg {
  width: 19px;
  height: 19px;
}

.hero__scroll {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-muted);
  animation: bounce 2s infinite;
}

.hero__scroll svg {
  width: 26px;
  height: 26px;
}

@keyframes bounce {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

/* ---------- 通用区块 ---------- */
.section {
  padding: 96px 0;
}

.section:nth-child(even) .container {
  /* no-op，保持结构清晰 */
}

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

.section__tag {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9rem;
  color: var(--primary);
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.section__title {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 48px;
}

/* ---------- 关于我 ---------- */
.about__grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 48px;
  align-items: start;
}

.about__text p {
  color: var(--text-muted);
  margin-bottom: 18px;
}

.about__meta {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.about__meta-item {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border);
}

.about__meta-key {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  color: var(--text-muted);
  min-width: 56px;
}

.about__meta-value {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.about__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 22px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-card__num {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.stat-card__label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---------- 技能 ---------- */
.skills__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

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

.skill-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.skill-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.skill-card__icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 1.2rem;
}

.skill-card__head h3 {
  font-size: 1.05rem;
}

.skill-bar {
  height: 8px;
  background: var(--surface-2);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
  position: relative;
}

.skill-bar__fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  border-radius: 8px;
  transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.skill-bar__label {
  position: absolute;
  top: -2px;
  right: 0;
  transform: translateY(-100%);
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.skill-bar {
  margin-top: 20px;
}

.skill-bar:first-of-type {
  margin-top: 0;
}

/* ---------- 项目 ---------- */
.projects {
  background: var(--bg-soft);
}

.projects__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.project-card__cover {
  height: 180px;
  background: linear-gradient(135deg, var(--g, #6366f1), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-card__mock {
  width: 76%;
  height: 110px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(4px);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mock-bar {
  width: 45%;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.7);
}

.mock-block {
  width: 100%;
  height: 42px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.35);
}

.mock-row {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.3);
}

.project-card__mock--chart {
  justify-content: flex-end;
}

.mock-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 100%;
}

.mock-chart span {
  flex: 1;
  border-radius: 4px 4px 0 0;
  background: rgba(255, 255, 255, 0.65);
  min-height: 12px;
}

.project-card__mock--phone {
  width: 60px;
  height: 110px;
  padding: 8px;
  border-radius: 14px;
}

.mock-phone__screen {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.25);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 8px;
}

.mock-phone__screen span {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.6);
}

.mock-phone__screen span:nth-child(2) {
  width: 70%;
}

.mock-phone__screen span:nth-child(3) {
  width: 45%;
}

.project-card__body {
  padding: 24px;
}

.project-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

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

.project-card__year {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.project-card__body p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 16px;
}

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

.project-card__tags span {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-muted);
}

.projects__more {
  text-align: center;
  margin-top: 44px;
}

/* ---------- 经历 ---------- */
.timeline {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding-left: 28px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--primary), transparent);
}

.timeline__item {
  position: relative;
  padding-bottom: 36px;
}

.timeline__item:last-child {
  padding-bottom: 0;
}

.timeline__dot {
  position: absolute;
  left: -28px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--primary);
}

.timeline__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}

.timeline__period {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  color: var(--primary);
  display: block;
  margin-bottom: 6px;
}

.timeline__card h3 {
  font-size: 1.08rem;
  margin-bottom: 8px;
}

.timeline__card em {
  font-style: normal;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.timeline__card p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* ---------- 联系 ---------- */
.contact {
  background: var(--bg-soft);
}

.contact__sub {
  color: var(--text-muted);
  max-width: 480px;
  margin-bottom: 40px;
}

.contact__form {
  max-width: 620px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.contact__form input,
.contact__form textarea {
  width: 100%;
  padding: 13px 16px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.contact__form input:focus,
.contact__form textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

.contact__form textarea {
  resize: vertical;
}

.contact__form .btn {
  align-self: flex-start;
}

.contact__notice {
  font-size: 0.9rem;
  color: #22c55e;
  min-height: 1.4em;
}

/* ---------- 页脚 ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.footer__heart {
  color: #ef4444;
}

.footer__back a {
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.footer__back a:hover {
  color: var(--primary);
}

/* ---------- 滚动显现动画 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .about__grid {
    grid-template-columns: 1fr;
  }

  .contact__row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .nav__links {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    transform: translateY(-120%);
    transition: transform 0.3s ease;
    padding: 8px 0;
  }

  .nav__links.open {
    transform: translateY(0);
  }

  .nav__links a {
    padding: 14px 24px;
    font-size: 1rem;
  }

  .nav__burger {
    display: flex;
  }

  .section {
    padding: 72px 0;
  }

  .footer__inner {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
}
