/* ===== DESIGN TOKENS ===== */
:root {
  --bg:           #fafafa;
  --bg-sidebar:   #ffffff;
  --text:         #111827;
  --text-muted:   #6b7280;
  --accent:       #2563eb;   /* deep space-blue; WCAG AA on white: 4.77:1 */
  --accent-dark:  #1d4ed8;
  --accent-soft:  rgba(37, 99, 235, 0.08);
  --border:       #e5e7eb;
  --sidebar-w:    240px;
  --content-max:  680px;
  --radius:       6px;
  --radius-lg:    12px;
  --topbar-h:     54px;
}

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

/* ===== MOTION ===== */
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration:  0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== BASE ===== */
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color:       var(--text);
  font-size:   1rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
  font-weight: 700;
  line-height: 1.2;
}

p { max-width: 65ch; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}
a:hover { color: var(--accent-dark); }

:focus-visible {
  outline:        2px solid var(--accent);
  outline-offset: 3px;
  border-radius:  2px;
}

/* ===== SIDEBAR (desktop) ===== */
.sidebar {
  position:       fixed;
  inset:          0 auto 0 0;
  width:          var(--sidebar-w);
  background:     var(--bg-sidebar);
  border-right:   1px solid var(--border);
  display:        flex;
  flex-direction: column;
  padding:        3rem 1.75rem 2rem;
  z-index:        50;
}

.sidebar-header { margin-bottom: 3rem; }

.site-name {
  font-size:    1.375rem;
  color:        var(--text);
  line-height:  1.3;
  margin-bottom: 0.5rem;
}

.site-desc {
  font-family: 'Inter', system-ui, sans-serif;
  font-size:   0.775rem;
  color:       var(--text-muted);
  line-height: 1.5;
}

.nav-links {
  list-style:     none;
  display:        flex;
  flex-direction: column;
  gap:            0.125rem;
}

.nav-link {
  display:     block;
  padding:     0.5rem 0.75rem;
  border-radius: var(--radius);
  color:       var(--text-muted);
  text-decoration: none;
  font-size:   0.875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition:  color 0.15s ease, background-color 0.15s ease;
}
.nav-link:hover {
  color:       var(--accent);
  background:  var(--accent-soft);
}
.nav-link.active {
  color:       var(--accent);
  background:  var(--accent-soft);
  font-weight: 600;
}

/* ===== TOPBAR (mobile only, hidden on desktop) ===== */
.topbar {
  display:         none;
  position:        sticky;
  top:             0;
  z-index:         50;
  background:      var(--bg-sidebar);
  border-bottom:   1px solid var(--border);
  padding:         0 1.25rem;
  height:          var(--topbar-h);
  align-items:     center;
  justify-content: space-between;
  gap:             1rem;
}

.topbar-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size:   0.95rem;
  font-weight: 700;
  color:       var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar-nav {
  display:     flex;
  align-items: center;
  gap:         0.25rem;
}
.topbar-nav .nav-link {
  font-size: 0.775rem;
  padding:   0.35rem 0.6rem;
  white-space: nowrap;
}

/* ===== MAIN CONTENT ===== */
main { margin-left: var(--sidebar-w); }

section {
  padding:           5rem 4rem 5rem 3.5rem;
  border-bottom:     1px solid var(--border);
  scroll-margin-top: 2rem;
  max-width:         calc(var(--content-max) + 7.5rem);
}
section:last-child { border-bottom: none; }

section > h2 {
  font-size:     clamp(1.6rem, 3vw, 2rem);
  margin-bottom: 2rem;
}

/* ===== ABOUT ===== */
.about-layout {
  display:               grid;
  grid-template-columns: 190px 1fr;
  gap:                   3rem;
  align-items:           start;
}

.profile-photo {
  width:         190px;
  height:        auto;
  border-radius: var(--radius-lg);
  display:       block;
}

.about-text p {
  text-align: justify;
  margin-bottom: 1.25rem;
}
.about-text p:last-child { margin-bottom: 0; }

/* ===== PUBLICATIONS ===== */
#publications p { margin-bottom: 1.25rem; }
#publications p:last-of-type { margin-bottom: 0; }

#publications ul {
  list-style:  disc;
  padding-left: 1.5rem;
  margin:      0.5rem 0 1.25rem;
}
#publications li {
  margin-bottom: 0.35rem;
  line-height:   1.65;
}

.pub-links {
  display:   flex;
  flex-wrap: wrap;
  gap:       0.75rem;
  margin-top: 2rem;
}

.pub-pill {
  display:     inline-flex;
  align-items: center;
  padding:     0.4rem 1.1rem;
  border:      1.5px solid var(--accent);
  border-radius: 100px;
  color:       var(--accent);
  text-decoration: none;
  font-size:   0.875rem;
  font-weight: 500;
  transition:  background-color 0.15s ease, color 0.15s ease;
}
.pub-pill:hover {
  background: var(--accent);
  color:      #fff;
}

/* ===== CONTACT ===== */
.contact-list {
  list-style:    none;
  display:       flex;
  flex-direction: column;
  gap:           1.5rem;
  margin-bottom: 3rem;
}

.contact-item {
  display:     flex;
  align-items: flex-start;
  gap:         1rem;
  line-height: 1.5;
}

.contact-icon {
  color:       var(--accent);
  flex-shrink: 0;
  padding-top: 2px;
  display:     flex;
  align-items: center;
}

.contact-link {
  color:           var(--text);
  text-decoration: none;
  border-bottom:   1px solid var(--border);
  padding-bottom:  1px;
  transition:      color 0.15s ease, border-color 0.15s ease;
}
.contact-link:hover {
  color:        var(--accent);
  border-color: var(--accent);
}

address {
  font-style:  normal;
  line-height: 1.8;
  color:       var(--text);
}

.map-wrapper {
  border-radius: var(--radius-lg);
  overflow:      hidden;
  border:        1px solid var(--border);
  max-width:     600px;
}

.map-iframe {
  width:   100%;
  height:  340px;
  border:  none;
  display: block;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 899px) {
  .sidebar { display: none; }
  .topbar  { display: flex; }

  main { margin-left: 0; }

  section {
    padding:           3rem 1.5rem;
    scroll-margin-top: var(--topbar-h);
    max-width:         100%;
  }

  .about-layout {
    grid-template-columns: 1fr;
    gap:                   2rem;
  }

  .profile-photo {
    width:  160px;
    margin: 0 auto;
  }

  p { max-width: 100%; }

  .map-wrapper { max-width: 100%; }
}

@media (max-width: 480px) {
  section { padding: 2.5rem 1.25rem; }

  /* Hide name on very small viewports — nav links fill the bar */
  .topbar-name { display: none; }

  .topbar-nav .nav-link {
    font-size: 0.75rem;
    padding:   0.3rem 0.5rem;
  }
}
