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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  background: #fff;
  color: #111;
  height: 100vh;
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Top bar */
#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #e8e8e8;
  background: #fff;
  z-index: 100;
}

#site-title {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

#top-nav {
  display: flex;
  gap: 20px;
  align-items: center;
  font-size: 12px;
}

#top-nav a {
  color: #555;
}

#top-nav a:hover {
  color: #111;
}

/* Layout */
#layout {
  display: flex;
  position: fixed;
  top: 38px;
  left: 0;
  right: 0;
  bottom: 0;
}

/* Sidebar */
#sidebar {
  width: 210px;
  border-right: 1px solid #e8e8e8;
  overflow-y: auto;
  padding: 16px 0;
  flex-shrink: 0;
}

#sidebar a {
  display: block;
  padding: 4px 16px;
  font-size: 12px;
  color: #555;
  line-height: 1.5;
}

#sidebar a:hover {
  color: #111;
}

#sidebar a.active {
  color: #111;
  font-weight: 500;
}

/* Main content */
#main-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* Project grid */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 28px 20px;
}

.project-card {
  display: block;
}

.img-wrap {
  aspect-ratio: 1;
  overflow: hidden;
}

.img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.project-card:hover .img-wrap img {
  opacity: 0.85;
}

.card-line1 {
  font-size: 12px;
  color: #111;
  margin-top: 6px;
  line-height: 1.4;
}

.card-line2 {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
  line-height: 1.4;
}

.card-descriptor {
  font-style: italic;
  color: #b0b0b0;
  margin-left: 4px;
}

/* Page content (single pages: projects, bio, publications) */
.page-content {
  max-width: 680px;
}

.page-content h1 {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 20px;
  line-height: 1.4;
}

.page-content h2,
.page-content h3 {
  font-size: 13px;
  font-weight: 500;
  margin: 20px 0 8px;
}

.page-content p {
  line-height: 1.65;
  margin-bottom: 14px;
  color: #333;
}

.page-content a {
  text-decoration: underline;
  color: #111;
}

.page-content img {
  max-width: 100%;
  height: auto;
  margin: 16px 0;
  display: block;
}

.page-content ul,
.page-content ol {
  margin: 0 0 14px 20px;
  line-height: 1.65;
  color: #333;
}

/* Mobile */
@media (max-width: 600px) {
  body {
    overflow: auto;
    height: auto;
  }

  #layout {
    flex-direction: column;
    position: static;
    margin-top: 38px;
  }

  #sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e8e8e8;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 0;
    display: flex;
    white-space: nowrap;
  }

  #sidebar a {
    display: inline-block;
    padding: 4px 12px;
  }

  #main-content {
    overflow-y: visible;
    padding: 16px;
  }
}
