/* ============================================================
   Jiamao Liu — personal academic site
   Self-contained stylesheet.
   Palette: crisp white/blue background, deep blue accent.
   Headings: Source Serif 4 · Body: Inter (fonts self-hosted, so
   the site does not depend on Google Fonts from China).
   ============================================================ */

/* ---- Self-hosted variable fonts (latin subset) ---- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/latin-inter-normal-400.woff2') format('woff2');
  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: 'Source Serif 4';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/latin-sourceserif4-normal-variable.woff2') format('woff2');
  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: 'Source Serif 4';
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/latin-sourceserif4-italic-variable.woff2') format('woff2');
  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;
}

/* ---- Design tokens ---- */
:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --ink: #1a2332;
  --muted: #5b6b7c;
  --line: #dfe7f0;
  --accent: #0f4c81;
  --accent-deep: #0a3a63;
  --accent-soft: #e6eef6;
  --navy: #1f2a44;
  --radius: 12px;
  --maxw: 920px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
::selection {
  background: var(--accent-soft);
}
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Navigation ---- */
nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 249, 252, 0.9);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.nav-name {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.nav-name:hover {
  text-decoration: none;
  color: var(--accent);
}
.nav-links {
  display: flex;
  gap: 24px;
  font-size: 0.92rem;
  font-weight: 500;
}
.nav-links a {
  color: var(--muted);
}
.nav-links a:hover {
  color: var(--accent);
  text-decoration: none;
}
.nav-links a.active {
  color: var(--accent);
}
.nav-toggle {
  display: none;
  background: none;
  border: 0;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
}
@media (max-width: 720px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }
  .nav-links.open {
    display: flex;
  }
  .nav-links a {
    padding: 14px 24px;
    border-top: 1px solid var(--line);
  }
  .nav-toggle {
    display: block;
  }
}

/* ---- Page header (inner pages) ---- */
.page-head {
  padding: 54px 0 8px;
}
.page-head .sec-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.page-head h1 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.page-head p {
  color: var(--muted);
  margin-top: 10px;
  max-width: 60ch;
}
.page-head p sup {
  color: var(--accent);
  font-weight: 600;
}

/* ---- Hero (home) ---- */
header.hero {
  padding: 72px 0 60px;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 48px;
  align-items: center;
}
.hero h1 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 3rem;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 600;
}
.hero .role {
  color: var(--accent);
  font-weight: 600;
  margin-top: 6px;
  font-size: 1.05rem;
}
.hero .tagline {
  color: var(--muted);
  font-size: 1.12rem;
  margin-top: 18px;
  max-width: 46ch;
}
.hero-photo img {
  width: 300px;
  height: 300px;
  object-fit: cover;
  object-position: center 40%; /* slightly above center (50% = perfectly centred) */
  border-radius: 50%;
  border: 5px solid var(--surface);
  box-shadow: 0 12px 40px rgba(15, 76, 129, 0.18);
  display: block;
  margin: 0 auto;
}
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 9px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  transition: 0.15s;
  white-space: nowrap;
}
.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}
.btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn.primary:hover {
  background: var(--accent-deep);
  color: #fff;
}
.btn svg {
  width: 16px;
  height: 16px;
}
@media (max-width: 720px) {
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero .tagline {
    margin-left: auto;
    margin-right: auto;
  }
  .links {
    justify-content: center;
  }
  .hero h1 {
    font-size: 2.3rem;
  }
  .hero-photo {
    order: -1;
  }
  .hero-photo img {
    width: 220px;
    height: 220px;
  }
}

/* ---- Generic sections ---- */
section {
  padding: 40px 0;
  scroll-margin-top: 80px;
}
section + section {
  border-top: 1px solid var(--line);
}
.sec-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
h2 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 20px;
}
h3 {
  font-size: 1.08rem;
  font-weight: 600;
  margin-bottom: 6px;
}
p + p {
  margin-top: 14px;
}
.lead {
  font-size: 1.06rem;
}
.muted {
  color: var(--muted);
}
.note {
  color: var(--muted);
  font-size: 0.95rem;
}
.quote {
  font-family: 'Source Serif 4', Georgia, serif;
  font-style: italic;
  font-size: 1.15rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ---- Research themes ---- */
.themes {
  display: grid;
  gap: 18px;
}
.theme {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
}
.theme h3 {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.theme h3 span.n {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.5rem;
  color: var(--accent);
  font-weight: 600;
  line-height: 1;
}
.theme p {
  color: var(--muted);
  font-size: 0.97rem;
  margin-top: 8px;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}
.tag {
  font-size: 0.78rem;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
}

/* ---- Project / software cards ---- */
.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
}
.card p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 6px;
}
.card .plinks {
  margin-top: 12px;
}
.card.add {
  border-style: dashed;
  background: transparent;
  box-shadow: none;
}
.card.add h3 {
  color: var(--muted);
}
.card.poster-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.poster-imgs {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.poster-imgs .poster-thumb {
  display: block;
  flex: 1 1 240px;
  max-width: 340px;
}
.poster-imgs img {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: block;
  box-shadow: 0 2px 10px rgba(15, 76, 129, 0.06);
}
a.poster-thumb:hover img {
  box-shadow: 0 8px 20px rgba(15, 76, 129, 0.14);
}
.card.poster-card h3 {
  margin-bottom: 6px;
}
.card.poster-card p + p {
  margin-top: 4px;
}
.card.photo-card a img {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: block;
  box-shadow: 0 2px 10px rgba(15, 76, 129, 0.05);
}
.card .plinks a {
  font-size: 0.82rem;
  font-weight: 600;
}
@media (max-width: 680px) {
  .cards {
    grid-template-columns: 1fr;
  }
}

/* ---- Publications ---- */
.pubgroup {
  margin-bottom: 30px;
}
.pubgroup h2 {
  margin-bottom: 6px;
}
.pubgroup .count {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}
.pub {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.96rem;
}
.pub:last-child {
  border-bottom: 0;
}
.pub .ttl {
  font-weight: 600;
  color: var(--ink);
}
.pub .meta {
  color: var(--muted);
  margin-top: 3px;
  font-size: 0.92rem;
}
.pub .meta .venue {
  font-style: italic;
}
.pub b {
  color: var(--ink);
}
.pub .plinks {
  margin-top: 6px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.pub .plinks a {
  font-size: 0.82rem;
  font-weight: 600;
}
.idx {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
}

/* ---- Timeline-ish lists (talks / education / news) ---- */
.tlist {
  display: flex;
  flex-direction: column;
}
.titem {
  display: flex;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.titem:last-child {
  border-bottom: 0;
}
.titem .y {
  flex: 0 0 130px;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.92rem;
}
.titem .what .ev {
  font-weight: 600;
}
.titem .what .loc {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 2px;
}
@media (max-width: 680px) {
  .titem {
    flex-direction: column;
    gap: 4px;
  }
}

/* ---- Two-column mini lists (education / awards) ---- */
.cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 34px;
}
@media (max-width: 680px) {
  .cols {
    grid-template-columns: 1fr;
  }
}
.mini h3 {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.mini ul {
  list-style: none;
}
.mini li {
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.94rem;
  display: flex;
  justify-content: space-between;
  gap: 14px;
}
.mini li:last-child {
  border-bottom: 0;
}
.mini li .y {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
  font-size: 0.85rem;
}

/* ---- Skills chips ---- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 13px;
  font-size: 0.88rem;
  font-weight: 500;
}
.skill-cat {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 20px 0 10px;
}
.skill-cat + .chips + .skill-cat {
  margin-top: 22px;
}

/* ---- Publication timeline ---- */
.timeline {
  position: relative;
  padding-left: 2.6rem;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  border-radius: 1px;
  background: linear-gradient(to bottom, var(--accent), #a9c7e4);
}
.tl-year {
  position: relative;
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin: 2rem 0 0.9rem;
}
.tl-year:first-child {
  margin-top: 0;
}
.tl-year::before {
  content: "";
  position: absolute;
  top: 50%;
  left: calc(-2.6rem + 2px);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent);
  transform: translateY(-50%);
}
.pub-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(15, 76, 129, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.pub-card:hover {
  transform: translateX(5px);
  box-shadow: 0 8px 22px rgba(15, 76, 129, 0.08);
}
.pub-card .pub-title {
  font-weight: 600;
  font-size: 1.02rem;
  line-height: 1.45;
}
.pub-card .pub-authors {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 6px;
}
.pub-card .pub-authors b {
  color: var(--ink);
}
.pub-card .pub-authors sup {
  color: var(--accent);
  font-weight: 600;
}
.pub-card .pub-venue {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
  font-style: italic;
  margin-top: 6px;
}
.pub-card .pub-summary {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 9px;
  line-height: 1.6;
}
.pub-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.86rem;
  font-weight: 600;
}
.pub-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}
.pub-flags .flag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 10px;
  border-radius: 20px;
}
.flag.published {
  background: var(--accent-soft);
  color: var(--accent);
}
.flag.preprint {
  background: #eef2fa;
  color: #2b4a86;
}
.flag.submitted {
  background: #eef2ee;
  color: #3c5a45;
}
.flag.first {
  background: #eef1f6;
  color: #47566a;
}
.tl-note {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 10px;
}

/* ---- Contact box ---- */
.contact-box {
  background: var(--accent-soft);
  border: 1px solid #cfe0f0;
  color: var(--ink);
  border-radius: var(--radius);
  padding: 34px 36px;
  text-align: center;
  margin-top: 20px;
}
.contact-box h2 {
  color: var(--accent);
}
.contact-box p {
  color: var(--muted);
}
.contact-box a {
  color: var(--accent);
  font-weight: 600;
}
.contact-links {
  display: flex;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
  margin-top: 18px;
  font-weight: 600;
}

/* ---- Footer ---- */
footer {
  padding: 30px 0 50px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
  margin-top: 20px;
}

/* ---- Inline PDF viewer (CV page) ---- */
.cv-headline {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 34px;
}
.cv-headline h1 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.1;
}
.cv-headline .cv-meta {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 6px;
}
.cv-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.viewer {
  margin: 22px 0 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  height: calc(100vh - 250px);
  min-height: 520px;
}
.viewer embed,
.viewer object,
.viewer iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
.cv-fallback {
  margin: 8px 0 34px;
  font-size: 0.9rem;
  color: var(--muted);
}
@media (max-width: 720px) {
  .cv-headline {
    flex-direction: column;
    align-items: flex-start;
  }
  .viewer {
    height: calc(100vh - 320px);
    min-height: 420px;
  }
}

/* ---- Print (useful for the CV page) ---- */
@media print {
  nav,
  .no-print {
    display: none !important;
  }
  body {
    background: #fff;
  }
  section {
    break-inside: avoid;
    padding: 16px 0;
  }
  section + section {
    border-top: 1px solid #e0e0e0;
  }
  .page-head {
    padding: 0 0 8px;
  }
}
