/* ---------- Theme tokens ---------- */
:root {
  --bg: #ffffff;
  --text: #1f2328;
  --muted: #6a737d;
  --accent: #1d5fbf;
  --accent-soft: rgba(29, 95, 191, 0.08);
  --border: #e3e6ea;
  --card: #ffffff;
  --nav-bg: rgba(255, 255, 255, 0.92);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --tile-a: #1d5fbf;
  --tile-b: #5b8fd9;
  --award: #b7791f;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1c1c1d;
  --text: #e6e6e6;
  --muted: #9aa0a6;
  --accent: #6ea8fe;
  --accent-soft: rgba(110, 168, 254, 0.12);
  --border: #33363a;
  --card: #242526;
  --nav-bg: rgba(28, 28, 29, 0.92);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  --tile-a: #2c4f86;
  --tile-b: #4a74b3;
  --award: #f0b429;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1c1d;
    --text: #e6e6e6;
    --muted: #9aa0a6;
    --accent: #6ea8fe;
    --accent-soft: rgba(110, 168, 254, 0.12);
    --border: #33363a;
    --card: #242526;
    --nav-bg: rgba(28, 28, 29, 0.92);
    --shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    --tile-a: #2c4f86;
    --tile-b: #4a74b3;
    --award: #f0b429;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Roboto", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s, color 0.2s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
strong, b, .fw-bold { font-weight: 700; }
h1, h2, h3 { font-weight: 300; line-height: 1.25; }
img { max-width: 100%; }

.container { max-width: 930px; margin: 0 auto; padding: 0 16px; }
main.container { padding-top: 88px; padding-bottom: 48px; min-height: calc(100vh - 60px); }

/* ---------- Navbar ---------- */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; min-height: 56px; }
.nav-brand { color: var(--text); font-size: 1.15rem; font-weight: 300; }
.nav-brand:hover { text-decoration: none; color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-link { color: var(--text); padding: 6px 12px; font-weight: 400; border-radius: 6px; }
.nav-link:hover { color: var(--accent); text-decoration: none; }
.nav-link.active { color: var(--accent); font-weight: 500; }
.theme-toggle, .nav-toggle {
  background: none; border: 0; color: var(--text); cursor: pointer;
  font-size: 1rem; padding: 6px 10px; border-radius: 6px;
}
.theme-toggle:hover, .nav-toggle:hover { color: var(--accent); }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: inline; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: inline; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}
.nav-toggle { display: none; font-size: 1.25rem; }

/* ---------- Header ---------- */
.post-header { margin-bottom: 1.5rem; }
.post-title { font-size: 2.6rem; margin: 0 0 0.25rem; }
.desc { color: var(--muted); margin: 0; font-size: 1rem; }
.desc a { color: var(--muted); border-bottom: 1px dotted var(--muted); }
.desc a:hover { color: var(--accent); text-decoration: none; }

/* ---------- About ---------- */
.about { display: flex; flex-direction: row-reverse; gap: 32px; align-items: flex-start; }
.profile { flex: 0 0 240px; }
.profile img { width: 100%; height: auto; border-radius: 6px; box-shadow: var(--shadow); display: block; }
.bio { flex: 1; min-width: 0; }
.bio p { margin: 0 0 1rem; text-align: justify; hyphens: auto; }

.social { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 1.25rem; font-size: 1.6rem; }
.social a { color: var(--text); }
.social a:hover { color: var(--accent); text-decoration: none; }

/* ---------- Sections ---------- */
.section { margin-top: 2.75rem; }
.section h2 { font-size: 1.75rem; margin: 0 0 1rem; }
.section h2 a { color: inherit; }
.section h2 a:hover { color: var(--accent); text-decoration: none; }
.more { margin: 0.5rem 0 0; font-size: 0.95rem; }

/* ---------- News ---------- */
.news { width: 100%; border-collapse: collapse; }
.news th, .news td { padding: 6px 0; vertical-align: top; text-align: left; }
.news th { width: 110px; font-weight: 500; white-space: nowrap; padding-right: 16px; color: var(--text); }
.news tr + tr th, .news tr + tr td { border-top: 1px solid var(--border); }

/* ---------- Publications ---------- */
.jump { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1rem; }
.jump a {
  font-size: 0.85rem; font-weight: 400; padding: 3px 10px;
  border: 1px solid var(--border); border-radius: 999px; color: var(--text);
}
.jump a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.pubs { list-style: none; padding: 0; margin: 0; }
.pub { display: flex; gap: 24px; padding: 18px 0; }
.pub + .pub { border-top: 1px solid var(--border); }
.pub:target { background: var(--accent-soft); border-radius: 8px; box-shadow: 0 0 0 8px var(--accent-soft); }

.pub-thumb { flex: 0 0 200px; position: relative; }
.pub-thumb img {
  display: block; width: 100%; height: 130px; object-fit: contain;
  background: #fff; border-radius: 6px; box-shadow: var(--shadow); padding: 4px;
  cursor: zoom-in; transition: transform 0.15s;
}
.pub-thumb img:hover { transform: scale(1.03); }
.pub-tile {
  height: 130px; border-radius: 6px; box-shadow: var(--shadow);
  background: linear-gradient(135deg, var(--tile-a), var(--tile-b));
  color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.pub-tile span { font-size: 1.5rem; font-weight: 500; letter-spacing: 0.5px; }
.pub-tile small { opacity: 0.85; font-size: 0.9rem; }
.abbr {
  position: absolute; top: -8px; left: -6px; z-index: 1;
  background: var(--accent); color: #fff; font-size: 0.72rem; font-weight: 500;
  padding: 1px 8px; border-radius: 4px; box-shadow: var(--shadow); white-space: nowrap;
}
.pub-thumb:has(.pub-tile) .abbr { display: none; }

.pub-body { flex: 1; min-width: 0; }
.pub-title { font-weight: 500; line-height: 1.35; }
.pub-authors { margin-top: 2px; font-size: 0.95rem; }
.pub-authors .me { font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.pub-venue { color: var(--muted); font-size: 0.95rem; }
.pub-award { color: var(--award); font-weight: 500; font-size: 0.9rem; margin-top: 2px; }
.pub-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.btn {
  font: inherit; font-size: 0.78rem; font-weight: 400; line-height: 1.4;
  padding: 2px 10px; border-radius: 4px; cursor: pointer;
  color: var(--text); background: transparent; border: 1px solid var(--text);
}
.btn:hover, .btn.active { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.pub-extra { margin-top: 10px; font-size: 0.92rem; }
.pub-extra p { margin: 0; text-align: justify; }
.pub-extra pre {
  margin: 0; padding: 10px 12px; overflow-x: auto; font-family: "Roboto Mono", monospace; font-size: 0.78rem;
  background: var(--accent-soft); border-radius: 6px; white-space: pre;
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.8);
  display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: min(1100px, 100%); max-height: 90vh; background: #fff; border-radius: 6px; padding: 8px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.85rem; padding: 18px 0; text-align: center; }

/* ---------- Mobile ---------- */
@media (max-width: 700px) {
  .post-title { font-size: 2rem; }
  .about { flex-direction: column; align-items: stretch; }
  .profile { flex: none; max-width: 220px; margin: 0 auto; }
  .bio p { text-align: left; }
  .pub { flex-direction: column; gap: 12px; }
  .pub-thumb { flex: none; width: 100%; max-width: 340px; }
  .pub-thumb img, .pub-tile { height: 170px; }
  .pub-tile { height: 90px; }
  .news th { width: 84px; padding-right: 10px; }
  .nav-toggle { display: inline-block; margin-left: auto; }
  .nav-links {
    display: none; position: absolute; top: 56px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; padding: 8px 16px 12px;
    background: var(--bg); border-bottom: 1px solid var(--border);
  }
  .nav-links.open { display: flex; }
  .nav-link { padding: 8px 4px; }
  .theme-toggle { align-self: flex-start; padding: 8px 4px; }
}
