/* Qijun Zhu — personal academic website.
   Plain CSS, no build step. Colors are defined once below and redefined for dark mode. */

:root {
  --bg: #fbfaf7;
  --text: #1c1c1e;
  --muted: #5d5d63;
  --rule: #e3e0d8;
  --accent: #1e5b45;
  --accent-soft: #e6efe9;
  --header-bg: rgba(251, 250, 247, 0.92);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --measure: 46rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141618;
    --text: #e9e7e2;
    --muted: #a6a59f;
    --rule: #2b2e33;
    --accent: #8fd1b3;
    --accent-soft: #1c2a24;
    --header-bg: rgba(20, 22, 24, 0.92);
  }
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0.75rem;
  padding: 0.4rem 0.8rem;
  background: var(--accent);
  color: var(--bg);
  border-radius: 4px;
  z-index: 20;
}
.skip-link:focus { left: 1rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Header and navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}
.nav {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0.8rem 1.25rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.nav-name {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}
.nav-name {
  white-space: nowrap;
}
.nav-name:hover { text-decoration: none; }
.nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.25rem;
  font-size: 0.95rem;
}
.nav ul a { color: var(--muted); }
.nav ul a:hover { color: var(--accent); }

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

section {
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule);
}
section.intro,
section.about { border-top: none; }

.intro {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 3.25rem 0 1.25rem;
}
.portrait {
  flex: none;
  width: 9.5rem;
  height: 9.5rem;
  border-radius: 50%;
  object-fit: cover;
}
.portrait-placeholder {
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--serif);
  font-size: 2.6rem;
  letter-spacing: 0.04em;
}

h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 2.6rem;
  line-height: 1.1;
  margin: 0 0 0.45rem;
}
.role {
  margin: 0 0 0.7rem;
  color: var(--muted);
}
.market {
  display: inline-block;
  margin: 0 0 0.85rem;
  padding: 0.15rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 500;
}
.contact {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.2rem;
  font-size: 0.97rem;
}

.about p { margin: 0 0 0.9rem; }
.fields {
  color: var(--muted);
  font-size: 0.97rem;
}
.fields strong {
  color: var(--text);
  font-weight: 600;
  margin-right: 0.45rem;
}

h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.65rem;
  line-height: 1.2;
  margin: 0.5rem 0 0.75rem;
}
h3 {
  font-size: 1.03rem;
  line-height: 1.4;
  margin: 0 0 0.25rem;
}
h3.group {
  margin: 1.6rem 0 0.7rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
h4,
.project h3,
.entry h3 {
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.35;
  font-weight: 600;
  margin: 0 0 0.3rem;
}

.paper,
.project,
.entry { margin: 0 0 1.6rem; }
.paper p,
.project p,
.entry p { margin: 0.25rem 0; }

.authors,
.meta {
  color: var(--muted);
  font-size: 0.95rem;
}
.authors { font-style: italic; }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  font-size: 0.95rem;
}

.citation { margin: 0; }

.news {
  list-style: none;
  margin: 0;
  padding: 0;
}
.news li {
  display: grid;
  grid-template-columns: 5.75rem 1fr;
  gap: 1rem;
  padding: 0.3rem 0;
}
.news-date {
  color: var(--muted);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  padding-top: 0.05rem;
}

.entry.compact { margin-bottom: 1rem; }

.entry-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.date {
  flex: none;
  color: var(--muted);
  font-size: 0.95rem;
  white-space: nowrap;
}

.site-footer {
  max-width: var(--measure);
  margin: 1rem auto 0;
  padding: 0 1.25rem 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer p {
  margin: 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

/* 404 page */
.not-found {
  border-top: none;
  padding: 4.5rem 0 3rem;
}
.not-found h1 { margin-bottom: 1rem; }
.not-found p { margin: 0 0 1rem; }
.not-found .error-code {
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Phones */
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .intro {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
    padding-top: 2.25rem;
  }
  .portrait { width: 7rem; height: 7rem; }
  .portrait-placeholder { font-size: 2rem; }
  h1 { font-size: 2.1rem; }
  .nav { padding: 0.75rem 1rem; }
  .nav ul { gap: 0.9rem; }
  main { padding: 0 1rem; }
  .site-footer { padding: 0 1rem 2.5rem; }
}

/* Small phones: the name is already in the page heading, so the bar keeps only the section links */
@media (max-width: 480px) {
  .nav-name { display: none; }
  .nav { justify-content: center; }
  .nav ul { gap: 1.1rem; }
  .entry-head { flex-direction: column; gap: 0; }
  .news li { grid-template-columns: 1fr; gap: 0; padding: 0.4rem 0; }
}

@media print {
  .site-header,
  .skip-link { display: none; }
  body { background: #fff; color: #000; }
  a { color: #000; }
}
