/* Manni Cui — personal homepage
   Type: Newsreader (headings, titles) + IBM Plex Sans (text). Fonts are self-hosted
   so the page loads the same from anywhere, including mainland China. */

@font-face { font-family: "Newsreader"; src: url("../fonts/Newsreader16pt-Regular.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("../fonts/Newsreader16pt-Medium.woff") format("woff"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("../fonts/Newsreader16pt-Italic.woff") format("woff"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Newsreader Display"; src: url("../fonts/Newsreader72pt-Regular.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/IBMPlexSans-Regular-Latin1.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/IBMPlexSans-Italic-Latin1.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/IBMPlexSans-Medium-Latin1.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/IBMPlexSans-SemiBold-Latin1.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --ink: #1B1E26;
  --muted: #5A6070;
  --faint: #8A90A0;
  --rule: #DCDFE6;
  --real: #2F4FD6;      /* cobalt: the "real" end of the path */
  --gen: #B23A8F;       /* orchid: the "generated" end */
  --link: #2F4FD6;
  --link-hover: #B23A8F;
  --sans: "IBM Plex Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", system-ui, sans-serif;
  --serif: "Newsreader", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "STSong", Georgia, serif;
  --display: "Newsreader Display", "Newsreader", "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  --measure: 46rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12141A;
    --surface: #1A1D25;
    --ink: #E7E9EE;
    --muted: #9AA1B2;
    --faint: #757C8D;
    --rule: #2A2E38;
    --real: #7D95FF;
    --gen: #E07BC6;
    --link: #8FA4FF;
    --link-hover: #E07BC6;
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.62;
  font-feature-settings: "kern", "liga";
  text-rendering: optimizeLegibility;
}
html[lang="zh-CN"] body { line-height: 1.8; letter-spacing: 0.01em; }

a { color: var(--link); text-decoration: none; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--link-hover); text-decoration: underline; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--real); outline-offset: 3px; border-radius: 3px; }

img { max-width: 100%; display: block; }

.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: .4rem .7rem; z-index: 10; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  max-width: var(--measure); margin: 0 auto; padding: .7rem 1.25rem;
  display: flex; align-items: center; gap: 1.5rem;
}
.wordmark { font-family: var(--serif); font-size: 1.12rem; color: var(--ink); font-weight: 500; white-space: nowrap; }
.wordmark:hover { color: var(--ink); text-decoration: none; }
.nav { display: flex; gap: 1rem; margin-left: auto; font-size: .88rem; white-space: nowrap; }
.nav a { color: var(--muted); }
.nav a:hover { color: var(--ink); text-decoration: none; }
.lang {
  font-size: .86rem; color: var(--ink); white-space: nowrap;
  border: 1px solid var(--rule); border-radius: 999px; padding: .16rem .7rem;
  background: var(--surface);
}
.lang:hover { color: var(--ink); border-color: var(--real); text-decoration: none; }
.lang span { color: var(--faint); }

/* ---------- page ---------- */
main { max-width: var(--measure); margin: 0 auto; padding: 0 1.25rem 4rem; }

.hero { padding-top: 3.5rem; }
.portrait {
  width: 9.5rem; height: auto; aspect-ratio: 4 / 5; object-fit: cover;
  border-radius: 10px; background: var(--surface);
  box-shadow: 0 0 0 1px var(--rule);
}
.name {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(2.3rem, 5.4vw, 3.05rem); line-height: 1.02;
  letter-spacing: -0.012em; margin: .1rem 0 .55rem;
}
.name .alt { font-family: var(--serif); color: var(--muted); font-size: .62em; letter-spacing: .04em; margin-left: .35em; white-space: nowrap; }
.role { margin: 0 0 1rem; color: var(--muted); font-size: .98rem; }
.bio p { margin: 0 0 .8rem; max-width: 38rem; }
.bio strong { font-weight: 600; }

.emails { display: flex; align-items: flex-start; gap: .55rem; margin: 1.1rem 0 0; font-size: .95rem; }
.emails svg { width: 1.05rem; height: 1.05rem; color: var(--muted); flex: none; margin-top: .22rem; }
.emails .addr { display: flex; flex-wrap: wrap; gap: .1rem .45rem; }
.emails .sep { color: var(--faint); }
.contact { display: flex; flex-wrap: wrap; gap: .5rem .55rem; margin-top: .8rem; padding: 0; list-style: none; }
.contact a {
  display: inline-flex; align-items: center; gap: .42rem;
  font-size: .9rem; color: var(--ink); padding: .3rem .72rem;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--surface);
}
.contact a:hover { border-color: var(--real); color: var(--real); text-decoration: none; }
.contact svg { width: 1rem; height: 1rem; flex: none; }

/* the real → generated strip: the page's one signature element */
.path {
  display: grid; grid-template-columns: repeat(32, 1fr); gap: 4px;
  margin: 2.6rem 0 0; height: 10px;
}
.path i { display: block; border-radius: 2px; background: color-mix(in oklab, var(--gen) var(--p), var(--real)); }
@media (prefers-reduced-motion: no-preference) {
  .path i { animation: settle .9s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--k) * 22ms + 150ms); }
  @keyframes settle { from { opacity: 0; transform: translateY(-5px) scaleY(.4); } to { opacity: 1; transform: none; } }
}
.path-caption { display: flex; justify-content: space-between; font-size: .78rem; color: var(--faint); margin-top: .35rem; }

/* ---------- sections ---------- */
section { padding-top: 2.6rem; }
h2 {
  font-family: var(--serif); font-weight: 500; font-size: 1.62rem; line-height: 1.2;
  margin: 0 0 1.1rem; letter-spacing: -0.005em;
}
html[lang="zh-CN"] h2 { letter-spacing: .04em; }

/* news */
.news { list-style: none; margin: 0; padding: 0; }
.news li { display: grid; grid-template-columns: 5.6rem 1fr; gap: 1rem; padding: .32rem 0; }
.news time { color: var(--faint); font-variant-numeric: tabular-nums; font-size: .92rem; padding-top: .06rem; }

/* publications */
.pubs { list-style: none; margin: 0; padding: 0; }
.pub { padding: 1.5rem 0; border-top: 1px solid var(--rule); }
.pub:first-child { border-top: 0; padding-top: .2rem; }
.thumb {
  display: block; background: #FFFFFF; border-radius: 8px; overflow: hidden; padding: .55rem .7rem;
  box-shadow: 0 0 0 1px var(--rule); margin-bottom: .95rem;
}
.thumb img { width: 100%; height: auto; }
.thumb:hover { box-shadow: 0 0 0 1.5px var(--real); }
.pub-title { font-family: var(--serif); font-weight: 500; font-size: 1.16rem; line-height: 1.32; margin: 0 0 .35rem; }
.pub-title a { color: var(--ink); }
.pub-title a:hover { color: var(--real); }
.authors { margin: 0 0 .3rem; font-size: .92rem; color: var(--muted); line-height: 1.5; }
.authors .me { color: var(--ink); font-weight: 600; }
.venue { margin: 0 0 .45rem; font-size: .92rem; }
.venue em { font-style: normal; font-weight: 600; color: var(--real); }
.venue .pre { color: var(--muted); font-weight: 500; }
.links { margin: 0; font-size: .9rem; color: var(--faint); }
.links a { font-weight: 500; }
.links .sep { margin: 0 .4rem; }
.note { font-size: .82rem; color: var(--faint); margin: .9rem 0 0; }

/* timeline-style rows for education & experience */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: grid; grid-template-columns: 9.6rem 1fr; gap: 1rem; padding: .55rem 0; }
.rows time { color: var(--faint); font-size: .9rem; font-variant-numeric: tabular-nums; padding-top: .1rem; }
.rows .when { color: var(--faint); font-size: .9rem; padding-top: .1rem; }
.lede { margin: 0 0 .9rem; max-width: 40rem; }
.research .org { font-family: var(--serif); font-weight: 500; font-size: 1.12rem; }
.research .what a, .rows .org a { color: inherit; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: .2em; }
.research .what a:hover, .rows .org a:hover { color: var(--real); text-decoration-color: currentColor; }
.rows .org { font-weight: 600; }
.rows .what { color: var(--muted); font-size: .94rem; }
.rows .what + .what { margin-top: .1rem; }

.honors { margin: 0; padding-left: 1.1rem; }
.honors li { padding: .18rem 0; }
.honors li::marker { color: var(--gen); }

/* footer */
footer { max-width: var(--measure); margin: 0 auto; padding: 1.4rem 1.25rem 2.5rem; border-top: 1px solid var(--rule); color: var(--faint); font-size: .85rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---------- small screens ---------- */
@media (max-width: 720px) {
  .nav { display: none; }
  .lang { margin-left: auto; }
  .hero { padding-top: 2.2rem; }
  .portrait { width: 7.5rem; }
  .emails .addr { flex-direction: column; gap: .05rem; }
  .emails .sep { display: none; }
  .path { gap: 3px; height: 8px; margin-top: 2rem; }
  .thumb { padding: .35rem .4rem; }
  .news li { grid-template-columns: 1fr; gap: 0; padding: .45rem 0; }
  .rows li { grid-template-columns: 1fr; gap: .05rem; padding: .6rem 0; }
}
