/* 全局样式，被 index.html 引用 (webpage/style.css) */

/* ----- Reset & Base ----- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --accent: #2563eb;
  --bg:     #f9fafb;
  --card:   #ffffff;
  --text:   #1f2937;
  --muted:  #6b7280;
  --border: #e5e7eb;
  --radius: 8px;
}
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----- Layout ----- */
.container { max-width: 860px; margin: 0 auto; padding: 0 1.5rem; }

header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky; top: 0; z-index: 10;
}
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
nav .site-name { font-weight: 700; font-size: 1.1rem; }
nav ul { display: flex; gap: 1.5rem; list-style: none; }
nav ul li a {
  color: var(--muted);
  font-size: 0.9rem;
  transition: color .2s, background .2s;
  padding: .3rem .75rem;
  border-radius: var(--radius);
}
nav ul li a:hover { color: var(--accent); background: #eff6ff; text-decoration: none; }
nav ul li a.active { color: var(--accent); background: #dbeafe; font-weight: 600; text-decoration: none; }

main { padding: 3rem 0 5rem; }

/* ----- Section ----- */
h2 {
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}
/* ----- Papers ----- */
.papers-note { font-size: .82rem; color: var(--muted); margin-bottom: 1rem; }
.card-title.bold { font-weight: 800; }
.author-bold { font-weight: 700; color: var(--text); }

/* ----- About ----- */
.about-grid { display: grid; grid-template-columns: 140px 1fr; gap: 2rem; align-items: start; }
.avatar {
  width: 140px; height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; color: var(--muted);
}
.about-info h1 { font-size: 1.8rem; margin-bottom: .3rem; }
.about-info .position { color: var(--muted); margin-bottom: .8rem; }
.about-info .bio { margin-bottom: 1rem; }
/* ----- About Links ----- */
.links { display: flex; flex-direction: column; gap: .35rem; margin-top: .6rem; }
.link-row { display: flex; align-items: baseline; gap: .5rem; font-size: .9rem; }
.link-label { color: var(--muted); min-width: 80px; font-size: .82rem; }
.link-row a { color: var(--text); }
.link-row a:hover { color: var(--accent); }


/* ----- Card ----- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  margin-bottom: 1rem;
}
.card-title { font-weight: 600; margin-bottom: .3rem; }
.card-meta { font-size: .85rem; color: var(--muted); margin-bottom: .5rem; }
.card-desc { font-size: .9rem; }
.tag {
  display: inline-block;
  background: #eff6ff; color: var(--accent);
  border-radius: 4px; padding: .1rem .5rem;
  font-size: .78rem; margin: .2rem .2rem 0 0;
}
.card-links { margin-top: .6rem; font-size: .85rem; display: flex; gap: 1rem; }

/* ----- Blog ----- */
.blog-date { font-size: .82rem; color: var(--muted); }

/* ----- CV ----- */
.cv-section { margin-bottom: 2rem; }
.cv-section h3 { font-size: 1rem; color: var(--muted); margin-bottom: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.cv-item { margin-bottom: .9rem; }
.cv-item .cv-title { font-weight: 600; }
.cv-item .cv-sub { font-size: .88rem; color: var(--muted); }
/* ----- Experience (About) ----- */
.exp-list { margin-top: 2.5rem; }
.exp-category { margin-bottom: 1.8rem; }
.exp-cat-title {
  font-weight: 700; font-size: 1rem;
  color: var(--accent);
  margin-bottom: .6rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .5rem;
  user-select: none;
}
.exp-cat-title:hover { opacity: .8; }
.exp-arrow { font-size: .75rem; color: var(--muted); width: 1em; }
.exp-item { padding: .4rem 0 .4rem .8rem; border-left: 2px solid var(--border); margin-bottom: .4rem; }
.exp-item-title { font-weight: 500; }
.exp-item-sub   { font-size: .85rem; color: var(--muted); }
.exp-item-desc  { font-size: .88rem; margin-top: .2rem; }

/* ----- Tree ----- */
.tree-group { margin-bottom: .6rem; }
.tree-header {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .9rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  font-weight: 600;
}
.tree-header:hover { background: #f0f4ff; }
.tree-arrow { font-size: .75rem; color: var(--muted); width: 1em; }
.tree-count {
  margin-left: auto;
  font-size: .78rem; color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 .5rem;
}
.tree-body { display: none; padding: .5rem 0 0 1rem; }
.tree-body.open { display: block; }
/* 一级大类标题加深背景以示区分 */
.tree-header-l1 {
  background: #eef2ff;
  font-size: 1rem;
}
.tree-header-l1:hover { background: #dbeafe; }

/* 二级子类缩进 */
.tree-body-l1 { padding-left: 1rem; }


/* ----- CV Download Button ----- */
.cv-download { margin-top: .6rem; }
.cv-dl-btn {
  display: inline-block;
  background: var(--bg);
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: .25rem .8rem;
  border-radius: 20px;
  font-size: .85rem;
}
.cv-dl-btn:hover { background: var(--accent); color: #fff; text-decoration: none; }

/* ----- Post Overlay ----- */
.post-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 100;
  overflow-y: auto;
  padding: 2rem 1rem;
}
.post-overlay-inner {
  position: relative;
  max-width: 780px;
  margin: 0 auto;
  background: var(--card);
  border-radius: var(--radius);
  padding: 2rem;
}
.overlay-close {
  position: absolute; top: 1rem; right: 1rem;
  background: none; border: none;
  font-size: 1.2rem; cursor: pointer; color: var(--muted);
}
.post-content { line-height: 1.8; }
.post-content h1,.post-content h2,.post-content h3 { margin: 1.2rem 0 .5rem; }
.post-content p  { margin-bottom: .8rem; }
.post-content code { background: var(--bg); padding: .1rem .3rem; border-radius: 3px; font-size: .9em; }
.post-content pre { background: var(--bg); padding: 1rem; border-radius: var(--radius); overflow-x: auto; }
.tex-preview { white-space: pre-wrap; font-size: .88rem; font-family: monospace; }

/* ----- Post Page (md 渲染页) ----- */
.post-page { max-width: 720px; }
.post-back {
  background: none; border: none;
  color: var(--accent); cursor: pointer;
  font-size: .9rem; margin-bottom: 1.5rem;
  padding: 0;
}
.post-back:hover { text-decoration: underline; }
