:root {
  --bg: #ffffff;
  --text: #1f2328;
  --muted: #5f6670;
  --faint: #8a9099;
  --rule: #e6e8eb;
  --accent: #1d4f91;
  --accent-soft: #eef3fa;
  --badge-bg: #fdf3dc;
  --badge-text: #7a5a00;
  --dot: #c5cbd3;
}

/* dark mode */
:root[data-theme="dark"] {
  --bg: #14171b;
  --text: #e6e8eb;
  --muted: #a3aab3;
  --faint: #7d848d;
  --rule: #2a2f36;
  --accent: #7fb0f0;
  --accent-soft: #1b2533;
  --badge-bg: #3a3014;
  --badge-text: #f0d48a;
  --dot: #3c434c;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171b;
    --text: #e6e8eb;
    --muted: #a3aab3;
    --faint: #7d848d;
    --rule: #2a2f36;
    --accent: #7fb0f0;
    --accent-soft: #1b2533;
    --badge-bg: #3a3014;
    --badge-text: #f0d48a;
    --dot: #3c434c;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 820px; margin: 0 auto; padding: 0 20px; }

/* nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}
.nav .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; gap: 16px;
}
.nav .brand { font-weight: 600; color: var(--text); white-space: nowrap; }
.nav ul { list-style: none; display: flex; gap: 20px; margin: 0; padding: 0; overflow-x: auto; }
.nav ul a { color: var(--muted); font-size: 15px; white-space: nowrap; }
.nav ul a:hover { color: var(--text); text-decoration: none; }
.nav .right { display: flex; align-items: center; gap: 20px; min-width: 0; }
.theme-toggle {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--rule); background: transparent; color: var(--muted);
  cursor: pointer; display: grid; place-items: center; padding: 0;
}
.theme-toggle:hover { color: var(--text); border-color: var(--faint); }
.theme-toggle span { font-size: 16px; line-height: 1; }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }

/* callout */
.callout {
  margin: 16px 0 0; padding: 10px 14px; border-radius: 6px;
  background: var(--accent-soft); border-left: 3px solid var(--accent); font-size: 15px;
}

/* sections */
section { padding: 40px 0 8px; }
h2 {
  font-size: 22px; font-weight: 600; margin: 0 0 20px;
  padding-bottom: 8px; border-bottom: 1px solid var(--rule);
}
h3 {
  font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint); margin: 28px 0 14px;
}

/* about */
.about { display: flex; gap: 32px; align-items: flex-start; padding-top: 48px; }
.about img.photo {
  width: 220px; height: 270px; object-fit: cover; object-position: top;
  border-radius: 8px; flex-shrink: 0;
}
.about h1 { font-size: 32px; font-weight: 700; margin: 0 0 4px; line-height: 1.2; }
.about .tagline { color: var(--muted); font-size: 17px; margin: 0 0 16px; }
.about p { margin: 0 0 12px; }
.icons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; margin-left: -8px; }
.icons a {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px;
  color: var(--muted);
}
.icons a:hover { color: var(--accent); background: var(--accent-soft); }
.icons svg { width: 21px; height: 21px; }

/* papers */
.paper {
  display: grid; grid-template-columns: 240px 1fr; gap: 20px;
  padding: 16px 0; border-bottom: 1px solid var(--rule);
}
.paper:last-child { border-bottom: none; }
.paper.no-thumb { grid-template-columns: 1fr; }
.paper .thumb {
  width: 100%; border: 1px solid var(--rule); border-radius: 6px;
  background: #fff; padding: 6px;
}
.paper .title { font-weight: 600; margin: 0 0 4px; line-height: 1.4; }
.paper .authors { color: var(--muted); font-size: 15px; margin: 0 0 4px; }
.paper .authors strong { color: var(--text); font-weight: 600; }
.paper .venue { font-size: 15px; font-style: italic; margin: 0 0 8px; }
.paper .desc { font-size: 15px; margin: 0 0 8px; }
.paper .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.tag {
  display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}

/* enlarged figure */
.thumb.zoomable { cursor: zoom-in; }
.lightbox {
  border: none; padding: 0; background: transparent;
  max-width: 95vw; max-height: 95vh; overflow: visible; outline: none;
}
.lightbox::backdrop { background: rgba(0, 0, 0, .75); }
.lightbox img {
  display: block; max-width: 92vw; max-height: 88vh;
  background: #fff; padding: 16px; border-radius: 8px; cursor: zoom-out;
}

/* news timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 110px; top: 8px; bottom: 8px;
  width: 2px; background: var(--rule);
}
.timeline li {
  display: grid; grid-template-columns: 96px 1fr; gap: 30px;
  padding: 6px 0; position: relative; font-size: 15px;
}
.timeline li::before {
  content: ""; position: absolute; left: 106px; top: 13px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--dot);
}
.timeline li.upcoming::before { border-color: var(--accent); background: var(--accent); }
.timeline .date { color: var(--faint); font-size: 14px; text-align: right; white-space: nowrap; }
.badge {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; padding: 1px 7px; border-radius: 4px; margin-right: 6px;
  background: var(--badge-bg); color: var(--badge-text); vertical-align: 1px;
}
.news-more { margin-top: 8px; font-size: 14px; }
.timeline li.older { display: none; }
.timeline.show-all li.older { display: grid; }

/* presentations, experience */
.entries { list-style: none; margin: 0; padding: 0; }
.entries li {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 16px;
  padding: 8px 0; font-size: 15px;
}
.entries .what { font-weight: 600; }
.entries .where { color: var(--muted); grid-column: 1; }
.entries .when { color: var(--faint); font-size: 14px; grid-row: 1; grid-column: 2; white-space: nowrap; }

.entries.stacked li { grid-template-columns: 1fr; gap: 2px; }
.entries.stacked .when { grid-row: auto; grid-column: 1; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; }

footer {
  margin-top: 48px; padding: 24px 0 40px; border-top: 1px solid var(--rule);
  color: var(--faint); font-size: 14px;
}

/* phone */
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .nav .brand { display: none; }
  .nav .wrap { justify-content: flex-start; }
  .nav .right { width: 100%; justify-content: space-between; gap: 10px; }
  .nav ul { gap: 12px; }
  .nav ul a { font-size: 13px; }
  .about { flex-direction: column; gap: 20px; padding-top: 28px; }
  .about img.photo { width: 140px; height: 170px; }
  .about h1 { font-size: 28px; }
  .paper { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .timeline::before { left: 4px; }
  .timeline li { grid-template-columns: 1fr; gap: 0; padding-left: 24px; }
  .timeline li::before { left: 0; }
  .timeline .date { text-align: left; }
  .entries li { grid-template-columns: 1fr; }
  .entries .when { grid-row: auto; grid-column: 1; }
}
