/* ============================================================
   Yuheng Wang — modern minimal homepage
   Grid layout · hairline dividers · numbered sections
   ============================================================ */

:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #6b6b6b;
  --faint: #9a9a9a;
  --hairline: #e8e8e8;
  --accent: #0f62d0;
  --accent-hover: #b8551f;
  --oral: #b8321a;
  --card-bg: #fafafa;
  --max-w: 780px;

  --font-sans: 'Iowan Old Style', 'Baskerville', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, 'Songti SC', 'STSong', serif;
  --font-serif: 'Iowan Old Style', 'Baskerville', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --font-display: 'Iowan Old Style', 'Baskerville', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

/* ---- Theme: Ink (midnight background, aged-cream text, gold links) ---- */
html[data-theme="ink"] {
  --bg: #0f1419;
  --fg: #e8e3d5;
  --muted: #a09a8a;
  --faint: #6e6a5f;
  --hairline: #2a3038;
  --accent: #d4a574;
  --accent-hover: #c97545;
  --oral: #d67c56;
  --card-bg: #171d24;
}
html[data-theme="ink"] .header .bio,
html[data-theme="ink"] .pub-authors,
html[data-theme="ink"] .plain-list .what,
html[data-theme="ink"] .preview-body { color: #d0cbbe; }
html[data-theme="ink"] .book-form input,
html[data-theme="ink"] .book-form select,
html[data-theme="ink"] .book-form textarea,
html[data-theme="ink"] .preview-body,
html[data-theme="ink"] .qr,
html[data-theme="ink"] .copy-btn { background: var(--card-bg); color: var(--fg); }
html[data-theme="ink"] ::selection { background: var(--accent); color: var(--bg); }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern", "liga", "onum";
  transition: background-color .25s ease, color .25s ease;
}
a, .contact a, .pub-title, .copy-btn, .submit-btn,
.book-form input, .book-form select, .book-form textarea,
.wechat-block, .mail-preview, .qr {
  transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}

/* ---------- Theme switcher ---------- */
.theme-switch {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
}
.theme-switch button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: transform .2s ease, color .2s ease, border-color .2s ease, background .2s ease;
}
.theme-switch button:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: rotate(-12deg);
}
.theme-switch svg {
  width: 18px;
  height: 18px;
}
.theme-switch .icon-sun  { display: none; }
.theme-switch .icon-moon { display: block; }
html[data-theme="ink"] .theme-switch .icon-sun  { display: block; }
html[data-theme="ink"] .theme-switch .icon-moon { display: none; }

@media (max-width: 720px) {
  .theme-switch { top: 12px; right: 12px; }
  .theme-switch button { width: 32px; height: 32px; }
  .theme-switch svg { width: 16px; height: 16px; }
}

::selection { background: #111; color: #fff; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
a:hover {
  color: var(--accent-hover);
  border-bottom-color: currentColor;
}

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 56px 32px 72px;
}

/* ---------- Header ---------- */
.header {
  padding-bottom: 44px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 26px;
}
.header-heading {
  min-width: 0;
}

.header .name {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.1;
  margin: 0;
}

.header .role {
  display: none;
}

.header .bio {
  font-size: 15px;
  line-height: 1.7;
  color: #232323;
  margin: 0;
}
.header .bio + .bio { margin-top: 10px; }

.avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--card-bg);
  flex-shrink: 0;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(4%) contrast(1.02);
}

.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 14px;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.contact a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg);
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 1px;
}
.contact a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.contact .icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  vertical-align: -2px;
}
.contact a.cta {
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 3px 12px 4px;
  gap: 7px;
}
.contact a.cta:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* ---------- Section title ---------- */
.section {
  padding: 32px 0 24px;
  border-top: 1px solid var(--hairline);
}

.section-head {
  margin-bottom: 24px;
}
.section-title {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--fg);
}
.section-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 6px 0 0;
}

/* ---------- Publications ---------- */
.pubs { display: flex; flex-direction: column; gap: 28px; }

.pub {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 28px;
  align-items: start;
}

.pub-thumb {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: var(--card-bg);
}
.pub-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pub-body { padding-top: 2px; }

.pub-title {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.005em;
  line-height: 1.4;
  display: inline;
  border-bottom: none;
}
.pub-title:hover {
  color: var(--accent);
}

.pub-authors {
  font-size: 14px;
  color: #333;
  margin: 8px 0 4px;
  line-height: 1.55;
}
.pub-authors.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pub-authors .me {
  color: var(--fg);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.pub-venue {
  font-family: var(--font-sans);
  font-style: italic;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  margin-right: 6px;
}
.oral {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--oral);
  border: 1px solid currentColor;
  padding: 1px 6px;
  border-radius: 2px;
  margin-left: 4px;
  vertical-align: 1.5px;
}

.pub-links {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}
.pub-links a { color: var(--muted); }
.pub-links a:hover { color: var(--accent); }
.pub-links .sep { color: var(--faint); margin: 0 6px; }

/* ---------- Plain list (internships, activities, honors) ---------- */
.plain-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.plain-list li {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 20px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 14px;
}
.plain-list li:last-child { border-bottom: none; }
.plain-list .when {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}
.plain-list .what { color: #232323; }
.plain-list .what .place {
  color: var(--fg);
  font-weight: 500;
}

.subhead {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
  font-weight: 500;
}
.plain-list + .subhead { margin-top: 22px; }

/* ---------- Footer ---------- */
.footer {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--faint);
  display: flex;
  justify-content: space-between;
  letter-spacing: 0.04em;
}

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .wrap { padding: 48px 22px 72px; }
  .header { padding-bottom: 40px; }
  .header-top { gap: 20px; margin-bottom: 24px; }
  .header .name { font-size: 34px; }
  .avatar { width: 96px; height: 96px; }
  .pub { grid-template-columns: 96px 1fr; gap: 18px; }
  .plain-list li { grid-template-columns: 110px 1fr; gap: 14px; }
}
