/* ===== Local fonts ===== */
@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin-600-normal.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("fonts/lora-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("fonts/lora-latin-600-normal.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("fonts/lora-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("fonts/lora-latin-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}

/* ===== Base ===== */
* { box-sizing: border-box; }
:root {
  --primary: #3f6c93;
  --bg: #fcfcfb;
  --text: #3a434c;
  --text-light: #8a939c;
  --border: #e6e9ec;
  --link: #34719e;
  --link-hover: #24557c;
  --card-shadow: 0 2px 8px rgba(30, 50, 70, 0.08);
  --radius: 8px;
  --transition: all 0.25s ease-in-out;
}
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Microsoft YaHei";
  line-height: 1.6;
  min-height: 100vh;
}
::selection { background: #3f6c9333; }
h1, h2, h3 { font-family: "Lora", "Microsoft YaHei"; line-height: 1.25; }
h1 { font-size: 1.9em; margin: 0 0 0.6em; }
h2 { font-size: 1.35em; margin: 1.8em 0 0.5em; padding-bottom: 0.25em; border-bottom: 1px solid var(--border); }
a { color: var(--link); text-decoration: none; border-bottom: 1px solid transparent; transition: var(--transition); }
a:hover { color: var(--link-hover); border-bottom-color: var(--link-hover); }

/* ===== Masthead ===== */
.masthead {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 60px;
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.masthead__nav {
  max-width: 1100px; margin: 0 auto; height: 100%;
  display: flex; align-items: center; gap: 1.5em; padding: 0 1.25em;
}
.masthead__brand {
  font-family: "Lora", "Microsoft YaHei";
  font-weight: 700; font-size: 1.05em; color: var(--text);
  white-space: nowrap;
}
.masthead__brand:hover { color: var(--primary); border-bottom-color: transparent; }
.masthead__menu {
  display: flex; gap: 0.25em; list-style: none; margin: 0 0 0 auto; padding: 0;
}
.masthead__menu a {
  display: block; padding: 0.35em 0.85em; border-radius: 6px;
  color: var(--text); font-size: 0.92em; font-weight: 500; border-bottom: 0;
}
.masthead__menu a:hover { color: var(--primary); background: #f0f4f7; }
.masthead__menu .selected a { color: #fff; background: var(--primary); }
.nav-toggle {
  display: none; margin-left: auto; border: 0; background: none; cursor: pointer; padding: 8px;
}
.nav-toggle span {
  display: block; width: 22px; height: 2px; margin: 4px 0;
  background: var(--text); border-radius: 2px; transition: var(--transition);
}

/* ===== Layout ===== */
.page {
  max-width: 1100px; margin: 0 auto; padding: 90px 1.25em 4em;
  display: grid; grid-template-columns: 260px 1fr; gap: 3em;
}
.content { min-width: 0; animation: fadein 0.4s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

/* ===== Sidebar ===== */
.sidebar {
  position: sticky;
  top: 90px;
  align-self: start;
  padding-top: 0.5em;
}
.author__avatar img {
  width: 180px; height: 180px; object-fit: cover;
  border-radius: 50%; display: block;
  border: 4px solid #fff;
  box-shadow: 0 0 0 1px var(--border), 0 4px 14px rgba(30, 50, 70, 0.14);
  transition: var(--transition);
}
.author__avatar img:hover { transform: scale(1.03); }
.author__name { font-size: 1.15em; margin: 1em 0 0.3em; }
.author__bio { color: var(--text-light); font-size: 0.9em; margin: 0 0 1.2em; }
.author__urls { list-style: none; margin: 0; padding: 0; font-size: 0.92em; }
.author__urls li { margin-bottom: 0.45em; white-space: nowrap; }
.author__urls .ic {
  color: var(--primary); margin-right: 0.6em; font-size: 0.7em;
  vertical-align: middle;
}
.author__urls a { color: var(--text); border-bottom: 0; }
.author__urls a:hover { color: var(--primary); }

/* ===== Entries (publications / talks / cv) ===== */
.entry {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--card-shadow); padding: 1em 1.25em; margin-bottom: 1em;
  transition: var(--transition);
}
.entry:hover { box-shadow: 0 4px 14px rgba(30, 50, 70, 0.13); transform: translateY(-2px); }
.entry__title { margin: 0 0 0.2em; font-size: 1.05em; }
.entry__meta { color: var(--text-light); font-size: 0.85em; margin: 0 0 0.3em; }
.software-list { margin: 0; padding-left: 1.2em; }
.software-list li { margin-bottom: 0.5em; font-size: 0.95em; }

/* CV page inline PDF viewer */
.cv-pdf { padding: 0.75em; }
.cv-pdf:hover { transform: none; }
.cv-pdf__viewer {
  display: block; width: 100%; height: 75vh;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .page { grid-template-columns: 1fr; gap: 2em; }
  .sidebar { position: static; text-align: center; }
  .author__avatar img { margin: 0 auto; }
  .author__urls li { white-space: normal; }
}
@media (max-width: 640px) {
  .nav-toggle { display: block; }
  .masthead__menu {
    display: none; position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column; padding: 0.5em 1.25em 1em;
    background: rgba(255, 255, 255, 0.97);
    border-bottom: 1px solid var(--border);
  }
  .masthead__menu.open { display: flex; }
}
