/* =========================================================
   Shanyun Gao — personal site
   Colors live in :root; change --accent to retheme.
   ========================================================= */
:root {
  --bg: #ffffff;
  --surface: #f3f8fc;
  --text: #22252a;
  --muted: #5d636b;
  --border: #d9e7f2;
  --accent: #2672b0;        /* light-blue theme: main blue (text, buttons, underlines) */
  --accent-soft: #e3f1fb;   /* pale light blue (badges, highlight boxes) */
  --link: #1f5f99;          /* link text */
  --header-bg: rgba(240,247,253,.96); /* top menu bar */
  --radius: 8px;
  --sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--sans);
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- masthead ---------- */
.masthead {
  position: sticky; top: 0; z-index: 10;
  background: var(--header-bg);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.masthead-inner {
  max-width: 1180px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
}
.site-name { font: 600 1.25rem/1.2 var(--serif); color: var(--text); }
.site-name:hover { text-decoration: none; color: var(--accent); }
.nav { display: flex; gap: 4px 20px; flex-wrap: wrap; }
.nav a { color: var(--muted); font-weight: 600; font-size: .98rem; padding: 2px 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--text); text-decoration: none; border-color: var(--border); }
.nav a.active { color: var(--text); border-color: var(--accent); }

/* ---------- layout ---------- */
.page {
  max-width: 1180px; margin: 0 auto; padding: 36px 24px 24px;
  display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 48px;
}
.sidebar { position: sticky; top: 92px; align-self: start; }
.avatar { width: 168px; height: 168px; border-radius: 50%; object-fit: cover; display: block; border: 1px solid var(--border); }
.author-name { font: 600 1.35rem/1.25 var(--serif); margin: 16px 0 4px; }
.author-bio { margin: 0 0 14px; color: var(--muted); font-size: .96rem; line-height: 1.45; }
.author-links { list-style: none; padding: 0; margin: 0; font-size: .95rem; }
.author-links li { display: flex; align-items: center; gap: 8px; padding: 4px 0; color: var(--muted); }
.author-links a { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.author-links svg { color: var(--accent); width: 18px; height: 18px; }

.content { min-width: 0; }
.page-title { font: 600 2rem/1.2 var(--serif); margin: 0 0 18px; }
.section-title {
  font: 600 1.45rem/1.3 var(--serif); margin: 40px 0 18px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.content h2:not(.section-title) { font: 600 1.45rem/1.3 var(--serif); margin: 32px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.content h3:not(.paper-title) { font-size: 1.1rem; margin: 22px 0 10px; color: var(--muted); }
.lede { color: var(--muted); }

.about p { margin: 0 0 14px; }
.interests { background: var(--accent-soft); border-radius: var(--radius); padding: 10px 14px; font-size: .96rem; }
.interests span { font-weight: 700; color: var(--accent); }

/* ---------- papers ---------- */
.paper-card { padding: 4px 0 30px; margin-bottom: 30px; border-bottom: 1px solid var(--border); }
.paper-card:last-of-type { border-bottom: 0; }
.venue-badge {
  display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 2px 8px; margin-bottom: 8px;
}
.paper-title { font: 600 1.22rem/1.35 var(--serif); margin: 0 0 4px; }
.paper-authors { margin: 0 0 10px; color: var(--muted); font-size: .96rem; }
.paper-authors strong { color: var(--text); }
.paper-venue { margin: -6px 0 10px; color: var(--muted); font-size: .96rem; }
.paper-venue strong { font-style: normal; font-weight: 700; color: var(--text); }  /* short venue name, e.g. NeurIPS */
.paper-summary { margin: 0 0 16px; }
.paper-figure { max-width: 640px; margin: 0 auto 16px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }  /* figure size: change max-width */
.paper-figure img { display: block; margin: 0 auto; max-height: 300px; object-fit: contain; }

.paper-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none;
  font: 600 .9rem/1 var(--sans); color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px;
}
.btn::-webkit-details-marker { display: none; }
.btn:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { color: #fff; filter: brightness(1.08); }
.bibtex { flex-basis: auto; }
.bibtex[open] { flex-basis: 100%; }
.bibtex pre {
  margin: 10px 0 0; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; font-size: .8rem; line-height: 1.45; overflow-x: auto; white-space: pre;
}

.pub-entry { padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.pub-entry:last-of-type { border-bottom: 0; }
.abstract { margin: 0 0 14px; font-size: .97rem; }
.abstract-label { font-weight: 700; }

/* ---------- teaching ---------- */
.teach-item { position: relative; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; }
.teach-item p { margin: 0 0 6px; }
.teach-item ul { margin: 6px 0 0; padding-left: 20px; }
.teach-item .when { float: right; color: var(--muted); font-size: .92rem; }
.teach-item.placeholder { border-style: dashed; color: var(--muted); }
.tag { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 2px 6px; }

/* ---------- CV / resume ---------- */
.doc-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.pdf-frame { width: 100%; height: 80vh; min-height: 520px; border: 1px solid var(--border); border-radius: var(--radius); }

/* ---------- personal ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 14px 0 8px; }
.photo-grid .photo { display: block; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--border); aspect-ratio: 4 / 3; background: var(--surface); }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.photo-grid .photo:hover img { transform: scale(1.04); }
.photo-grid.cats { grid-template-columns: repeat(2, minmax(0, 300px)); }
.photo-grid.cats .photo { aspect-ratio: 1 / 1; }
@media (max-width: 860px) { .photo-grid { grid-template-columns: repeat(2, 1fr); } .photo-grid.cats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- footer ---------- */
.footer { max-width: 1180px; margin: 24px auto 0; padding: 20px 24px 36px; color: var(--muted); font-size: .88rem; border-top: 1px solid var(--border); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .page { grid-template-columns: 1fr; gap: 24px; padding: 24px 16px; }
  .masthead-inner { padding: 12px 16px; gap: 8px 20px; }
  .sidebar { position: static; display: grid; grid-template-columns: 96px 1fr; gap: 4px 16px; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 18px; }
  .avatar { width: 96px; height: 96px; grid-row: span 1; }
  .author-name { margin-top: 0; }
  .author-bio { margin-bottom: 0; }
  .author-links { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 6px; }
  .page-title { font-size: 1.7rem; }
  .teach-item .when { float: none; display: block; }
  .footer { padding: 18px 16px 30px; }
}
