/* =========================================================================
   Xiaoting Du — Academic Homepage
   Aesthetic: refined academic minimalism, single accent (BUPT red #C00000)
   No build step. Plain CSS. Responsive down to ~360px.
   ========================================================================= */

/* ----- Design tokens ----- */
:root {
  --red:        #C00000;   /* BUPT red — the single accent */
  --red-soft:   #f7e9e9;   /* tinted background for highlight blocks */
  --red-line:   #e3bcbc;   /* subtle red borders */
  --ink:        #1a1a1a;   /* primary text */
  --ink-2:      #595959;   /* secondary text */
  --ink-3:      #8a8a8a;   /* tertiary / meta */
  --bg:         #ffffff;
  --bg-2:       #ffffff;   /* white cards on the warm canvas */
  --canvas:     #f7f5f0;   /* warm page canvas */
  --line:       #e7e6e1;   /* hairline dividers */
  --max:        920px;     /* content column width */
  --nav-h:      58px;

  --serif: "Spectral", "Noto Serif SC", Georgia, "Songti SC", serif;
  --sans:  "Source Sans 3", "Noto Sans SC", -apple-system, BlinkMacSystemFont,
           "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ----- Reset-ish ----- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.66;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; }

/* =========================================================================
   Top navigation
   ========================================================================= */
.nav {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h);
  z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  background: rgba(255,255,255,0.86);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav__brand {
  font-family: var(--serif); font-weight: 600; font-size: 19px;
  color: var(--ink); letter-spacing: .01em;
}
.nav__brand b { color: var(--red); }
.nav__links { display: flex; gap: 22px; align-items: center; }
.nav__links a {
  color: var(--ink-2); font-size: 14.5px; font-weight: 500;
  letter-spacing: .02em; padding: 4px 0; position: relative;
  text-decoration: none; transition: color .18s ease;
}
.nav__links a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -2px;
  height: 2px; background: var(--red); transition: right .22s ease;
}
.nav__links a:hover { color: var(--red); }
.nav__links a:hover::after,
.nav__links a.active::after { right: 0; }
.nav__links a.active { color: var(--ink); }

.nav__toggle {
  display: none; border: 0; background: none; cursor: pointer;
  width: 30px; height: 30px; padding: 4px;
}
.nav__toggle span {
  display: block; height: 2px; margin: 5px 0; background: var(--ink);
  transition: transform .25s ease, opacity .2s ease;
}
.nav.open .nav__toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav.open .nav__toggle span:nth-child(2) { opacity: 0; }
.nav.open .nav__toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =========================================================================
   Layout shell
   ========================================================================= */
main { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.section { padding: 60px 0 14px; }
.section + .section { border-top: 1px solid var(--line); }
.section h2 {
  font-size: 30px; margin: 0 0 28px; letter-spacing: -.015em;
  display: inline-flex; align-items: baseline; gap: 14px;
}
.section h2::before {
  content: ""; width: 30px; height: 4px; background: var(--red);
  align-self: center; border-radius: 3px;
}

/* =========================================================================
   Hero
   ========================================================================= */
.hero { padding-top: calc(var(--nav-h) + 40px); }
.hero__grid {
  display: grid; grid-template-columns: 212px 1fr; gap: 40px; align-items: start;
}
.hero__photo {
  width: 212px; border-radius: 12px; border: 6px solid #fff;
  box-shadow: 0 22px 48px -24px rgba(0,0,0,.45), 0 0 0 1px var(--line);
}
.hero__name {
  font-size: 40px; margin: 0 0 6px; letter-spacing: -.01em;
}
.hero__name .zh { font-size: 26px; color: var(--ink-2); margin-left: 10px; font-weight: 500; }
.hero__role { font-size: 18px; color: var(--ink); margin: 0 0 4px; font-weight: 600; }
.hero__affil { color: var(--ink-2); margin: 0 0 4px; }
.hero__affil a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--red-line); }
.hero__tags { margin: 12px 0 6px; }
.tag-pill {
  display: inline-block; font-size: 13px; color: var(--red);
  border: 1px solid var(--red-line); border-radius: 999px;
  padding: 2px 12px; background: var(--red-soft);
}
.hero__contact { margin: 14px 0 0; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hero__contact a { color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
.hero__contact a { transition: color .15s ease, transform .15s ease; }
.hero__contact a:hover { color: var(--red); text-decoration: none; transform: translateY(-2px); }
.hero__contact .ai, .hero__contact .icn { font-size: 22px; }

/* Prospective students — the one deliberately prominent block */
.callout {
  margin-top: 24px; padding: 18px 22px;
  background: var(--red-soft); border: 1px solid var(--red-line);
  border-left: 4px solid var(--red); border-radius: 10px;
  box-shadow: 0 16px 36px -26px rgba(192,0,0,.55);
}
.callout h3 { margin: 0 0 6px; font-size: 17px; color: var(--red); }
.callout p { margin: 0; color: var(--ink); font-size: 15.5px; }
.callout p + p { margin-top: 6px; color: var(--ink-2); }

/* =========================================================================
   News
   ========================================================================= */
.news { list-style: none; margin: 0; padding: 0; }
.news li { display: flex; gap: 14px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.news li:last-child { border-bottom: 0; }
.news time {
  flex: 0 0 84px; color: var(--red); font-weight: 600;
  font-variant-numeric: tabular-nums; font-size: 14.5px; padding-top: 2px;
}
.news span { color: var(--ink); }
.news .ev { display: inline-block; width: 22px; margin-right: 4px; text-align: center; font-style: normal; }
.todo { color: var(--ink-3); font-style: italic; }

/* =========================================================================
   About / generic prose
   ========================================================================= */
.prose p { margin: 0 0 14px; color: var(--ink); }
.zh-block { color: var(--ink-2); font-size: 14.5px; }
.cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 7px 0; border-bottom: 1px solid var(--line); display: flex; gap: 14px; }
.timeline li:last-child { border-bottom: 0; }
.timeline .yr { flex: 0 0 118px; color: var(--ink-2); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }

/* Research interest cards */
.interests { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 0 0 14px; }
.interest {
  border: 1px solid var(--line); border-top: 3px solid var(--red);
  border-radius: 10px; padding: 18px; background: #fff;
  box-shadow: 0 12px 30px -22px rgba(0,0,0,.35);
}
.interest h3 { font-size: 16px; margin: 0 0 4px; }
.interest p { margin: 0; font-size: 14px; color: var(--ink-2); }
.note { font-size: 14.5px; color: var(--ink-2); }

/* =========================================================================
   Publications
   ========================================================================= */
.pub-summary {
  font-size: 14.5px; color: var(--ink-2); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 4px; padding: 12px 16px; margin: 0 0 8px;
}
.year-head {
  font-family: var(--serif); font-weight: 600; font-size: 19px; color: var(--ink);
  margin: 22px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line);
}
.pub { display: flex; gap: 16px; padding: 13px 12px; align-items: baseline; margin: 0 -12px; border-radius: 8px; transition: background .16s ease, box-shadow .16s ease; }
.pub + .pub { border-top: 1px solid #edece6; }
.pub:hover { background: #fff; box-shadow: 0 12px 30px -18px rgba(0,0,0,.32); }
.pub:hover + .pub { border-top-color: transparent; }
.venue {
  flex: 0 0 94px; text-align: right; font-weight: 700; font-size: 12.5px;
  color: var(--red); letter-spacing: .02em; font-variant-numeric: tabular-nums; padding-top: 3px;
}
.venue a { color: var(--red); }
.pub__body { color: var(--ink); }
.pub__body .me { color: var(--red); font-weight: 700; }
.pub__body .title { font-weight: 600; color: var(--ink); }
.pub__body .viz { font-style: italic; color: var(--ink-2); }
.pub__body .award { color: var(--red); font-weight: 600; }
.pub.featured { background: linear-gradient(90deg, var(--red-soft), transparent 72%); border-radius: 8px; }
.pub__links a {
  font-size: 12.5px; border: 1px solid var(--red-line); color: var(--red);
  border-radius: 3px; padding: 0 6px; margin-left: 6px; white-space: nowrap;
}
.pub__links a:hover { background: var(--red); color: #fff; text-decoration: none; }

/* =========================================================================
   Generic lists (grants, teaching, students, awards, services)
   ========================================================================= */
.list { list-style: none; margin: 0 0 8px; padding: 0; }
.list > li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; gap: 12px; }
.list > li:last-child { border-bottom: 0; }
.list .bullet { color: var(--red); flex: 0 0 auto; }
.list .lead { font-weight: 600; color: var(--ink); }
.subhead { font-weight: 700; color: var(--red); margin: 22px 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
#services .list > li { padding: 6px 0; font-size: 14.5px; line-height: 1.55; }
#services .list .bullet { font-size: 12px; }
/* Teaching courses: two-column grid for balance */
#teaching .list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; }
#teaching .list > li { border-bottom: 0; padding: 7px 0; }
/* Two-column variant for short lists (e.g. journal reviewing) */
.list.cols2 { column-count: 2; column-gap: 44px; }
.list.cols2 > li { break-inside: avoid; }
.svc { display: grid; grid-template-columns: 150px 1fr; gap: 6px 16px; }
.svc dt { color: var(--red); font-weight: 600; font-size: 14.5px; }
.svc dd { margin: 0; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 3px; padding: 2px 8px; color: var(--ink-2); }
.stat-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; }
.stat { border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: 4px; padding: 8px 14px; background: var(--bg-2); }
.stat b { color: var(--red); font-size: 20px; font-family: var(--serif); }
.stat span { display: block; font-size: 13px; color: var(--ink-2); }

/* =========================================================================
   Footer
   ========================================================================= */
.foot { border-top: 1px solid var(--line); margin-top: 40px; padding: 26px 0 50px; color: var(--ink-3); font-size: 13.5px; text-align: center; }
.foot a { color: var(--ink-2); }

/* =========================================================================
   Scroll-reveal (progressive enhancement; visible by default if no JS)
   ========================================================================= */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }
/* Accessibility + safety: never keep content hidden when motion is reduced */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none; }
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 720px) {
  body { font-size: 16px; }
  .nav__toggle { display: block; }
  .nav__links {
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: #fff; border-bottom: 1px solid var(--line);
    padding: 6px 24px 14px; transform: translateY(-12px);
    opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  }
  .nav.open .nav__links { opacity: 1; transform: none; pointer-events: auto; }
  .nav__links a { width: 100%; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .nav__links a::after { display: none; }

  .hero { padding-top: calc(var(--nav-h) + 26px); }
  .hero__grid { grid-template-columns: 1fr; gap: 18px; justify-items: center; text-align: center; }
  .hero__photo { width: 168px; }
  .hero__name { font-size: 32px; }
  .hero__contact { justify-content: center; }
  .callout { text-align: left; }

  .cols { grid-template-columns: 1fr; gap: 18px; }
  .interests { grid-template-columns: 1fr; }
  #teaching .list { grid-template-columns: 1fr; }
  .list.cols2 { column-count: 1; }
  .svc { grid-template-columns: 1fr; gap: 2px 0; }
  .svc dt { margin-top: 8px; }

  .pub { flex-direction: column; gap: 4px; }
  .venue { flex: none; text-align: left; }
  .news li { flex-direction: column; gap: 0; }
  .news time { flex: none; }
}
