:root {
  --ink: #1b1b19;
  --text: #262624;
  --text-muted: #77766f;
  --bg: #f7f6f3;
  --card-bg: #ffffff;
  --border: #e4e2db;
  --border-strong: #d4d2c8;
  --sidebar-width: 260px;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--border-strong);
}

a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: #fff;
  padding: 10px 16px;
  z-index: 200;
}

.skip-link:focus {
  left: 8px;
  top: 8px;
}

section {
  scroll-margin-top: 20px;
}

/* ---------- Sidebar ---------- */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  overflow-y: auto;
  background: #ffffff;
  border-right: 1px solid var(--border);
  color: var(--text);
  display: flex;
  flex-direction: column;
  padding: 36px 26px;
  z-index: 100;
}

.profile {
  text-align: center;
  margin-bottom: 30px;
}

.profile-photo {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-strong);
  padding: 3px;
  margin-bottom: 16px;
}

.profile h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.45rem;
  color: var(--ink);
  margin: 0 0 6px;
  letter-spacing: 0.2px;
}

.profile .role {
  font-size: 0.86rem;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}

.profile .affil {
  font-size: 0.84rem;
  margin: 0 0 8px;
  color: var(--text-muted);
}

.group-link {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-bottom: 1px dotted var(--border-strong);
}

.group-link:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.nav-toggle {
  display: none;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.nav-links a {
  color: var(--text);
  text-decoration: none;
  border-bottom: none;
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 12px;
  border-left: 2px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.nav-links a:hover {
  background: var(--bg);
  color: var(--ink);
}

.nav-links a.active {
  color: var(--ink);
  border-left-color: var(--ink);
  background: var(--bg);
  font-weight: 700;
}

.sidebar-social {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sidebar-social a {
  color: var(--text-muted);
  font-size: 0.82rem;
  text-decoration: none;
  border-bottom: none;
  padding: 3px 12px;
}

.sidebar-social a:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* ---------- Content ---------- */

.content {
  margin-left: var(--sidebar-width);
  max-width: 780px;
  padding: 44px 32px 20px;
}

section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0 0 28px;
}

.section-inner {
  padding: 34px 38px 38px;
}

h2 {
  font-family: var(--serif);
  font-weight: 400;
  color: var(--ink);
  font-size: 1.55rem;
  margin: 0 0 22px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
  letter-spacing: 0.2px;
}

h3 {
  font-weight: 700;
  color: var(--ink);
  font-size: 1.02rem;
  margin: 22px 0 4px;
}

.section-inner > h3:first-of-type {
  margin-top: 0;
}

p {
  line-height: 1.65;
}

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

/* Publications */

.pub-list {
  margin: 0 0 8px;
  padding-left: 1.2em;
}

.pub-list li {
  margin-bottom: 10px;
  line-height: 1.55;
  font-size: 0.96rem;
}

.pub-list li::marker {
  color: var(--text-muted);
}

.pub-list li:has(.ref-tag) {
  list-style: none;
}

.ref-tag {
  display: inline-block;
  font-weight: 400;
  color: var(--text-muted);
  margin-right: 6px;
  scroll-margin-top: 20px;
}

/* Teaching / Software entries */

.entry {
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.entry:first-of-type {
  border-top: none;
  padding-top: 0;
}

.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.entry-head h3 {
  margin: 0;
}

.entry-date {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.86rem;
}

.entry-sub {
  margin: 4px 0 2px;
  color: var(--text-muted);
  font-style: italic;
}

.entry-meta {
  margin: 0 0 4px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Contact */

.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.contact-list li {
  display: flex;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.contact-list li:first-child {
  border-top: none;
}

.contact-label {
  min-width: 130px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Footer */

footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.86rem;
  padding: 8px 4px 40px;
}

/* ---------- Responsive: sidebar becomes a top bar + dropdown ---------- */

@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 14px 20px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .profile {
    text-align: left;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
  }

  .profile-photo {
    width: 42px;
    height: 42px;
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .profile h1 {
    font-size: 1.1rem;
  }

  .profile .role,
  .profile .affil,
  .group-link {
    display: none;
  }

  .nav-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--border-strong);
    color: var(--ink);
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
  }

  .nav-toggle-bars {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }

  .nav-toggle-bars span {
    display: block;
    width: 16px;
    height: 2px;
    background: var(--ink);
  }

  .nav-links {
    order: 3;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    border-top: none;
    padding-top: 0;
    transition: max-height 0.25s ease;
  }

  .nav-links.open {
    max-height: 320px;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid var(--border);
  }

  .sidebar-social {
    display: none;
  }

  .content {
    margin-left: 0;
    max-width: 100%;
    padding: 28px 20px 20px;
  }
}

@media (max-width: 480px) {
  .section-inner {
    padding: 24px 20px 28px;
  }

  h2 {
    font-size: 1.35rem;
  }
}
