:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1d2125;
  --muted: #5f6670;
  --line: #e4e1da;
  --accent: #1f3a5f;
  --accent-soft: #e8eef5;
  --land: #e2e0da;
  --lived: #2f5d8a;
  --worked: #e09a2c;
  --visited: #b7c7d8;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171b;
    --surface: #1b1f24;
    --text: #e7e9ec;
    --muted: #9aa3ad;
    --line: #2c323a;
    --accent: #9cc0ea;
    --accent-soft: #1f2a38;
    --land: #2a3038;
    --lived: #6fa3d8;
    --worked: #e3a23f;
    --visited: #4a6079;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* Nav */
.topnav {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topnav-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 16px; }
.brand { font-family: var(--serif); font-weight: 600; font-size: 20px; text-decoration: none; color: var(--text); }
.topnav ul { list-style: none; display: flex; gap: 20px; margin: 0; padding: 0; overflow-x: auto; }
.topnav ul a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; }
.topnav ul a:hover { color: var(--text); }

/* Hero */
.hero { display: flex; align-items: center; gap: 32px; padding-top: 64px; padding-bottom: 40px; }
.photo {
  flex: none; width: 140px; height: 140px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; overflow: hidden;
  font-family: var(--serif); font-size: 44px;
}
.photo img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(32px, 6vw, 46px); line-height: 1.1; margin: 0 0 8px; letter-spacing: -0.01em; }
.subtitle { margin: 0 0 14px; color: var(--muted); font-size: 17px; }
.profiles { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; padding: 0; font-size: 14px; font-weight: 500; }

/* Sections */
section { padding: 36px 0; border-top: 1px solid var(--line); }
h2 { font-family: var(--serif); font-weight: 600; font-size: 26px; margin: 0 0 18px; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 10px; }
#bio p { margin: 0 0 14px; max-width: 68ch; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 18px 0 0; }
.tags li { background: var(--accent-soft); color: var(--accent); padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; }

/* Publications */
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters button {
  font: 500 13px var(--sans); color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; cursor: pointer;
}
.filters button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.year { font-family: var(--serif); color: var(--muted); font-weight: 400; font-size: 18px; margin: 22px 0 8px; }
.pubs { list-style: none; margin: 0; padding: 0; }
.pub { padding: 14px 0; border-bottom: 1px dashed var(--line); }
.pub:last-child { border-bottom: 0; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.pub-title { font-family: var(--serif); font-size: 19px; font-weight: 600; line-height: 1.35; }
.pub-authors { font-size: 14px; margin-top: 4px; }
.pub-venue { font-size: 14px; color: var(--muted); font-style: italic; }
.pub-note { font-size: 14px; color: var(--muted); margin-top: 4px; }
.pub-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 13px; font-weight: 600; }

/* Projects */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; }
.card h3 { font-family: var(--serif); font-size: 18px; line-height: 1.35; margin-bottom: 6px; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
.card .meta { font-size: 13px; color: var(--muted); }
.card p { font-size: 14px; margin: 10px 0 0; }

/* CV */
.two-col { display: grid; gap: 32px; grid-template-columns: 1fr 1fr; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 0 0 16px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.t-main { font-weight: 600; font-size: 15px; }
.t-sub, .t-date { font-size: 14px; color: var(--muted); }

/* Map */
.map-figure { margin: 0; position: relative; }
.map-wrap svg { display: block; width: 100%; height: auto; }
.country { fill: var(--land); stroke: var(--bg); stroke-width: 0.5; }
.country.hl { stroke: var(--bg); stroke-width: 0.8; }
.c-lived { fill: var(--lived); }
.c-worked { fill: var(--worked); }
.c-visited { fill: var(--visited); }
.country.c-both { fill: url(#hatch); }
.country.hl:hover, .dot:hover { filter: brightness(1.12); }
.hatch-a { fill: var(--worked); }
.hatch-b { fill: var(--lived); }
.dot { stroke: var(--bg); stroke-width: 1.5; }
.dot.c-both { fill: var(--lived); stroke: var(--worked); stroke-width: 2.5; }
.map-tip {
  position: absolute; pointer-events: none; z-index: 2;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 10px; font-size: 13px; line-height: 1.4; box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.map-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: 7px; vertical-align: -2px; }
.sw-lived { background: var(--lived); }
.sw-worked { background: var(--worked); }
.sw-visited { background: var(--visited); }
.place-stat { margin: 0 0 18px; font-family: var(--serif); font-size: 17px; color: var(--muted); }
.sw-both { background: repeating-linear-gradient(45deg, var(--lived) 0 3px, var(--worked) 3px 6px); }
.place-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 14px 0 0; font-size: 14px; }
.place-list dt { font-weight: 600; white-space: nowrap; }
.place-list dd { margin: 0; color: var(--muted); }

.footer { padding: 28px 20px 48px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }

@media (max-width: 640px) {
  .hero { flex-direction: column; align-items: flex-start; gap: 20px; padding-top: 36px; }
  .photo { width: 104px; height: 104px; font-size: 34px; }
  .two-col { grid-template-columns: 1fr; }
  .topnav ul { gap: 14px; }
}
.timeline + .col-sub { margin-top: 28px; }
.timeline + .col-sub, .langs + .col-sub { margin-top: 28px; }
.langs { margin: 0; font-size: 14px; line-height: 1.9; }
.lang { font-weight: 600; }
.lang-level { color: var(--muted); }
.langs-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-top: 24px; padding-top: 20px; border-top: 1px dashed var(--line); }
.langs-row h3 { margin: 0; }
