/* ============================================================
   Claude / Anthropic 风格：暖米色纸面、陶土色强调、衬线标题
   布局：桌面端整屏固定，左栏常驻，仅主区独立滚动
   ============================================================ */

:root {
  --bg: #edeadf;
  --paper: #fbfaf6;
  --side: #f5f2e9;
  --text: #1b1a16;
  --text-2: #55524a;
  --muted: #8f8a7c;
  --line: #e5e0d2;
  --line-2: #efeade;
  --accent: #bd5d3a;
  --accent-soft: #f3e6dc;
  --chip: #f1ede2;
  --shadow: 0 1px 2px rgba(60, 50, 35, .04), 0 20px 50px -28px rgba(60, 50, 35, .3);

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --serif: "Iowan Old Style", "Charter", "Songti SC", "Source Han Serif SC",
           "Noto Serif CJK SC", "Noto Serif SC", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg: #131211;
  --paper: #1c1b18;
  --side: #181714;
  --text: #ece9e0;
  --text-2: #b2ada1;
  --muted: #807b70;
  --line: #2f2d27;
  --line-2: #252420;
  --accent: #d97757;
  --accent-soft: #2b211c;
  --chip: #242320;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 24px 60px -24px rgba(0, 0, 0, .7);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg: #131211; --paper: #1c1b18; --side: #181714;
    --text: #ece9e0; --text-2: #b2ada1; --muted: #807b70;
    --line: #2f2d27; --line-2: #252420;
    --accent: #d97757; --accent-soft: #2b211c; --chip: #242320;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 24px 60px -24px rgba(0, 0, 0, .7);
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  justify-content: center;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .25s ease, color .25s ease;
}

a { color: inherit; text-decoration: none; transition: color .16s ease; }
a:hover { color: var(--accent); }

h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

::selection { background: var(--accent-soft); color: var(--text); }

/* ---------- shell ---------- */
.paper {
  position: relative;
  flex: 0 1 1760px;
  max-width: 1760px;
  min-width: 0;
  margin: 14px;
  display: grid;
  grid-template-columns: 356px minmax(0, 1fr);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ---------- sidebar (fixed, own scroll) ---------- */
.sidebar {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 42px 34px 36px;
  background: var(--side);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.avatar {
  width: 62px; height: 62px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: var(--accent);
  color: #fdfbf7;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 500;
  letter-spacing: .02em;
  box-shadow: 0 8px 20px -12px rgba(189, 93, 58, .8);
}
.avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }

.name {
  margin-top: 20px;
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -.005em;
}
.role {
  margin-top: 7px;
  font-size: 13px;
  color: var(--accent);
  letter-spacing: .02em;
}
.tagline { margin-top: 12px; font-size: 13px; color: var(--text-2); line-height: 1.7; }

.side-title {
  margin-bottom: 13px;
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}

.contact { display: flex; flex-direction: column; gap: 10px; }
.contact li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); min-width: 0; }
.contact svg { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.contact a, .contact span { overflow-wrap: anywhere; }

.stack { display: flex; flex-direction: column; gap: 13px; }
.stack p { font-size: 12.5px; color: var(--text-2); line-height: 1.7; }
.stack p span {
  display: block; margin-bottom: 1px;
  color: var(--muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
}

.plain { display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.plain li { display: flex; justify-content: space-between; gap: 12px; color: var(--text-2); }
.plain em { font-style: normal; color: var(--muted); font-size: 12px; }

/* ---------- main (the only scroller) ---------- */
.main {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  padding: 58px 64px 56px;
  display: flex;
  flex-direction: column;
  gap: 44px;
}

/* 细滚动条 */
.sidebar, .main { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.main::-webkit-scrollbar, .sidebar::-webkit-scrollbar { width: 10px; }
.main::-webkit-scrollbar-track, .sidebar::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb {
  background: var(--line);
  border: 3px solid transparent;
  border-radius: 10px;
  background-clip: content-box;
}
.main::-webkit-scrollbar-thumb:hover, .sidebar::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

/* ---------- section headings ---------- */
.section-title {
  display: flex;
  align-items: baseline;
  gap: 11px;
  margin-bottom: 20px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: .01em;
  color: var(--text);
}
.section-title .idx {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 400;
  color: var(--accent);
  letter-spacing: .06em;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  transform: translateY(-4px);
  background: linear-gradient(to right, var(--line), transparent);
}

.lead {
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.95;
  color: var(--text-2);
  letter-spacing: .002em;
}
.lead::first-letter { color: var(--text); }

/* ---------- highlights ---------- */
.highlights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hl {
  padding: 17px 19px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(189, 93, 58, .035), transparent 60%);
  transition: border-color .2s ease, transform .2s ease;
}
.hl:hover { border-color: var(--line); transform: translateY(-1px); }
.hl h3 { font-family: var(--serif); font-size: 14.5px; margin-bottom: 5px; }
.hl p { font-size: 12.8px; color: var(--text-2); line-height: 1.72; }

/* ---------- education ---------- */
.edu { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.edu h3 { font-family: var(--serif); font-size: 16px; }
.edu .pos { font-family: var(--sans); font-size: 13.5px; color: var(--text-2); }
.edu.second { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line-2); }

.sep { margin: 0 8px; color: var(--muted); font-weight: 400; }
.when { font-family: var(--mono); font-size: 11.5px; color: var(--muted); letter-spacing: -.005em; white-space: nowrap; }

.muted { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

.grades { margin-top: 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 7px 18px; }
.grades span { display: flex; align-items: baseline; gap: 8px; font-size: 12.6px; color: var(--text-2); }
.grades em { font-style: normal; }
.grades b { font-family: var(--mono); font-size: 12.5px; font-weight: 500; color: var(--accent); }

/* ---------- publication ---------- */
.pub {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 8px;
  background: var(--accent-soft);
}
.pub-tag { font-family: var(--mono); font-size: 10.5px; letter-spacing: .05em; color: var(--accent); margin-bottom: 8px; }
.pub h3 { font-family: var(--serif); font-size: 16px; line-height: 1.55; font-weight: 500; }
.pub-meta { margin-top: 6px; font-size: 12px; color: var(--muted); }
.pub > p { margin-top: 10px; font-size: 13.3px; color: var(--text-2); line-height: 1.8; }
html[data-theme="dark"] .pub { background: rgba(217, 119, 87, .06); }

/* ---------- projects ---------- */
.projects { display: flex; flex-direction: column; gap: 30px; }
.proj { break-inside: avoid; }
.proj-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.proj-head h3 { font-family: var(--serif); font-size: 16px; }
.proj-role { margin-top: 3px; font-size: 12.2px; color: var(--muted); }
.proj > p { margin-top: 9px; font-size: 13.6px; color: var(--text-2); line-height: 1.82; }
.proj .chips { margin-top: 12px; }
.proj-link { font-size: 12.6px; }
.proj-link a { color: var(--accent); border-bottom: 1px solid transparent; }
.proj-link a:hover { border-bottom-color: currentColor; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 3px 9px;
  border-radius: 5px;
  background: var(--chip);
  color: var(--text-2);
  font-size: 11.6px;
  font-family: var(--mono);
  letter-spacing: -.01em;
  white-space: nowrap;
}
.chips.small .chip { font-size: 11.2px; }

/* ---------- honors ---------- */
.honors { display: flex; flex-direction: column; }
.honors li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 18px;
  padding: 9px 0;
  font-size: 13.4px; color: var(--text-2);
  border-bottom: 1px solid var(--line-2);
}
.honors li:last-child { border-bottom: 0; }

/* ---------- footer ---------- */
.footer {
  margin-top: 4px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.footer a { color: var(--text-2); }

/* ---------- top controls ---------- */
.controls {
  position: fixed;
  top: 30px; right: 34px;
  z-index: 30;
  display: flex;
  gap: 8px;
}
.ctl {
  width: 34px; height: 34px;
  padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .02em;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, transform .16s ease;
}
.ctl:hover { color: var(--accent); border-color: var(--accent); }
.ctl:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ctl svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.ctl:hover svg { transform: rotate(12deg); }
.ctl .icon-moon { display: none; }
html[data-theme="dark"] .ctl .icon-sun,
html[data-theme="auto"] .ctl .icon-sun { display: none; }
html[data-theme="dark"] .ctl .icon-moon,
html[data-theme="auto"] .ctl .icon-moon { display: block; }
@media (prefers-color-scheme: light) {
  html[data-theme="auto"] .ctl .icon-sun { display: block; }
  html[data-theme="auto"] .ctl .icon-moon { display: none; }
}

/* ---------- entrance ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal { animation: rise .55s cubic-bezier(.22, .7, .3, 1) both; }
  .reveal:nth-of-type(2) { animation-delay: .05s; }
  .reveal:nth-of-type(3) { animation-delay: .1s; }
  .reveal:nth-of-type(4) { animation-delay: .15s; }
  .reveal:nth-of-type(5) { animation-delay: .2s; }
  .reveal:nth-of-type(6) { animation-delay: .25s; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* 宽屏：优势四列，避免卡片被拉得过宽 */
@media (min-width: 1560px) {
  .highlights { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- responsive: back to normal page scroll ---------- */
@media (max-width: 900px) {
  html, body { height: auto; }
  body { display: block; overflow: auto; padding: 0; }
  .paper {
    display: block;
    margin: 0;
    min-height: 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }
  .sidebar {
    height: auto;
    overflow: visible;
    padding: 36px 24px 30px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    gap: 26px;
  }
  .main { height: auto; overflow: visible; padding: 34px 24px 44px; gap: 36px; }
  .controls { position: fixed; top: 16px; right: 16px; }
  .name { font-size: 26px; }
  .lead { font-size: 15.5px; }
  .section-title { font-size: 16px; }
  .highlights { grid-template-columns: 1fr; }
  .honors li { flex-direction: column; gap: 1px; }
}

/* ---------- print ---------- */
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  html, body { height: auto; overflow: visible; }
  body { display: block; padding: 0; background: #fff; color: #000; font-size: 10.5pt; }
  .theme-toggle, .controls { display: none; }
  .paper { display: block; margin: 0; border: 0; box-shadow: none; border-radius: 0; overflow: visible; }
  .sidebar { height: auto; overflow: visible; padding: 0 0 6mm; background: #fff; border: 0; display: block; }
  .sidebar .side-block, .identity { display: inline-block; vertical-align: top; margin-right: 8mm; }
  .identity { display: block; }
  .main { height: auto; overflow: visible; padding: 0; gap: 6mm; }
  .entry, .card, .proj, .hl, .pub { break-inside: avoid; }
  .reveal { animation: none !important; }
  .section-title::after { background: #ccc; }
  .hl, .pub, .chip { background: #fff; border-color: #ccc; }
  .honors li { border-color: #ddd; }
}
