/* ===== Variables ===== */
:root {
  --font-serif: 'Noto Serif SC', 'Songti SC', 'STSong', serif;
  --font-sans: 'Noto Sans SC', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  --bg: #faf9f6;
  --bg-alt: #f3f1eb;
  --bg-card: #ffffff;
  --text: #2a2a2a;
  --text-secondary: #6b6b6b;
  --text-muted: #9a9a9a;
  --accent: #b8743f;
  --accent-light: #d4956a;
  --accent-bg: rgba(184, 116, 63, 0.08);
  --border: #e5e2da;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 8px 40px rgba(0, 0, 0, 0.08);
  --nav-blur: rgba(250, 249, 246, 0.85);
  --max-width: 720px;
}

[data-theme="dark"] {
  --bg: #161616;
  --bg-alt: #1e1e1e;
  --bg-card: #222222;
  --text: #e2e2e2;
  --text-secondary: #9a9a9a;
  --text-muted: #6b6b6b;
  --accent: #d4956a;
  --accent-light: #e0a578;
  --accent-bg: rgba(212, 149, 106, 0.12);
  --border: #2e2e2e;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
  --shadow-hover: 0 8px 40px rgba(0, 0, 0, 0.35);
  --nav-blur: rgba(22, 22, 22, 0.85);
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-light);
}

/* ===== Scroll Progress ===== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--accent);
  z-index: 1000;
  transition: width 0.1s ease;
}

/* ===== Navigation ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: var(--nav-blur);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background 0.4s ease;
}

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

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--text) !important;
  letter-spacing: 0.05em;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-link {
  font-size: 14px;
  color: var(--text-secondary) !important;
  font-weight: 400;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--text) !important;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--accent-bg);
}

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

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

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  top: -20%;
  left: -10%;
  right: -10%;
  bottom: -20%;
  background:
    radial-gradient(ellipse at 30% 40%, var(--accent-bg) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 60%, var(--accent-bg) 0%, transparent 50%);
  z-index: 0;
  animation: heroGlow 8s ease-in-out infinite alternate;
}

@keyframes heroGlow {
  0% { transform: scale(1) rotate(0deg); opacity: 0.6; }
  100% { transform: scale(1.1) rotate(5deg); opacity: 1; }
}

.hero-content {
  text-align: center;
  z-index: 1;
  padding: 0 24px;
}

.hero-greeting {
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 300;
  margin-bottom: 16px;
  letter-spacing: 0.15em;
}

.hero-name {
  font-family: var(--font-serif);
  font-size: clamp(56px, 12vw, 96px);
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 12px;
  position: relative;
}

.hero-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 0.5em;
  font-weight: 300;
  margin-bottom: 24px;
  padding-left: 0.5em;
}

.hero-tagline {
  font-size: 16px;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  font-weight: 300;
}

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

.hero-scroll {
  position: absolute;
  bottom: 40px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
  animation: heroFade 0.8s ease 0.9s both;
}

@keyframes heroFade {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-scroll span {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  display: block;
  margin-bottom: 8px;
  padding-left: 0.2em;
}

.scroll-indicator {
  width: 1px;
  height: 40px;
  margin: 0 auto;
  background: linear-gradient(to bottom, var(--text-muted), transparent);
  position: relative;
  overflow: hidden;
}

.scroll-indicator::after {
  content: '';
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 50%;
  background: var(--accent);
  animation: scrollDown 2s ease-in-out infinite;
}

@keyframes scrollDown {
  0% { top: -100%; }
  100% { top: 200%; }
}

/* ===== Sections ===== */
.section {
  padding: 100px 0;
  position: relative;
}

.section-alt {
  background: var(--bg-alt);
  transition: background 0.4s ease;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 40px;
  color: var(--text);
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 0;
  width: 32px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

/* ===== About ===== */
.about-text {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 2;
}

.about-text p {
  margin-bottom: 16px;
}

.about-text p:last-child {
  margin-bottom: 0;
}

/* ===== Tags ===== */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.tag {
  font-size: 14px;
  padding: 8px 20px;
  border-radius: 100px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 400;
  transition: all 0.3s ease;
  cursor: default;
}

.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* ===== Link Cards ===== */
.link-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text) !important;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.link-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
  color: var(--accent) !important;
}

.link-icon {
  color: var(--accent);
  margin-bottom: 16px;
  transition: transform 0.3s ease;
}

.link-card:hover .link-icon {
  transform: scale(1.1);
}

.link-card h3 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
  color: inherit;
}

.link-card p {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 300;
}

/* ===== Footer ===== */
.footer {
  padding: 48px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  transition: border-color 0.4s ease;
}

.footer-name {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}

.footer-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-meta a {
  color: var(--text-muted) !important;
  transition: color 0.2s ease;
}

.footer-meta a:hover {
  color: var(--accent) !important;
}

.footer-dot {
  color: var(--text-muted);
}

/* ===== Reveal Animation ===== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* Stagger hero content */
.hero .reveal:nth-child(1) { transition-delay: 0.1s; }
.hero .reveal:nth-child(2) { transition-delay: 0.3s; }
.hero .reveal:nth-child(3) { transition-delay: 0.5s; }
.hero .reveal:nth-child(4) { transition-delay: 0.7s; }

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .nav-inner {
    padding: 0 16px;
  }

  .nav-right {
    gap: 18px;
  }

  .nav-link {
    font-size: 13px;
  }

  .container {
    padding: 0 20px;
  }

  .section {
    padding: 64px 0;
  }

  .section-title {
    font-size: 24px;
  }

  .about-text {
    font-size: 15px;
  }

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

  .link-card {
    padding: 28px 16px;
  }

  .hero-scroll {
    bottom: 24px;
  }
}

/* ===== Selection ===== */
::selection {
  background: var(--accent);
  color: var(--bg);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
