/* Zanlin Ni — homepage styles. */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-wght-normal.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: "Inter";
  src: url("../fonts/inter-latin-wght-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  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;
}

/* ------------------------------------------------------------------ tokens */

:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;

  --bg: #ffffff;
  --surface: #f6f7f9;
  --text: #16191d;
  --text-2: #464d59;
  --muted: #6b7280;
  --rule: #e6e8ec;
  --accent: #1f4f99;
  --accent-strong: #163c78;
  --award-bg: #fbf0dc;
  --award-fg: #85480a;

  --page-max: 760px;
  --fs: 16px;
  --lh: 1.65;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #161a20;
    --text: #e7e9ec;
    --text-2: #b4bac4;
    --muted: #8a919d;
    --rule: #262b33;
    --accent: #8db2f5;
    --accent-strong: #b3cbf8;
    --award-bg: #3a2b14;
    --award-fg: #f0c47e;
  }
}

html[lang="zh-CN"] { --lh: 1.8; }

/* -------------------------------------------------------------------- base */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 76px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs);
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

p { margin: 0; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4 { color: var(--text); }
strong { font-weight: 600; }

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  z-index: 20;
}
.skip-link:focus { top: 12px; }

/* ------------------------------------------------------------------ topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(12px);
  backdrop-filter: saturate(1.5) blur(12px);
  border-bottom: 1px solid var(--rule);
}

.topbar-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { color: var(--text); font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.brand:hover { color: var(--text); text-decoration: none; }

.nav { display: flex; align-items: center; gap: 2px; }
.nav a {
  color: var(--text-2);
  font-size: 15px;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
.nav .lang-switch { margin-left: 8px; border: 1px solid var(--rule); font-size: 14px; padding: 4px 10px; }

/* ------------------------------------------------------------------ layout */

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

body:not(.page-home) .profile { display: none; }

/* ----------------------------------------------------------------- profile */

.profile { display: flex; align-items: center; gap: 28px; margin-bottom: 32px; }

.portrait {
  width: 136px;
  height: 136px;
  flex: none;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 0 0 1px var(--rule);
}

.profile-text { min-width: 0; }

.name { margin: 0; font-size: 32px; line-height: 1.2; font-weight: 650; letter-spacing: -0.02em; }

.alt-name {
  margin-left: 8px;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
  white-space: nowrap;
}

.role { margin: 6px 0 14px; color: var(--text-2); font-size: 16.5px; }
.role span { white-space: nowrap; }

.contact {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  font-size: 15px;
}
.contact a { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); }
.contact a:hover { color: var(--accent); text-decoration: none; }
.contact svg { width: 16px; height: 16px; flex: none; }
.contact span { overflow-wrap: anywhere; }

/* ----------------------------------------------------------- page content */

.bio p { font-size: 16.5px; }
.bio p + p { margin-top: 12px; }
.bio a, .news-list a, .entry a, .section > p a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.bio a:hover, .news-list a:hover, .entry a:hover, .section > p a:hover { text-decoration-color: currentColor; }

.page-title { margin: 0 0 8px; font-size: 30px; line-height: 1.25; font-weight: 650; letter-spacing: -0.02em; }

.section { margin-top: 52px; }
.section h2 { margin: 0 0 16px; font-size: 20px; line-height: 1.3; font-weight: 650; letter-spacing: -0.01em; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.section-head h2 { margin: 0; }
.more { font-size: 15px; white-space: nowrap; }
.section-note { color: var(--muted); font-size: 14px; }

/* -------------------------------------------------------------------- news */

.news-list { list-style: none; margin: 0; padding: 0; }
.news-list li { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 16px; padding: 6px 0; }
.news-list time {
  color: var(--muted);
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-top: 1px;
}

/* ------------------------------------------------------------ publications */

.pub { padding: 14px 0; border-top: 1px solid var(--rule); }
.pub-list > .pub:first-child { border-top: 0; }

.pub-title { margin: 0 0 3px; font-size: 16px; line-height: 1.4; font-weight: 600; letter-spacing: -0.005em; }
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); }

.pub-authors { color: var(--text-2); font-size: 14.5px; line-height: 1.55; }
.pub-authors .me { color: var(--text); font-weight: 600; }

.pub-meta { margin-top: 5px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px; }
.venue { color: var(--text); font-weight: 600; }
.venue-note { color: var(--muted); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 12.5px;
  line-height: 20px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-award { background: var(--award-bg); color: var(--award-fg); }
.badge-detail { font-weight: 500; font-variant-numeric: tabular-nums; }
.badge-oral { color: var(--text-2); box-shadow: inset 0 0 0 1px var(--rule); }

.pub-links { display: inline-flex; flex-wrap: wrap; gap: 2px 14px; margin-left: 4px; font-weight: 500; }
.pub-links::before { content: "·"; color: var(--muted); margin-right: -4px; font-weight: 400; }

/* ---------------------------------------------------------------------- cv */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 20px;
  padding: 12px 0;
  border-top: 1px solid var(--rule);
}
.timeline li:first-child { border-top: 0; padding-top: 0; }
.timeline--honors li { padding: 8px 0; }
.period { color: var(--muted); font-size: 14.5px; font-variant-numeric: tabular-nums; padding-top: 1px; }
.entry-title { font-weight: 600; }
.entry-org { color: var(--text-2); }
.entry-detail { margin-top: 4px; color: var(--text-2); font-size: 15px; }

/* ------------------------------------------------------------------ footer */

.footer { margin-top: 72px; border-top: 1px solid var(--rule); }
.footer-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 20px 24px 36px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  color: var(--muted);
  font-size: 13.5px;
}

/* ------------------------------------------------------------------ mobile */

@media (max-width: 640px) {
  :root { --fs: 15.5px; }

  .topbar-inner { padding: 0 16px; height: 52px; gap: 8px; }
  .nav .nav-home { display: none; }
  .nav a { padding: 6px 8px; font-size: 14.5px; }
  .nav .lang-switch { margin-left: 4px; }

  .layout { padding: 32px 20px 16px; }

  .profile {
    display: grid;
    grid-template-columns: clamp(104px, 31vw, 128px) minmax(0, 1fr);
    column-gap: 18px;
    row-gap: 0;
    margin-bottom: 26px;
  }
  /* Let the contacts use the full width below the portrait and identity. */
  .profile-text { display: contents; }
  .portrait { grid-row: 1 / 3; width: 100%; height: auto; aspect-ratio: 1; border-radius: 12px; }
  .name, .role { grid-column: 2; }
  .name { grid-row: 1; align-self: end; font-size: 25px; }
  .alt-name { display: block; margin: 2px 0 0; font-size: 16px; }
  .role { grid-row: 2; align-self: start; margin: 6px 0 0; font-size: 15px; }
  .role span { display: block; }
  .role .sep { display: none; }
  .contact { grid-column: 1 / -1; margin-top: 16px; gap: 0 24px; font-size: 14.5px; }
  .contact li:first-child { flex-basis: 100%; }
  .contact a { min-height: 32px; }

  .bio p { font-size: 15.5px; }
  .section { margin-top: 40px; }
  .page-title { font-size: 26px; }

  .news-list li { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 7px 0; }
  .news-list time { font-size: 13.5px; }

  .pub-title { font-size: 15.5px; }
  .pub-links { flex-basis: 100%; margin-left: 0; }
  .pub-links::before { content: none; }

  .timeline li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
