:root {
  --bg: #ffffff;
  --bg-alt: #f7f7f5;
  --fg: #1a1a1a;
  --fg-muted: #6b6b6b;
  --border: #e8e8e5;
  --accent: #1a1a1a;
  --accent-contrast: #ffffff;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", "Songti SC", "SimSun", serif;
  --max-width: 1080px;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--fg);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

.container.narrow {
  max-width: 820px;
}

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

/* ---------- Header / Nav ---------- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}

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

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

.brand {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-dot {
  color: var(--fg-muted);
}

.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
}

.nav-link {
  position: relative;
  font-size: 0.95rem;
  color: var(--fg-muted);
  transition: color 0.2s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--fg);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--fg);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

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

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

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

/* ---------- Hero ---------- */

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  padding: 120px 0 80px;
}

.hero-eyebrow,
.section-eyebrow {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--fg-muted);
  font-size: 1.05rem;
  margin-bottom: 16px;
}

.hero-title {
  font-size: clamp(3rem, 9vw, 6.5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.hero-subtitle {
  margin-top: 20px;
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-weight: 500;
  color: var(--fg);
}

.hero-desc {
  margin-top: 16px;
  max-width: 560px;
  font-size: 1.05rem;
  color: var(--fg-muted);
}

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

.scroll-hint {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 42px;
  border: 2px solid var(--fg-muted);
  border-radius: 14px;
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.scroll-hint span {
  width: 4px;
  height: 8px;
  border-radius: 2px;
  background: var(--fg-muted);
  animation: scroll-bounce 1.8s ease-in-out infinite;
}

@keyframes scroll-bounce {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(10px); opacity: 0.3; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 13px 30px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(26, 26, 26, 0.18);
}

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

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

/* ---------- Sections ---------- */

.section {
  padding: 110px 0;
}

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

.section-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.02em;
  margin-bottom: 48px;
}

/* ---------- About ---------- */

.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  align-items: start;
}

.about-text p {
  color: var(--fg-muted);
  font-size: 1.05rem;
  margin-bottom: 16px;
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 12px;
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

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

.skills {
  margin-top: 56px;
}

.skills h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

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

.skill-tags li {
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.9rem;
  color: var(--fg-muted);
  transition: border-color 0.2s ease, color 0.2s ease;
}

.skill-tags li:hover {
  border-color: var(--fg);
  color: var(--fg);
}

/* ---------- Projects ---------- */

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

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

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

.project-thumb {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.thumb-a { background: linear-gradient(135deg, #e8e8e5, #f4f4f2); }
.thumb-b { background: linear-gradient(135deg, #efe9e2, #f7f4ef); }
.thumb-c { background: linear-gradient(135deg, #e6e9ee, #f0f2f6); }

.project-body {
  padding: 24px;
}

.project-body h3 {
  font-size: 1.15rem;
  margin-bottom: 8px;
}

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

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin-bottom: 18px;
}

.project-tags li {
  font-size: 0.78rem;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--fg-muted);
}

.project-link {
  font-size: 0.9rem;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.project-link:hover {
  border-bottom-color: var(--fg);
}

/* ---------- Blog ---------- */

.post-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-item {
  display: block;
  padding: 28px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.post-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--fg);
}

.post-meta {
  font-size: 0.82rem;
  color: var(--fg-muted);
  font-family: var(--font-serif);
  font-style: italic;
}

.post-item h3 {
  margin: 8px 0;
  font-size: 1.25rem;
}

.post-item p {
  color: var(--fg-muted);
  font-size: 0.95rem;
}

/* ---------- Contact ---------- */

.section-contact {
  text-align: center;
  background: var(--fg);
  color: var(--bg);
}

.section-contact .section-eyebrow {
  color: rgba(255, 255, 255, 0.6);
}

.section-contact .btn-primary {
  background: var(--bg);
  color: var(--fg);
}

.section-contact .btn-primary:hover {
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.18);
}

.contact-desc {
  max-width: 480px;
  margin: 0 auto 40px;
  color: rgba(255, 255, 255, 0.7);
}

.contact-actions {
  margin-bottom: 48px;
}

.social-links {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
}

.social-links a {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.92rem;
  transition: color 0.2s ease;
}

.social-links a:hover {
  color: var(--bg);
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 32px 0;
  border-top: 1px solid var(--border);
  background: var(--fg);
  color: rgba(255, 255, 255, 0.6);
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
}

.back-top {
  color: rgba(255, 255, 255, 0.6);
  transition: color 0.2s ease;
}

.back-top:hover {
  color: var(--bg);
}

/* ---------- Reveal animation ---------- */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

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

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .project-grid {
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 640px) {
  .section {
    padding: 80px 0;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 64px;
    right: 0;
    left: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
  }

  .nav-links.open {
    max-height: 320px;
  }

  .nav-links li {
    text-align: center;
  }

  .nav-link {
    display: block;
    padding: 16px 0;
  }

  .nav-link::after {
    display: none;
  }

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

  .about-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .site-footer .container {
    flex-direction: column;
    gap: 8px;
  }
}
