/* ============================================================
   DESIGN TOKENS — light mode (default)
   ============================================================ */
:root {
  --bg:           #ffffff;
  --bg-alt:       #f8fafc;
  --text:         #0f172a;
  --text-muted:   #64748b;
  --accent:       #4338ca;
  --accent-2:     #3730a3;
  --accent-sub:   #eef2ff;
  --border:       #e2e8f0;
  --card:         #ffffff;
  --tag-bg:       #eef2ff;
  --tag-text:     #4338ca;
  --tl-line:      #e2e8f0;
  --nav-bg:       rgba(255,255,255,0.90);
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
  --radius:       12px;
}

/* Dark — system preference, no manual override */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #0f172a;
    --bg-alt:     #1e293b;
    --text:       #f1f5f9;
    --text-muted: #94a3b8;
    --accent:     #818cf8;
    --accent-2:   #a5b4fc;
    --accent-sub: #1e1b4b;
    --border:     #334155;
    --card:       #1e293b;
    --tag-bg:     #1e1b4b;
    --tag-text:   #a5b4fc;
    --tl-line:    #334155;
    --nav-bg:     rgba(15,23,42,0.90);
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.30);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.45);
  }
}

/* Dark — manual override beats media query (same element, later in file) */
[data-theme="dark"] {
  --bg:         #0f172a;
  --bg-alt:     #1e293b;
  --text:       #f1f5f9;
  --text-muted: #94a3b8;
  --accent:     #818cf8;
  --accent-2:   #a5b4fc;
  --accent-sub: #1e1b4b;
  --border:     #334155;
  --card:       #1e293b;
  --tag-bg:     #1e1b4b;
  --tag-text:   #a5b4fc;
  --tl-line:    #334155;
  --nav-bg:     rgba(15,23,42,0.90);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.30);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.45);
}

/* Light — manual override */
[data-theme="light"] {
  --bg:         #ffffff;
  --bg-alt:     #f8fafc;
  --text:       #0f172a;
  --text-muted: #64748b;
  --accent:     #4338ca;
  --accent-2:   #3730a3;
  --accent-sub: #eef2ff;
  --border:     #e2e8f0;
  --card:       #ffffff;
  --tag-bg:     #eef2ff;
  --tag-text:   #4338ca;
  --tl-line:    #e2e8f0;
  --nav-bg:     rgba(255,255,255,0.90);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 68px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s, color 0.2s;
}

h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -0.02em; font-weight: 700; }

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

img { max-width: 100%; height: auto; display: block; }

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
  max-width: 960px;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.section { padding-block: 5rem; }
.section-alt { background: var(--bg-alt); }

/* ============================================================
   NAVIGATION
   ============================================================ */
.nav-header {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.nav-container {
  max-width: 1060px;
  margin-inline: auto;
  padding-inline: 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-logo {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
  flex-shrink: 0;
}
.nav-logo:hover { color: var(--accent); text-decoration: none; }

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.1rem;
  align-items: center;
}

.nav-link {
  display: block;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}
.nav-link:hover,
.nav-link.active {
  color: var(--accent);
  background: var(--accent-sub);
  text-decoration: none;
}

.theme-toggle {
  margin-left: 0.5rem;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-sub);
}
.theme-toggle .icon { width: 16px; height: 16px; }

/* hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-direction: column;
  gap: 5px;
  margin-left: 0.5rem;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* ============================================================
   HERO / ABOUT
   ============================================================ */
.hero-section {
  padding-top: calc(64px + 5rem);
  padding-bottom: 5rem;
  min-height: 90vh;
  display: flex;
  align-items: center;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4rem;
  align-items: center;
}

.hero-eyebrow {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}

.hero-name {
  font-size: clamp(2.4rem, 5vw, 3.5rem);
  font-weight: 700;
  margin-bottom: 0.45rem;
}

.hero-role {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.hero-affil { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.hero-affil a { color: var(--text-muted); }
.hero-affil a:hover { color: var(--accent); text-decoration: underline; }

.hero-bio {
  font-size: 0.975rem;
  color: var(--text-muted);
  max-width: 540px;
  line-height: 1.8;
  margin-bottom: 1.75rem;
}
.hero-bio strong { color: var(--text); font-weight: 600; }
.hero-bio a { color: var(--accent); }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.15rem;
  border-radius: 9px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn-icon { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-secondary:hover { background: var(--accent-sub); color: var(--accent); }

/* Social row */
.social-links { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  text-decoration: none;
}
.social-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-sub);
  text-decoration: none;
}
.social-link svg { width: 18px; height: 18px; }

/* Avatar */
.hero-image { flex-shrink: 0; }

.avatar {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--border);
  box-shadow: var(--shadow-md);
  transition: border-color 0.2s;
}

/* ============================================================
   SECTION HEADINGS
   ============================================================ */
.section-title {
  font-size: clamp(1.6rem, 3vw, 2rem);
  margin-bottom: 0.6rem;
}
.section-title::after {
  content: '';
  display: block;
  width: 36px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin-top: 0.5rem;
}

.section-intro {
  font-size: 0.975rem;
  color: var(--text-muted);
  max-width: 620px;
  line-height: 1.75;
  margin-bottom: 2.25rem;
}

/* ============================================================
   RESEARCH INTERESTS
   ============================================================ */
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1.1rem;
}

.research-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.25rem;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.research-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.research-icon {
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: 0.65rem;
}
.research-card h3 { font-size: 0.975rem; margin-bottom: 0.45rem; }
.research-card p  { font-size: 0.875rem; color: var(--text-muted); line-height: 1.65; }
.research-card p em { color: var(--accent); font-style: normal; font-weight: 500; }

/* ============================================================
   PUBLICATIONS
   ============================================================ */
.publications-list { display: flex; flex-direction: column; gap: 1rem; }

.pub-card {
  display: flex;
  gap: 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.4rem 1.25rem;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.pub-card:hover { box-shadow: var(--shadow-md); border-color: var(--accent); }

.pub-year {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-sub);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  height: fit-content;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 0.2rem;
  letter-spacing: 0.02em;
}

.pub-body { flex: 1; min-width: 0; }

.pub-title {
  font-size: 0.975rem;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 0.3rem;
}
.pub-authors { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 0.2rem; }
.pub-venue   { font-size: 0.85rem;  color: var(--text-muted); font-style: italic; margin-bottom: 0.85rem; }

.pub-abstract {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.7;
  border-left: 3px solid var(--accent);
  padding-left: 0.9rem;
  margin-bottom: 0.85rem;
}
.pub-abstract em { color: var(--text); font-style: normal; font-weight: 500; }

/* Tags */
.pub-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}
.tag {
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  letter-spacing: 0.01em;
}

/* Pill buttons (abstract / bibtex / links) */
.pub-links { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.pill-btn {
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--accent);
  background: var(--accent-sub);
  border: 1px solid transparent;
  padding: 0.22rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  line-height: 1.6;
  display: inline-flex;
  align-items: center;
}
.pill-btn:hover { border-color: var(--accent); color: var(--accent-2); text-decoration: none; }
.pill-btn[aria-expanded="true"] { background: var(--accent); color: #fff; }

/* BibTeX block */
.bibtex {
  margin-top: 0.75rem;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--text-muted);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  white-space: pre;
  cursor: text;
  user-select: all;
}

/* Extra top padding on the standalone publications page to clear the fixed navbar */
.pub-page-section { padding-top: calc(64px + 3rem); }

/* View all publications link */
.view-all-wrap {
  margin-top: 1.75rem;
  text-align: center;
}

/* ============================================================
   PROJECTS
   ============================================================ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.1rem;
}

.project-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.25rem;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.project-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.project-title { font-size: 0.975rem; font-weight: 600; line-height: 1.4; flex: 1; color: var(--text); }

/* Small corner label showing where the card links ("GitHub ↗" or "Visit ↗") */
.project-dest-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s;
}

/* When the card is an <a> tag, reset link styles so it looks like a card */
a.project-card {
  display: block;
  text-decoration: none;
  color: inherit;
}
a.project-card:hover { text-decoration: none; }
a.project-card:hover .project-dest-label { color: var(--accent); }

.project-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 1rem;
}

/* ============================================================
   EXPERIENCE TIMELINE
   ============================================================ */
.experience-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
}

.tl-group {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.timeline {
  position: relative;
  padding-left: 1.6rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 0;
  width: 2px;
  background: var(--tl-line);
  border-radius: 1px;
}

.timeline-item {
  position: relative;
  margin-bottom: 2rem;
}
.timeline-item:last-child { margin-bottom: 0; }

.tl-dot {
  position: absolute;
  left: -1.6rem;
  top: 7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  outline: 2px solid var(--accent);
  z-index: 1;
}

.tl-date {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.03em;
  margin-bottom: 0.2rem;
}
.tl-title { font-size: 0.95rem; margin-bottom: 0.15rem; }
.tl-org   { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.tl-desc  { font-size: 0.875rem; color: var(--text-muted); line-height: 1.6; }
.tl-desc a { color: var(--accent); }

/* ============================================================
   CONTACT
   ============================================================ */
.contact-wrap { text-align: center; }
.contact-wrap .section-title::after { margin-inline: auto; }
.contact-wrap .section-intro { margin-inline: auto; }
.contact-wrap .social-links { justify-content: center; }

.contact-email {
  display: inline-block;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 1.5rem;
}
.contact-email:hover { color: var(--accent-2); }

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

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--text);
  color: var(--bg);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 820px) {
  .experience-columns { grid-template-columns: 1fr; gap: 2.5rem; }
}

@media (max-width: 720px) {
  /* Mobile nav */
  .nav-links {
    display: none;
    position: fixed;
    top: 64px;
    inset-inline: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0.75rem 1rem 1rem;
    gap: 0.2rem;
    z-index: 99;
  }
  .nav-links.open { display: flex; }
  .nav-link { padding: 0.55rem 0.75rem; }
  .nav-toggle { display: flex; }

  /* Hero stacks vertically */
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2rem;
  }
  .hero-image { order: -1; }
  .avatar { width: 180px; height: 180px; margin-inline: auto; }
  .hero-bio { margin-inline: auto; }
  .hero-actions { justify-content: center; }
  .social-links { justify-content: center; }
}

@media (max-width: 480px) {
  .section { padding-block: 3.5rem; }
  .hero-section { padding-top: calc(64px + 2.5rem); }
  .research-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .pub-card { flex-direction: column; gap: 0.6rem; }
  .pub-year { align-self: flex-start; }
}
