/* =============================================
   CSS Custom Properties
   ============================================= */
:root {
  --bg:        #fafaf9;
  --text:      #18181b;
  --muted:     #71717a;
  --accent:    #2563eb;
  --border:    #e4e4e7;
  --pub-hover: #fef9c3;
  --max-w:     860px;
  --transition: 0.15s ease;
}

[data-theme="dark"] {
  --bg:        #1c1917;
  --text:      #faf8f5;
  --muted:     #a8998c;
  --accent:    #60a5fa;
  --border:    #292524;
  --pub-hover: #27230f;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  transition: background var(--transition), color var(--transition);
}

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

/* Author name highlight in publication lists */
ins {
  text-decoration: none;
  font-weight: 700;
  font-style: normal;
}

/* =============================================
   Page wrapper
   ============================================= */
.page-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
}

/* =============================================
   Header
   ============================================= */
.site-header {
  display: flex;
  align-items: flex-start;
  gap: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.header-bio {
  flex: 1;
}

.site-name {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.header-bio p {
  font-size: 0.9375rem;
  color: var(--text);
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

.header-links {
  font-size: 0.9375rem;
}
.header-links a {
  color: var(--accent);
}

.header-photo {
  flex-shrink: 0;
  width: 180px;
}
.header-photo img {
  width: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--border);
}

#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  padding: 0.15rem 0.45rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1;
  transition: border-color var(--transition), color var(--transition);
  vertical-align: middle;
}
#theme-toggle:hover {
  color: var(--text);
  border-color: var(--muted);
}

/* =============================================
   Sections
   ============================================= */
section {
  margin-bottom: 0;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--border);
}
section:last-of-type {
  border-bottom: none;
}

.section-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.section-bio {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.section-bio-highlight {
  background: var(--pub-hover);
  padding: 0 3px;
  border-radius: 2px;
}

.section-sub {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

/* =============================================
   Publications
   ============================================= */
.pub-row {
  display: flex;
  gap: 1.5rem;
  padding: 0.75rem 0.5rem;
  border-radius: 6px;
  transition: background var(--transition);
}
.pub-row:hover {
  background: var(--pub-hover);
}

.pub-thumb {
  flex-shrink: 0;
  width: 160px;
}
.pub-thumb img {
  width: 160px;
  height: 120px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.pub-thumb-placeholder {
  width: 160px;
  height: 120px;
  background: var(--border);
  border-radius: 4px;
}

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

.pub-title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 0.2rem;
}
.pub-title a {
  color: var(--text);
}
.pub-title a:hover {
  color: var(--accent);
  text-decoration: none;
}
.pub-title span {
  color: var(--text);
}

.pub-authors {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.pub-venue-text {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.pub-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.pub-links a {
  font-size: 0.8125rem;
  color: var(--accent);
}
.pub-links a:hover {
  text-decoration: underline;
}

/* =============================================
   Experience & Education entries
   ============================================= */
.entry-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  margin-bottom: 0.2rem;
}
.entry-row:first-of-type {
  margin-top: 0.5rem;
}

.entry-meta {
  display: flex;
  flex-direction: column;
}

.entry-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}
.entry-title a {
  color: var(--text);
}
.entry-title a:hover {
  color: var(--accent);
}

.entry-org {
  font-size: 0.875rem;
  color: var(--muted);
}

.entry-date {
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

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

/* =============================================
   Footer
   ============================================= */
footer {
  padding: 1.5rem 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 600px) {
  .site-header {
    flex-direction: column-reverse;
    gap: 1rem;
  }
  .header-photo {
    width: auto;
  }
  .header-photo img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
  }
  .pub-row {
    flex-direction: column;
    gap: 0.75rem;
  }
  .pub-thumb,
  .pub-thumb img,
  .pub-thumb-placeholder {
    width: 100%;
    height: 140px;
  }
  .entry-row {
    flex-direction: column;
    gap: 0.1rem;
  }
  .page-wrap {
    padding: 1.5rem 1rem 2rem;
  }
}
