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

:root {
  --bg: #fbfbfd;
  --bg-alt: #f5f5f7;
  --border: rgba(0,0,0,0.06);
  --text: #1d1d1f;
  --text-secondary: #424245;
  --text-muted: #86868b;
  --link: #06c;
  --link-hover: #0077ed;
  --container: 900px;
  --transition: 0.3s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--link); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--link-hover); }
strong { font-weight: 600; }
::selection { background: rgba(0,102,204,0.1); }

/* ── Navigation ──────────────────────────────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(251,251,253,0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 40px;
  display: flex; align-items: center; justify-content: space-between;
  height: 44px;
}
.nav-brand { display: flex; align-items: center; color: var(--text); opacity: 0.85; }
.nav-brand:hover { color: var(--text); opacity: 1; }
.nav-logo { width: 32px; height: 32px; }
.nav-links { display: flex; align-items: center; gap: 28px; list-style: none; }
.nav-links a { font-size: 0.76rem; font-weight: 400; color: var(--text-secondary); letter-spacing: 0.01em; }
.nav-links a:hover { color: var(--text); }
.btn-nav {
  padding: 4px 12px; background: var(--text); color: var(--bg) !important;
  border-radius: 980px; font-weight: 400; font-size: 0.72rem;
}
.btn-nav:hover { opacity: 0.8; }
.nav-toggle { display: none; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; padding: 4px; }
.nav-toggle span { display: block; width: 16px; height: 1.5px; background: var(--text); border-radius: 1px; }

@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .nav-links {
    display: none; position: absolute; top: 44px; left: 0; right: 0;
    flex-direction: column; background: rgba(251,251,253,0.98);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    padding: 20px 40px; gap: 14px;
  }
  .nav-links.open { display: flex; }
}

/* ── Intro ───────────────────────────────────────────────────────────────── */
.intro {
  padding: 100px 0 72px;
}
.intro-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 72px;
  align-items: start;
}
.intro-left h1 {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.4px;
  line-height: 1.2;
  margin-bottom: 16px;
  color: var(--text);
}
.intro-role {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 28px;
  font-weight: 400;
}
.intro-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.84rem;
}
.intro-links a {
  color: var(--text-muted);
  transition: color var(--transition);
}
.intro-links a:hover { color: var(--link); }
.intro-right {
  padding-top: 4px;
}
.intro-bio {
  font-size: 0.98rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 16px;
  font-weight: 400;
}
.intro-bio:last-child { margin-bottom: 0; }
.intro-bio.lead {
  font-size: 1.15rem;
  color: var(--text);
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 12px;
}
.intro-bio.secondary {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 8px;
  letter-spacing: 0.02em;
}

@media (max-width: 768px) {
  .intro { padding: 80px 0 48px; }
  .intro-grid { grid-template-columns: 1fr; gap: 32px; }
}

/* ── Sections ────────────────────────────────────────────────────────────── */
.section { padding: 80px 0; }
.section-alt { background: var(--bg-alt); }

.section-heading {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.5px;
  margin-bottom: 40px;
  color: var(--text);
}
.section-more { margin-top: 32px; }
.section-more a { font-size: 0.88rem; color: var(--link); }

/* keep old class name for research/blog pages */
.section-title {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 32px;
}

/* ── Publications ────────────────────────────────────────────────────────── */
.pub-list { display: flex; flex-direction: column; }
.pub-item {
  display: flex; gap: 20px; padding: 24px 0;
  border-bottom: 1px solid var(--border);
}
.pub-item:last-child { border-bottom: none; }
.pub-year {
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem; font-weight: 400; color: var(--text-muted);
  flex-shrink: 0; padding-top: 2px; width: 40px;
}
.pub-body h3 { font-size: 0.95rem; font-weight: 600; line-height: 1.5; margin-bottom: 4px; color: var(--text); }
.pub-authors { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 2px; }
.pub-venue { font-size: 0.78rem; color: var(--text-muted); }

@media (max-width: 600px) {
  .pub-item { flex-direction: column; gap: 4px; }
  .pub-year { width: auto; }
}

/* ── CV List ─────────────────────────────────────────────────────────────── */
.cv-list { display: flex; flex-direction: column; }
.cv-item {
  display: flex; gap: 32px; padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.cv-item:last-child { border-bottom: none; }
.cv-date {
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem; font-weight: 400; color: var(--text-muted);
  flex-shrink: 0; width: 110px; padding-top: 2px;
}
.cv-detail strong { display: block; font-size: 0.95rem; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.cv-org { display: block; font-size: 0.84rem; color: var(--text-muted); }
.cv-detail p { font-size: 0.84rem; color: var(--text-muted); line-height: 1.6; margin-top: 6px; }

@media (max-width: 600px) {
  .cv-item { flex-direction: column; gap: 4px; }
  .cv-date { width: auto; }
}

/* ── Tags ────────────────────────────────────────────────────────────────── */
.tag {
  padding: 4px 12px; border-radius: 980px; font-size: 0.76rem; font-weight: 400;
  background: var(--bg-alt); border: none; color: var(--text-muted);
}
.tag-accent { background: rgba(0,102,204,0.06); color: var(--link); }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer {
  padding: 32px 0;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
}
.footer-inner p { font-size: 0.76rem; color: var(--text-muted); }
.footer-links-row { display: flex; gap: 20px; }
.footer-links-row a { font-size: 0.76rem; color: var(--text-muted); }
.footer-links-row a:hover { color: var(--text); }

/* keep old footer classes for research/blog */
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; margin-bottom: 32px; }
.footer-brand-col p { color: var(--text-muted); font-size: 0.84rem; margin-top: 6px; }
.footer-links { display: flex; flex-direction: column; gap: 6px; }
.footer-links h4 { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 4px; }
.footer-links a { font-size: 0.84rem; color: var(--text-muted); }
.footer-links a:hover { color: var(--text); }
.footer-bottom { padding-top: 20px; border-top: 1px solid var(--border); text-align: center; }
.footer-bottom p { font-size: 0.76rem; color: var(--text-muted); }

@media (max-width: 600px) {
  .footer-inner { flex-direction: column; gap: 12px; text-align: center; }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .section { padding: 56px 0; }
  .hero { padding: 120px 0 56px; }
}

/* ── Research Page ───────────────────────────────────────────────────────── */
.page-header { padding: 120px 0 48px; background: var(--bg); }
.page-header h1 { font-size: 2rem; font-weight: 600; letter-spacing: -0.5px; margin-bottom: 8px; }
.page-header p { font-size: 1rem; color: var(--text-muted); max-width: 540px; }

.research-areas { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.research-card { background: var(--bg-alt); border: none; border-radius: 12px; padding: 28px; transition: background var(--transition); }
.research-card:hover { background: rgba(0,0,0,0.04); }
.research-card h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.research-card p { font-size: 0.84rem; color: var(--text-muted); line-height: 1.65; }

.full-pub-item { padding: 18px 0; border-bottom: 1px solid var(--border); }
.full-pub-item:last-child { border-bottom: none; }
.full-pub-item h3 { font-size: 0.92rem; font-weight: 600; margin-bottom: 4px; }
.full-pub-item .pub-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.full-pub-item .pub-meta span { font-size: 0.72rem; padding: 3px 10px; border-radius: 980px; background: var(--bg-alt); border: none; color: var(--text-muted); }
.full-pub-item .pub-meta span.year { background: rgba(0,102,204,0.06); color: var(--link); }

/* ── Blog Page ───────────────────────────────────────────────────────────── */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.blog-card { background: var(--bg-alt); border: none; border-radius: 12px; overflow: hidden; transition: background var(--transition), transform var(--transition); text-decoration: none; color: inherit; }
.blog-card:hover { background: rgba(0,0,0,0.04); transform: translateY(-2px); }
.blog-card-img { height: 160px; background: var(--bg-alt); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; }
.blog-card-body { padding: 24px; }
.blog-card-date { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 8px; }
.blog-card-body h3 { font-size: 1rem; font-weight: 600; margin-bottom: 8px; line-height: 1.4; color: var(--text); }
.blog-card-body p { font-size: 0.84rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 12px; }
.blog-card-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.blog-card-tags .tag { font-size: 0.7rem; padding: 2px 8px; }

/* ── Blog Post ───────────────────────────────────────────────────────────── */
.blog-post { padding-top: 80px; }
.blog-post-header { padding: 64px 0 36px; }
.blog-back-link { display: inline-block; font-size: 0.84rem; color: var(--text-muted); margin-bottom: 20px; }
.blog-back-link:hover { color: var(--link); }
.blog-post-header h1 { font-size: 2rem; font-weight: 600; letter-spacing: -0.5px; line-height: 1.25; margin-bottom: 16px; }
.blog-post-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.blog-post-meta time { font-size: 0.78rem; color: var(--text-muted); }
.blog-post-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.blog-post-content { max-width: 640px; margin: 0 auto; padding: 56px 24px 80px; font-size: 1.05rem; line-height: 1.85; color: var(--text-secondary); }
.blog-post-content h2 { font-size: 1.4rem; font-weight: 600; margin-top: 48px; margin-bottom: 16px; color: var(--text); }
.blog-post-content h3 { font-size: 1.15rem; font-weight: 600; margin-top: 36px; margin-bottom: 10px; color: var(--text); }
.blog-post-content p { margin-bottom: 20px; }
.blog-post-content ul, .blog-post-content ol { margin-bottom: 20px; padding-left: 24px; }
.blog-post-content li { margin-bottom: 8px; }
.blog-post-content blockquote { margin: 32px 0; padding: 16px 24px; border-left: 3px solid var(--border); color: var(--text-muted); font-style: italic; }
.blog-post-content code { font-family: 'SF Mono', 'Menlo', monospace; font-size: 0.85em; background: var(--bg-alt); padding: 2px 6px; border-radius: 4px; }
.blog-post-content pre { margin: 28px 0; padding: 24px; background: var(--bg-alt); border: none; border-radius: 12px; overflow-x: auto; }
.blog-post-content pre code { background: none; padding: 0; font-size: 0.84rem; line-height: 1.65; }
.blog-post-content img { max-width: 100%; height: auto; border-radius: 12px; margin: 28px 0; }
.blog-post-content a { color: var(--link); }
.blog-post-content a:hover { text-decoration: underline; }
.blog-empty { text-align: center; color: var(--text-muted); font-size: 0.95rem; padding: 56px 0; }

/* ── Animations ──────────────────────────────────────────────────────────── */
.fade-in { opacity: 0; transform: translateY(8px); transition: opacity 0.5s ease, transform 0.5s ease; }
.fade-in.visible { opacity: 1; transform: translateY(0); }

.accent { color: var(--link); }
.nav-brand { text-transform: none; }
