/* Custom styles for Chenrui Ma's academic homepage */

:root {
  --bg: #f8fbff;
  --surface: #ffffff;
  --surface-soft: #f2f6fb;
  --ink: #102033;
  --muted: #5f6f82;
  --line: #dfe7f0;
  --primary: #123a63;
  --primary-dark: #08233f;
  --primary-soft: #eaf2fb;
  --accent: #5d7592;
  --accent-soft: #eef4fa;
  --shadow: 0 14px 36px rgba(18, 58, 99, 0.08);
}

* {
  letter-spacing: 0;
}

html {
  scroll-padding-top: 92px;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

.container {
  max-width: 1080px;
}

a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
}

a:hover,
a:focus {
  color: var(--accent);
  text-decoration: none;
}

b,
strong {
  font-weight: 700;
}

hr {
  border-top: 1px solid var(--line);
}

.navbar-custom {
  background-color: rgba(8, 35, 63, 0.98);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 30px rgba(8, 35, 63, 0.26);
}

.navbar-custom .navbar-brand {
  font-size: 20px;
  font-weight: 700;
}

.navbar-custom .nav-link {
  color: rgba(255, 255, 255, 0.88);
  font-size: 16px;
  font-weight: 600;
  padding-left: 0.7rem;
  padding-right: 0.7rem;
}

.navbar-custom .nav-link:hover,
.navbar-custom .nav-link:focus,
.navbar-custom .nav-link.active {
  color: #ffffff;
}

.navbar-custom .dropdown-menu {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(8, 35, 63, 0.14);
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(23, 32, 51, 0.16);
  margin-top: 9px;
  min-width: 220px;
  padding: 8px;
}

.navbar-custom .dropdown-item {
  border-radius: 6px;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 650;
  padding: 8px 10px;
}

.navbar-custom .dropdown-item:hover,
.navbar-custom .dropdown-item:focus,
.navbar-custom .dropdown-item.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.intro-panel {
  font-size: 17px;
  padding-top: 96px;
}

.intro-panel > .row {
  border-bottom: 1px solid var(--line);
  padding-bottom: 30px;
}

.profile-column {
  align-items: center;
  display: flex;
  flex-direction: column;
  padding-top: 18px;
  padding-right: 38px;
  text-align: center;
}

.profile-photo {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  max-width: 100%;
  object-fit: cover;
  width: 100%;
}

.profile-action-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 auto;
  max-width: 214px;
  width: 100%;
}

.profile-action {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--primary);
  display: flex;
  flex-direction: column;
  font-size: 0.82rem;
  font-weight: 700;
  gap: 4px;
  justify-content: center;
  line-height: 1.12;
  min-height: 54px;
  padding: 8px 6px;
  text-align: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.profile-action i {
  font-size: 1.18rem;
  line-height: 1;
}

.profile-action:hover,
.profile-action:focus {
  border-color: rgba(18, 58, 99, 0.36);
  box-shadow: 0 10px 22px rgba(18, 58, 99, 0.1);
  color: var(--primary-dark);
  transform: translateY(-1px);
}

.profile-email-list {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.45;
  margin-top: 10px;
  max-width: 230px;
  text-align: center;
  width: 100%;
  word-break: break-word;
}

.intro-copy p {
  margin-bottom: 12px;
  text-align: left;
}

.intro-kicker {
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.intro-copy h1 {
  color: var(--ink);
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.08;
  margin: 0 0 6px;
}

.intro-subtitle {
  color: var(--muted);
  font-size: 1.03rem;
  font-weight: 600;
  margin-bottom: 18px;
}

.other-page-intro {
  padding-bottom: 20px;
}

.other-page-intro h1 {
  color: var(--ink);
  font-size: 2.45rem;
  font-weight: 800;
  line-height: 1.1;
  margin: 0 0 6px;
}

.availability-note {
  background: var(--primary-soft);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  color: var(--ink);
  line-height: 1.7;
  margin: 16px 0 12px;
  padding: 14px 18px;
}

h3[id] {
  align-items: center;
  color: var(--ink);
  display: flex;
  font-size: 1.38rem;
  font-weight: 800;
  margin-bottom: 0;
}

h3[id]::before {
  background: var(--primary);
  border-radius: 2px;
  content: "";
  display: inline-block;
  flex: 0 0 auto;
  height: 22px;
  margin-right: 10px;
  width: 4px;
}

h3[id] + hr {
  margin-bottom: 22px;
  margin-top: 12px;
}

h3[id] small {
  color: var(--muted);
  font-weight: 400;
  line-height: 1.4;
  margin-left: 6px;
}

.cv-overview h3 {
  align-items: center;
  color: var(--ink);
  display: flex;
  font-size: 1.38rem;
  font-weight: 800;
  margin-bottom: 0;
}

.cv-overview h3::before {
  background: var(--primary);
  border-radius: 2px;
  content: "";
  display: inline-block;
  flex: 0 0 auto;
  height: 22px;
  margin-right: 10px;
  width: 4px;
}

.cv-overview h3 small {
  color: var(--muted);
  font-weight: 400;
  line-height: 1.4;
  margin-left: 6px;
}

.cv-grid {
  display: grid;
  gap: 34px;
  grid-template-columns: 1fr;
}

.cv-panel {
  min-width: 0;
}

.cv-panel h3 + hr {
  margin-bottom: 18px;
}

.cv-entry {
  border-left: 2px solid var(--line);
  display: grid;
  align-items: start;
  gap: 18px;
  grid-template-columns: 165px 82px 1fr;
  margin-bottom: 18px;
  min-height: 82px;
  padding-left: 18px;
  position: relative;
}

.cv-entry:last-child {
  margin-bottom: 0;
}

.cv-entry::before {
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: 50%;
  content: "";
  height: 10px;
  left: -6px;
  position: absolute;
  top: 8px;
  width: 10px;
}

.cv-entry-date {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1.45;
  padding-top: 26px;
  white-space: nowrap;
}

.cv-logo-wrap {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(23, 32, 51, 0.05);
  display: flex;
  height: 76px;
  justify-content: center;
  width: 76px;
}

.cv-logo {
  display: block;
  max-height: 62px;
  max-width: 64px;
  object-fit: contain;
}

.cv-entry-body {
  min-width: 0;
}

.cv-role {
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.35;
}

.cv-org {
  color: var(--primary);
  font-weight: 750;
  line-height: 1.4;
  margin-top: 2px;
}

.cv-meta {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 3px;
}

.cv-detail {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  margin-top: 8px;
}

.research-topics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
  margin-top: 18px;
  padding-left: 0;
}

.research-topics li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(23, 32, 51, 0.05);
  padding: 14px 16px;
}

.news-group {
  display: grid;
  grid-template-columns: 74px 1fr;
  column-gap: 20px;
  margin-bottom: 18px;
}

.news-year {
  color: var(--primary);
  font-weight: 800;
  line-height: 1.55;
  padding-top: 4px;
}

.news-list {
  list-style: none;
  margin-bottom: 0;
  padding-left: 0;
}

.news-list li {
  border-left: 2px solid var(--line);
  line-height: 1.55;
  margin-bottom: 4px;
  padding: 4px 0 5px 14px;
}

.news-list li:hover {
  border-left-color: var(--primary);
}

.selected-publications {
  display: grid;
  gap: 16px;
  padding-top: 12px;
}

.selected-publications > hr {
  display: none;
}

.pub-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(23, 32, 51, 0.06);
  margin-left: 0;
  margin-right: 0;
  padding: 16px;
}

.pub-card:hover {
  border-color: #cfcfcf;
  box-shadow: var(--shadow);
}

.pub-image-col {
  align-items: center;
  display: flex;
  justify-content: center;
  padding-left: 0;
}

.pub-thumb {
  aspect-ratio: 4 / 3;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  object-fit: contain;
  width: 100%;
}

.pub-content {
  color: var(--muted);
  padding-right: 0;
}

.pub-content font[color="black"] {
  color: var(--ink) !important;
  display: inline-block;
  font-size: 1.04rem;
  line-height: 1.45;
  margin: 2px 0;
}

.pub-content small a {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: inline-block;
  font-size: 0.82rem;
  margin-left: 4px;
  padding: 1px 7px;
}

.pub-content small a:hover,
.pub-content small a:focus {
  background: var(--primary-soft);
  border-color: #cfcfcf;
}

.pub-content font[color="firebrick"] {
  color: #9f2d24 !important;
  display: inline-block;
  margin-top: 3px;
}

.publication-category {
  align-items: center;
  color: var(--primary);
  display: flex;
  font-size: 1.08rem;
  font-weight: 800;
  gap: 12px;
  letter-spacing: 0;
  margin: 26px 0 12px;
}

.publication-category::after {
  background: var(--line);
  content: "";
  flex: 1;
  height: 1px;
}

.other-publications {
  counter-reset: other-publication;
  display: grid;
  gap: 10px;
  list-style: none;
  margin-bottom: 4px;
  padding-left: 0;
}

.other-publications li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  counter-increment: other-publication;
  line-height: 1.55;
  margin-bottom: 0;
  padding: 13px 16px 13px 54px;
  position: relative;
}

.other-publications li::before {
  align-items: center;
  background: var(--primary-soft);
  border: 1px solid #d7d7d7;
  border-radius: 7px;
  color: var(--primary);
  content: counter(other-publication);
  display: flex;
  font-size: 0.82rem;
  font-weight: 800;
  height: 26px;
  justify-content: center;
  left: 16px;
  line-height: 1;
  position: absolute;
  top: 16px;
  width: 26px;
}

.other-authors {
  color: var(--muted);
}

.other-title {
  color: var(--ink);
  font-size: 1.01rem;
  font-weight: 800;
  line-height: 1.45;
  margin: 3px 0;
}

.other-meta-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.other-venue {
  color: var(--primary);
}

.other-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pub-link {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--primary);
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.4;
  padding: 1px 7px;
}

.pub-link:hover,
.pub-link:focus {
  background: var(--primary-soft);
  border-color: #cfcfcf;
  color: var(--primary-dark);
  text-decoration: none;
}

.publication-more-link {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.publication-more-link a {
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 8px;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 800;
  padding: 8px 14px;
}

.publication-more-link a:hover,
.publication-more-link a:focus {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.timeline-entry {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(23, 32, 51, 0.05);
  margin-left: 0;
  margin-right: 0;
  padding: 16px 12px;
}

.logo-column {
  align-items: center;
  display: flex;
  justify-content: center;
}

.honor-list,
.media-list {
  list-style: none;
  padding-left: 0;
}

.honor-list li,
.media-list li {
  border-left: 3px solid var(--primary-soft);
  margin-bottom: 10px;
  padding: 2px 0 2px 14px;
}

.service-list {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 14px 18px;
}

.visitor-map {
  margin: 30px 0;
  text-align: center;
}

.visitor-map h5 {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 15px;
}

.visitor-map iframe,
.visitor-map img,
.visitor-map canvas {
  max-width: 100%;
}

footer {
  color: var(--muted);
  font-size: 0.92rem;
  padding-bottom: 20px;
}

@media (max-width: 991.98px) {
  .cv-grid {
    grid-template-columns: 1fr;
  }

  .research-topics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  body {
    font-size: 15px;
  }

  .navbar-custom .nav-link {
    padding-left: 0;
  }

  .intro-panel {
    padding-top: 84px;
  }

  .intro-copy h1 {
    font-size: 2.25rem;
  }

  h3[id] {
    flex-wrap: wrap;
  }

  h3[id] small {
    flex-basis: 100%;
    margin-left: 14px;
    margin-top: 2px;
  }

  .cv-overview h3 {
    flex-wrap: wrap;
  }

  .cv-overview h3 small {
    flex-basis: 100%;
    margin-left: 14px;
    margin-top: 2px;
  }

  .cv-panel {
    padding: 0;
  }

  .cv-entry {
    grid-template-columns: minmax(0, 1fr) 82px;
    gap: 12px 14px;
    padding-left: 16px;
  }

  .cv-entry-body {
    grid-column: 1 / -1;
  }

  .cv-entry-date {
    padding-top: 28px;
  }

  .cv-logo-wrap {
    justify-self: end;
  }

  .profile-column {
    padding-right: 15px;
  }

  .profile-photo {
    max-width: 220px;
  }

  .news-group {
    display: block;
    margin-bottom: 20px;
  }

  .news-year {
    margin-bottom: 6px;
  }

  .pub-card {
    padding: 14px;
  }

  .pub-image-col {
    justify-content: flex-start;
    margin-bottom: 12px;
    padding-right: 0;
  }

  .pub-thumb {
    max-width: 220px;
  }

  .other-publications li {
    padding: 12px 13px 12px 48px;
  }

  .other-publications li::before {
    left: 13px;
    top: 15px;
  }

  .other-meta-row {
    align-items: flex-start;
    display: block;
  }

  .other-links {
    display: flex;
    margin-top: 5px;
  }

  .publication-more-link {
    justify-content: flex-start;
  }

  .logo-column {
    justify-content: flex-start;
    margin-bottom: 10px;
  }
}
