:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e6e4e0;
  --accent: #c8553d;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);
  --maxw: 760px;
}
[data-theme="dark"] {
  --bg: #0f0f0f;
  --surface: #181818;
  --text: #ededed;
  --muted: #9a9a9a;
  --line: #2a2a2a;
  --accent: #e07a5f;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.4);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  transition: background .4s ease, color .4s ease;
}

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

.progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: var(--accent); z-index: 100; transition: width .1s linear;
}

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1.5rem;
  padding: 1rem clamp(1.25rem, 5vw, 3rem);
  backdrop-filter: saturate(180%) blur(12px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease;
}
.nav.scrolled { border-bottom-color: var(--line); }
.brand { font-weight: 600; font-size: 1.05rem; letter-spacing: -.01em; }
.brand span { color: var(--accent); }
.nav-links { display: flex; gap: 1.4rem; margin-left: auto; font-size: .92rem; }
.nav-links a { color: var(--muted); transition: color .2s ease; }
.nav-links a:hover { color: var(--text); }
.theme-toggle {
  background: none; border: 1px solid var(--line); color: var(--muted);
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  font-size: 1rem; transition: all .2s ease;
}
.theme-toggle:hover { color: var(--text); border-color: var(--muted); }

main { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(1.25rem, 5vw, 2rem); }

/* Hero */
.hero { padding: clamp(4rem, 12vh, 8rem) 0 clamp(3rem, 8vh, 5rem); }
.eyebrow {
  text-transform: uppercase; letter-spacing: .18em; font-size: .72rem;
  color: var(--muted); margin-bottom: 1.25rem;
}
.hero h1 { font-size: clamp(2.8rem, 9vw, 4.5rem); font-weight: 700; letter-spacing: -.03em; line-height: 1.05; }
.hero h1 .accent { color: var(--accent); }
.subtitle { font-size: 1.15rem; color: var(--muted); margin-top: .75rem; font-weight: 500; }
.lead { font-size: 1.1rem; margin-top: 1.5rem; max-width: 38rem; color: var(--text); }
.hero-actions { display: flex; gap: .9rem; margin-top: 2rem; flex-wrap: wrap; }
.btn {
  padding: .7rem 1.4rem; border-radius: 8px; font-size: .95rem; font-weight: 500;
  transition: all .2s ease; border: 1px solid transparent;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn.ghost { border-color: var(--line); color: var(--text); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }

/* Sections */
.section { padding: clamp(2.5rem, 7vh, 4rem) 0; border-top: 1px solid var(--line); }
.section h2 {
  font-size: 1.5rem; font-weight: 600; letter-spacing: -.01em;
  margin-bottom: 1.8rem; display: flex; align-items: baseline; gap: .75rem;
}
.num { font-size: .8rem; color: var(--accent); font-weight: 600; letter-spacing: .05em; }
.prose p { margin-bottom: 1rem; color: var(--text); }
.prose p:last-child { margin-bottom: 0; }

.facts {
  list-style: none; display: flex; gap: 2.5rem; flex-wrap: wrap;
  margin-top: 1.75rem; padding-top: 1.5rem; border-top: 1px solid var(--line);
}
.facts li { font-size: .98rem; }
.facts span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: .25rem; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 1.4rem; transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; }
.card h3 { font-size: 1.05rem; margin-bottom: .5rem; font-weight: 600; }
.card p { font-size: .92rem; color: var(--muted); line-height: 1.6; }

/* Projects */
.project-list { display: flex; flex-direction: column; gap: .5rem; }
.project {
  display: flex; align-items: center; gap: 1rem; justify-content: space-between;
  padding: 1.25rem; border-radius: 12px; border: 1px solid transparent;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
.project:hover { background: var(--surface); border-color: var(--line); transform: translateX(4px); }
.project h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: .25rem; }
.project p { font-size: .92rem; color: var(--muted); }
.tags { display: flex; gap: .4rem; flex-shrink: 0; }
.tags span {
  font-size: .72rem; padding: .25rem .6rem; border-radius: 99px;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent);
}

/* Papers */
.papers { list-style: none; counter-reset: p; display: flex; flex-direction: column; gap: 1.5rem; }
.papers li { counter-increment: p; position: relative; padding-left: 2.5rem; }
.papers li::before {
  content: counter(p, decimal-leading-zero); position: absolute; left: 0; top: .1rem;
  font-size: .85rem; color: var(--accent); font-weight: 600;
}
.paper-title { font-weight: 500; font-size: 1.02rem; }
.paper-meta { font-size: .88rem; color: var(--muted); margin-top: .2rem; }

/* Contact */
.links { display: flex; gap: 1rem; margin-top: 1.25rem; }
.links a {
  padding: .6rem 1.2rem; border: 1px solid var(--line); border-radius: 8px;
  font-size: .92rem; transition: all .2s ease;
}
.links a:hover { border-color: var(--accent); color: var(--accent); }

/* Footer */
.footer {
  max-width: var(--maxw); margin: 0 auto; padding: 3rem clamp(1.25rem, 5vw, 2rem);
  border-top: 1px solid var(--line); display: flex; justify-content: space-between;
  font-size: .88rem; color: var(--muted); flex-wrap: wrap; gap: .5rem;
}

/* Reveal animation */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

@media (max-width: 560px) {
  .nav-links { display: none; }
  .project { flex-direction: column; align-items: flex-start; gap: .75rem; }
  .facts { gap: 1.5rem; }
}
