/* ===== Google Fonts ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=DM+Serif+Display:ital@0;1&family=JetBrains+Mono:wght@400;500&display=swap');

/* ===== Design Tokens — Light Mode (default) ===== */
:root {
  /* Backgrounds */
  --bg:           #f5f7fb;
  --bg-2:         #eaeff8;
  --surface:      #ffffff;
  --card:         #ffffff;
  --card-border:  rgba(0, 0, 0, 0.08);
  --card-hover:   rgba(180, 112, 10, 0.035);
  --card-border-hover: rgba(180, 112, 10, 0.35);
  --card-shadow:  0 1px 4px rgba(0,0,0,0.06);

  /* Accent — amber/gold, darkened for legibility on white */
  --accent:       #b8720a;
  --accent-light: #d4870c;
  --accent-dim:   rgba(184, 114, 10, 0.75);
  --accent-glow:  rgba(184, 114, 10, 0.09);
  --accent-glow2: rgba(184, 114, 10, 0.05);

  /* Text */
  --text:         #0f172a;
  --text-2:       #374155;
  --text-3:       #64748b;

  /* Nav */
  --nav-bg:       rgba(245, 247, 251, 0.88);
  --nav-border:   rgba(0, 0, 0, 0.07);
  --mobile-nav-bg: rgba(245, 247, 251, 0.98);

  /* Badges */
  --badge-bg:       rgba(180, 112, 10, 0.1);
  --badge-color:    #a36208;
  --badge-border:   rgba(180, 112, 10, 0.2);
  --spotlight-bg:   rgba(202, 138, 4, 0.1);
  --spotlight-color:#92650a;
  --spotlight-border:rgba(202,138,4,0.22);

  /* Code */
  --code-bg:      rgba(0,0,0,0.04);
  --code-color:   #b8720a;
  --pre-bg:       rgba(0,0,0,0.035);
  --pre-border:   rgba(0,0,0,0.07);

  /* Misc */
  --font-sans:    'Inter', system-ui, -apple-system, sans-serif;
  --font-serif:   'DM Serif Display', Georgia, serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;
  --nav-h:        60px;
  --max-w:        840px;
  --r:            12px;
  --r-sm:         8px;
  --ease:         cubic-bezier(0.4, 0, 0.2, 1);
  --t:            0.2s var(--ease);
  --t-slow:       0.5s var(--ease);
}

/* ===== Dark Mode Overrides ===== */
[data-theme="dark"] {
  --bg:           #070b16;
  --bg-2:         #0c1322;
  --surface:      #111c2e;
  --card:         rgba(255, 255, 255, 0.033);
  --card-border:  rgba(255, 255, 255, 0.07);
  --card-hover:   rgba(232, 168, 56, 0.04);
  --card-border-hover: rgba(232, 168, 56, 0.28);
  --card-shadow:  none;

  --accent:       #e8a838;
  --accent-light: #f5c76a;
  --accent-dim:   rgba(232, 168, 56, 0.65);
  --accent-glow:  rgba(232, 168, 56, 0.11);
  --accent-glow2: rgba(232, 168, 56, 0.06);

  --text:         #dde4f0;
  --text-2:       #8899bb;
  --text-3:       #46567a;

  --nav-bg:       rgba(7, 11, 22, 0.78);
  --nav-border:   rgba(255, 255, 255, 0.05);
  --mobile-nav-bg: rgba(7, 11, 22, 0.98);

  --badge-bg:       rgba(232, 168, 56, 0.10);
  --badge-color:    #e8a838;
  --badge-border:   rgba(232, 168, 56, 0.18);
  --spotlight-bg:   rgba(251, 191, 36, 0.12);
  --spotlight-color:#fbbf24;
  --spotlight-border:rgba(251,191,36,0.25);

  --code-bg:      rgba(255,255,255,0.055);
  --code-color:   #f5c76a;
  --pre-bg:       rgba(255,255,255,0.037);
  --pre-border:   rgba(255,255,255,0.07);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--t-slow), color var(--t-slow);
}

/* Subtle noise texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}
[data-theme="dark"] body::before { opacity: 0.4; }

/* ===== Typography ===== */
h1, h2, h3, h4 { line-height: 1.2; }
h1 { font-family: var(--font-serif); font-weight: 400; font-size: 2.6rem; color: var(--text); }
h2 { font-family: var(--font-serif); font-weight: 400; font-size: 1.9rem; color: var(--text); }
h3 { font-family: var(--font-serif); font-weight: 400; font-size: 1.4rem; color: var(--text); }

a { color: var(--accent); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--accent-light); }

p { color: var(--text-2); line-height: 1.8; }
strong { color: var(--text); font-weight: 600; }
em { color: var(--text-2); font-style: italic; }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--text-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* ===== Navbar ===== */
nav:not(.post-toc) {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--nav-border);
  transition: background var(--t-slow), border-color var(--t-slow);
}

.nav-inner {
  max-width: calc(var(--max-w) + 80px);
  margin: 0 auto;
  padding: 0 36px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.nav-brand {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: 0.01em;
  transition: color var(--t);
  flex-shrink: 0;
}
.nav-brand:hover { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
}

.nav-links a {
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 13px;
  border-radius: 6px;
  transition: all var(--t);
  letter-spacing: 0.025em;
  white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--accent);
  background: var(--accent-glow);
}

.nav-cv {
  border: 1px solid rgba(180, 112, 10, 0.3) !important;
  color: var(--accent) !important;
}
[data-theme="dark"] .nav-cv {
  border-color: rgba(232, 168, 56, 0.3) !important;
}
.nav-cv:hover {
  background: var(--accent-glow) !important;
  border-color: var(--accent) !important;
}

/* ── Theme toggle button ── */
.theme-toggle {
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text-2);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t);
  flex-shrink: 0;
  box-shadow: var(--card-shadow);
}
.theme-toggle:hover {
  border-color: var(--card-border-hover);
  color: var(--accent);
  background: var(--accent-glow);
}

/* Show moon in light mode, sun in dark mode */
.icon-sun  { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun  { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* Mobile hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--t);
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== Layout ===== */
main { padding-top: var(--nav-h); min-height: 100vh; position: relative; z-index: 1; }
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }

.section { padding: 72px 0; }
.section + .section { border-top: 1px solid var(--card-border); }

.section-eyebrow {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
  display: block;
}
.section-heading {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: var(--text);
  margin-bottom: 36px;
}

/* ===== Hero glow ===== */
.hero-glow {
  position: absolute;
  top: -120px;
  right: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(ellipse at center, var(--accent-glow) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

/* ===== Hero ===== */
.hero { padding: 76px 0 56px; position: relative; overflow: hidden; }

.hero-inner {
  display: flex;
  gap: 52px;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}

.hero-photo-wrap { flex-shrink: 0; }

.hero-photo {
  width: 152px;
  height: 152px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--card-border-hover);
  box-shadow:
    0 0 0 6px var(--accent-glow2),
    0 0 48px var(--accent-glow),
    0 12px 32px rgba(0,0,0,0.12);
  transition: box-shadow var(--t-slow);
}
.hero-photo:hover {
  box-shadow:
    0 0 0 6px var(--accent-glow),
    0 0 64px var(--accent-glow),
    0 16px 40px rgba(0,0,0,0.15);
}

.hero-text { flex: 1; }
.hero-text h1 { margin-bottom: 6px; }

.hero-subtitle { font-size: 0.95rem; color: var(--text-2); margin-bottom: 4px; }
.hero-affil    { font-size: 0.85rem; color: var(--text-3); margin-bottom: 18px; }

.hero-contact { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; flex-wrap: wrap; }

.hero-email {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.83rem;
  color: var(--text-2);
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 5px 14px;
  border-radius: 20px;
  transition: all var(--t);
}
.hero-email:hover {
  border-color: var(--card-border-hover);
  color: var(--accent);
  background: var(--accent-glow2);
}
.hero-email svg { opacity: 0.6; }

.hero-bio { font-size: 0.975rem; color: var(--text-2); line-height: 1.85; max-width: 600px; }
.hero-bio strong { color: var(--text); }
.hero-bio em { color: var(--accent-dim); font-style: italic; }

/* ===== Timeline ===== */
.timeline { display: flex; flex-direction: column; }

.timeline-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--card-border);
  transition: all var(--t);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-item:hover .timeline-role { color: var(--accent); }

.timeline-year { font-size: 0.77rem; color: var(--text-3); font-weight: 500; letter-spacing: 0.04em; padding-top: 3px; }
.timeline-role { font-size: 0.9rem; font-weight: 600; color: var(--text); margin-bottom: 2px; transition: color var(--t); }
.timeline-org { font-size: 0.83rem; color: var(--accent); margin-bottom: 2px; }
.timeline-detail { font-size: 0.78rem; color: var(--text-3); }

/* ===== Publications ===== */
.pub-category { margin-bottom: 52px; }
.pub-category-title { font-family: var(--font-serif); font-size: 1.5rem; color: var(--text); margin-bottom: 6px; }
.pub-category-desc { font-size: 0.83rem; color: var(--text-3); margin-bottom: 24px; font-style: italic; }
.pub-subcategory { margin-bottom: 28px; }
.pub-subcategory-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 14px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--card-border);
}
.pub-list { display: flex; flex-direction: column; gap: 10px; list-style: none; }

.pub-item {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--r);
  padding: 16px 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: all var(--t);
  box-shadow: var(--card-shadow);
}
.pub-item:hover {
  border-color: var(--card-border-hover);
  background: var(--card-hover);
  transform: translateX(3px);
  box-shadow: -3px 0 0 var(--accent), 0 4px 16px rgba(0,0,0,0.08);
}

.pub-num { font-size: 0.72rem; color: var(--text-3); font-weight: 600; min-width: 20px; padding-top: 3px; font-variant-numeric: tabular-nums; }
.pub-body { flex: 1; }
.pub-title { font-size: 0.875rem; font-weight: 600; color: var(--text); line-height: 1.55; margin-bottom: 5px; }
.pub-authors { font-size: 0.78rem; color: var(--text-3); margin-bottom: 9px; line-height: 1.5; }
.pub-authors .me {
  color: var(--text);
  font-weight: 700;
}
.pub-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }

.venue-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--badge-bg);
  color: var(--badge-color);
  border: 1px solid var(--badge-border);
}
.spotlight-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--spotlight-bg);
  color: var(--spotlight-color);
  border: 1px solid var(--spotlight-border);
}
.pub-link {
  font-size: 0.72rem;
  color: var(--text-3);
  border: 1px solid var(--card-border);
  padding: 2px 9px;
  border-radius: 20px;
  transition: all var(--t);
}
.pub-link:hover { color: var(--accent); border-color: var(--card-border-hover); background: var(--accent-glow); }
.pub-sub-items { list-style: none; margin-top: 8px; margin-left: 12px; display: flex; flex-direction: column; gap: 3px; }
.pub-sub-item { font-size: 0.77rem; color: var(--text-3); display: flex; align-items: flex-start; gap: 6px; line-height: 1.5; }
.pub-sub-item::before { content: '↳'; opacity: 0.4; flex-shrink: 0; margin-top: 1px; }

/* ===== Blog Index ===== */
.blog-hero { padding: 72px 0 48px; border-bottom: 1px solid var(--card-border); }
.blog-hero h1 { margin-bottom: 12px; }
.blog-hero p { max-width: 520px; }
.blog-posts-section { padding: 52px 0 80px; }

.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }

.blog-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--r);
  padding: 24px;
  transition: all var(--t);
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: inherit;
  box-shadow: var(--card-shadow);
}
.blog-card:hover {
  border-color: var(--card-border-hover);
  background: var(--card-hover);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.1);
  color: inherit;
}
.blog-card-date { font-size: 0.73rem; color: var(--text-3); letter-spacing: 0.05em; }
.blog-card-title { font-family: var(--font-serif); font-size: 1.12rem; color: var(--text); line-height: 1.4; }
.blog-card:hover .blog-card-title { color: var(--accent); }
.blog-card-excerpt { font-size: 0.83rem; color: var(--text-3); line-height: 1.7; flex: 1; }
.blog-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.blog-tag {
  font-size: 0.68rem;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--card);
  color: var(--text-3);
  border: 1px solid var(--card-border);
}

/* ===== Blog Post ===== */
.post-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  z-index: 200;
  width: 0%;
  transition: width 0.08s linear;
}

.post-header {
  padding: 64px 0 40px;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 48px;
}

.post-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-3);
  margin-bottom: 28px;
  transition: color var(--t);
}
.post-back:hover { color: var(--accent); }

.post-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }

.post-title { font-family: var(--font-serif); font-size: 2.4rem; color: var(--text); line-height: 1.18; margin-bottom: 20px; }

.post-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 0.78rem; color: var(--text-3); }
.post-meta span { display: flex; align-items: center; gap: 5px; }

.post-content { max-width: 680px; margin: 0 auto; padding-bottom: 96px; }
.post-content h2 { font-family: var(--font-serif); font-size: 1.65rem; color: var(--text); margin: 52px 0 16px; scroll-margin-top: calc(var(--nav-h) + 24px); }
.post-content h3 { font-size: 1.05rem; font-weight: 600; color: var(--text); margin: 36px 0 12px; scroll-margin-top: calc(var(--nav-h) + 24px); }
.post-content p { color: var(--text-2); margin-bottom: 22px; line-height: 1.9; font-size: 1rem; }
.post-content ul, .post-content ol { color: var(--text-2); padding-left: 24px; margin-bottom: 22px; }
.post-content li { margin-bottom: 8px; line-height: 1.8; }

.post-content .katex-display { margin: 28px 0; overflow-x: auto; padding: 4px 0; }
.post-content .katex { font-size: 1.05em; }

.post-content pre {
  background: var(--pre-bg);
  border: 1px solid var(--pre-border);
  border-radius: var(--r-sm);
  padding: 20px 22px;
  overflow-x: auto;
  margin-bottom: 22px;
}
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.855rem;
  color: var(--code-color);
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
}
.post-content pre code { background: none; padding: 0; color: var(--text-2); font-size: 0.84rem; line-height: 1.7; }

.post-content blockquote {
  border-left: 2px solid var(--accent);
  padding: 8px 20px;
  margin: 28px 0;
  background: var(--accent-glow2);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.post-content blockquote p { color: var(--text-2); font-style: italic; margin-bottom: 0; }
.post-content hr { border: none; border-top: 1px solid var(--card-border); margin: 40px 0; }

/* ===== Footer ===== */
footer { border-top: 1px solid var(--card-border); padding: 28px 0; text-align: center; position: relative; z-index: 1; }
.footer-text { font-size: 0.78rem; color: var(--text-3); }
.footer-text a { color: var(--text-3); }
.footer-text a:hover { color: var(--accent); }

/* ===== Fade-in ===== */
.fade-in { opacity: 0; transform: translateY(18px); transition: opacity 0.65s var(--ease), transform 0.65s var(--ease); }
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* ===== Responsive ===== */
@media (max-width: 720px) {
  h1 { font-size: 1.9rem; }

  .nav-links {
    display: none;
    position: fixed;
    top: var(--nav-h);
    inset-inline: 0;
    background: var(--mobile-nav-bg);
    backdrop-filter: blur(20px);
    padding: 16px;
    flex-direction: column;
    gap: 4px;
    border-bottom: 1px solid var(--nav-border);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 14px; width: 100%; }
  .nav-toggle { display: flex; }
  .nav-inner { padding: 0 20px; }

  .hero { padding: 48px 0 40px; }
  .hero-inner { flex-direction: column; gap: 24px; }
  .hero-photo { width: 120px; height: 120px; }

  .timeline-item { grid-template-columns: 1fr; gap: 4px; }
  .timeline-year { font-size: 0.72rem; }

  .post-title { font-size: 1.8rem; }
  .section { padding: 52px 0; }
  .blog-grid { grid-template-columns: 1fr; }
}

/* ===== KaTeX ===== */
.katex-html { color: var(--text); }

/* ================================================================
   SIDEBAR TWO-COLUMN LAYOUT (index.html)
   ================================================================ */

.page-wrap {
  display: flex;
  gap: 52px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 28px;
  padding-top: var(--nav-h);
  align-items: flex-start;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--nav-h) + 28px);
  padding-top: 40px;
  padding-bottom: 40px;
  /* max height + scroll if sidebar content taller than viewport */
  max-height: calc(100vh - var(--nav-h) - 28px);
  overflow-y: auto;
  scrollbar-width: none; /* hide scrollbar but keep scroll */
  -ms-overflow-style: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sb-photo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}
.sb-photo {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--card-border-hover);
  box-shadow: 0 0 0 5px var(--accent-glow2), 0 0 28px var(--accent-glow), 0 8px 24px rgba(0,0,0,0.1);
  transition: box-shadow var(--t-slow);
}
.sb-photo:hover {
  box-shadow: 0 0 0 5px var(--accent-glow), 0 0 40px var(--accent-glow), 0 10px 28px rgba(0,0,0,0.12);
}
.sb-name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--text);
  text-align: center;
  margin-bottom: 3px;
}
.sb-title {
  font-size: 0.78rem;
  color: var(--text-2);
  text-align: center;
  margin-bottom: 2px;
}
.sb-affil {
  font-size: 0.75rem;
  color: var(--text-3);
  text-align: center;
  margin-bottom: 14px;
}

/* Social icon links */
.sb-social {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}
.sb-social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  color: var(--text-3);
  transition: all var(--t);
  flex-shrink: 0;
}
.sb-social-link:hover {
  color: var(--accent);
  border-color: var(--card-border-hover);
  background: var(--accent-glow);
  transform: translateY(-1px);
}
.sb-social-link svg { width: 14px; height: 14px; }

.sb-links {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.sb-email-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.77rem;
  color: var(--text-2);
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 4px 12px;
  border-radius: 20px;
  transition: all var(--t);
  white-space: nowrap;
}
.sb-email-link:hover {
  border-color: var(--card-border-hover);
  color: var(--accent);
  background: var(--accent-glow2);
}

.sb-divider {
  height: 1px;
  background: var(--card-border);
  margin-bottom: 18px;
}

.sb-section-label {
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

/* Compact experience list in sidebar */
.sb-exp { display: flex; flex-direction: column; }

.sb-exp-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--card-border);
}
.sb-exp-year {
  font-size: 0.65rem;
  color: var(--text-3);
  letter-spacing: 0.04em;
  margin-bottom: 1px;
}
.sb-exp-role {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1px;
  line-height: 1.3;
}
.sb-exp-org {
  font-size: 0.75rem;
  color: var(--accent);
  line-height: 1.3;
}
.sb-exp-detail {
  font-size: 0.7rem;
  color: var(--text-3);
  margin-top: 1px;
  line-height: 1.3;
}

/* ── Main content column ──────────────────────────────────────────── */
.main-col {
  flex: 1;
  min-width: 0;
  padding-top: 40px;
  padding-bottom: 80px;
}

/* Bio section */
.bio-section {
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--card-border);
}
.bio-text {
  font-size: 0.94rem;
  color: var(--text-2);
  line-height: 1.82;
}
.bio-text strong { color: var(--text); }
.bio-text em { color: var(--accent-dim); font-style: italic; }

/* Publications section heading */
.pub-main-heading {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  color: var(--text);
  margin-bottom: 20px;
  font-weight: 400;
}

/* Tighter spacing overrides for the main column */
.pub-section .pub-category         { margin-bottom: 28px; }
.pub-section .pub-category-title   { font-size: 1.15rem; margin-bottom: 4px; }
.pub-section .pub-category-desc    { font-size: 0.78rem; margin-bottom: 14px; }
.pub-section .pub-subcategory      { margin-bottom: 14px; }
.pub-section .pub-subcategory-title { margin-bottom: 10px; padding-bottom: 5px; font-size: 0.66rem; }
.pub-section .pub-list             { gap: 6px; }

.pub-section .pub-item {
  padding: 10px 13px;
}
.pub-section .pub-item:hover {
  box-shadow: -3px 0 0 var(--accent), 0 2px 10px rgba(0,0,0,0.06);
}

/* ── Two-line pub layout: title+venue on row 1, authors on row 2 ──
   Uses explicit grid placement so DOM order doesn't matter.        */
.pub-section .pub-body {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  column-gap: 12px;
  row-gap: 2px;
}

.pub-section .pub-title {
  grid-area: 1 / 1 / 2 / 2;
  font-size: 0.845rem;
  margin-bottom: 0;
  line-height: 1.45;
}

.pub-section .pub-meta {
  grid-area: 1 / 2 / 2 / 3;
  align-self: start;
  margin-top: 1px;
  flex-wrap: nowrap; /* keep badges on one line */
}

.pub-section .pub-authors {
  grid-area: 2 / 1 / 3 / 3; /* spans both columns */
  font-size: 0.75rem;
  margin-bottom: 0;
}

.pub-section .pub-sub-items {
  grid-area: 3 / 1 / 4 / 3; /* spans both columns */
  margin-top: 4px;
}

.pub-section .venue-badge, .pub-section .spotlight-badge, .pub-section .pub-link {
  font-size: 0.64rem;
  padding: 2px 8px;
  white-space: nowrap;
}


/* ── Responsive: stack on narrow screens ──────────────────────────── */
@media (max-width: 860px) {
  .page-wrap {
    flex-direction: column;
    gap: 0;
    padding-top: var(--nav-h);
  }

  .sidebar {
    width: 100%;
    position: static;
    max-height: none;
    overflow-y: visible;
    padding-top: 32px;
    padding-bottom: 0;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 28px;
  }

  /* Horizontal layout for sidebar on tablet */
  .sb-photo-wrap { justify-content: flex-start; }
  .sb-photo { width: 80px; height: 80px; }
  .sb-name, .sb-title, .sb-affil { text-align: left; }
  .sb-links { justify-content: flex-start; }

  .sb-exp {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0 16px;
  }

  .main-col { padding-top: 24px; }
}

@media (max-width: 540px) {
  .page-wrap { padding: 0 16px; padding-top: var(--nav-h); }
  .sb-exp { grid-template-columns: 1fr 1fr; }
  .pub-main-heading { font-size: 1.3rem; }
}
