/* Zhuoya Du — academic homepage
   Palette is built from the navy used in the printed CV (#003B7E).
   No web fonts: the page must load fast on mainland connections. */

:root {
  color-scheme: light;
  --ink: #0F1720;
  --navy: #003B7E;
  --navy-soft: #2C5E96;
  --mid: #55636F;
  --faint: #8A949D;
  --paper: #FBFBF9;
  --panel: #F4F5F3;
  --rule: #E1E4E7;
  --brass: #8A6A00;
  --rail: 300px;
  --gutter: 60px;
  --serif: "Palatino Linotype", Palatino, "Book Antiqua", "Songti SC", SimSun, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.72;
  text-rendering: optimizeLegibility;
}

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

/* ---------- shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: var(--gutter);
  max-width: 1180px;
  margin: 0 auto;
  padding: 56px 40px 96px;
  align-items: start;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--navy);
  color: #fff;
  padding: 10px 16px;
  z-index: 50;
}
.skip:focus { left: 12px; top: 12px; }

/* ---------- left rail ---------- */

.rail { position: sticky; top: 56px; }

.portrait {
  width: 168px;
  aspect-ratio: 203 / 250;
  object-fit: cover;
  object-position: 50% 18%;
  display: block;
  border: 1px solid var(--rule);
  background: var(--panel);
}

.rail h1 {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.16;
  margin: 22px 0 2px;
}

.rail .romanized {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--mid);
  margin: 0 0 14px;
  font-style: italic;
}

.affil { font-size: 14px; color: var(--mid); margin: 0; line-height: 1.6; }
.affil strong { color: var(--ink); font-weight: 600; }

.rail-mail {
  font-family: var(--mono);
  font-size: 12.5px;
  margin: 14px 0 0;
  word-break: break-all;
}

/* icon row + nav in the rail */

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  padding: 5px 10px;
  border: 1px solid var(--rule);
  background: #fff;
  color: var(--mid);
  transition: border-color .15s, color .15s;
}
.links a:hover { border-color: var(--navy); color: var(--navy); text-decoration: none; }
.links svg { width: 13px; height: 13px; fill: currentColor; flex: none; }
/* Not filled in yet: reads as a placeholder rather than a dead link. */
.links a[data-todo] { border-style: dashed; color: var(--faint); cursor: default; }
.links a[data-todo]:hover { border-color: var(--rule); color: var(--faint); }

.rail nav { margin-top: 28px; border-top: 1px solid var(--rule); padding-top: 14px; }
.rail nav ol { list-style: none; margin: 0; padding: 0; counter-reset: sec; }
.rail nav li { margin: 0; }

.rail nav a {
  display: block;
  font-size: 13.5px;
  color: var(--mid);
  padding: 3.5px 0 3.5px 0;
  border-left: 2px solid transparent;
  padding-left: 12px;
  margin-left: -14px;
  transition: color .15s, border-color .15s;
}
.rail nav a:hover { color: var(--navy); text-decoration: none; }
.rail nav a[aria-current="true"] {
  color: var(--navy);
  border-left-color: var(--navy);
  font-weight: 600;
}

.lang {
  margin-top: 26px;
  display: inline-flex;
  border: 1px solid var(--rule);
  background: #fff;
  overflow: hidden;
}
.lang button {
  font: inherit;
  font-size: 12.5px;
  letter-spacing: .03em;
  padding: 5px 13px;
  border: 0;
  background: transparent;
  color: var(--mid);
  cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--navy); color: #fff; }

/* ---------- main column ---------- */

main { min-width: 0; }

section { margin: 0 0 52px; scroll-margin-top: 28px; }
section:last-of-type { margin-bottom: 28px; }

h2 {
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--navy);
  margin: 0 0 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mid);
  margin: 30px 0 12px;
}
h3:first-of-type { margin-top: 6px; }

p { margin: 0 0 14px; }
p:last-child { margin-bottom: 0; }

/* small caps label in the rail, above the keyword chips */
.rail-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 22px 0 0;
}

/* research keyword chips */
.topics { display: flex; flex-wrap: wrap; gap: 7px; margin: 9px 0 0; padding: 0; list-style: none; }
.topics li {
  font-size: 12.5px;
  color: var(--navy-soft);
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 3px 10px;
}

/* ---------- the spine: publications & timelines ----------
   A hairline rail carries the year in mono; the square marker's weight
   encodes journal tier, so the shape of the record is scannable. */

.spine { list-style: none; margin: 0; padding: 0; }

.spine > li {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 0 20px;
  padding: 0 0 22px 0;
}

/* The hairline hangs off .entry, not off the <li>, so it stays centred on the
   markers at every breakpoint instead of tracking the grid column width. */
.spine .entry::after {
  content: "";
  position: absolute;
  left: -0.5px;
  top: 8px;
  bottom: -30px;
  width: 1px;
  background: var(--rule);
  z-index: 0;
}
.spine > li:last-child .entry::after { display: none; }

.year {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--faint);
  text-align: right;
  padding-top: 2px;
  letter-spacing: -0.02em;
}

.entry { position: relative; padding-left: 20px; }

.entry::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: -4.5px;
  top: 8px;
  width: 9px;
  height: 9px;
  background: var(--paper);
  border: 1.5px solid var(--faint);
}
/* tier weight: top-tier entries read solid, lower tiers recede */
.entry[data-tier="1"]::before { background: var(--navy); border-color: var(--navy); }
.entry[data-tier="2"]::before { background: var(--navy-soft); border-color: var(--navy-soft); }
.entry[data-tier="3"]::before { background: #fff; border-color: var(--navy-soft); }

.title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
  margin: 0 0 4px;
  color: var(--ink);
}
.title a { color: inherit; }

.authors { font-size: 14px; color: var(--mid); margin: 0 0 3px; }
.authors .me { color: var(--ink); font-weight: 700; }
.authors .corr { color: var(--brass); font-weight: 700; }

.venue { font-size: 14px; margin: 0; color: var(--mid); }
.venue em { font-family: var(--serif); font-style: italic; color: var(--ink); font-size: 15px; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.badges li {
  font-size: 11.5px;
  letter-spacing: 0.02em;
  line-height: 1.5;
  padding: 1.5px 7px;
  border: 1px solid var(--rule);
  color: var(--mid);
  background: #fff;
  white-space: nowrap;
}
.badges li[data-flag="top"] { color: var(--navy); border-color: var(--navy-soft); background: #F2F6FB; font-weight: 600; }
.badges li[data-flag="abs"] { color: var(--brass); border-color: #D9C68A; background: #FBF7EA; font-weight: 600; }
.badges li[data-flag="status"] { color: #4A5A46; border-color: #C9D6C4; background: #F2F7F1; }

.doi { font-family: var(--mono); font-size: 11.5px; margin: 6px 0 0; }
.doi a { color: var(--navy-soft); }

/* education / grants / awards reuse the spine, lighter */

.spine.plain .entry::before { background: #fff; border-color: var(--navy-soft); }
.spine.plain > li { padding-bottom: 18px; }

.line-title { font-size: 15.5px; font-weight: 600; margin: 0 0 2px; color: var(--ink); }
.line-meta { font-size: 14px; color: var(--mid); margin: 0; }
.line-meta .role {
  font-size: 11.5px;
  letter-spacing: .04em;
  border: 1px solid var(--rule);
  padding: 1px 6px;
  margin-left: 6px;
  color: var(--navy);
  white-space: nowrap;
}

/* teaching + service: plain lists, no spine needed */
.stack { list-style: none; margin: 0; padding: 0; }
.stack > li {
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
  justify-content: space-between;
}
.stack > li:last-child { border-bottom: 0; }
.stack .what { font-size: 15px; }
.stack .note { font-size: 12.5px; color: var(--faint); }

/* contact / advising panel */
.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--navy);
  padding: 20px 24px;
}
.panel p { font-size: 15px; }
.panel dl { margin: 14px 0 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; font-size: 14.5px; }
.panel dt { color: var(--faint); font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; padding-top: 3px; }
.panel dd { margin: 0; }
.panel dd.mono { font-family: var(--mono); font-size: 13px; }

footer {
  grid-column: 1 / -1;
  border-top: 1px solid var(--rule);
  margin-top: 28px;
  padding-top: 16px;
  font-size: 12.5px;
  color: var(--faint);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  justify-content: space-between;
}

/* language switching: JS toggles a class on <html> */
html[data-lang="en"] [lang="zh"] { display: none; }
html[data-lang="zh"] [lang="en"] { display: none; }
/* titles/venues stay in their original language — opt out with .keep */
html[data-lang="en"] [lang="zh"].keep,
html[data-lang="zh"] [lang="en"].keep { display: revert; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  :root { --gutter: 36px; }
  .shell {
    grid-template-columns: minmax(0, 1fr);
    padding: 32px 22px 64px;
    gap: 32px;
  }
  .rail { position: static; }
  .rail-head { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 18px; align-items: start; }
  .portrait { width: 108px; }
  .rail h1 { margin-top: 0; font-size: 26px; }
  .rail nav { display: none; }
  .spine > li { grid-template-columns: 42px minmax(0, 1fr); gap: 0 14px; }
  .title { font-size: 16px; }
  .stack > li { justify-content: flex-start; }
}

@media (max-width: 560px) {
  body { font-size: 15px; }
  /* stacked: the year sits above the entry, so drop the connecting hairline */
  .spine > li { grid-template-columns: minmax(0, 1fr); }
  .spine .entry::after { display: none; }
  .year { text-align: left; padding: 0 0 4px 20px; }
  .entry { padding-left: 20px; }
  .entry::before { left: 0; top: 7px; }
  .panel { padding: 16px 18px; }
  .panel dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .panel dt { padding-top: 8px; }
}

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

/* ---------- print ---------- */

@media print {
  .rail nav, .lang, .links, .skip { display: none; }
  .shell { display: block; max-width: none; padding: 0; }
  body { font-size: 10.5pt; background: #fff; }
  section { margin-bottom: 22px; page-break-inside: avoid; }
  a { color: var(--ink); }
  .doi { display: none; }
}

