:root {
  --bg: #ffffff;
  --bg-soft: #f6f7fb;
  --card: #ffffff;
  --text: #1d2433;
  --text-muted: #5b6475;
  --border: #e4e7ef;
  --accent: #4f46e5;
  --accent-soft: rgba(79, 70, 229, 0.09);
  --gold: #b7791f;
  --gold-soft: rgba(183, 121, 31, 0.12);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.06);
  --radius: 14px;
  --max: 920px;
}

[data-theme="dark"] {
  --bg: #0e1117;
  --bg-soft: #151a23;
  --card: #161b25;
  --text: #e6e9f0;
  --text-muted: #9aa3b5;
  --border: #252c3a;
  --accent: #8b85ff;
  --accent-soft: rgba(139, 133, 255, 0.14);
  --gold: #f0b85a;
  --gold-soft: rgba(240, 184, 90, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  transition: background 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }

.nav-brand { font-weight: 500; font-size: 1.05rem; color: var(--text); letter-spacing: -0.01em; }
.nav-brand:hover { text-decoration: none; }
.brand-first { font-weight: 700; color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: block;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
}
.nav-links a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.nav-links a.active { color: var(--accent); background: var(--accent-soft); }

.theme-toggle, .nav-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  margin-left: 8px;
  font-size: 0.95rem;
}
.theme-toggle:hover, .nav-toggle:hover { color: var(--accent); border-color: var(--accent); }
.icon-sun { display: none; }
[data-theme="dark"] .icon-sun { display: inline; }
[data-theme="dark"] .icon-moon { display: none; }
.nav-toggle { display: none; }

/* Main */
main.container { padding-top: 56px; padding-bottom: 72px; }

.page-header { margin-bottom: 24px; }
.page-header h1 {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 2.3rem;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
.page-description { color: var(--text-muted); margin: 0; }

/* Hero */
.hero { display: grid; grid-template-columns: 1fr 260px; gap: 48px; align-items: start; }
.hero-kicker { color: var(--accent); font-weight: 600; margin: 0 0 4px; }
.hero-name {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 2.7rem;
  line-height: 1.15;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.hero-role { color: var(--text-muted); margin: 0 0 20px; font-size: 0.98rem; line-height: 1.55; }
.hero-photo img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.bio p { margin: 0 0 14px; }

.callout {
  margin: 18px 0 0 !important;
  padding: 12px 16px;
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  background: var(--accent-soft);
}
.callout i { color: var(--accent); margin-right: 6px; }
.callout strong { color: var(--text); }

.interests { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px !important; }
.tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.socials { display: flex; gap: 10px; margin-top: 20px; }
.socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1.15rem;
  transition: all 0.2s ease;
}
.socials a:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}

.contact-emails { margin: 14px 0 0; font-size: 0.92rem; color: var(--text-muted); }
.contact-emails i { margin-right: 6px; }
.contact-emails .sep { margin: 0 6px; }

/* Sections */
.section { margin-top: 56px; }
.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}
.page-header + .section, .page-header + .cv-download + .section { margin-top: 24px; }
.year-title { color: var(--accent); }

/* News */
.news, .awards { list-style: none; margin: 0; padding: 0; }
.news li, .awards li {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
}
.news li:last-child, .awards li:last-child { border-bottom: none; }
.news-date { font-weight: 600; color: var(--text-muted); font-size: 0.9rem; padding-top: 2px; }

/* Publications */
.pub {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.pub:last-of-type { border-bottom: none; }
.pub-badge {
  align-self: start;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  letter-spacing: 0.02em;
}
.pub-title { font-size: 1.04rem; font-weight: 600; line-height: 1.45; margin: 0 0 4px; }
.pub-authors { margin: 0 0 2px; color: var(--text-muted); font-size: 0.93rem; }
.pub-authors .me { color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.pub-venue { margin: 0; font-size: 0.92rem; color: var(--text-muted); }
.pub-award {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  font-style: normal;
  padding: 2px 9px;
  border-radius: 999px;
  color: var(--gold);
  background: var(--gold-soft);
}
.pub-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.btn-chip {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 11px;
  border-radius: 7px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.15s ease;
}
.btn-chip:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.more-link { margin-top: 14px; font-weight: 600; }

/* Projects */
.project-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.project-card {
  display: flex;
  flex-direction: column;
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.project-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.project-meta { font-size: 0.8rem; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; }
.project-title { margin: 6px 0 2px; font-size: 1.1rem; line-height: 1.35; }
.project-org { font-size: 0.86rem; color: var(--text-muted); margin-bottom: 10px; }
.project-desc { font-size: 0.93rem; margin: 0 0 14px; flex-grow: 1; }
.project-tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* CV */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover { text-decoration: none; filter: brightness(1.08); }
[data-theme="dark"] .btn-primary { color: #0e1117; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 22px; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -29px;
  top: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.tl-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.tl-period { color: var(--text-muted); font-size: 0.88rem; font-weight: 500; white-space: nowrap; }
.tl-org { color: var(--accent); font-size: 0.93rem; font-weight: 500; }
.tl-details { color: var(--text-muted); font-size: 0.92rem; }

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

/* Responsive */
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .hero-photo { order: -1; max-width: 220px; }
  .hero-name { font-size: 2.2rem; }
  .project-grid { grid-template-columns: 1fr; }
  .pub { grid-template-columns: 1fr; gap: 8px; }
  .pub-badge { justify-self: start; }
  .news li, .awards li { grid-template-columns: 1fr; gap: 0; }

  .nav-toggle { display: inline-block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 12px 24px 18px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }
  .nav-links.open { display: flex; }
  .theme-toggle { margin: 8px 0 0; }
}
