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

/* ─── LIGHT THEME ─── */
:root {
  --primary:       #1e3a8a;
  --primary-hover: #1e40af;
  --primary-light: #eef2ff;
  --primary-muted: #c7d2fe;
  --text:          #111827;
  --text-muted:    #4b5563;
  --text-faint:    #9ca3af;
  --border:        #e5e7eb;
  --bg:            #ffffff;
  --bg-alt:        #f9fafb;
  --bg-card:       #ffffff;
  --shadow:        rgba(0,0,0,0.06);
  --nav-height:    56px;
}

/* ─── DARK THEME ─── */
html.dark {
  --primary:       #93c5fd;
  --primary-hover: #bfdbfe;
  --primary-light: #1e2d5a;
  --primary-muted: #1e3a8a;
  --text:          #f1f5f9;
  --text-muted:    #94a3b8;
  --text-faint:    #64748b;
  --border:        #1e293b;
  --bg:            #0f172a;
  --bg-alt:        #1e293b;
  --bg-card:       #1e293b;
  --shadow:        rgba(0,0,0,0.3);
}

/* ─── BASE ─── */
body {
  font-family: 'Inter', 'Noto Sans SC', sans-serif;
  font-size: 19px;
  line-height: 1.85;
  color: var(--text);
  background: var(--bg);
  transition: background 0.25s, color 0.25s;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── NAV ─── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--bg);
  border-bottom: 2px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.25s, border-color 0.25s;
}
.nav-inner {
  width: 75%;
  max-width: 1400px;
  min-width: 320px;
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* social icons in nav (left side) */
.nav-social {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}
.nav-social a {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 1rem;
  text-decoration: none;
  border-radius: 4px;
  transition: color 0.15s;
}
.nav-social a:hover { color: var(--primary); }

.nav-spacer { flex: 1; }

/* nav links (right side) */
.nav-links {
  display: flex;
  gap: 0.1rem;
  list-style: none;
}
.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.28rem 0.7rem;
  border-radius: 5px;
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.15s;
  letter-spacing: 0.01em;
}
.nav-links a:hover { color: var(--primary); text-decoration: none; }
.nav-links a.active { color: var(--primary); font-weight: 700; }

/* dark mode toggle button */
.theme-toggle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--primary); border-color: var(--primary); }

/* ─── LAYOUT ─── */
.page-wrapper {
  width: 75%;
  max-width: 1400px;
  min-width: 320px;
  margin: 0 auto;
  padding: 2.8rem 0 5rem;
}
section { margin-bottom: 2.8rem; }

/* ─── SECTION TITLE ─── */
.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.35rem;
  margin-bottom: 1.4rem;
  display: inline-block;
}

/* ─── PUBLICATION CARDS ─── */
.pub-list { display: flex; flex-direction: column; gap: 1rem; }
.pub-card {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.2rem;
  padding: 1.2rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pub-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 20px var(--shadow);
}
.pub-thumb {
  width: 300px;
  aspect-ratio: 2 / 1;
  height: auto;
  min-width: 0;
  border-radius: 6px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
  overflow: hidden;
}
.pub-thumb img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 5px; }
.pub-thumb img { cursor: zoom-in; }
.pub-title { font-weight: 600; font-size: 1rem; line-height: 1.45; margin-bottom: 0.28rem; }
.pub-title a { color: var(--text); text-decoration: none; }
.pub-title a:hover { color: var(--primary); }
.pub-authors { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.18rem; }
.pub-authors .me { font-weight: 700; color: var(--text); }
.pub-venue { font-size: 0.8rem; color: var(--text-faint); margin-bottom: 0.45rem; font-style: italic; }
.pub-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.5rem; }
.tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.12rem 0.5rem;
  border-radius: 4px;
  background: var(--primary-light);
  color: var(--primary);
}
.pub-links { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.pub-links a {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 4px;
  padding: 0.12rem 0.5rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.pub-links a:hover { background: var(--primary); color: #fff; }
.bibtex-toggle {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-faint);
  border: 1px solid var(--border);
  background: none;
  border-radius: 4px;
  padding: 0.12rem 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  font-family: inherit;
}
.bibtex-toggle:hover { border-color: var(--text-muted); color: var(--text-muted); }
.bibtex-block {
  display: none;
  margin-top: 0.5rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.7rem 1rem;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  overflow-x: auto;
  grid-column: 1 / -1;
}
.bibtex-block.open { display: block; }

.toc-lightbox {
  display: none !important;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.85);
}
.toc-lightbox.show { display: flex !important; }
.toc-lightbox img {
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: 90vw !important;
  max-height: 85vh !important;
  object-fit: contain;
}
.toc-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  border: 0;
  background: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox-modal.toc-mode .lightbox-nav,
.lightbox-modal.toc-mode .lightbox-counter { display: none; }

/* ─── EXP / EDUCATION ─── */
.exp-list { display: flex; flex-direction: column; }
.exp-item {
  display: grid;
  grid-template-columns: 185px 1fr;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.exp-item:last-child { border-bottom: none; }
.exp-period { font-size: 0.92rem; color: var(--text-faint); padding-top: 2px; line-height: 1.45; white-space: nowrap; }
.exp-title { font-weight: 600; font-size: 1.1rem; }
.exp-subtitle { font-size: 1.02rem; color: var(--text-muted); }
.exp-detail { font-size: 0.98rem; color: var(--text-faint); margin-top: 0.18rem; }

/* ─── AWARDS ─── */
.award-list { display: flex; flex-direction: column; }
.award-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.award-item:last-child { border-bottom: none; }
.award-year { color: var(--text-faint); white-space: nowrap; font-size: 0.92rem; }

/* ─── NEWS ─── */
.news-list { list-style: none; }
.news-list li {
  display: flex;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.news-list li:last-child { border-bottom: none; }
.news-date { white-space: nowrap; color: var(--text-faint); min-width: 88px; font-variant-numeric: tabular-nums; font-size: 0.92rem; }

/* ─── SKILLS ─── */
.skills-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.skill-chip {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.28rem 0.8rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-alt);
}

/* ─── VIEW ALL LINK ─── */
.view-all {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 1rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}
.view-all:hover { text-decoration: underline; }

/* ─── FOOTER ─── */
footer {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-faint);
  padding: 2rem 0 1rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}
footer a { color: var(--text-faint); }
footer a:hover { color: var(--text-muted); }

/* ─── YEAR LABEL ─── */
.year-label {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.85rem;
}
.year-group { margin-bottom: 2rem; }

/* ─── RESPONSIVE ─── */
@media (max-width: 600px) {
  .nav-inner { width: 92%; gap: 0.75rem; }
  .page-wrapper { width: 92%; }
  .nav-links a { padding: 0.28rem 0.5rem; font-size: 0.8rem; }
  .pub-card { grid-template-columns: 1fr; }
  .pub-thumb { width: 100%; height: auto; }
  .exp-item { grid-template-columns: 1fr; gap: 0.15rem; }
  .exp-period { color: var(--primary); font-weight: 600; }
}
