:root {
  --bg: #ffffff;
  --bg-alt: #f6f7fb;
  --card-bg: #ffffff;
  --text: #1a1c23;
  --text-muted: #5b5f6b;
  --border: #e4e6ec;
  --accent: #3454d1;
  --accent-dark: #223a9e;
  --accent-soft: #eaeeff;
  --avatar-ring: #fff;
  --max-width: 860px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161c;
    --bg-alt: #1a1d25;
    --card-bg: #1e212a;
    --text: #e8e9ee;
    --text-muted: #9a9eab;
    --border: #2c2f3a;
    --accent: #7f9bff;
    --accent-dark: #a9bcff;
    --accent-soft: #232842;
    --avatar-ring: #1e212a;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #14161c;
  --bg-alt: #1a1d25;
  --card-bg: #1e212a;
  --text: #e8e9ee;
  --text-muted: #9a9eab;
  --border: #2c2f3a;
  --accent: #7f9bff;
  --accent-dark: #a9bcff;
  --accent-soft: #232842;
  --avatar-ring: #1e212a;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; font-size: 93.75%; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Hero ---------- */

header.hero {
  position: relative;
  padding: 64px 0 44px;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-alt) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}

.hero img.avatar {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--avatar-ring);
  box-shadow: 0 4px 18px rgba(26, 28, 35, 0.12);
  margin-bottom: 22px;
}

.theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
}

.theme-toggle svg { width: 18px; height: 18px; }

.theme-toggle .icon-moon { display: none; }

:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: inline-flex; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: inline-flex; }
}

h1.title {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.subtitle {
  font-size: 1.08rem;
  color: var(--text-muted);
  margin: 0 0 6px;
}

.subtitle .accent { color: var(--accent); font-weight: 600; }

.location {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0 0 26px;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 0.94rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--text);
  color: var(--bg);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(26, 28, 35, 0.18);
}

.btn.btn-outline {
  background: var(--card-bg);
  color: var(--text);
}

.btn.btn-outline:hover { background: var(--bg-alt); }

.btn svg { width: 17px; height: 17px; flex-shrink: 0; }

/* ---------- Nav ---------- */

nav.subnav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

nav.subnav .wrap {
  display: flex;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 10px 24px;
}

nav.subnav a {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
}

nav.subnav a:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

/* ---------- Sections ---------- */

section {
  padding: 52px 0;
  border-bottom: 1px solid var(--border);
}

section.alt { background: var(--bg-alt); }

section:last-of-type { border-bottom: none; }

h2.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  margin: 0 0 30px;
  letter-spacing: -0.01em;
}

.lede {
  max-width: 680px;
  margin: 0 auto 30px;
  text-align: center;
  color: var(--text-muted);
  font-size: 1rem;
}

.prose {
  max-width: 700px;
  margin: 0 auto;
  font-size: 1.02rem;
  color: var(--text);
  text-align: left;
}

/* ---------- Entry cards (publications / experience / education) ---------- */

.entry-list {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.entry-group-label {
  max-width: 780px;
  margin: 0 auto 14px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.entry-group-label:not(:first-child) {
  margin-top: 34px;
}

.entry {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
}

.entry .entry-title {
  font-size: 1.06rem;
  font-weight: 700;
  margin: 0 0 6px;
  line-height: 1.4;
  letter-spacing: -0.005em;
}

.entry .entry-meta {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin: 0 0 8px;
  line-height: 1.5;
}

.entry .entry-meta .accent { color: var(--accent-dark); font-weight: 600; }

.entry .entry-body {
  font-size: 0.92rem;
  color: var(--text);
  margin: 0;
}

.entry .entry-links {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.entry .entry-links a {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-dark);
  background: var(--accent-soft);
  text-decoration: none;
  transition: background 0.15s ease;
}

.entry .entry-links a:hover { background: var(--accent); color: #fff; }

/* ---------- Publications: denser row treatment ---------- */

#publications .entry-list { gap: 2px; }

#publications .entry {
  background: transparent;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
  padding: 14px 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 16px;
}

#publications .entry-list > .entry:last-child { border-bottom: none; }

#publications .entry-title {
  font-size: 0.96rem;
  margin: 0;
  flex: 1 1 420px;
}

#publications .entry-meta {
  font-size: 0.82rem;
  margin: 2px 0 0;
  flex: 1 1 420px;
  order: 3;
}

#publications .entry-links {
  margin: 0;
  flex: 0 0 auto;
}

#publications .entry-body {
  flex: 1 1 100%;
  order: 4;
  margin-top: 6px;
}


/* Publications: first-author highlight */
#publications .entry.first-author,
#publications .entry.first-author.has-thumb {
  background: var(--accent-soft);
  border-radius: 10px;
  border-bottom-color: transparent;
  margin-left: -10px;
  margin-right: -10px;
  padding-left: 14px;
  padding-right: 14px;
}

#publications .entry.first-author + .entry { border-top: none; }

#publications .entry.first-author .entry-links a {
  background: var(--accent);
  color: #fff;
}

#publications .entry.first-author .entry-links a:hover {
  background: var(--accent-dark);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #publications .entry.first-author .entry-links a { color: #14161c; }
  :root:not([data-theme="light"]) #publications .entry.first-author .entry-links a:hover { background: #fff; color: #14161c; }
}

:root[data-theme="dark"] #publications .entry.first-author .entry-links a { color: #14161c; }
:root[data-theme="dark"] #publications .entry.first-author .entry-links a:hover { background: #fff; color: #14161c; }

/* Publications: optional banner thumbnail */
#publications .entry.has-thumb {
  display: grid;
  grid-template-columns: 240px 1fr;
  column-gap: 20px;
  row-gap: 0;
  align-items: start;
  padding: 18px 4px;
}

#publications .has-thumb .pub-thumb {
  grid-column: 1;
  grid-row: 1 / span 3;
  width: 240px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
}

#publications .has-thumb > :not(.pub-thumb) { grid-column: 2; }
#publications .has-thumb .entry-links { margin-top: 8px; }

@media (max-width: 640px) {
  #publications .entry.has-thumb { grid-template-columns: 1fr; }
  #publications .has-thumb .pub-thumb { grid-column: 1; grid-row: auto; width: 100%; margin-bottom: 10px; }
  #publications .has-thumb > :not(.pub-thumb) { grid-column: 1; }
}

#publications .conf-entry { align-items: flex-start; }

.talk-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  flex: 1 1 100%;
  order: 4;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.talk-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.talk-badge {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-dark);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.talk-desc {
  flex: 1 1 340px;
  font-size: 0.88rem;
  color: var(--text);
}

/* ---------- Skills ---------- */

.skills-grid {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.skills-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.skills-row:last-child { border-bottom: none; padding-bottom: 0; }

.skills-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 1px;
}

.skills-value {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.5;
}

@media (max-width: 640px) {
  .skills-row { grid-template-columns: 1fr; gap: 4px; }
}

/* ---------- Earlier Projects list ---------- */

.simple-list {
  max-width: 700px;
  margin: 0 auto;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.simple-list li {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.simple-list li strong { color: var(--text); }

.simple-list a {
  color: var(--accent-dark);
  font-weight: 600;
  text-decoration: none;
}

.simple-list a:hover { text-decoration: underline; }

/* ---------- Interests / tags ---------- */

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  max-width: 700px;
  margin: 0 auto;
}

.tag {
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.88rem;
  font-weight: 600;
}

/* ---------- Footer ---------- */

footer {
  padding: 30px 0 50px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

footer a { color: var(--text-muted); }

.center { text-align: center; }

/* ---------- Timeline (Experience / Education) ---------- */

.timeline {
  max-width: 780px;
  margin: 0 auto;
  position: relative;
  padding-left: 28px;
  border-left: 2px solid var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 32px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-marker {
  position: absolute;
  left: -33px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent);
}

.timeline-date {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.timeline-content .entry-title { font-size: 1.02rem; font-weight: 700; margin: 0 0 4px; line-height: 1.4; }
.timeline-content .entry-meta { font-size: 0.86rem; color: var(--text-muted); margin: 0 0 8px; }
.timeline-content .entry-body { font-size: 0.92rem; color: var(--text); margin: 0; }

.exp-list {
  margin: 0;
  padding-left: 20px;
  font-size: 0.92rem;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exp-list li { line-height: 1.55; }

/* ---------- Compact timeline (keeps the roadmap line) ---------- */

section { padding: 36px 0; }
h2.section-title { margin-bottom: 20px; }

.timeline-item { padding-bottom: 18px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-date { font-size: 0.72rem; margin-bottom: 2px; }
.timeline-marker { top: 2px; }

.timeline-content .entry-title { font-size: 0.96rem; margin-bottom: 2px; }
.timeline-content .entry-meta { font-size: 0.82rem; margin-bottom: 4px; }
.timeline-content .entry-body,
.exp-list { font-size: 0.86rem; }
.exp-list { gap: 3px; padding-left: 18px; }
.exp-list li { line-height: 1.45; }
.timeline-content .entry-body { line-height: 1.5; }

.skills-row { padding: 7px 0; }
.simple-list li { margin-bottom: 8px; }
.lede { margin-bottom: 16px; }

/* ---------- Compact hero (avatar left, text right) ---------- */

header.hero { padding: 36px 0 28px; text-align: left; }

header.hero > .wrap {
  display: grid;
  grid-template-columns: 112px 1fr;
  column-gap: 28px;
  align-items: center;
}

.hero img.avatar {
  grid-row: 1 / span 5;
  width: 112px;
  height: 112px;
  margin: 0;
}

header.hero > .wrap > :not(.avatar) { grid-column: 2; }

h1.title { font-size: 1.9rem; margin-bottom: 4px; }
.subtitle { font-size: 1rem; margin-bottom: 2px; }
.location { font-size: 0.86rem; margin-bottom: 12px; }

header.hero .tag-row { margin: 0 0 14px !important; justify-content: flex-start; gap: 6px; }
header.hero .tag { padding: 4px 12px; font-size: 0.8rem; }
header.hero .links { justify-content: flex-start; gap: 8px; }
header.hero .btn { padding: 7px 16px; font-size: 0.86rem; }

@media (max-width: 640px) {
  header.hero { padding: 48px 0 26px; text-align: center; }
  header.hero > .wrap { display: block; }
  .hero img.avatar { width: 96px; height: 96px; margin-bottom: 14px; }
  header.hero .tag-row { margin: 0 auto 14px !important; }
  header.hero .tag-row, header.hero .links { justify-content: center; }
}

/* ---------- Mobile ---------- */

@media (max-width: 640px) {
  .wrap { padding: 0 18px; }

  header.hero { padding: 56px 0 36px; }

  .theme-toggle { top: 14px; right: 14px; }

  h1.title { font-size: 1.7rem; }

  .btn { padding: 9px 16px; font-size: 0.88rem; }

  nav.subnav .wrap { gap: 2px; padding: 8px 12px; }

  nav.subnav a { padding: 6px 10px; font-size: 0.8rem; }

  section { padding: 40px 0; }

  h2.section-title { font-size: 1.3rem; }

  .entry { padding: 16px 18px; }

  .entry .entry-title { font-size: 1rem; }

  .timeline { padding-left: 20px; }

  .timeline-marker { left: -25px; }
}
