/* ═══════════════════════════════════════════
   LIGHT THEME (default)
   ═══════════════════════════════════════════ */
:root {
  --color-bg: #fdfdfd;
  --color-text: #1d1d1d;
  --color-text-secondary: #555;
  --color-text-muted: #888;
  --color-link: #b5121b;
  --color-link-hover: #8a0e15;
  --color-border: #e0e0e0;
  --color-border-light: #f0f0f0;
  --color-tag-bg: #f4f4f4;
  --color-tag-text: #444;
  --color-nav-bg: rgba(253, 253, 253, 0.92);
  --color-code-bg: #f6f6f6;
  --color-accent-subtle: #fdf6f6;
  --color-placeholder-from: #eee;
  --color-placeholder-to: #ddd;
  --color-placeholder-stroke: #999;
  --font-display: 'EB Garamond', Georgia, 'Times New Roman', serif;
  --font-body: 'Source Sans 3', 'Helvetica Neue', Helvetica, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --max-width: 820px;
  --nav-height: 56px;
}

/* ═══════════════════════════════════════════
   DARK THEME
   ═══════════════════════════════════════════ */
[data-theme="dark"] {
  --color-bg: #161618;
  --color-text: #e4e4e7;
  --color-text-secondary: #a1a1aa;
  --color-text-muted: #71717a;
  --color-link: #f87171;
  --color-link-hover: #fca5a5;
  --color-border: #2e2e33;
  --color-border-light: #232328;
  --color-tag-bg: #232328;
  --color-tag-text: #c4c4cc;
  --color-nav-bg: rgba(22, 22, 24, 0.92);
  --color-code-bg: #1e1e22;
  --color-accent-subtle: #2a1a1a;
  --color-placeholder-from: #2a2a2e;
  --color-placeholder-to: #232328;
  --color-placeholder-stroke: #555;
}

/* ═══════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  font-size: 16px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ═══════════════════════════════════════════
   NAVIGATION
   ═══════════════════════════════════════════ */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-nav-bg);
  border-bottom: 1px solid var(--color-border-light);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.nav-brand {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-links {
  display: flex;
  gap: 4px;
}
.nav-links a {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--color-text);
  background: var(--color-tag-bg);
}

/* ── Theme toggle ── */
.theme-toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all 0.25s ease;
  flex-shrink: 0;
}
.theme-toggle:hover {
  color: var(--color-text);
  background: var(--color-tag-bg);
  border-color: var(--color-text-muted);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
}
.theme-toggle .icon-moon  { display: block; }
.theme-toggle .icon-sun   { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }

/* ── Hamburger (mobile) ── */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-hamburger svg {
  stroke: var(--color-text);
}

/* ═══════════════════════════════════════════
   MAIN CONTAINER
   ═══════════════════════════════════════════ */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ═══════════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════════ */
.page-header {
  padding: 56px 0 20px;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--color-text);
}

/* ═══════════════════════════════════════════
   ABOUT PAGE — LAYOUT
   ═══════════════════════════════════════════ */
.about-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  padding: 12px 0 48px;
  align-items: start;
}

/* ── Profile column ── */
.profile-col {
  position: sticky;
  top: 80px;
}
.profile-photo {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  object-fit: cover;
  background: var(--color-border-light);
  display: block;
  border: 1px solid var(--color-border-light);
}
.profile-placeholder {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--color-placeholder-from) 0%, var(--color-placeholder-to) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border-light);
  transition: background 0.3s ease;
}
.profile-placeholder svg {
  opacity: 0.5;
  stroke: var(--color-placeholder-stroke);
}

/* ── Social links ── */
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
  justify-content: center;
}
.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: all 0.2s ease;
  background: var(--color-tag-bg);
}
.social-links a:hover {
  color: var(--color-link);
  background: var(--color-accent-subtle);
  transform: translateY(-1px);
}
.social-links a svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}
.contact-note {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 12px;
  font-style: italic;
}

/* ── Bio column ── */
.bio-col p {
  margin-bottom: 16px;
  font-size: 1.0rem;
  color: var(--color-text);
  line-height: 1.78;
}
.bio-col a {
  color: var(--color-link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.bio-col a:hover {
  border-bottom-color: var(--color-link);
}

/* ═══════════════════════════════════════════
   SECTION HEADINGS
   ═══════════════════════════════════════════ */
.section-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  margin: 48px 0 24px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-text);
  display: inline-block;
  letter-spacing: -0.01em;
}
.section-title a {
  color: inherit;
  text-decoration: none;
}
.page-subtitle {
  color: var(--color-text-secondary);
  margin-bottom: 8px;
  font-size: 0.92rem;
}

/* ═══════════════════════════════════════════
   PUBLICATIONS
   ═══════════════════════════════════════════ */
.pub-list {
  list-style: none;
}
.pub-item {
  padding: 24px 0;
  border-bottom: 1px solid var(--color-border-light);
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 20px;
  align-items: start;
}
.pub-item:last-child {
  border-bottom: none;
}
.pub-venue-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  background: var(--color-tag-bg);
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-tag-text);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  font-family: var(--font-body);
  border: 1px solid var(--color-border);
}
.pub-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 4px;
  color: var(--color-text);
}
.pub-authors {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  margin-bottom: 2px;
  line-height: 1.5;
}
.pub-authors .you {
  font-weight: 600;
  color: var(--color-text);
}
.pub-meta {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-bottom: 8px;
}
.pub-award {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: #b8860b;
  font-weight: 600;
  margin-bottom: 6px;
}
[data-theme="dark"] .pub-award {
  color: #f0c040;
}

/* ── Publication link pills ── */
.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.pub-links a {
  font-size: 0.76rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 5px;
  text-decoration: none;
  color: var(--color-link);
  background: var(--color-accent-subtle);
  border: 1px solid rgba(181, 18, 27, 0.12);
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
}
[data-theme="dark"] .pub-links a {
  border-color: rgba(248, 113, 113, 0.2);
}
.pub-links a:hover {
  background: var(--color-link);
  color: #fff;
  border-color: var(--color-link);
}
.pub-links button {
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 5px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}
.pub-links button:hover {
  background: var(--color-tag-bg);
  color: var(--color-text);
}

/* ── Expandable abstract & bibtex ── */
.pub-abstract,
.pub-bibtex {
  display: none;
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--color-code-bg);
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border-light);
}
.pub-abstract.open,
.pub-bibtex.open {
  display: block;
}
.pub-bibtex pre {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  color: var(--color-text-secondary);
}

/* ═══════════════════════════════════════════
   CV PAGE
   ═══════════════════════════════════════════ */
.cv-section {
  margin-bottom: 40px;
}
.cv-section h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--color-text);
  letter-spacing: -0.01em;
}
.cv-entry {
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border-light);
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
}
.cv-entry:last-child {
  border-bottom: none;
}
.cv-date {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  padding-top: 2px;
  font-variant-numeric: tabular-nums;
}
.cv-content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
  line-height: 1.4;
}
.cv-content .cv-org {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
}
.cv-content .cv-org a {
  color: var(--color-link);
  text-decoration: none;
}
.cv-content .cv-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 4px;
  line-height: 1.6;
}
.cv-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-link);
  text-decoration: none;
  padding: 8px 18px;
  border: 1px solid var(--color-link);
  border-radius: 8px;
  transition: all 0.2s;
  margin-bottom: 32px;
}
.cv-download:hover {
  background: var(--color-link);
  color: #fff;
}

/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */
footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px;
  border-top: 1px solid var(--color-border-light);
  font-size: 0.78rem;
  color: var(--color-text-muted);
  text-align: center;
  line-height: 1.6;
}
footer a {
  color: var(--color-text-muted);
  text-decoration: underline;
}

/* ═══════════════════════════════════════════
   RESPONSIVE — MOBILE (<680px)
   ═══════════════════════════════════════════ */
@media (max-width: 680px) {
  .page-header h1 {
    font-size: 2rem;
  }
  .about-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .profile-col {
    position: static;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .profile-photo,
  .profile-placeholder {
    width: 160px;
  }
  .pub-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .cv-entry {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .nav-hamburger {
    display: block;
  }
  .nav-links.closed {
    display: none;
  }
  .nav-links {
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--color-nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border-light);
    padding: 8px 24px 16px;
    gap: 2px;
    z-index: 99;
  }
  .nav-links a {
    padding: 10px 14px;
  }
}

/* ═══════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════ */
.fade-in {
  opacity: 0;
  transform: translateY(10px);
  animation: fadeUp 0.5s ease forwards;
}
@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.fade-in:nth-child(2) { animation-delay: 0.08s; }
.fade-in:nth-child(3) { animation-delay: 0.16s; }
.fade-in:nth-child(4) { animation-delay: 0.24s; }
