/* ============================================================
   PhD website — styles
   ✏️ 想换主题色：只改下面的 --accent 即可
   ============================================================ */

:root {
  --accent: #00274c;          /* Michigan blue */
  --accent-2: #2f6fd1;        /* blue highlight (section underlines, card numbers) */
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #1d1f23;
  --muted: #646a73;
  --border: #e6e3dc;
  --tag-bg: #f1f3f6;
  --link: #1f5fa8;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  --serif: "Source Serif 4", Georgia, "Songti SC", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --maxw: 920px;
}

[data-theme="dark"] {
  --accent: #9fc3ec;
  --accent-2: #7fb2f0;
  --bg: #111214;
  --surface: #18191c;
  --text: #ececee;
  --muted: #9a9ea6;
  --border: #2c2e33;
  --tag-bg: #212327;
  --link: #8ab8ee;
  --shadow: none;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background .2s, color .2s;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; }

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

/* ---------- Top navigation: liquid glass ---------- */
:root {
  /* ✏️ 透明度调这三个：--glass-bg 越小越透，--glass-blur 越小背后越清晰 */
  --glass-bg: linear-gradient(180deg, rgba(255,255,255,.66), rgba(255,255,255,.52));
  --glass-blur: 2px;
  --glass-sheen: rgba(255,255,255,.12);
  --glass-sheet-bg: rgba(255,255,255,.55);   /* mobile dropdown: needs more cover so links stay readable */
  --nav-halo: 0 0 6px rgba(255,255,255,.95), 0 0 2px rgba(255,255,255,.9);
  /* ✏️ 边框的彩虹色：--glass-iris-stops 是一圈色环，--glass-rim-width 是玻璃边的厚度 */
  --glass-rim-width: 1.6px;
  --glass-iris-stops:
      #ffffff 0deg, #ffd1e8 40deg, #c9b8ff 85deg, #9fe3ff 130deg, #ffffff 175deg,
      #b8ffd9 220deg, #fff3a8 265deg, #ffc7b0 310deg, #ffffff 360deg;
  --glass-rim-light: linear-gradient(160deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 35%, rgba(255,255,255,0) 65%, rgba(255,255,255,.9) 100%);
  --glass-shadow:
    /* thickness: lit top-left bevel, shaded bottom-right bevel */
    inset 1.5px 2px 1px -0.5px rgba(255,255,255,.95),
    inset -1.5px -2px 2px -0.5px rgba(0,30,60,.10),
    /* dispersion: warm fringe on the left, cool fringe on the right */
    inset 6px 0 10px -6px rgba(255,90,170,.28),
    inset -6px 0 10px -6px rgba(60,170,255,.30),
    inset 0 -6px 10px -7px rgba(120,255,200,.25),
    /* glow inside the rim, outline, drop shadow */
    inset 0 0 14px rgba(255,255,255,.35),
    0 0 0 .5px rgba(0,30,60,.12),
    0 8px 28px rgba(0,30,60,.12),
    0 1px 3px rgba(0,0,0,.06);
  --pill-bg: rgba(0,39,76,.07);
  --pill-shadow: inset 0 1px 1px rgba(255,255,255,.8), inset 0 -1px 2px rgba(0,39,76,.06), 0 1px 4px rgba(0,39,76,.08);
}
[data-theme="dark"] {
  --glass-bg: linear-gradient(180deg, rgba(40,44,52,.66), rgba(24,27,32,.55));
  --glass-sheen: rgba(255,255,255,.04);
  --glass-sheet-bg: rgba(24,27,32,.6);
  --nav-halo: 0 0 6px rgba(0,0,0,.9), 0 0 2px rgba(0,0,0,.8);
  --glass-iris-stops:
      #ffffff99 0deg, #ff7ac6 40deg, #8f7bff 85deg, #4fd2ff 130deg, #ffffff99 175deg,
      #5dffb0 220deg, #ffe066 265deg, #ff8a65 310deg, #ffffff99 360deg;
  --glass-rim-light: linear-gradient(160deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,0) 35%, rgba(255,255,255,0) 65%, rgba(255,255,255,.35) 100%);
  --glass-shadow:
    inset 1.5px 2px 1px -0.5px rgba(255,255,255,.28),
    inset -1.5px -2px 2px -0.5px rgba(0,0,0,.5),
    inset 6px 0 10px -6px rgba(255,90,170,.30),
    inset -6px 0 10px -6px rgba(60,170,255,.32),
    inset 0 0 14px rgba(255,255,255,.06),
    0 0 0 .5px rgba(255,255,255,.10),
    0 8px 30px rgba(0,0,0,.45);
  --pill-bg: rgba(255,255,255,.10);
  --pill-shadow: inset 0 1px 1px rgba(255,255,255,.18), 0 1px 4px rgba(0,0,0,.3);
}

.topbar {
  position: sticky; top: 12px; z-index: 10;
  padding: 0 16px; pointer-events: none;   /* only the pill itself is clickable */
}
.nav {
  pointer-events: auto;
  position: relative; isolation: isolate;
  max-width: calc(var(--maxw) - 16px); margin: 0 auto; padding: 0 8px 0 8px;
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  border-radius: 999px;
  box-shadow: var(--glass-shadow);
  transition: box-shadow .3s;
}
/* The glass itself lives on its own layer, so the name lens inside the bar can refract too
   (an element with backdrop-filter hides the page from the backdrop-filters of its children) */
.nav-glass {
  position: absolute; inset: 0; border-radius: inherit; z-index: -2; pointer-events: none;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
}
/* Glass rim: iridescent ring + white specular highlights on the top-left and bottom-right.
   The color ring slowly turns, like light moving across a glass edge. */
@property --rim-angle { syntax: "<angle>"; inherits: true; initial-value: 0deg; }
@keyframes rim-spin { to { --rim-angle: 360deg; } }
.nav::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: var(--glass-rim-width);
  background: var(--glass-rim-light), conic-gradient(from var(--rim-angle), var(--glass-iris-stops));
  animation: rim-spin 14s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none; z-index: -1;
}
/* Soft sheen across the upper half */
.nav::after {
  content: ""; position: absolute; inset: 1px 1px 50% 1px; border-radius: 999px 999px 40% 40% / 999px 999px 100% 100%;
  background: linear-gradient(180deg, var(--glass-sheen), transparent);
  pointer-events: none; z-index: -1;
}
.topbar.scrolled .nav { box-shadow: var(--glass-shadow), 0 12px 40px rgba(0,30,60,.10); }

/* Chromium: real refraction through the SVG displacement filter defined in index.html */
.refract .nav-glass {
  backdrop-filter: url(#liquid-glass) saturate(150%);
}

@media (prefers-reduced-motion: reduce) { .nav::before { animation: none; } }

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .nav-glass { background: color-mix(in srgb, var(--bg) 94%, transparent); }
}

.brand { font-family: var(--serif); font-weight: 600; font-size: 1.12rem; color: var(--text); white-space: nowrap; text-shadow: var(--nav-halo); }
.brand:hover { text-decoration: none; }
/* Name sits straight on the bar's glass, so the bar's refraction runs right under it */
.brand {
  position: relative; padding: 8px 18px; border-radius: 999px; line-height: 1.2;
}
.nav-links { list-style: none; display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; }
.nav-links a {
  position: relative; z-index: 1;
  display: block; padding: 7px 14px; border-radius: 999px;
  color: var(--muted); font-size: .9rem; font-weight: 500;
  text-shadow: var(--nav-halo);
  transition: color .25s;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
/* Current section: no pill, just colored bold text */
.nav-links a.active { color: #c4b5fd; font-weight: 700; text-decoration: none; }
/* Reserve the bold width so neighbors don't shift when a link turns bold */
.nav-links a[data-label]::after {
  content: attr(data-label); display: block; height: 0; overflow: hidden; visibility: hidden;
  font-weight: 700;
}
.nav-indicator { display: none; }

/* Sliding glass pill behind the current / hovered link (positioned by main.js) */
.nav-indicator {
  position: absolute; top: 0; left: 0; height: 36px; width: 0; z-index: 0;
  border-radius: 999px; background: var(--pill-bg); box-shadow: var(--pill-shadow);
  opacity: 0; pointer-events: none;
  transition:
    transform .5s cubic-bezier(.34,1.45,.64,1),
    width .5s cubic-bezier(.34,1.45,.64,1),
    opacity .25s;
}

.nav-indicator::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: conic-gradient(from 200deg, var(--glass-iris-stops));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: .9;
}

.theme-toggle {
  display: grid; place-items: center; width: 38px; height: 38px; margin-left: 6px;
  border: 0; border-radius: 50%; cursor: pointer; color: var(--muted);
  background: var(--pill-bg); box-shadow: var(--pill-shadow);
  transition: color .2s, transform .2s;
}
.theme-toggle:hover { color: var(--text); transform: scale(1.06); }
.theme-toggle:active { transform: scale(.94); }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

.menu-toggle { display: none; background: none; border: 0; padding: 8px 12px; cursor: pointer; }
.menu-toggle span { display: block; width: 20px; height: 2px; margin: 4px 0; border-radius: 2px; background: var(--text); transition: transform .25s, opacity .2s; }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Sections ---------- */
section { padding: 85px 0 8px; }
section h2 {
  font-size: 1.6rem; margin: 0 0 20px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border); position: relative;
}
section h2::after {
  content: ""; position: absolute; left: 0; bottom: -1px;
  width: 44px; height: 3px; background: var(--accent-2); border-radius: 2px;
}
.section-lead { color: var(--muted); max-width: 70ch; margin-top: 0; }
.muted { color: var(--muted); }

/* ---------- Hero / About ---------- */
.hero { padding-top: 64px; }
.avatar {
  display: block; margin-bottom: 20px;
  width: 140px; height: 140px; object-fit: cover; border-radius: 50%;
  border: 4px solid var(--surface); box-shadow: var(--shadow), 0 0 0 1px var(--border);
}
.links { list-style: none; padding: 0; margin: -6px 0 22px; display: flex; gap: 6px; flex-wrap: wrap; }
.links a {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  color: var(--muted); border: 1px solid var(--border); transition: .15s;
}
.links a:hover { color: var(--surface); background: var(--accent); border-color: var(--accent); }
[data-theme="dark"] .links a:hover { color: var(--bg); }

.intro h1 { font-size: 2.4rem; margin: 0 0 6px; }
.native-name { font-size: 1.3rem; color: var(--muted); font-weight: 400; margin-left: 8px; }
.role { color: var(--muted); margin: 0 0 20px; font-size: .98rem; }
.intro p { margin: 0 0 14px; }
.callout {
  background: color-mix(in srgb, var(--text) 11%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--text) 14%, var(--border));
  border-left: 2px solid color-mix(in srgb, var(--accent) 70%, var(--border));
  padding: 10px 14px; border-radius: 0 8px 8px 0;
}
.interests { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.tag { background: var(--tag-bg); color: var(--text); font-size: .82rem; padding: 4px 12px; border-radius: 999px; }

/* ---------- News ---------- */
.news-list { list-style: none; padding: 0; margin: 0; }
.news-list li { display: grid; grid-template-columns: 92px 1fr; gap: 16px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.news-list li:last-child { border-bottom: 0; }
.news-list time { font-weight: 600; color: var(--accent); font-size: .9rem; padding-top: 1px; font-variant-numeric: tabular-nums; }
.news-list li.collapsed { display: none; }
.show-more, .filter, .bib-toggle {
  font: inherit; cursor: pointer; background: transparent; color: var(--link);
  border: 1px solid var(--border); border-radius: 6px;
}
.show-more { margin-top: 12px; padding: 4px 12px; font-size: .88rem; }
.show-more:hover { background: var(--tag-bg); }

/* ---------- Research cards ---------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 8px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.card-num { font-family: var(--serif); font-size: 1.5rem; color: var(--accent-2); font-weight: 600; }
.card h3 { margin: 6px 0 8px; font-size: 1.12rem; }
.card p { margin: 0 0 14px; color: var(--muted); font-size: .93rem; flex: 1; }
.card-link { font-size: .9rem; font-weight: 500; }

/* ---------- Publications ---------- */
.pub-note { color: var(--muted); font-size: .88rem; margin: -6px 0 16px; }
/* Pointer to the design portfolio under the project list */
.more-link { color: var(--muted); font-size: .93rem; margin: 10px 0 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.filter { padding: 4px 14px; font-size: .86rem; color: var(--muted); border-radius: 999px; }
.filter:hover { color: var(--text); }
.filter.active { background: var(--accent); border-color: var(--accent); color: var(--surface); }
[data-theme="dark"] .filter.active { color: var(--bg); }

.year { font-size: 1.05rem; color: var(--muted); margin: 26px 0 6px; font-family: var(--sans); font-weight: 600; letter-spacing: .02em; }
.pub-list { list-style: none; padding: 0; margin: 0; }
.pub { display: grid; grid-template-columns: 96px 1fr; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.pub:last-child { border-bottom: 0; }
.pub.hidden { display: none; }
.venue-badge {
  align-self: start; text-align: center; font-size: .74rem; font-weight: 600; letter-spacing: .03em;
  padding: 4px 6px; border-radius: 6px; background: var(--accent); color: #fff; margin-top: 3px;
}
[data-theme="dark"] .venue-badge { color: var(--bg); }
.venue-badge.journal { background: #2f7d5b; color: #fff; }
.venue-badge.preprint { background: var(--tag-bg); color: var(--muted); }
.pub-title { font-weight: 600; font-size: 1.02rem; line-height: 1.45; }
.pub-authors { font-size: .93rem; color: var(--muted); }
.pub-authors .me { color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent-2); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.pub-venue { font-size: .93rem; }
.award { display: inline-block; font-size: .74rem; font-weight: 600; color: #a6461c; background: #fdeee4; padding: 0 8px; border-radius: 999px; margin-left: 6px; }
[data-theme="dark"] .award { color: #ffb489; background: #3a2418; }
.pub-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pub-links a, .bib-toggle {
  font-size: .78rem; font-weight: 500; padding: 1px 10px; border: 1px solid var(--border);
  border-radius: 6px; color: var(--link); line-height: 1.8;
}
.pub-links a:hover, .bib-toggle:hover { background: var(--tag-bg); text-decoration: none; }
.bibtex {
  font: .78rem/1.55 var(--mono); background: var(--tag-bg); padding: 12px 14px; border-radius: 8px;
  overflow-x: auto; margin: 10px 0 0; position: relative; white-space: pre;
}
.empty-state { color: var(--muted); font-style: italic; }

/* ---------- Teaching ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.sub { font-size: 1.1rem; margin: 6px 0 8px; }
.plain-list { padding-left: 18px; margin: 0 0 18px; }
.plain-list li { margin-bottom: 6px; }

/* ---------- Contact & Footer ---------- */
.contact { padding-bottom: 40px; }
.footer { border-top: 1px solid var(--border); text-align: center; color: var(--muted); font-size: .85rem; padding: 22px; margin-top: 32px; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .cards { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 680px) {
  .menu-toggle { display: block; }
  .topbar { padding: 0 12px; }
  .nav { height: 52px; padding: 0 4px 0 6px; }
  .nav-indicator { display: none; }
  /* Dropdown is its own glass sheet under the pill */
  .nav-links {
    position: absolute; top: calc(100% + 10px); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 10px; border-radius: 24px;
    background: var(--glass-sheet-bg);
    backdrop-filter: blur(14px) saturate(180%); -webkit-backdrop-filter: blur(14px) saturate(180%);
    box-shadow: var(--glass-shadow);
    opacity: 0; visibility: hidden; transform: translateY(-8px) scale(.97); transform-origin: top center;
    transition: opacity .25s, transform .35s cubic-bezier(.34,1.45,.64,1), visibility .25s;
  }
  .nav-links.open { opacity: 1; visibility: visible; transform: none; }
  .nav-links a { padding: 11px 16px; }
  .theme-toggle { margin: 6px 0 2px 10px; }

  .hero { padding-top: 40px; }
  .avatar { width: 120px; height: 120px; }
  .intro h1 { font-size: 2rem; }

  .news-list li { grid-template-columns: 1fr; gap: 0; }
  .pub { grid-template-columns: 1fr; gap: 8px; }
  .venue-badge { justify-self: start; }
}

@media print {
  .topbar, .filters, .theme-toggle, .bib-toggle, .show-more { display: none !important; }
  .news-list li.collapsed { display: grid; }
  body { background: #fff; }
}

/* ---------- Education & Research Experience timeline ---------- */
.timeline { list-style: none; margin: 0 0 22px; padding: 0 0 0 20px; border-left: 2px solid var(--border); }
.timeline > li { position: relative; padding: 0 0 18px; }
.timeline > li:last-child { padding-bottom: 4px; }
.timeline > li::before {
  content: ""; position: absolute; left: -27px; top: 8px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.tl-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tl-head .muted { font-size: .9rem; font-variant-numeric: tabular-nums; }
.bullets { margin: 6px 0 0; padding-left: 18px; font-size: .95rem; }
.bullets li { margin-bottom: 3px; }

/* ---------- Project descriptions ---------- */
.proj-desc { margin: 6px 0 0; font-size: .93rem; color: var(--muted); max-width: 68ch; }
