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

html {
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}

body {
  font-family: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1a1a1a;
  background-color: #FAFAF5;
}

a {
  color: #c0392b;
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: #a93226;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.3;
}

hr {
  border: none;
  border-top: 1px solid #e5e5e0;
}

body.theme-transition,
body.theme-transition *,
body.theme-transition *::before,
body.theme-transition *::after {
  transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease !important;
}

.site-wrapper {
  display: flex;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
}

.main-content {
  flex: 1;
  max-width: 820px;
  padding: 40px;
}

@media (max-width: 768px) {
  .site-wrapper {
    flex-direction: column;
    max-width: 100%;
  }
  .main-content {
    padding: 24px;
  }
}
.sidebar {
  flex-shrink: 0;
  width: max-content;
  max-width: 300px;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid #e5e5e0;
  background: #FAFAF5;
  overflow-y: auto;
}

.sidebar-inner {
  padding: 40px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.sidebar-profile {
  margin-bottom: 40px;
  text-align: right;
}

.sidebar-links {
  align-items: flex-end;
}

.profile-photo-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
  margin-left: auto;
  margin-bottom: 12px;
  cursor: pointer;
  border-radius: 50%;
  overflow: hidden;
}

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

.profile-photo-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.profile-photo-wrapper:hover .profile-photo-video {
  opacity: 1;
}

.profile-name {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 2px;
  color: #1a1a1a;
}
.profile-name a {
  color: inherit;
}
.profile-name a:hover {
  color: #c0392b;
}

.profile-role {
  color: #555;
  font-size: 16px;
}

.profile-tags {
  color: #555;
  font-size: 11px;
  margin-top: 6px;
  line-height: 1.4;
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1a1a1a;
  font-size: 14px;
}
.sidebar-link:hover {
  color: #c0392b;
}
.sidebar-link svg {
  flex-shrink: 0;
  opacity: 0.6;
}

.dark-mode-toggle {
  background: none;
  border: 1px solid #e5e5e0;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  color: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-top: auto;
  align-self: flex-end;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.dark-mode-toggle:hover {
  border-color: #c0392b;
  color: #c0392b;
}
.dark-mode-toggle .moon-icon {
  display: none;
}

body.dark-mode .dark-mode-toggle .sun-icon {
  display: none;
}
body.dark-mode .dark-mode-toggle .moon-icon {
  display: block;
}

@media (max-width: 768px) {
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    width: 100%;
    max-width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid #e5e5e0;
  }
  .sidebar-inner {
    padding: 10px 16px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    min-height: auto;
  }
  .sidebar-profile {
    margin-bottom: 0;
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
  }
  .profile-photo-wrapper {
    width: 38px;
    height: 38px;
    min-width: 38px;
    margin: 0;
  }
  .profile-photo,
  .profile-photo-video {
    width: 38px;
    height: 38px;
    min-width: 38px;
  }
  .profile-name {
    font-size: 16px;
    margin-bottom: 0;
  }
  .profile-role,
  .profile-tags {
    display: none;
  }
  .sidebar-links {
    display: none;
  }
  .dark-mode-toggle {
    margin-top: 0;
    align-self: auto;
    width: 34px;
    height: 34px;
    border: none;
  }
}
@media (max-width: 380px) {
  .profile-name {
    font-size: 15px;
  }
  .sidebar-links {
    gap: 13px;
  }
}
.content-header {
  margin-bottom: 24px;
}

.content-bio {
  font-size: 16px;
  line-height: 1.6;
}
.content-bio p {
  margin-bottom: 12px;
}
.content-bio a {
  color: #1a1a1a;
  text-decoration: underline;
  text-decoration-color: #ccc;
  text-underline-offset: 2px;
}
.content-bio a:hover {
  text-decoration-color: #c0392b;
  color: #c0392b;
}

.section-divider {
  margin: 24px 0;
}

.content-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid #e5e5e0;
}

.toggle-btn {
  background: none;
  border: none;
  padding: 8px 16px;
  font-size: 16px;
  font-family: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #555;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.toggle-btn:hover {
  color: #1a1a1a;
}
.toggle-btn.active {
  color: #1a1a1a;
  border-bottom-color: #c0392b;
  font-weight: 600;
}

.content-section {
  display: none;
}
.content-section.active {
  display: block;
}

.year-group {
  margin-bottom: 24px;
}

.year-heading {
  font-size: 20px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.year-divider {
  margin-bottom: 12px;
}

.pub-card {
  display: flex;
  gap: 24px;
  padding: 12px 0;
  border-bottom: 1px solid #e5e5e0;
  align-items: flex-start;
}
.pub-card:last-child {
  border-bottom: none;
}

.pub-info {
  flex: 1;
  min-width: 0;
}

.pub-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.4;
}
.pub-title a {
  color: #1a1a1a;
}
.pub-title a:hover {
  color: #c0392b;
}
.pub-title .arrow {
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  display: inline-block;
}
.pub-title a:hover .arrow {
  opacity: 1;
  transform: translateX(2px);
}

.pub-authors {
  font-size: 14px;
  color: #555;
  margin-bottom: 2px;
  line-height: 1.4;
}
.pub-authors b {
  color: #1a1a1a;
  font-weight: 600;
}
.pub-authors a,
.pub-authors a:hover {
  color: inherit;
  text-decoration: none;
}
body.dark-mode .pub-authors a,
body.dark-mode .pub-authors a:hover {
  color: inherit;
}

.pub-venue {
  font-size: 14px;
  color: #555;
  margin-bottom: 4px;
}

.pub-legend {
  font-size: 14px;
  color: #777;
  margin-bottom: 4px;
}

.pub-award {
  color: #c0392b;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.pub-links {
  margin-top: 8px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.pub-links a {
  color: #555;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  transition: color 0.15s ease;
}
.pub-links a:hover {
  color: #c0392b;
}
.pub-links a svg {
  display: block;
  flex-shrink: 0;
}

.pub-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.pub-tag {
  display: inline-block;
  margin-top: 0;
  padding: 1px 7px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.6;
  color: #555;
  background: #f0f0ea;
  border-radius: 999px;
}
body.dark-mode .pub-tag {
  color: #bbb;
  background: #2a2a2a;
}

.pub-thumb {
  flex-shrink: 0;
  width: 160px;
}
.pub-thumb img,
.pub-thumb video {
  width: 100%;
  border-radius: 10px;
  object-fit: cover;
  display: block;
}

.pub-thumb-hover {
  position: relative;
}
.pub-thumb-hover .pub-thumb-animated {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.pub-thumb-hover:hover .pub-thumb-animated {
  opacity: 1;
}

.blog-card {
  padding: 12px 0;
}

.blog-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}
.blog-title a {
  color: #1a1a1a;
}
.blog-title a:hover {
  color: #c0392b;
}
.blog-title .arrow {
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.15s ease;
  display: inline-block;
}
.blog-title a:hover .arrow {
  opacity: 1;
}

.blog-date {
  font-size: 14px;
  color: #555;
  display: block;
  margin-bottom: 4px;
}

.blog-excerpt {
  font-size: 14px;
  color: #555;
}

.card-divider {
  margin: 0;
}

@media (max-width: 768px) {
  .content-name {
    font-size: 22px;
  }
  .pub-card {
    flex-direction: column-reverse;
    gap: 12px;
  }
  .pub-thumb {
    width: 100%;
  }
  .pub-thumb img,
  .pub-thumb video {
    max-height: 200px;
    width: auto;
    max-width: 100%;
  }
  .pub-thumb-hover .pub-thumb-animated {
    max-height: 200px;
    max-width: 100%;
  }
}
.blog-post {
  max-width: 680px;
}

.post-header {
  margin-bottom: 40px;
}

.back-link {
  font-size: 14px;
  color: #555;
  display: inline-block;
  margin-bottom: 24px;
}
.back-link:hover {
  color: #c0392b;
}

.post-title {
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #1a1a1a;
}

.post-date {
  font-size: 14px;
  color: #555;
}

.post-content {
  font-size: 16px;
  line-height: 1.75;
}
.post-content p {
  margin-bottom: 24px;
}
.post-content h2 {
  font-size: 20px;
  margin-top: 40px;
  margin-bottom: 12px;
}
.post-content h3 {
  font-size: 16px;
  margin-top: 24px;
  margin-bottom: 12px;
}
.post-content ul, .post-content ol {
  margin-bottom: 24px;
  padding-left: 24px;
}
.post-content li {
  margin-bottom: 4px;
}
.post-content code {
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 14px;
}
.post-content pre {
  background: #f5f5f0;
  padding: 24px;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 24px;
}
.post-content pre code {
  background: none;
  padding: 0;
}
.post-content img {
  border-radius: 4px;
  margin: 24px 0;
}
.post-content blockquote {
  border-left: 3px solid #c0392b;
  padding-left: 24px;
  color: #555;
  margin-bottom: 24px;
}
.post-content a {
  color: #1a1a1a;
  text-decoration: underline;
  text-decoration-color: #ccc;
  text-underline-offset: 2px;
}
.post-content a:hover {
  text-decoration-color: #c0392b;
  color: #c0392b;
}

body.dark-mode {
  background-color: #121212;
  color: #e0e0e0;
}
body.dark-mode a {
  color: #e74c3c;
}
body.dark-mode a:hover {
  color: rgb(236.5890410959, 117.6849315068, 105.4109589041);
}
body.dark-mode hr {
  border-top-color: #2a2a2a;
}
body.dark-mode .sidebar {
  background: #121212;
  border-right-color: #2a2a2a;
  border-bottom-color: #2a2a2a;
}
body.dark-mode .profile-name {
  color: #e0e0e0;
}
body.dark-mode .profile-role,
body.dark-mode .profile-tags {
  color: #aaa;
}
body.dark-mode .sidebar-link {
  color: #e0e0e0;
}
body.dark-mode .sidebar-link:hover {
  color: #e74c3c;
}
body.dark-mode .dark-mode-toggle {
  color: #e0e0e0;
  border-color: #2a2a2a;
}
body.dark-mode .dark-mode-toggle:hover {
  border-color: #e74c3c;
  color: #e74c3c;
}
body.dark-mode .content-tags {
  color: #aaa;
}
body.dark-mode .content-bio a {
  color: #e0e0e0;
  text-decoration-color: #444;
}
body.dark-mode .content-bio a:hover {
  color: #e74c3c;
  text-decoration-color: #e74c3c;
}
body.dark-mode .toggle-btn {
  color: #aaa;
}
body.dark-mode .toggle-btn:hover {
  color: #e0e0e0;
}
body.dark-mode .toggle-btn.active {
  color: #e0e0e0;
  border-bottom-color: #e74c3c;
}
body.dark-mode .content-toggle {
  border-bottom-color: #2a2a2a;
}
body.dark-mode .pub-card {
  border-bottom-color: #2a2a2a;
}
body.dark-mode .pub-title a {
  color: #e0e0e0;
}
body.dark-mode .pub-title a:hover {
  color: #e74c3c;
}
body.dark-mode .pub-authors {
  color: #aaa;
}
body.dark-mode .pub-authors b {
  color: #e0e0e0;
}
body.dark-mode .pub-venue {
  color: #aaa;
}
body.dark-mode .pub-legend {
  color: #aaa;
}
body.dark-mode .pub-award {
  color: #e74c3c;
}
body.dark-mode .pub-links a {
  color: #aaa;
}
body.dark-mode .pub-links a:hover {
  color: #e74c3c;
}
body.dark-mode .year-heading {
  color: #e0e0e0;
}
body.dark-mode .year-divider,
body.dark-mode .card-divider,
body.dark-mode .section-divider {
  border-top-color: #2a2a2a;
}
body.dark-mode .blog-title a {
  color: #e0e0e0;
}
body.dark-mode .blog-title a:hover {
  color: #e74c3c;
}
body.dark-mode .blog-date,
body.dark-mode .blog-excerpt {
  color: #aaa;
}
body.dark-mode .post-title {
  color: #e0e0e0;
}
body.dark-mode .post-date,
body.dark-mode .back-link {
  color: #aaa;
}
body.dark-mode .back-link:hover {
  color: #e74c3c;
}
body.dark-mode .post-content a {
  color: #e0e0e0;
  text-decoration-color: #444;
}
body.dark-mode .post-content a:hover {
  color: #e74c3c;
  text-decoration-color: #e74c3c;
}
body.dark-mode .post-content code {
  background: rgba(255, 255, 255, 0.1);
}
body.dark-mode .post-content pre {
  background: #1e1e1e;
}
body.dark-mode .post-content blockquote {
  border-left-color: #e74c3c;
  color: #aaa;
}

/* Tagged sections: label on the left, content on the right */
.tagged-sections {
  margin-bottom: 32px;
}

.section-row {
  display: flex;
  gap: 32px;
  padding: 20px 0;
  border-bottom: 1px solid #e5e5e0;
  align-items: flex-start;
  scroll-margin-top: 24px;
}

.section-row:last-child {
  border-bottom: none;
}

a.section-tag {
  flex-shrink: 0;
  width: 140px;
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  text-align: right;
  line-height: 1.4;
  padding-top: 2px;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease;
}

a.section-tag:hover {
  color: #c0392b;
}

.section-content {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  line-height: 1.6;
}

.section-content p {
  margin-bottom: 12px;
}

.section-content p:last-child,
.section-content ul:last-child {
  margin-bottom: 0;
}

.section-content ul {
  padding-left: 1.2em;
  margin-bottom: 12px;
}

.section-content li {
  margin-bottom: 8px;
}

.section-content a {
  color: #1a1a1a;
  text-decoration: underline;
  text-decoration-color: #ccc;
  text-underline-offset: 2px;
}

.section-content a:hover {
  color: #c0392b;
  text-decoration-color: #c0392b;
}

.section-content strong {
  font-weight: 600;
}

@media (max-width: 768px) {
  .section-row {
    flex-direction: column;
    gap: 8px;
    padding: 16px 0;
  }

  .section-tag {
    width: auto;
    text-align: left;
  }
}

body.dark-mode .section-row {
  border-bottom-color: #2a2a2a;
}

body.dark-mode a.section-tag {
  color: #e0e0e0;
}

body.dark-mode a.section-tag:hover {
  color: #e74c3c;
}

/* Sidebar page navigation (Service / Talks / Misc) */
.sidebar-pages {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e5e5e0;
}

/* Publications nav tag and bio social row are mobile-only */
.sidebar-page-link.pub-nav {
  display: none;
}
.bio-social {
  display: none;
}

.sidebar-page-link {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
}

.sidebar-page-link:hover,
.sidebar-page-link.active {
  color: #c0392b;
}

body.dark-mode .sidebar-pages {
  border-top-color: #2a2a2a;
}

body.dark-mode .sidebar-page-link {
  color: #e0e0e0;
}

body.dark-mode .sidebar-page-link:hover,
body.dark-mode .sidebar-page-link.active {
  color: #e74c3c;
}

@media (max-width: 768px) {
  .sidebar-pages {
    flex-direction: row;
    align-items: center;
    gap: 16px;
    margin: 0;
    padding: 0;
    border-top: none;
  }
  .sidebar-page-link {
    font-size: 14px;
  }
  .sidebar-page-link.pub-nav {
    display: block;
  }

  /* On mobile the homepage hides Publications until the tag is clicked */
  #publications {
    display: none;
  }
  #publications:target {
    display: block;
  }

  /* Social links move below the bio on mobile */
  .bio-social {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    margin: 14px 0 4px;
  }
  .bio-social a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #1a1a1a;
  }
  .bio-social a svg {
    flex-shrink: 0;
    opacity: 0.7;
  }
  .bio-social a:hover {
    color: #c0392b;
  }
  body.dark-mode .bio-social a {
    color: #e0e0e0;
  }
  body.dark-mode .bio-social a:hover {
    color: #e74c3c;
  }
}

/* Topic filter: scroll horizontally instead of overflowing on small screens */
@media (max-width: 768px) {
  .content-toggle {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .content-toggle::-webkit-scrollbar {
    display: none;
  }
  .toggle-btn {
    flex-shrink: 0;
    padding: 8px 10px;
    font-size: 14px;
  }
}

/* Vertical content blocks (Research Interests, Publications, sub-pages) */
.content-block {
  margin-bottom: 24px;
}

.block-heading {
  font-size: 20px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.block-body {
  font-size: 16px;
  line-height: 1.6;
}

.block-body p {
  margin-bottom: 12px;
}

.block-body p:last-child,
.block-body ul:last-child {
  margin-bottom: 0;
}

.block-body ul {
  padding-left: 1.2em;
  margin-bottom: 12px;
}

.block-body li {
  margin-bottom: 8px;
}

.block-body a {
  color: #1a1a1a;
  text-decoration: underline;
  text-decoration-color: #ccc;
  text-underline-offset: 2px;
}

.block-body a:hover {
  color: #c0392b;
  text-decoration-color: #c0392b;
}

.block-body strong {
  font-weight: 600;
}

body.dark-mode .block-heading {
  color: #e0e0e0;
}

body.dark-mode .block-body a {
  color: #e0e0e0;
  text-decoration-color: #444;
}

body.dark-mode .block-body a:hover {
  color: #e74c3c;
  text-decoration-color: #e74c3c;
}

body.dark-mode .section-content a {
  color: #e0e0e0;
  text-decoration-color: #444;
}

body.dark-mode .section-content a:hover {
  color: #e74c3c;
  text-decoration-color: #e74c3c;
}