:root {
  --bg-color: #000;
  --text-color: #fff;
  --text-muted: #aaa;
  --link-color: #4a9eff;
  --link-hover: #7bb8ff;
  --border-color: #333;
  --nav-active: #4a9eff;
}

html[data-theme="light"] {
  --bg-color: #fff;
  --text-color: #000;
  --text-muted: #555;
  --link-color: #0066cc;
  --link-hover: #004499;
  --border-color: #ddd;
  --nav-active: #0066cc;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 56px 0 70px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  transition: background-color 0.3s, color 0.3s;
}

a {
  color: var(--link-color);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Navigation */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background-color: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
}

.site-nav {
  max-width: 800px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 56px;
}

.site-nav--about {
  justify-content: flex-end;
}

.site-brand {
  color: var(--text-color);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 400;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: auto;
}

.site-brand:hover {
  color: var(--link-color);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-width: 0;
}

.nav-links li {
  flex-shrink: 0;
}

.nav-links a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.95rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}

.nav-links a:hover {
  color: var(--text-color);
  text-decoration: none;
  opacity: 0.75;
}

.nav-links a.active {
  font-weight: 400;
  color: var(--text-color);
  border-bottom-color: var(--text-color);
  opacity: 1;
}

.nav-links a.active:hover {
  opacity: 1;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-color);
  font-size: 1.1rem;
  padding: 0.25rem 0 0 0.5rem;
  line-height: 1;
}

.theme-toggle:hover {
  color: var(--link-color);
}

.theme-toggle .fa-sun {
  display: none;
}

html[data-theme="light"] .theme-toggle .fa-moon {
  display: none;
}

html[data-theme="light"] .theme-toggle .fa-sun {
  display: inline-block;
}

/* Page content */
.page-header {
  margin-bottom: 0.5rem;
}

.post-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
}

.post-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 1.5rem;
}

.profile {
  float: right;
  width: 30%;
  margin: 0 0 1rem 1.5rem;
}

.profile-photo {
  position: relative;
  padding: 2px;
  border-radius: 12px;
  cursor: pointer;
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.38) 0%,
    rgba(255, 255, 255, 0.1) 45%,
    rgba(255, 255, 255, 0.22) 100%
  );
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition:
    transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    box-shadow 0.45s ease,
    background 0.45s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.profile-photo__inner {
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.profile-photo img {
  display: block;
  width: 100%;
  border-radius: 10px;
  transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 0.45s ease;
}

.profile-photo:hover,
.profile-photo.is-active,
.profile-photo:focus-visible {
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.55) 0%,
    rgba(255, 255, 255, 0.18) 50%,
    rgba(255, 255, 255, 0.4) 100%
  );
  box-shadow:
    0 14px 32px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transform: translateY(-3px);
  outline: none;
}

.profile-photo:hover img,
.profile-photo.is-active img,
.profile-photo:focus-visible img {
  transform: scale(1.025);
  filter: contrast(1.04) brightness(1.04);
}

html[data-theme="light"] .profile-photo {
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(240, 240, 240, 0.6) 50%,
    rgba(255, 255, 255, 0.85) 100%
  );
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 1);
}

html[data-theme="light"] .profile-photo:hover,
html[data-theme="light"] .profile-photo.is-active,
html[data-theme="light"] .profile-photo:focus-visible {
  box-shadow:
    0 14px 32px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 1);
}

.education-section {
  margin-top: 2rem;
  clear: both;
}

.education-section h2,
.news h2 {
  font-size: 1.25rem;
  margin: 0 0 1rem;
}

.education-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.education-item {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
}

.institution-logo {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  object-fit: contain;
  background-color: #fff;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.education-details h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
}

.education-details p {
  margin: 0.15rem 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.education-details em {
  font-style: normal;
  color: var(--text-muted);
}

.clearfix::after {
  content: "";
  display: table;
  clear: both;
}

.news {
  margin-top: 2rem;
}

.news table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.news th {
  text-align: left;
  font-weight: 400;
  color: var(--text-muted);
  padding: 0.4rem 1rem 0.4rem 0;
  white-space: nowrap;
  vertical-align: top;
}

.news td {
  padding: 0.4rem 0;
  vertical-align: top;
}

.social {
  text-align: center;
  margin-top: 2.5rem;
}

.contact-icons {
  font-size: 2rem;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.contact-icons a {
  color: var(--text-color);
}

.contact-icons a:hover {
  color: var(--link-color);
  text-decoration: none;
}

.contact-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

/* Courses & Publications */
.page-section h5 {
  font-size: 1rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--text-muted);
}

.page-section p {
  margin: 0.25rem 0;
}

.publication-item {
  margin-bottom: 1.25rem;
}

.publication-item .title {
  font-weight: 700;
}

.publication-item .authors {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.project-item {
  margin-bottom: 1.5rem;
}

.project-item .title {
  font-weight: 700;
}

.project-item .project-meta {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.project-item p {
  margin: 0.25rem 0 0;
}

/* Footer */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--bg-color);
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 9px 0 8px;
}

footer a {
  color: var(--text-color);
}

footer a:hover {
  color: var(--link-color);
}

/* Mobile */
@media (max-width: 576px) {
  body {
    padding-top: 72px;
  }

  .profile {
    float: none;
    width: 60%;
    margin: 0 auto 1.5rem;
    display: block;
  }

  .education-item {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .site-nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  .site-nav--about {
    justify-content: center;
  }

  .site-brand {
    width: 100%;
    text-align: center;
    margin-right: 0;
  }

  .nav-links {
    width: 100%;
    gap: 0.5rem 0.75rem;
    justify-content: center;
  }

  .nav-links a {
    font-size: 0.85rem;
  }
}
