/* ============================================================
   字体自托管（@font-face）
   - Inter / Newsreader / JetBrains Mono 的 Google Fonts 可变字体，
     只保留 latin 子集（页面无 Latin-1 扩展字符，其余语言回落系统字体）。
   - 全部为 SIL Open Font License 1.1，许可证同目录：OFL-*.txt。
   - 中文刻意走系统黑体 PingFang SC / Microsoft YaHei，不引入中文字体文件。
   - 原先使用的专有商用字体已移除（不可公开分发）。
   ============================================================ */
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-normal-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-normal-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-normal-latin.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ============================================================
   Design tokens — 参照 claude.com
   ============================================================ */
:root {
  /* 色彩 — 与 Claude Design Library 亮色 token 对齐 */
  --bg: #faf9f5;        /* library bg-100 (semantic --background) */
  --bg-alt: #ede9de;    /* library bg-300 (semantic --muted) */
  --card: #FFFFFF;
  --ink: #141413;       /* library icon-900 */
  --ink-2: #6e6d68;     /* library text-500 (semantic --muted-foreground) */
  --ink-3: #9b988c;     /* library text-400 */
  --line: #dad9d4;      /* library border-300 (semantic --border) */
  --clay: #c96442;      /* library brand-500 (亮色模式) */
  --clay-dark: #b0562f; /* library brand-600 */
  --clay-tint: #f4e0d5; /* library brand-100 */

  /* 字体：@font-face 自托管的 Inter / Newsreader / JetBrains Mono（见文件头部），
     只含 latin 子集；中文刻意走系统黑体 PingFang SC，避免宋体观感。 */
  --font-sans: "Inter", -apple-system, "PingFang SC", "Microsoft YaHei",
    "Segoe UI", sans-serif;
  /* Newsreader → 英文标题 / 正文（衬线） */
  --font-serif: "Newsreader", "PingFang SC", "Microsoft YaHei", -apple-system,
    "Songti SC", serif;
  /* JetBrains Mono → 代码 / 终端 */
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    monospace;

  /* 圆角 — 六级体系，对齐 Library */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --container: 1040px;

  /* 阴影 — 七级体系，对齐 Library */
  --shadow-2xs: 0 1px 3px 0px rgba(0, 0, 0, 0.05);
  --shadow-xs: 0 1px 3px 0px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0px rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow: 0 1px 3px 0px rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 1px 3px 0px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 1px 3px 0px rgba(0, 0, 0, 0.1), 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 1px 3px 0px rgba(0, 0, 0, 0.1), 0 8px 10px -1px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 1px 3px 0px rgba(0, 0, 0, 0.25);
}

/* ============================================================
   Dark mode — Claude Design Library 暗色 token
   ============================================================ */
.dark {
  --bg: #262624;        /* library bg-100 dark */
  --bg-alt: #30302e;    /* library bg-300 dark */
  --card: #2c2c2b;      /* library bg-200 dark */
  --ink: #faf9f5;       /* library text-900 dark */
  --ink-2: #b7b5a9;     /* library text-500 dark */
  --ink-3: #908e84;     /* library text-400 dark */
  --line: #3e3e38;      /* library border-300 dark */
  --clay: #d97757;      /* library brand-500 dark */
  --clay-dark: #e08d6f; /* library brand-600 dark */
  --clay-tint: #4d3528; /* library brand-100 dark */
}
.dark body {
  -webkit-font-smoothing: antialiased;
}
.dark .nav {
  background: rgba(38, 38, 36, 0.85);
}
.dark .prose pre {
  background: #1b1b19;
  color: #E8E6DF;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
a:hover { color: var(--clay-dark); }

/* 语言块：由 html[data-lang] 控制显隐。
   只作用于 body 内的语言块，绝不能命中 <html> 根元素（display:none 的根元素会导致整页空白）。 */
body [data-lang] { display: none; }
html[data-lang="zh"] body [data-lang="zh"] { display: block; }
html[data-lang="en"] body [data-lang="en"] { display: block; }
body span[data-lang] { display: none; }
html[data-lang="zh"] body span[data-lang="zh"] { display: inline; }
html[data-lang="en"] body span[data-lang="en"] { display: inline; }

/* ============================================================
   导航 — claude.com 同款：细线、模糊背景、胶囊语言切换
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 249, 245, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-logo {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-bottom: none;
}
.nav-logo:hover { color: var(--ink); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav-links a {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-2);
  border-bottom: none;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--clay-dark); box-shadow: var(--shadow-xs); }

.lang-toggle {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  padding: 2px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
}
.lang-toggle span {
  padding: 4px 12px;
  border-radius: 999px;
  color: var(--ink-3);
  transition: all 0.15s ease;
}
.lang-toggle span.on {
  background: var(--ink);
  color: var(--bg);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--card);
  cursor: pointer;
  color: var(--ink-2);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--ink-3);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
}
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
.dark .theme-toggle .sun { display: block; }
.dark .theme-toggle .moon { display: none; }

.nav-burger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--ink);
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  padding: 96px 0 72px;
}
.hero-kicker {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--clay-dark);
  margin: 0 0 20px;
}
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 24px;
}
.hero-bio {
  font-family: var(--font-serif);
  font-size: 19px;
  line-height: 1.7;
  color: var(--ink-2);
  max-width: 640px;
  margin: 0 0 36px;
}
.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.btn:hover {
  border-color: var(--ink-3);
  color: var(--ink);
  box-shadow: var(--shadow-md);
}
.btn:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 2px;
}
.btn.primary {
  background: var(--clay);
  border-color: var(--clay);
  color: #fff;
}
.btn.primary:hover {
  background: var(--clay-dark);
  border-color: var(--clay-dark);
  color: #fff;
  box-shadow: var(--shadow-md);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--ink);
}
.btn.ghost:hover {
  background: var(--bg-alt);
  box-shadow: none;
}

/* ============================================================
   Sections
   ============================================================ */
.section {
  padding: 64px 0;
  border-top: 1px solid var(--line);
}
.section-title {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.section-sub {
  color: var(--ink-2);
  margin: 0 0 40px;
  max-width: 620px;
}
.about-copy {
  max-width: 760px;
  margin: 20px 0 0;
  color: var(--ink-2);
  font-family: var(--font-serif);
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1.6;
}

/* 研究方向卡片 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}
.card-eyebrow {
  margin: 0 0 10px;
  font: 600 10px/1.2 var(--font-sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--clay-tint);
  color: var(--clay-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 18px;
}
.card h3 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px;
}
.card p {
  font-size: 14.5px;
  color: var(--ink-2);
  margin: 0;
}

/* 项目卡片 */
.project-card {
  display: flex;
  flex-direction: column;
  min-height: 238px;
}
.project-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.project-index {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
}
.project-card h3 {
  overflow-wrap: anywhere;
}
.project-card p {
  flex: 1;
  line-height: 1.65;
}
.project-actions {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.project-link {
  color: var(--clay-dark);
  font-size: 13.5px;
  font-weight: 600;
  border-bottom: 1px solid transparent;
}
.project-link:hover {
  border-bottom-color: var(--clay-dark);
}

/* 论文列表 */
.pub-list { display: flex; flex-direction: column; gap: 16px; }
.list-empty {
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--ink-2);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 40px 28px;
  text-align: center;
}
.pub {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 28px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
}
.pub-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 6px;
}
.pub-authors {
  font-size: 14px;
  color: var(--ink-2);
  margin: 0 0 10px;
}
.pub-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: var(--clay-tint);
  color: var(--clay-dark);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.tag:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.tag.gray, .tag.muted {
  background: var(--bg-alt);
  color: var(--ink-2);
}
.tag.outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.pub-link {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--clay-dark);
  border-bottom: 1px solid transparent;
}
.pub-link:hover { border-bottom-color: var(--clay-dark); }

/* News 时间线 */
.news-list { display: flex; flex-direction: column; }
.news-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.news-item:last-child { border-bottom: none; }
.news-date {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-3);
  padding-top: 2px;
}
.news-text { margin: 0; color: var(--ink-2); }
.news-text a { color: var(--clay-dark); border-bottom: 1px solid transparent; }
.news-text a:hover { border-bottom-color: var(--clay-dark); }

/* ============================================================
   Notes 列表页
   ============================================================ */
.page-head { padding: 80px 0 40px; }
.page-title {
  font-family: var(--font-serif);
  font-size: clamp(36px, 5vw, 52px);
  font-weight: 500;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
}
.page-sub { color: var(--ink-2); font-size: 17px; margin: 0; max-width: 600px; }

.filters {
  display: flex;
  gap: 8px;
  margin: 32px 0 24px;
}
.filter-btn {
  padding: 7px 16px;
  border-radius: calc(var(--radius) - 6px);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.filter-btn:hover { border-color: var(--ink-3); color: var(--ink); }
.filter-btn.on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow-xs);
}

.note-list { display: flex; flex-direction: column; gap: 16px; padding-bottom: 80px; }
.note-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.note-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}
.note-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.note-date {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-3);
}
.note-card h3 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 8px;
}
.note-card p { margin: 0 0 14px; color: var(--ink-2); font-size: 15px; }
.note-read {
  font-size: 14px;
  font-weight: 500;
  color: var(--clay-dark);
}

/* ============================================================
   笔记详情页 — 衬线长文排版
   ============================================================ */
.article { padding: 64px 0 96px; }
.article-inner { max-width: 680px; margin: 0 auto; }
.article-back {
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 40px;
}
.article-back:hover { color: var(--clay-dark); }
.article-head { margin-bottom: 48px; }
.article-title {
  font-family: var(--font-serif);
  font-size: clamp(32px, 5vw, 44px);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 16px;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-3);
}

.prose {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.8;
  color: var(--ink);
}
.prose p { margin: 0 0 24px; }
.prose h2 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 48px 0 16px;
}
.prose h3 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  margin: 36px 0 12px;
}
.prose ul, .prose ol { margin: 0 0 24px; padding-left: 24px; }
.prose li { margin-bottom: 8px; }
.prose a { color: var(--clay-dark); border-bottom: 1px solid var(--clay-tint); }
.prose a:hover { border-bottom-color: var(--clay-dark); }
.prose blockquote {
  margin: 0 0 24px;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--clay);
  color: var(--ink-2);
  font-style: italic;
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-alt);
  padding: 2px 6px;
  border-radius: 5px;
}
.prose pre {
  background: #1F1E1B;
  color: #E8E6DF;
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  overflow-x: auto;
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 1.6;
}
.prose pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}
.prose hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 48px 0;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  border-top: 1px solid var(--line);
  padding: 40px 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer p {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-3);
}
.footer-links { display: flex; gap: 20px; }
.footer-links a { font-size: 13.5px; color: var(--ink-2); }
.footer-links a:hover { color: var(--clay-dark); }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 800px) {
  .card-grid { grid-template-columns: 1fr; }
  .pub { flex-direction: column; gap: 12px; }
  .news-item { grid-template-columns: 1fr; gap: 4px; }
}

@media (max-width: 760px) {
  .hero { padding: 64px 0 48px; }
  .nav-burger { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 8px 24px 16px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 0; font-size: 15px; }
  .nav-links .lang-toggle { margin: 8px 0; }
}

/* Travel entry shares the site's spacing, colors, and typography. */
.travel-list { padding-bottom: 80px; }
.travel-entry { display: flex; align-items: center; justify-content: space-between; gap: 32px; padding: 32px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-alt); }
.travel-entry:hover { border-color: var(--clay); color: var(--ink); }
.travel-entry-kicker { margin: 0 0 12px; font-size: 12px; letter-spacing: .06em; color: var(--clay-dark); }
.travel-entry h3 { margin: 0 0 10px; font-family: var(--font-serif); font-size: clamp(24px, 3vw, 32px); font-weight: 500; line-height: 1.3; }
.travel-entry-date { margin: 0; font-size: 14px; color: var(--ink-2); }
.travel-entry .project-link { flex-shrink: 0; }
@media (max-width: 540px) { .travel-entry { flex-direction: column; align-items: flex-start; padding: 24px; gap: 24px; } }
