/* ---- Minimal academic site ---- */
:root {
  --text: #222;
  --muted: #666;
  --accent: #9a3324;      /* CMU-ish muted red */
  --border: #e5e5e5;
  --bg: #ffffff;
  --maxw: 760px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

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

/* ---- Top bar ---- */
.topbar {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 8px;
}
.topbar a {
  display: inline-block;
  padding: 16px 14px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.topbar a:hover { color: var(--text); text-decoration: none; }
.topbar a.active { color: var(--text); border-bottom: 2px solid var(--accent); }

/* ---- Layout ---- */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px 24px 80px;
}

h1 { font-size: 1.9rem; margin: 0 0 4px; }
h2 {
  font-size: 1.3rem;
  margin: 44px 0 16px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.subtitle { color: var(--muted); margin-top: 0; }

/* ---- Home intro ---- */
.intro { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }
.intro-left { width: 180px; flex-shrink: 0; }
.intro .photo {
  width: 100%;
  border-radius: 6px;
  display: block;
}
.intro .bio { flex: 1; min-width: 260px; }
.intro .bio p:first-child { margin-top: 0; }

.contact { margin-top: 8px; margin-bottom: 4px; }
.contact .label { font-weight: 600; }

/* Link list stacked under the photo. */
.links {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  font-weight: 500;
}
.links li { padding: 3px 0; line-height: 1.35; }

.callout {
  margin-top: 28px;
  padding: 14px 18px;
  background: #faf6f5;
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
}

/* ---- View toggle ---- */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin: 4px 0 8px;
}
.view-toggle button {
  border: none;
  background: var(--bg);
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  padding: 7px 16px;
  cursor: pointer;
}
.view-toggle button + button { border-left: 1px solid var(--border); }
.view-toggle button:hover { color: var(--text); }
.view-toggle button.active { background: var(--accent); color: #fff; }

/* ---- Year-group header (chronological view) ---- */
.year-head {
  font-size: 1.05rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 32px 0 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.year-head:first-child { margin-top: 12px; }

/* ---- Area selector (by-area view) ---- */
.area-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 8px 0 24px;
}
.area-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  text-align: center;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.area-card:hover { border-color: var(--muted); }
.area-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.area-card-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
}
.area-card-label {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

/* Slim bar for image-less areas (e.g. "Other topics"). */
.area-bars { margin: 0 0 24px; }
.area-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 11px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.area-bar:hover { border-color: var(--muted); }
.area-bar.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.area-bar-label { font-size: 0.92rem; font-weight: 600; color: var(--text); }
.area-bar-chevron { color: var(--muted); font-size: 1.2rem; line-height: 1; }

/* ---- Publications (title-first hierarchy) ---- */
.pub-list { list-style: none; padding: 0; margin: 0; }
.pub-list li {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.pub-list li:last-child { border-bottom: none; }
.pub-list li.has-thumb {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.pub-thumb {
  width: 150px;
  flex-shrink: 0;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: left top;   /* crop the lower / right part */
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fafafa;
}
.pub-body { flex: 1; min-width: 0; }

/* Typographic "cover" tile for works without a thumbnail. */
.pub-thumb-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  background: linear-gradient(135deg, #dcebff, #e9e2ff);
  color: #33529c;
}
.pub-thumb-cover span {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.25;
}

.pub-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.pub-title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}
/* Shortened titles carry the full version in a custom hover
   tooltip (immediate, unlike the delayed native title tooltip). */
.pub-title[data-full] {
  position: relative;
  border-bottom: 1px dotted #c4c4c4;
  cursor: help;
}
.pub-title[data-full]:hover::after {
  content: attr(data-full);
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 30;
  width: max-content;
  max-width: 360px;
  white-space: normal;
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.4;
  color: #fff;
  background: #2a2a2a;
  padding: 8px 11px;
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}
.pub-authors { margin-top: 3px; color: var(--text); }
.pub-authors b { font-weight: 600; }
.pub-venue {
  margin-top: 1px;
  font-style: italic;
  font-size: 0.92rem;
  color: var(--muted);
}
.pub-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Link + cite buttons share a pill shape. */
.pub-link-btn,
.cite-btn {
  display: inline-block;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.2;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 4px 11px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.pub-link-btn:hover { text-decoration: none; color: #fff; }

/* Publication-type links, each its own color; artifact links
   (slides / poster / video / talk) share one neutral color. */
.link-arxiv      { background: #fdeaea; color: #b31b1b; }  /* arXiv red */
.link-arxiv:hover { background: #b31b1b; }
.link-journal    { background: #e7f1ea; color: #2f6b47; }  /* journal green */
.link-journal:hover { background: #2f6b47; }
.link-conference { background: #e8eef7; color: #33517e; }  /* conference blue */
.link-conference:hover { background: #33517e; }
.link-resource   { background: #f0f0f2; color: #555; }     /* slides/poster/... */
.link-resource:hover { background: #555; }
.link-blog       { background: #f0ebf9; color: #6d4c9f; }  /* blog post */
.link-blog:hover { background: #6d4c9f; }

/* Cite: outlined, to set the special action apart from the
   filled resource/venue pills. */
.cite-btn {
  background: transparent;
  color: var(--text);
  border-color: #cfcfcf;
}
.cite-btn:hover { background: var(--text); color: #fff; border-color: var(--text); }
.cite-btn.cite-done { background: #2f6b47; color: #fff; border-color: #2f6b47; }

.award {
  margin-top: 6px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
}

/* Explanatory note for a work (e.g. authorship clarification). */
.pub-note {
  margin-top: 8px;
  padding: 10px 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
  background: #f7f7f8;
  border-left: 3px solid var(--border);
  border-radius: 0 4px 4px 0;
}
.pub-note p { margin: 0 0 8px; }
.pub-note p:last-child { margin-bottom: 0; }
.pub-note-credit {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
}
.note { color: var(--muted); font-size: 0.9rem; }

/* ---- Awards page ---- */
.award-list { list-style: none; padding: 0; margin: 0; }
.award-list li {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.award-list li:last-child { border-bottom: none; }
.award-name { font-weight: 500; }
.award-paper { font-weight: 400; font-style: italic; color: var(--muted); }
.award-year {
  flex-shrink: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 520px) {
  body { font-size: 16px; }
  .intro-left { width: 140px; }
  .area-cards { grid-template-columns: 1fr; }
  .pub-list li.has-thumb { flex-direction: column; }
  .pub-thumb { width: 100%; max-width: 220px; }
}