body {
  font-family: "Segoe UI", Arial, sans-serif;
  margin: 0;
  line-height: 1.6;
  color: #333;
  background-color: #fafafa;
}

/* hero: big intro banner, scrolls away normally like any other content */
header {
  background-color: #1e293b;
  color: white;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 20px;
}

header h1 {
  margin: 0;
  font-size: 2em;
}
header nav {
  margin-top: 10px;
}

/* sticky-bar: fixed, constant size always — only opacity toggles on scroll,
   so its box never resizes and Chrome never has to recompute a sticky/fixed
   element's layout mid-scroll (that resize was the source of a rendering
   glitch where the two header states could visibly overlap for a frame) */
.sticky-bar {
  background: #1e293b;
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 10px 28px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.sticky-bar.visible {
  opacity: 1;
  pointer-events: auto;
}

.sticky-bar h1 {
  margin: 0;
  margin-right: 12px;
  font-size: 1.05rem;
}

.sticky-bar nav {
  margin-top: 0;
}

/* small layout niceties for links */
nav a {
  margin: 0 8px;
  text-decoration: none;
  color: #facc15;
  font-weight: bold;
}

nav a:hover {
  color: #fff;
}

main {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
}

section {
  background: white;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

section h2 {
  color: #1e293b;
  border-bottom: 2px solid #facc15;
  padding-bottom: 0.3rem;
}

ul {
  list-style: none;
  padding: 0;
}

ul li {
  margin-bottom: 0.8rem;
}

#papers-list li,
#media-list li,
#teaching-list li {
  padding-bottom: 0.8rem;
  border-bottom: 1px solid #eee;
  line-height: 1.5;
}

#papers-list li:last-child,
#media-list li:last-child,
#teaching-list li:last-child {
  border-bottom: none;
}

.tag {
  display: inline-block;
  background-color: #facc15;
  color: #1e293b;
  font-size: 0.7rem;
  font-weight: bold;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-right: 0.4rem;
  vertical-align: middle;
  text-decoration: none;
}

a {
  color: #1d4ed8;
}

a:hover {
  color: #2563eb;
}

footer {
  text-align: center;
  padding: 1rem;
  background-color: #1e293b;
  color: white;
}

.profile {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.profile img {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.profile .info {
  flex: 1;
  min-width: 250px;
}

/* Prevent horizontal overflow by using border-box sizing */
*, *::before, *::after {
  box-sizing: border-box;
}

/* ensure images never overflow their containers */
img {
  max-width: 100%;
  height: auto;
}

/* make nav flexible so links can wrap instead of forcing page width */
header nav,
.sticky-bar nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

/* on narrow screens, keep the sticky bar stacked so the title doesn't
   wrap into multiple lines fighting the nav for row space */
@media (max-width: 600px) {
  .sticky-bar {
    flex-direction: column;
    padding: 10px 16px;
  }

  .sticky-bar h1 {
    margin-right: 0;
  }
}
