/* cleanup old underline hover rules; use left rule + vertical indicator instead */
:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  --font-serif: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  /* Default tokens (will be overridden by [data-theme]) */
  --bg: #0f172a; /* 深蓝黑，与参考一致 */
  --fg: #e2e8f0;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --border: #334155;
}

/* Smooth anchor scrolling globally */
html { scroll-behavior: smooth; }

/* Academic */
[data-theme="academic"] {
  --bg: #fcfcfa;
  --fg: #0f172a;
  --muted: #475569;
  --accent: #1d4ed8;
  --border: #e2e8f0;
}

/* Midnight (dark) */
[data-theme="midnight"] {
  --bg: #0f172a;        /* slate-900 */
  --fg: #e2e8f0;        /* slate-200 */
  --muted: #94a3b8;     /* slate-400 */
  --accent: #60a5fa;    /* blue-400 */
  --border: #334155;    /* slate-700 */
}

/* Mono (grayscale, minimal) */
[data-theme="mono"] {
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #6b7280;
  --accent: #111827; /* use near-black for emphasis */
  --border: #e5e7eb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--fg);
  background-color: var(--bg);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* Academic uses serif for body copy */
[data-theme="academic"] body { font-family: var(--font-serif); }
[data-theme="mono"] body { letter-spacing: 0.1px; }

.container {
  width: 100%;
  max-width: 1240px;
  padding: 0 0; /* 让左列更贴近视口以还原参考布局 */
  margin: 0 auto;
}

.layout-two-col {
  display: grid;
  grid-template-columns: 340px 1fr; /* 略收窄左栏 */
  gap: 64px; /* 收紧列间距，避免右侧过空 */
  position: relative;
  z-index: 1;
}
.sidebar {
  position: sticky;
  top: 96px; /* 提高左侧起始位置 */
  align-self: start;
}
[data-layout="education"] .sidebar,
[data-layout="project"] .sidebar {
  top: 112px; /* 教育与项目页左栏位置整体上移 */
}
/* 调整左栏内边距，避免整体“偏下” */
[data-layout="education"] .sidebar .sidebar-inner,
[data-layout="project"] .sidebar .sidebar-inner {
  padding-top: 24px;
}
.sidebar-inner { display: flex; flex-direction: column; min-height: calc(100vh - 160px); gap: 16px; padding: 8px 0; }
.sidebar-footer { margin-top: 18px; position: static; background: transparent; padding-top: 0; }
.author-card { border: 0; padding: 0; background: transparent; position: relative; }
.author-card .name { margin: 0 0 8px; font-weight: 800; font-size: 3.5rem; letter-spacing: -0.01em; line-height: 1.05; color: var(--fg); }
.author-card .title { margin: 0 0 12px; color: color-mix(in oklab, var(--fg) 88%, transparent); font-weight: 600; font-size: 1.125rem; letter-spacing: .01em; }
.author-card .tagline { margin: 0 0 20px; color: color-mix(in oklab, var(--muted) 95%, transparent); max-width: 320px; line-height: 1.7; }
.author-card .avatar { display: block; width: 96px; height: 96px; border-radius: 999px; margin: 18px 0 0; border: 2px solid color-mix(in oklab, var(--accent) 30%, transparent); }

.avatar-orb {
  position: relative;
  width: 138px;
  height: 138px;
  margin: 0 0 22px;
  border-radius: 36% 64% 54% 46% / 46% 38% 62% 54%;
  padding: 2px;
  isolation: isolate;
  transform: translate3d(var(--fluid-x, 0px), var(--fluid-y, 0px), 0);
  animation: avatar-breathe 11s ease-in-out infinite;
}
.avatar-orb::before {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: inherit;
  background:
    radial-gradient(circle at 24% 18%, rgba(251, 191, 36, .42), transparent 34%),
    radial-gradient(circle at 82% 72%, rgba(96, 165, 250, .28), transparent 38%),
    linear-gradient(135deg, rgba(94, 234, 212, .42), rgba(251, 146, 60, .24));
  filter: blur(16px);
  opacity: .72;
  z-index: -2;
  animation: fluid-spin 18s linear infinite;
}
.avatar-orb::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.2),
    0 24px 80px rgba(2,6,23,.28);
  pointer-events: none;
}
.avatar-orb img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  object-position: 57% 42%;
  filter: saturate(.95) contrast(1.06);
}

.cv-link,
.cv-inline-cta a {
  color: #5eead4;
  text-decoration: none;
}
.cv-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  margin: 0 0 8px;
  padding: 10px 14px;
  border: 1px solid rgba(94, 234, 212, .24);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(94, 234, 212, .12), rgba(96, 165, 250, .07)),
    rgba(15, 23, 42, .28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
  font-size: .84rem;
  font-weight: 700;
  letter-spacing: .02em;
  transition: transform .35s cubic-bezier(.16,1,.3,1), border-color .25s ease, color .25s ease, background .25s ease;
}
.cv-link:hover,
.cv-link:focus-visible {
  color: #ccfbf1;
  border-color: rgba(94, 234, 212, .58);
  background:
    linear-gradient(135deg, rgba(94, 234, 212, .18), rgba(96, 165, 250, .11)),
    rgba(15, 23, 42, .34);
  transform: translate3d(2px, -2px, 0) scale(1.015);
  text-decoration: none;
}

.cv-inline-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 22px;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in oklab, var(--border) 72%, transparent);
  background: color-mix(in oklab, var(--bg) 76%, transparent);
  color: color-mix(in oklab, var(--muted) 92%, transparent);
  font-size: .85rem;
}
.cv-inline-cta a {
  font-weight: 700;
}
.cv-inline-cta a:hover {
  color: #ccfbf1;
  text-decoration: none;
}
.icons { list-style: none; padding: 0; margin: 8px 0 0; display: flex; gap: 12px; }
/* 白透风格：默认白色 75% 不透明度，悬停全白；移除外框与背景 */
.icons a { color: rgba(255,255,255,0.75) !important; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; width: 50px; height: 50px; border-radius: 8px; border: 0; background: transparent; transition: color .2s ease; }
.icons a:hover { color: #ffffff !important; }
.icons .icon { display: inline-block; width: 28px; height: 28px; background-color: currentColor; }
/* 默认隐藏回退图片，避免与 mask 版本叠加 */
.icons .icon-img { display: none; }
/* 使用 mask 以 currentColor 着色 SVG 图标 */
.icons .icon-github { -webkit-mask-image: url('../img/icon/github.svg'); mask-image: url('../img/icon/github.svg'); -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; -webkit-mask-size: contain; mask-size: contain; }
.icons .icon-instagram { -webkit-mask-image: url('../img/icon/instagram.svg'); mask-image: url('../img/icon/instagram.svg'); -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; -webkit-mask-size: contain; mask-size: contain; }
.icons .icon-blog { -webkit-mask-image: url('../img/icon/blog.svg'); mask-image: url('../img/icon/blog.svg'); -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; -webkit-mask-size: contain; mask-size: contain; }
.icons a:hover { color: #ffffff; }

/* Fallback: 若不支持 mask，则隐藏 span.icon，显示 img.icon-img */
@supports not ((mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>")) or (-webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>"))) {
  .icons .icon { display: none; }
  .icons .icon-img { display: inline-block; width: 28px; height: 28px; filter: invert(1) brightness(1.25) saturate(0); opacity: .75; transition: opacity .2s ease; }
  .icons a:hover .icon-img { opacity: 1; }
}

.content { min-width: 0; padding-top: 128px; padding-left: 32px; }

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.site-title {
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  margin-right: 24px;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  margin-right: 16px;
}
.site-nav a:hover { color: var(--fg); }

.theme-switcher {
  margin-left: auto;
}
.theme-switcher select {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 6px;
}

main.container { padding: 28px 0 60px; }

h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.875rem; margin: 0 0 1rem; }
h2 { font-size: 1.25rem; margin: 2rem 0 0.75rem; }
.content h2 { font-size: 0.875rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-weight: 700; }
.side-nav { margin-top: 24px; display: block; position: relative; }
/* 垂直活动指示条（与每项左侧横线组合） */
.side-nav .side-indicator {
  position: absolute;
  left: 0;
  width: 40px;
  height: 2px;
  background: var(--accent);
  transform: translateY(0);
  transition: transform .35s cubic-bezier(.22,.61,.36,1);
  border-radius: 2px;
  opacity: 0.9;
}
/* per-item horizontal rule + text color transitions */
.side-nav a { position: relative; display: block; color: var(--muted); text-decoration: none; padding: 10px 0 10px 56px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; font-size: 12px; line-height: 1; transition: color .25s ease, transform .25s ease; }
.side-nav a::before { content: ""; position: absolute; left: 0; top: 50%; width: 40px; height: 2px; background: color-mix(in oklab, var(--accent) 28%, transparent); transform-origin: left center; transform: translateY(-50%) scaleX(.4); transition: transform .35s cubic-bezier(.22,.61,.36,1), background-color .3s ease; border-radius: 2px; }
.side-nav a:hover { color: var(--fg); transform: translateX(1px); }
.side-nav a:hover::before { transform: translateY(-50%) scaleX(1); }
.side-nav a,
.side-nav a:hover,
.side-nav a:focus,
.side-nav a:active,
.side-nav a:focus-visible { text-decoration: none !important; }
.side-nav a[aria-current="true"],
.side-nav a.active { color: var(--accent); }
.side-nav a[aria-current="true"]::before,
.side-nav a.active::before { background: var(--accent); transform: translateY(-50%) scaleX(1); }

section { margin-bottom: 36px; }
section {
  transform: translate3d(calc(var(--section-flow-x, 0px) * .3), 0, 0);
}
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 14px 0; border-bottom: 1px solid var(--border); }
.timeline .timeline-head { display: flex; align-items: baseline; gap: 6px; }
.timeline .timeline-head .right { margin-left: auto; }
.timeline .timeline-head .right { font-family: var(--font-mono); font-size: 0.875rem; letter-spacing: .01em; color: var(--muted); }
.muted { color: var(--muted); }
.stack { color: var(--muted); font-size: 0.9rem; }

/* Typography system for right content */
.measure { max-width: 54ch; }
.measure-wide { max-width: 64ch; }

/* About section: slightly wider than default measure */
#about.measure { max-width: 60ch; }
.lead { font-size: 1.125rem; line-height: 1.75; color: var(--fg); }
.small { font-size: 0.875rem; }
.mono { font-family: var(--font-mono); }
.caps { text-transform: uppercase; letter-spacing: .14em; }
.eyebrow { display: inline-block; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); }

/* About: AI-native research portrait */
.about-copy {
  position: relative;
}
.about-copy::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 10px;
  width: 1px;
  height: calc(100% - 18px);
  background:
    linear-gradient(
      180deg,
      transparent,
      rgba(94, 234, 212, .52) 18%,
      rgba(96, 165, 250, .36) 58%,
      transparent
    );
  opacity: .58;
  transform-origin: top;
  animation: about-axis-pulse 7s ease-in-out infinite;
}
.about-line {
  position: relative;
  margin: 0 0 22px;
  line-height: 1.82;
  color: color-mix(in oklab, var(--fg) 66%, transparent) !important;
}
.about-line.reveal {
  filter: blur(2px);
}
.about-line.reveal.is-revealed {
  filter: blur(0);
}
.about-line::before {
  content: "";
  position: absolute;
  left: -32px;
  top: .88em;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  border: 1px solid rgba(94, 234, 212, .42);
  background: rgba(15, 23, 42, .64);
  box-shadow: 0 0 18px rgba(94, 234, 212, .18);
  transform: scale(.72);
  transition: transform .7s cubic-bezier(.16,1,.3,1), box-shadow .7s ease, border-color .7s ease;
}
.about-line.is-revealed::before {
  transform: scale(1);
  border-color: rgba(94, 234, 212, .78);
  box-shadow: 0 0 28px rgba(94, 234, 212, .3);
}
.about-signal {
  position: relative;
  display: inline;
  color: color-mix(in oklab, var(--fg) 90%, #5eead4 10%) !important;
  font-weight: 780;
  text-shadow: 0 0 18px rgba(94, 234, 212, .1);
}
.about-signal::after {
  content: "";
  position: absolute;
  left: -.08em;
  right: -.08em;
  bottom: .05em;
  height: .42em;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(94, 234, 212, .18), rgba(96, 165, 250, .1), rgba(251, 146, 60, .12));
  z-index: -1;
  transform-origin: left center;
  transform: scaleX(.18);
  opacity: .72;
  transition: transform .8s cubic-bezier(.16,1,.3,1), opacity .5s ease;
}
.about-line.is-revealed .about-signal::after {
  transform: scaleX(1);
}

.about-provenance {
  position: relative;
  isolation: isolate;
  margin: 34px 0 0;
  padding: 18px 18px 16px;
  border: 1px solid rgba(94, 234, 212, .18);
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(circle at var(--provenance-x, 16%) 0%, rgba(94, 234, 212, .13), transparent 32%),
    linear-gradient(135deg, rgba(15, 23, 42, .52), rgba(2, 6, 23, .2));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.08),
    0 24px 90px rgba(2,6,23,.18);
}
.about-provenance::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255,255,255,.08);
  pointer-events: none;
}
.about-provenance::after {
  content: "";
  position: absolute;
  inset: -40% -20%;
  background:
    linear-gradient(115deg, transparent 42%, rgba(255,255,255,.09) 50%, transparent 58%);
  transform: translateX(-45%) rotate(2deg);
  opacity: 0;
  pointer-events: none;
}
.about-provenance.is-revealed::after {
  animation: provenance-glint 1.8s .35s cubic-bezier(.16,1,.3,1) both;
}
.provenance-scan {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(94, 234, 212, .82), rgba(96, 165, 250, .46), transparent);
  opacity: .75;
  transform: translateY(14px) scaleX(.12);
  transform-origin: left;
}
.about-provenance.is-revealed .provenance-scan {
  animation: provenance-scan 2.8s .18s cubic-bezier(.16,1,.3,1) both;
}
.provenance-grid {
  position: absolute;
  inset: 0;
  opacity: .18;
  background-image:
    linear-gradient(rgba(94, 234, 212, .14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 165, 250, .12) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(circle at 70% 20%, #000, transparent 72%);
  animation: provenance-grid-drift 13s linear infinite;
  pointer-events: none;
}
.provenance-kicker {
  position: relative;
  margin: 0 0 8px;
  color: rgba(94, 234, 212, .82) !important;
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.provenance-body {
  position: relative;
  margin: 0;
  color: color-mix(in oklab, var(--fg) 72%, transparent) !important;
  font-size: .94rem;
  line-height: 1.68;
}
.provenance-signature {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 14px 0 0;
  color: color-mix(in oklab, var(--muted) 88%, transparent) !important;
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .04em;
}
.signature-mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  color: #5eead4 !important;
  border: 1px solid rgba(94, 234, 212, .28);
  background: rgba(94, 234, 212, .08);
  box-shadow: 0 0 20px rgba(94, 234, 212, .16);
}
.about-provenance.is-revealed .signature-mark {
  animation: signature-pulse 2.7s .8s ease-in-out infinite;
}
/* About section: 默认文字半透明，仅信号词与强调内容更亮 */
#about :where(p, li, a, span, em, code) {
  color: color-mix(in oklab, var(--fg) 58%, transparent);
}
#about strong, #about b {
  color: var(--fg);
}

/* Hero */
.hero {
  margin: 16px 0 28px;
  padding: 36px 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, color-mix(in oklab, var(--accent) 16%, var(--bg)) 0%, var(--bg) 60%);
}
[data-theme="midnight"] .hero {
  background: linear-gradient(180deg, color-mix(in oklab, var(--accent) 25%, var(--bg)) 0%, var(--bg) 70%);
}
.hero h1 {
  margin: 0 0 10px;
  font-size: 2rem;
}
.hero p {
  margin: 0;
  color: var(--muted);
}

.project-list { list-style: none; padding: 0; }
.project-list li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.project-list a { color: var(--fg); text-decoration: none; font-weight: 600; }
.project-list .summary { margin: 6px 0 0; color: var(--muted); max-width: 62ch; }

.pub-list { list-style: none; padding: 0; }
.pub-list li { padding: 10px 0; border-bottom: 1px solid var(--border); line-height: 1.6; }
.pub-item { font-size: 0.95rem; }
.pub-title { font-weight: 600; }
.pub-authors { color: color-mix(in oklab, var(--fg) 70%, transparent); margin-right: 4px; }
.pub-year { color: color-mix(in oklab, var(--muted) 90%, transparent); margin: 0 6px; }
.pub-venue { font-style: italic; color: color-mix(in oklab, var(--fg) 80%, transparent); }
.pub-link { margin-left: 8px; color: var(--accent); text-decoration: none; }
.pub-link:hover { text-decoration: underline; }

.project-meta span { color: var(--muted); margin-right: 8px; }
.project-links ul { list-style: none; padding: 0; }
.project-links li { display: inline-block; margin-right: 12px; }
.project-links a { color: var(--accent); text-decoration: none; }

/* Results table styling */
.table-wrap { width: 100%; overflow-x: auto; }
table.results-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: color-mix(in oklab, var(--bg) 96%, transparent);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow:
    0 6px 16px rgba(0,0,0,.14),
    inset 0 1px 0 rgba(255,255,255,.02);
}
table.results-table thead th {
  background: linear-gradient(180deg, rgba(148,163,184,0.16), rgba(148,163,184,0.06));
  color: color-mix(in oklab, var(--fg) 92%, transparent);
  font-weight: 600;
  text-align: right;
  padding: 10px 12px;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--border);
}
table.results-table thead th:first-child,
table.results-table tbody td:first-child {
  text-align: left;
}
table.results-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid color-mix(in oklab, var(--border) 90%, transparent);
  color: color-mix(in oklab, var(--fg) 88%, transparent);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
table.results-table tbody tr:nth-child(even) td {
  background: color-mix(in oklab, var(--bg) 92%, transparent);
}
table.results-table tbody tr:last-child td {
  border-bottom: 0;
}
table.results-table caption {
  caption-side: top;
  text-align: left;
  color: var(--muted);
  padding: 6px 2px 10px;
  font-size: 0.9rem;
}

/* Side-by-side results layout */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
.results-grid figure, .results-grid .table-wrap { margin: 0; }
.results-figure {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: color-mix(in oklab, var(--bg) 96%, transparent);
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
}
.results-figure img { display: block; width: 100%; height: auto; }
/* Academic-style figure & table captions with auto numbering */
article.project { counter-reset: fig tbl; }
figure.figure-academic { counter-increment: fig; }
figure.figure-academic figcaption {
  padding: 8px 10px;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}
figure.figure-academic figcaption::before {
  content: "Figure " counter(fig) ": ";
  font-style: normal;
  color: color-mix(in oklab, var(--fg) 80%, transparent);
  font-weight: 600;
}
/* Table captions with numbering */
table.results-table { counter-increment: tbl; }
table.results-table caption::before {
  content: "Table " counter(tbl) ": ";
  font-weight: 600;
  color: color-mix(in oklab, var(--fg) 80%, transparent);
}

/* Reference superscript */
.ref-sup {
  font-size: 0.75em;
  vertical-align: super;
  line-height: 0;
  margin-left: 2px;
}
.ref-sup a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 0;
}
.ref-sup a:hover { text-decoration: underline; }

/* Elegant hyperlink styling within project content */
article.project .project-content a {
  color: var(--accent);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: color .15s ease, background-size .25s ease;
}
article.project .project-content a:hover,
article.project .project-content a:focus {
  color: #93c5fd; /* slightly lighter */
  background-size: 100% 1px;
}
@media (max-width: 900px) {
  .results-grid { grid-template-columns: 1fr; }
}

/* Project two-level headings (Results → subsections) */
article.project .project-content h3 {
  margin: 2rem 0 .9rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: .01em;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
}
article.project .project-content h3::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 18px;
  border-radius: 3px;
  background: var(--accent);
}
article.project .project-content h4 {
  margin: 1.4rem 0 .6rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: color-mix(in oklab, var(--fg) 88%, transparent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
/* Ensure anchored headings are not hidden under sticky elements */
article.project .project-content h2[id],
article.project .project-content h3[id],
article.project .project-content h4[id] {
  scroll-margin-top: 110px;
}

/* Results layout helpers */
.result-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .result-row {
    grid-template-columns: 1fr;
  }
}
.result-figure {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in oklab, var(--bg) 96%, transparent);
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
}
.result-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
}
.gif-hero {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 8px 0 16px;
  box-shadow: 0 10px 20px rgba(0,0,0,.18);
}

/* Text transparency utilities */
.text-100 { color: var(--fg); }
.text-90 { color: color-mix(in oklab, var(--fg) 90%, transparent); }
.text-80 { color: color-mix(in oklab, var(--fg) 80%, transparent); }
.text-70 { color: color-mix(in oklab, var(--fg) 70%, transparent); }
.text-muted-90 { color: color-mix(in oklab, var(--muted) 90%, transparent); }
.text-muted-80 { color: color-mix(in oklab, var(--muted) 80%, transparent); }
.text-muted-70 { color: color-mix(in oklab, var(--muted) 70%, transparent); }

a { color: var(--accent); }
a:hover { text-decoration: underline; }

/* Scroll progress bar */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  transform-origin: left center;
  transform: scaleX(0);
  background: var(--accent);
  z-index: 50;
}

/* Carbon-like code block styling */
/* Only apply the container chrome to the outer wrapper (not pre.highlight) */
figure.highlight, .highlight:not(pre):not(code) {
  position: relative;
  background: #0b1220; /* dark backdrop */
  color: #e5e7eb;
  border: 1px solid rgba(148,163,184,0.18);
  border-radius: 12px;
  overflow: auto;
  box-shadow:
    0 10px 20px rgba(0,0,0,.35),
    inset 0 1px 0 rgba(255,255,255,.02);
  padding: 40px 16px 16px; /* leave room for faux titlebar */
}
.highlight pre, .highlight code, pre code {
  background: transparent !important;
  color: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  /* wrap long lines to avoid horizontal scrolling */
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  margin: 0;
}
/* Title bar only on outer wrapper */
figure.highlight::before, .highlight:not(pre):not(code)::before {
  /* Title bar */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 32px;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,0));
  border-bottom: 1px solid rgba(148,163,184,0.16);
}
figure.highlight::after, .highlight:not(pre):not(code)::after {
  /* traffic lights */
  content: "";
  position: absolute;
  top: 10px;
  left: 12px;
  width: 44px;
  height: 10px;
  background:
    radial-gradient(circle at 6px 5px, #ff5f56 0 4px, transparent 4px),
    radial-gradient(circle at 22px 5px, #ffbd2e 0 4px, transparent 4px),
    radial-gradient(circle at 38px 5px, #27c93f 0 4px, transparent 4px);
}
/* Rouge token colors (dracula-ish) */
.highlight .c, .highlight .cm, .highlight .c1 { color: #94a3b8; font-style: italic; } /* comment */
.highlight .k, .highlight .kr, .highlight .kd, .highlight .kc, .highlight .kt { color: #7dd3fc; font-weight: 600; } /* keywords */
.highlight .o, .highlight .ow { color: #93c5fd; }
.highlight .nf, .highlight .na { color: #fca5a5; } /* functions/attrs */
.highlight .nn, .highlight .nc { color: #fca5a5; }
.highlight .s, .highlight .sb, .highlight .s1, .highlight .s2, .highlight .se { color: #a7f3d0; } /* strings */
.highlight .mi, .highlight .mf, .highlight .mh, .highlight .m { color: #fde68a; } /* numbers */
.highlight .p { color: #e5e7eb; }
.highlight .err { color: #f87171; background: transparent; }

/* Inline code */
:not(pre) > code {
  background: rgba(148,163,184,0.12);
  color: #e5e7eb;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(148,163,184,0.18);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85em;
}

/* Optional line highlight (when fenced blocks include {#Lx}) */
.highlight .hll { background-color: rgba(96,165,250,0.12); display: block; margin: 0 -16px; padding: 0 16px; }

/* Experience template variant (two-column grid, left period, right content) */
section[data-template="experience"] .timeline { position: relative; padding-left: 0; }
section[data-template="experience"] .timeline::before { display: none; }
section[data-template="experience"] .timeline li { 
  display: grid; 
  grid-template-columns: 180px 1fr; 
  column-gap: 28px; 
  align-items: start; 
  border-bottom: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  padding: 24px 0; 
  position: relative; /* 用于绝对定位的悬停背景 */
}
section[data-template="experience"] .timeline li::before { display: none; }
section[data-template="experience"] .xp-period {
  font-family: var(--font-mono);
  font-size: 0.8125rem; /* 13px */
  letter-spacing: .06em;
  color: color-mix(in oklab, var(--muted) 88%, transparent);
  text-transform: uppercase;
  white-space: nowrap;
}
section[data-template="experience"] .xp-title {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 1.0625rem; /* 17px */
  line-height: 1.5;
  transition: color .15s cubic-bezier(.4,0,.2,1);
}
section[data-template="experience"] .xp-title .company { color: color-mix(in oklab, var(--fg) 86%, transparent); font-weight: 600; transition: color .15s cubic-bezier(.4,0,.2,1); }
section[data-template="experience"] .xp-title a.company { text-decoration: none; transition: color .15s cubic-bezier(.4,0,.2,1); }
section[data-template="experience"] .xp-title a.company:hover { color: #5eead4; }
section[data-template="experience"] .xp-summary { 
  margin: 6px 0 12px; 
  color: color-mix(in oklab, var(--fg) 82%, transparent);
}
/* 悬停高亮背景（桌面端） */
@media (min-width: 1024px) {
  section[data-template="experience"] .xp-hover-bg {
    position: absolute;
    top: -1rem;  /* 参考：-inset-y-4 */
    bottom: -1rem;
    left: -1.5rem; /* 参考：-inset-x-6 */
    right: -1.5rem;
    z-index: 0;
    border-radius: 0.375rem; /* rounded-md */
    display: block; /* lg:block */
    background-color: transparent;
    transition: background-color .15s cubic-bezier(.4,0,.2,1), box-shadow .15s cubic-bezier(.4,0,.2,1);
    pointer-events: none; /* 不拦截点击，避免遮挡链接 */
  }
  section[data-template="experience"] li:hover .xp-hover-bg {
    background-color: rgba(30,41,59, .5); /* bg-slate-800/50 */
    box-shadow:
      inset 0 1px 0 0 rgba(148,163,184,0.1), /* inner top hairline */
      0 10px 8px rgba(0,0,0,.04),            /* drop shadows */
      0 4px 3px rgba(0,0,0,.1);
  }
  /* 列表项悬停时，标题文字随之提亮为青色（模拟 group-hover 效果） */
  section[data-template="experience"] li:hover .xp-title strong,
  section[data-template="experience"] li:hover .xp-title .company,
  /* 保持标题链接颜色不变 */
  /* section[data-template="experience"] li:hover .xp-title a { */
    color: #5eead4; /* text-teal-300 */
  /* } */
}
section[data-template="experience"] .xp-tags { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 0; /* 使用 li 的 margin 实现 mr-1.5 与 mt-2 */
  list-style: none; 
  padding: 0; 
  margin: 8px 0 0; /* mt-2 */
  align-items: center;
}
section[data-template="experience"] .xp-tags li { 
  margin: 8px 6px 0 0; 
  padding: 0; 
  flex: 0 0 auto; /* 防止子项被拉伸，宽度随内容 */ 
  display: inline-flex; 
  width: -moz-fit-content; 
  width: fit-content; /* 胶囊宽度=内容宽度 */
}
section[data-template="experience"] .pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px; /* 与参考接近的 px-3 py-1 但更紧凑 */
  border-radius: 9999px; /* rounded-full */
  font-family: var(--font-sans);
  font-size: 0.75rem; /* 12px (text-xs) */
  line-height: 1.25rem; /* 20px (leading-5) */
  font-weight: 500; /* font-medium */
  letter-spacing: -0.01em; /* 轻微收紧字距以缩短视觉宽度 */
  text-transform: none;
  color: #5eead4; /* text-teal-300 */
  background-color: rgba(45, 212, 191, 0.10); /* bg-teal-400/10 */
  border: 0;
  box-shadow: none;
  text-decoration: none !important; /* 取消下划线（加强优先级） */
  text-decoration-line: none !important;
  text-decoration-color: transparent !important;
  text-decoration-thickness: 0 !important;
  text-underline-offset: 0 !important;
  width: -moz-fit-content; 
  width: fit-content; /* 宽度根据文字严格自适应 */
  min-width: 0;
  transition: color .15s cubic-bezier(.4,0,.2,1), background-color .15s cubic-bezier(.4,0,.2,1);
  vertical-align: middle;
  white-space: nowrap; /* 防止换行导致宽度异常 */
  flex: 0 0 auto; /* 禁止被拉伸 */
}

/* 彻底移除任何可能的伪元素影响尺寸或下划线显示 */
section[data-template="experience"] .xp-tags li::before,
section[data-template="experience"] .xp-tags li::after,
section[data-template="experience"] .xp-tags .pill::before,
section[data-template="experience"] .xp-tags .pill::after { content: none !important; }

section[data-template="experience"] .pill:hover,
section[data-template="experience"] .pill:focus,
section[data-template="experience"] .pill:focus-visible,
section[data-template="experience"] .pill:active {
  background-color: rgba(45, 212, 191, 0.12); /* 轻微提升 */
  color: #99f6e4; /* 稍亮一点的青，接近 text-teal-200 */
  text-decoration: none !important; /* 彻底取消下划线（加强优先级） */
  text-decoration-line: none !important;
  text-decoration-color: transparent !important;
  text-decoration-thickness: 0 !important;
  text-underline-offset: 0 !important;
  border: 0;
  box-shadow: none;
  outline: none; /* 移除描边 */
}

/* 防御性处理：若未来 pill 改为链接，彻底取消下划线与描边 */
section[data-template="experience"] .xp-tags a,
section[data-template="experience"] .xp-tags a:hover,
section[data-template="experience"] .xp-tags a:focus,
section[data-template="experience"] .xp-tags a:focus-visible,
section[data-template="experience"] .xp-tags a:active {
  text-decoration: none !important; /* 覆盖全局 a:hover 下划线 */
  border: 0;
  box-shadow: none;
  outline: none;
}

/* 经验区内彻底禁止任何链接下划线（包含标题链接等） */
section[data-template="experience"] a,
section[data-template="experience"] a:hover,
section[data-template="experience"] a:focus,
section[data-template="experience"] a:focus-visible,
section[data-template="experience"] a:active {
  text-decoration: none !important;
  text-decoration-line: none !important;
}

/* 返回按钮样式：采用正文色，无下划线，悬停轻微提亮 */
.back-link,
.back-link:visited { color: var(--fg); text-decoration: none; }
.back-link:hover,
.back-link:focus { color: color-mix(in oklab, var(--fg) 92%, transparent); text-decoration: none; }

/* 顶部 Back CTA：更大字号与留白，放在侧栏最上方 */
.back-cta { margin: 0 0 16px; }
.back-cta { margin: 0 0 16px; margin-left: -6px; }
.back-cta .back-link { display: inline-block; font-weight: 700; font-size: 1.25rem; letter-spacing: .01em; }
.back-cta .back-link::before { content: '← '; opacity: .9; }

/* 详情页右侧上移一些，减少顶部内边距 */
[data-layout="education"] .content,
[data-layout="project"] .content {
  padding-top: 100px;
}

/* 教育标题链接样式：使用正文色，不要蓝色/下划线 */
section[data-template="experience"] .xp-title .xp-link,
section[data-template="experience"] .xp-title .xp-link:visited {
  color: var(--fg) !important;
  text-decoration: none !important;
}
section[data-template="experience"] li:hover .xp-title .xp-link,
section[data-template="experience"] .xp-title .xp-link:hover,
section[data-template="experience"] .xp-title .xp-link:focus {
  color: var(--fg) !important;
  text-decoration: none !important;
}

/* 防止任何边框样式看起来像下划线 */
section[data-template="experience"] .xp-tags,
section[data-template="experience"] .xp-tags li,
section[data-template="experience"] .xp-tags .pill {
  border: 0 !important;
  border-bottom: 0 !important;
}

/* 兜底：无论 .pill 是否为 a，都不展示下划线 */
section[data-template="experience"] .xp-tags .pill,
section[data-template="experience"] .xp-tags .pill:hover,
section[data-template="experience"] .xp-tags .pill:focus,
section[data-template="experience"] .xp-tags .pill:focus-visible,
section[data-template="experience"] .xp-tags .pill:active {
  text-decoration: none !important;
  text-decoration-line: none !important;
  text-decoration-color: transparent !important;
  text-decoration-thickness: 0 !important;
  text-underline-offset: 0 !important;
}

/* Spotlight (鼠标灯光) */
#spotlight {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 999; /* 置顶，确保可见 */
  transition: opacity .3s ease;
  /* 初始为视口右上方的一束柔光，与参考接近 */
  background: radial-gradient(600px at 120% 0px, rgba(29,78,216,0.15), transparent 80%);
}

.fluid-field {
  pointer-events: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  opacity: .92;
  contain: paint;
}
.fluid-field::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(15, 23, 42, .92), rgba(2, 6, 23, .2)),
    radial-gradient(circle at 50% 0%, rgba(148, 163, 184, .07), transparent 34%);
}
.fluid-blob {
  position: absolute;
  width: 42vmax;
  height: 42vmax;
  border-radius: 42% 58% 70% 30% / 46% 39% 61% 54%;
  filter: blur(54px);
  opacity: .26;
  mix-blend-mode: screen;
  transform: translate3d(var(--blob-x, 0px), var(--blob-y, 0px), 0) rotate(var(--blob-rot, 0deg));
  will-change: transform;
}
.fluid-blob-a {
  left: -17vmax;
  top: -12vmax;
  background: rgba(45, 212, 191, .72);
  animation: fluid-morph-a 26s ease-in-out infinite alternate;
}
.fluid-blob-b {
  right: -19vmax;
  top: 18vmax;
  background: rgba(96, 165, 250, .62);
  animation: fluid-morph-b 31s ease-in-out infinite alternate;
}
.fluid-blob-c {
  left: 28vw;
  bottom: -26vmax;
  background: rgba(251, 146, 60, .5);
  animation: fluid-morph-c 37s ease-in-out infinite alternate;
}

/* Back to top */
#back-to-top {
  position: fixed;
  right: 20px;
  bottom: 24px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s step-end, border-color .2s ease, color .2s ease;
}
#back-to-top:hover { border-color: var(--accent); color: var(--accent); }
#back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); transition: opacity .2s ease, transform .2s ease, visibility 0s linear; }

/* Reveal */
.reveal {
  opacity: 0;
  transform: translate3d(0, 18px, 0) scale(.985) skewY(.35deg);
  filter: blur(4px);
  transition:
    opacity .75s cubic-bezier(.16,1,.3,1),
    transform .9s cubic-bezier(.16,1,.3,1),
    filter .75s cubic-bezier(.16,1,.3,1);
  transition-delay: calc(var(--reveal-index, 0) * 52ms);
}
.reveal.is-revealed {
  opacity: 1;
  transform: none;
  filter: blur(0);
}

/* Reveal variants */
.reveal.left { transform: translateX(-10px); }
.reveal.right { transform: translateX(10px); }
.reveal.up { transform: translateY(10px); }
.reveal.down { transform: translateY(-10px); }
.reveal.left.is-revealed,
.reveal.right.is-revealed,
.reveal.up.is-revealed,
.reveal.down.is-revealed { transform: none; }

/* Motion reduce */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .fluid-field,
  #spotlight { display: none !important; }
  section,
  .avatar-orb { transform: none !important; }
  .about-copy::before,
  .about-line::before,
  .provenance-grid,
  .provenance-scan { display: none !important; }
}

@keyframes avatar-breathe {
  0%, 100% { border-radius: 36% 64% 54% 46% / 46% 38% 62% 54%; }
  45% { border-radius: 58% 42% 40% 60% / 38% 56% 44% 62%; }
  72% { border-radius: 48% 52% 62% 38% / 56% 42% 58% 44%; }
}

@keyframes fluid-spin {
  to { transform: rotate(360deg); }
}

@keyframes fluid-morph-a {
  0% { border-radius: 42% 58% 70% 30% / 46% 39% 61% 54%; }
  100% { border-radius: 68% 32% 45% 55% / 62% 48% 52% 38%; }
}
@keyframes fluid-morph-b {
  0% { border-radius: 58% 42% 43% 57% / 52% 61% 39% 48%; }
  100% { border-radius: 35% 65% 67% 33% / 41% 44% 56% 59%; }
}
@keyframes fluid-morph-c {
  0% { border-radius: 49% 51% 33% 67% / 61% 38% 62% 39%; }
  100% { border-radius: 66% 34% 58% 42% / 37% 59% 41% 63%; }
}

@keyframes about-axis-pulse {
  0%, 100% { opacity: .28; transform: scaleY(.82); }
  48% { opacity: .72; transform: scaleY(1); }
}

@keyframes provenance-scan {
  0% { opacity: 0; transform: translateY(14px) scaleX(.08); }
  18% { opacity: .9; }
  62% { transform: translateY(102px) scaleX(1); }
  100% { opacity: .42; transform: translateY(118px) scaleX(.28); }
}

@keyframes provenance-glint {
  0% { opacity: 0; transform: translateX(-55%) rotate(2deg); }
  24% { opacity: 1; }
  100% { opacity: 0; transform: translateX(62%) rotate(2deg); }
}

@keyframes provenance-grid-drift {
  to { background-position: 26px 26px; }
}

@keyframes signature-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 20px rgba(94, 234, 212, .16);
  }
  48% {
    transform: scale(1.08);
    box-shadow: 0 0 34px rgba(94, 234, 212, .34);
  }
}

@media (max-width: 640px) {
  .site-nav { margin-top: 8px; display: block; }
  .site-nav a { margin-right: 12px; }
  .layout-two-col { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .avatar-orb { width: 112px; height: 112px; }
}


/* Detail layouts (Education & Project detail pages) */
.detail-layout { display: grid; grid-template-columns: 280px 1fr; gap: 32px; align-items: start; }
.detail-aside { position: sticky; top: 128px; align-self: start; }
.detail-card { border: 0; border-radius: 0; padding: 0; background: transparent; margin: 0 0 18px; }
.detail-card + .detail-card { padding-top: 16px; border-top: 1px solid color-mix(in oklab, var(--border) 75%, transparent); }
.detail-card h3 { margin: 0 0 6px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .10em; color: color-mix(in oklab, var(--muted) 96%, transparent); }
.detail-meta { list-style: none; padding: 0; margin: 0; }
.detail-meta li { margin: 6px 0; line-height: 1.55; color: color-mix(in oklab, var(--fg) 80%, transparent); }
.detail-meta li + li { margin-top: 8px; padding-top: 8px; border-top: 1px dashed color-mix(in oklab, var(--border) 55%, transparent); }
.detail-meta .k { color: var(--muted); margin-right: 6px; }
.detail-links { list-style: none; padding: 0; margin: 0; }
.detail-links li { margin: 6px 0; }
.detail-links a { color: color-mix(in oklab, var(--fg) 90%, transparent); text-decoration: none; }
.detail-links a:hover { color: var(--fg); text-decoration: none; }
.detail-toc { list-style: none; padding: 0; margin: 0; }
.detail-toc li { margin: 6px 0; }
.detail-toc a { color: color-mix(in oklab, var(--muted) 90%, transparent); text-decoration: none; }
.detail-toc a:hover { color: var(--fg); }

/* 左栏条目视觉强调：每个键值对前增加细导引线，提高扫读 */
.detail-meta li { position: relative; padding-left: 12px; }
.detail-meta li::before { content: ""; position: absolute; left: 0; top: 0.9em; width: 6px; height: 1px; background: color-mix(in oklab, var(--muted) 70%, transparent); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--fg); text-decoration: none; font-weight: 600; }
.btn:hover { border-color: color-mix(in oklab, var(--accent) 60%, var(--border)); color: var(--accent); text-decoration: none; }
.btn.block { display: flex; justify-content: center; width: 100%; }
.btn.ghost { background: transparent; }
.btn.accent { border-color: color-mix(in oklab, var(--accent) 50%, var(--border)); background: color-mix(in oklab, var(--accent) 10%, var(--bg)); }

.detail-main .section-title { margin: 18px 0 8px; font-size: 0.875rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }

@media (max-width: 980px) {
  .detail-layout { grid-template-columns: 1fr; }
  .detail-aside { position: static; }
}
