/* Rui Liu — personal site. Plain CSS (no build step needed). */

@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/source-serif-4-latin-opsz-normal.woff2") format("woff2");
  font-weight: 200 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: "Source Serif 4";
  src: url("../fonts/source-serif-4-latin-opsz-italic.woff2") format("woff2");
  font-weight: 200 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;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/source-serif-4-latin-ext-opsz-normal.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 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: "Source Sans 3";
  src: url("../fonts/source-sans-3-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 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;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #ffffff;
  --ink: #1b1f27;
  --muted: #5a6170;
  --faint: #8a909c;
  --rule: #e3e5ea;
  --accent: #2346b8;
  --accent-soft: #eef1fb;
  --award: #a23a12;
  --thumb-bg: #ffffff;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: "Source Sans 3", -apple-system, "Segoe UI", system-ui, sans-serif;
  --measure: 46rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15171c;
    --ink: #e7e9ee;
    --muted: #a7adb9;
    --faint: #7d8390;
    --rule: #2b2f38;
    --accent: #9fb3ff;
    --accent-soft: #1f2536;
    --award: #f0a27e;
    --thumb-bg: #f4f5f7;
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

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

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

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3.5rem 1.25rem 2.5rem;
}

/* ---------- Header ---------- */

.intro {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 1.75rem;
  align-items: center;
}

.portrait {
  width: 9.5rem;
  height: 9.5rem;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 30%;
  background: var(--rule);
}

.name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 2.5rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0;
}

.position {
  color: var(--muted);
  margin: 0.35rem 0 0.9rem;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.9375rem;
  line-height: 1.4;
}
.links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.links svg { width: 1em; height: 1em; flex: none; }

/* ---------- Research statement (the one large moment) ---------- */

.statement {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.05rem);
  line-height: 1.28;
  letter-spacing: -0.005em;
  margin: 3rem 0 1.5rem;
  max-width: 40ch;
  font-variation-settings: "opsz" 36;
}

.bio { margin-top: 2.25rem; }
.bio p { margin: 0 0 1rem; max-width: 42rem; text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.bio strong { font-weight: 650; }

/* ---------- Sections ---------- */

section { margin-top: 3.25rem; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.6rem;
  line-height: 1.2;
  margin: 0;
}

.section-note { color: var(--muted); font-size: 0.9375rem; margin: 0; }

/* Research themes */

.themes { display: grid; gap: 1.5rem; }

.theme {
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
}

.theme h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.2rem;
  line-height: 1.3;
  margin: 0 0 0.25rem;
}

.theme p { margin: 0 0 0.5rem; color: var(--muted); }

.theme-papers { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.theme-papers a {
  display: inline-block;
  padding: 0.05rem 0.55rem;
  border-radius: 4px;
  background: var(--accent-soft);
  font-size: 0.875rem;
  font-weight: 600;
}

.earlier { margin-top: 1.25rem; color: var(--muted); font-size: 0.9375rem; }

/* News */

.news { list-style: none; margin: 0; padding: 0; }
.news li {
  display: grid;
  grid-template-columns: 6.25rem 1fr;
  gap: 1rem;
  padding: 0.45rem 0;
}
.news time {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  font-size: 0.9375rem;
  padding-top: 0.08rem;
  white-space: nowrap;
}

details.more { margin-top: 0.5rem; }
details.more > summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.9375rem;
  padding: 0.35rem 0;
  list-style: none;
  width: fit-content;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before {
  content: "";
  display: inline-block;
  width: 0.45em; height: 0.45em;
  margin-right: 0.55em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.2em) rotate(45deg);
  transition: transform 0.15s ease;
}
details.more[open] > summary::before { transform: translateY(0) rotate(-135deg); }
details.more[open] > summary .when-closed,
details.more:not([open]) > summary .when-open { display: none; }

/* Publications */

.pubs { display: grid; gap: 2rem; }

.pub {
  display: grid;
  grid-template-columns: 11.5rem 1fr;
  gap: 1.25rem;
  scroll-margin-top: 1.5rem;
}

.pub:target .pub-title { background: var(--accent-soft); }

.pub-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--thumb-bg);
  overflow: hidden;
}
.pub-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 0.25rem; }
.pub-thumb span { font-family: var(--serif); font-weight: 600; color: #2346b8; font-size: 1.15rem; }

.pub-title {
  font-family: var(--sans);
  font-weight: 650;
  font-size: 1.0625rem;
  line-height: 1.4;
  margin: 0 0 0.2rem;
}
.pub-title a { color: var(--ink); }
.pub-title a:hover { color: var(--accent); }

.authors { color: var(--muted); font-size: 0.9375rem; line-height: 1.5; margin: 0; }
.authors a { color: inherit; }
.authors .me { color: var(--ink); font-weight: 650; white-space: nowrap; }

.venue {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.6rem;
  margin: 0.3rem 0 0;
  font-size: 0.9375rem;
}
.venue-name { color: var(--accent); font-weight: 650; }
.tag {
  font-size: 0.8125rem;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0 0.4rem;
}
.award { color: var(--award); font-weight: 600; }

.pub-desc { margin: 0.4rem 0 0; font-size: 0.9688rem; }

.pub-links { display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; margin: 0.35rem 0 0; padding: 0; list-style: none; font-size: 0.9375rem; font-weight: 600; }

/* Footer */

footer {
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  color: var(--faint);
  font-size: 0.875rem;
}
footer p { margin: 0.2rem 0; }
footer a { color: var(--muted); }

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .page { padding: 2rem 1rem 2rem; }
  .intro { grid-template-columns: 5.5rem 1fr; gap: 1rem; }
  .portrait { width: 5.5rem; height: 5.5rem; }
  .name { font-size: 1.9rem; }
  .position { font-size: 0.9375rem; margin-bottom: 0.6rem; }
  .intro .links { grid-column: 1 / -1; }
  .statement { margin-top: 2rem; }
  .bio p { text-align: left; }
  .news li { grid-template-columns: 1fr; gap: 0; }
  .pub { grid-template-columns: 1fr; gap: 0.75rem; }
  .pub-thumb { max-width: 22rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

html { scroll-behavior: smooth; }

/* ---------- CV page ---------- */

.cv .intro { grid-template-columns: 1fr auto; }
.cv .portrait { width: 6.5rem; height: 6.5rem; }
.cv h2 { font-size: 1.35rem; margin: 2.25rem 0 0.75rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--rule); }
.cv h3 { font-family: var(--sans); font-size: 1rem; font-weight: 650; color: var(--muted); margin: 1.25rem 0 0.5rem; }
.cv-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.25rem 1.5rem;
  padding: 0.4rem 0;
}
.cv-row .when { color: var(--muted); text-align: right; font-size: 0.9375rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cv-row .what { margin: 0; }
.cv-row .detail { color: var(--muted); font-size: 0.9375rem; margin: 0; }
.cv-pubs { margin: 0; padding-left: 1.6rem; }
.cv-pubs li { padding: 0.35rem 0; }
.cv-pubs li::marker { color: var(--faint); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.cv-pubs .pub-title { font-size: 1rem; }
.cv-pubs .authors, .cv-pubs .venue { font-size: 0.9063rem; }

@media (max-width: 640px) {
  .cv .intro { grid-template-columns: 1fr; }
  .cv .portrait { display: none; }
  .cv-row { grid-template-columns: 1fr; }
  .cv-row .when { text-align: left; }
}

@media print {
  :root { --paper: #fff; --ink: #000; --muted: #333; --faint: #555; --accent: #1a3a9e; --rule: #ccc; }
  body { font-size: 10pt; }
  .page { max-width: none; padding: 0; }
  .links a { border: 0; padding: 0; }
  .links svg, .no-print { display: none !important; }
  .cv h2 { break-after: avoid; }
  .cv-pubs li, .cv-row { break-inside: avoid; }
  a { color: inherit; }
}

/* CV: full venue names read better as quiet italics */
.cv-pubs .venue-name { color: var(--muted); font-weight: 400; font-style: italic; }
