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

:root {
  --bg: #fcfcfc;
  --text: #1a1a1a;
  --text-muted: #666;
  --accent: #2b6cb0;
  --accent-hover: #1a4f8a;
  --border: #e5e5e5;
  --border-light: #f0f0f0;
}

html {
  scroll-behavior: smooth;
  font-size: 17.5px;
}

body {
  font-family: Charter, 'Bitstream Charter', Georgia, serif;
  font-weight: 500;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

/* ── Header ───────────────────── */

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.5rem;
  position: relative;
}

.header-left h1 {
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.header-left .subtitle {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
}

.header-left .subtitle a {
  color: var(--accent);
  text-decoration: none;
}

.header-left .subtitle a:hover {
  text-decoration: underline;
}

.profile-photo {
  width: 156px;
  height: 180px;
  border-radius: 5px;
  object-fit: contain;
  flex-shrink: 0;
  position: absolute;
  top: -1.8rem;
  right: 1.8rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ── Sticky top ──────────────── */

.sticky-top {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  padding-top: 2.5rem;
  padding-bottom: 0;
}

.sticky-top.scrolled {
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}

/* ── Tab navigation ──────────── */

.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 1.5px solid var(--border);
  margin-top: 2.2rem;
}

.tab-nav button {
  background: none;
  border: none;
  padding: 0.55rem 1.3rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1.5px;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.03em;
}

.tab-nav button:focus {
  outline: none;
}

.tab-nav button:hover {
  color: var(--text);
  border-bottom-color: var(--border);
}

.tab-nav button.active {
  color: var(--text);
  border-bottom-color: var(--text);
  font-weight: 600;
}

/* ── Tab content ─────────────── */

.tab-content {
  padding-top: 2rem;
}

.tab-section {
  display: none;
}

.tab-section.active {
  display: block;
}

/* ── Sections ─────────────────── */

section {
  margin-bottom: 2rem;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.7rem;
  padding-bottom: 0.35rem;
  border-bottom: 1.5px solid var(--text);
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 1.2rem 0 0.5rem;
  padding-left: 0.6rem;
  border-left: 3px solid var(--accent);
}

h3:first-child {
  margin-top: 0;
}

p {
  margin-bottom: 0.5rem;
  text-align: justify;
}

p.note {
  font-size: 0.9rem;
  color: var(--text-muted);
}

p.note code {
  font-size: 0.85rem;
}

p.scholar-link {
  font-size: 0.9rem;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}

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

section ul {
  padding-left: 0.8rem;
  list-style: disc;
  margin-bottom: 0.5rem;
}

section ul li {
  margin-bottom: 0.35rem;
}

section ul li::marker {
  color: var(--accent);
  font-size: 0.8rem;
}

/* ── Collapsible list ─────────── */

.collapsible {
  list-style: none;
  padding-left: 0.8rem;
}

.collapsible li {
  border-bottom: 1px solid var(--border-light);
  list-style: disc;
  padding-bottom: 0.12rem;
}

.collapsible li::marker {
  color: var(--accent);
  font-size: 0.8rem;
}

.collapsible li:first-child {
  border-top: 1px solid var(--border-light);
}

.collapsible-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.45rem 0 0.12rem;
  user-select: none;
}

.coauthor-line {
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 0.1rem 0 0.1rem 1.6rem;
  margin: 0;
}

#teaching .collapsible-header,
#honors .grants-list .collapsible-header,
#honors .awards-list .collapsible-header {
  display: block;
}

.inline-muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.pub-venue,
.status-pill {
  margin-left: auto;
  flex-shrink: 0;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
}

.pub-venue {
  color: var(--accent);
  background: #e8f0fa;
}

.status-pill {
  color: var(--text-muted);
  background: var(--border-light);
}

/* ── Back to top ──────────────── */

#back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  display: none;
  width: 40px;
  height: 40px;
  background: var(--text);
  color: #fff;
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 40px;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  transition: background 0.2s, transform 0.2s;
}

#back-to-top:hover {
  background: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}

/* ── Responsive ───────────────── */

@media (max-width: 600px) {
  html { font-size: 15px; }

  main {
    padding: 0 1rem 2rem;
  }

  .sticky-top {
    padding-top: 1.2rem;
    padding-bottom: 0;
  }

  .header {
    flex-direction: column-reverse;
    align-items: center;
    text-align: center;
    gap: 0.8rem;
    margin-bottom: 0.5rem;
  }

  .tab-nav {
    margin-top: 0.8rem;
    justify-content: center;
    flex-wrap: wrap;
  }

  .tab-nav button {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.45rem 0.55rem;
    font-size: 0.85rem;
  }

  .collapsible-header {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.35rem 0.5rem;
  }

  .pub-venue,
  .status-pill {
    margin-left: 0;
    white-space: normal;
  }

  .coauthor-line {
    padding-left: 1rem;
  }

  p {
    text-align: left;
  }

  .profile-photo {
    position: static;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
  }

  .header-left h1 {
    font-size: 1.5rem;
  }

  #back-to-top {
    bottom: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    line-height: 36px;
    font-size: 1rem;
  }
}

@media print {
  .sticky-top {
    position: static;
    box-shadow: none;
  }
  .tab-nav {
    display: none;
  }
  .tab-section {
    display: block !important;
  }
  #back-to-top { display: none !important; }
  body { font-size: 12px; }
  main { max-width: 100%; padding: 0; }
}
