:root {
  --bg: #ffffff;
  --bg-alt: #f5f7fa;
  --text: #1c1c1e;
  --muted: #5f6368;
  --accent: #1a4d8f;
  --accent-text: #ffffff;
  --line: #e3e5e8;
}
:root { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #15171a;
    --bg-alt: #1d2024;
    --text: #e8e9ea;
    --muted: #9aa0a6;
    --accent: #8ab4f8;
    --accent-text: #10243f;
    --line: #2b2f34;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15171a;
  --bg-alt: #1d2024;
  --text: #e8e9ea;
  --muted: #9aa0a6;
  --accent: #8ab4f8;
  --accent-text: #10243f;
  --line: #2b2f34;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 70px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.65;
}
a { color: var(--accent); }
.wrap { max-width: 900px; margin: 0 auto; padding: 0 20px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-top: 10px; padding-bottom: 10px; }
.site-name { font-weight: bold; font-size: 1.15rem; margin: 0; }
.site-name a { color: var(--text); text-decoration: none; }
nav { font-family: system-ui, sans-serif; font-size: 0.92rem; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; }
nav a { color: var(--muted); text-decoration: none; padding: 4px 0; }
nav a:hover, nav a.active { color: var(--accent); }
.dropdown { position: relative; }
.dd-toggle {
  background: none; border: 0; margin: 0; padding: 4px 0;
  font: inherit; color: var(--muted); cursor: pointer;
}
.dd-toggle:hover, .dd-toggle.active, .dropdown.open .dd-toggle { color: var(--accent); }
.menu {
  display: none; position: absolute; top: 100%; left: 0; min-width: 190px; max-width: 80vw;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.dropdown.open .menu { display: block; }
.menu a { display: block; }
.btn {
  display: inline-block; background: var(--accent); color: var(--accent-text);
  padding: 6px 14px; border-radius: 6px; text-decoration: none;
  font-family: system-ui, sans-serif; font-size: 0.9rem;
}
.btn:hover { opacity: 0.9; }
nav a.btn { color: var(--accent-text); }

/* Page layout */
main { padding-top: 28px; padding-bottom: 40px; }
section { padding: 8px 0 12px; }
h1 { font-size: 1.8rem; margin: 0 0 6px; }
h2 { font-size: 1.25rem; margin: 2rem 0 0.8rem; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 0.4rem; }
.meta { color: var(--muted); font-size: 0.92rem; }
.tag {
  font-family: system-ui, sans-serif; font-size: 0.75rem;
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; color: var(--muted);
}

/* Hero */
.hero { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; padding: 10px 0 18px; }
.hero img {
  width: 190px; height: 190px; object-fit: cover; object-position: top;
  border-radius: 50%; border: 3px solid var(--line); background: var(--bg-alt);
}
.hero .text { flex: 1; min-width: 260px; }
.links a { margin-right: 14px; font-family: system-ui, sans-serif; font-size: 0.92rem; }
.jump { font-family: system-ui, sans-serif; font-size: 0.92rem; margin: 10px 0 0; }
.jump a { margin-right: 12px; }

/* Cards and grids */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.card { background: var(--bg-alt); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.stat { text-align: center; }
.stat .num { font-size: 1.9rem; font-weight: bold; color: var(--accent); font-family: system-ui, sans-serif; }
.stat .label { color: var(--muted); font-size: 0.88rem; font-family: system-ui, sans-serif; }
.skills { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.skills h3 { margin-top: 0; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 18px; }
.timeline li::before {
  content: ""; position: absolute; left: -6px; top: 8px; width: 10px; height: 10px;
  background: var(--accent); border-radius: 50%;
}
.timeline .when { font-family: system-ui, sans-serif; font-size: 0.85rem; color: var(--muted); display: block; }

/* Award */
.award { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.award img { width: 220px; max-width: 100%; border: 1px solid var(--line); border-radius: 6px; cursor: zoom-in; }
.award .info { flex: 1; min-width: 240px; }
.modal {
  display: none; position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0.8);
  align-items: center; justify-content: center; padding: 20px; cursor: zoom-out;
}
.modal.open { display: flex; }
.modal img { max-width: 100%; max-height: 100%; border-radius: 6px; }

/* Lists and tables */
ol.pubs { padding-left: 1.4rem; }
ol.pubs li { margin-bottom: 0.9rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: system-ui, sans-serif; font-size: 0.85rem; color: var(--muted); }
.todo { background: #fff6d6; color: #5a4a00; padding: 1px 4px; border-radius: 3px; }
@media (prefers-color-scheme: dark) { .todo { background: #4a4020; color: #f5e6a0; } }

footer { border-top: 1px solid var(--line); background: var(--bg-alt); padding: 22px 0 30px; color: var(--muted); font-size: 0.88rem; }
footer p { margin: 4px 0; }
/* Identifier icons */
.ids { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 0; margin: 10px 0; }
.ids a { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; color: var(--text); font-family: system-ui, sans-serif; font-size: 0.9rem; }
.ids a:hover { color: var(--accent); }
.ids svg { width: 28px; height: 28px; flex: none; }

/* Theme toggle button */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; cursor: pointer;
  background: none; color: var(--muted);
  border: 1px solid var(--line); border-radius: 50%;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
