/* ========================================
   Bifan Wei - Personal Homepage
   Academic Theme (ref: zhang-lingling.github.io)
   ======================================== */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 15px;
  background-color: #fff;
}

body {
  margin: 0;
  padding: 0;
  color: #494e52;
  font-family: "Trebuchet MS", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

a {
  color: #224b8d;
  text-decoration: none;
}
a:hover, a:active {
  color: #003366;
}

img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
  border: 0;
}

/* ---------- Headings ---------- */
h1, h2, h3, h4, h5, h6 {
  margin: 1em 0 0.5em;
  line-height: 1.2;
  font-family: "Trebuchet MS", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: bold;
}

h1 {
  margin-top: 1em;
  font-size: 1.4em;
}
h2 { font-size: 1.2em; }
h3 { font-size: 1em; }

/* ---------- Masthead / Navigation ---------- */
.masthead {
  position: sticky;
  top: 0;
  background-color: white;
  border-bottom: 1px solid #f2f3f3;
  z-index: 20;
  animation: intro 0.3s both;
  animation-delay: 0.15s;
}

@keyframes intro {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.masthead__inner-wrap {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 20px;
  clear: both;
}

.masthead__menu {
  float: left;
  width: 100%;
  clear: both;
}

.greedy-nav {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 48px;
  background: white;
}

.visible-links {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.masthead__menu-item {
  list-style-type: none;
  white-space: nowrap;
}

.masthead__menu-item a {
  display: block;
  padding: 12px 14px;
  font-size: 0.9em;
  color: #494e52;
  transition: background 0.2s, color 0.2s;
}

.masthead__menu-item a:hover,
.masthead__menu-item a.active {
  color: #224b8d;
  background: #f8f9fa;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  padding: 8px 10px;
  cursor: pointer;
  color: #494e52;
  font-size: 1.2em;
}

/* ---------- Main Layout (Two-Column) ---------- */
#main {
  max-width: 1024px;
  margin-left: auto;
  margin-right: auto;
  clear: both;
  padding-left: 1em;
  padding-right: 1em;
}
#main::after {
  clear: both;
  content: "";
  display: table;
}

/* ----- Sidebar ----- */
.sidebar {
  width: 15.254%;
  float: left;
  margin-right: 1.695%;
  opacity: 1;
  transition: opacity 0.2s ease-in-out;
  padding-right: 0;
}

.sidebar:hover { opacity: 1; }

.profile_box {
  margin-bottom: 1em;
}

.author__avatar {
  display: block;
  width: auto;
  height: auto;
  margin-bottom: 10px;
}

.author__avatar img {
  max-width: 175px;
  min-width: 75px;
  width: 100%;
  border-radius: 50%;
}

.author__content {
  margin-bottom: 8px;
}

.author__name {
  font-size: 1em;
  margin: 0 0 4px;
  line-height: 1.2;
  font-weight: bold;
}

.author__urls-wrapper {
  margin-bottom: 1em;
}

.author__urls {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85em;
  line-height: 1.8;
}

.author__urls li {
  white-space: nowrap;
  margin-bottom: 1px;
}

.author__urls a {
  display: block;
  margin-bottom: 4px;
  padding: 2px 0;
  color: #494e52;
  font-size: 1em;
  text-decoration: none;
}

.author__urls a:hover {
  text-decoration: underline;
  color: #224b8d;
}

.author__urls i,
.author__urls .ai {
  width: 20px;
  text-align: center;
  margin-right: 2px;
}

/* Social icon colors (matching reference) */
.social-icons .fa,
.social-icons .ai {
  color: #494e52;
}
.social-icons .fa-github,
.social-icons .fa-github-alt,
.social-icons .fa-github-square {
  color: #171516;
}
.social-icons .fa-graduation-cap {
  color: #494e52;
}
.social-icons .fa-envelope {
  color: #494e52;
}
.social-icons .fa-map-marker {
  color: #494e52;
}
.social-icons .fa-university {
  color: #494e52;
}

/* ----- Main Content (Page) ----- */
.page {
  float: left;
  width: 83.051%;
  position: relative;
}

.page__inner-wrap {
  float: left;
  width: 100%;
}

.page__content {
  float: left;
  width: 100%;
}

/* ----- Anchor offset for sticky nav ----- */
.anchor {
  display: block;
  position: relative;
  top: -60px;
  visibility: hidden;
}

/* ----- Content Styles ----- */
.page__content h1 {
  margin-top: 1.2em;
  padding-bottom: 6px;
  border-bottom: 1px solid #f0f0f0;
}

.page__content h1:first-of-type {
  margin-top: 0.5em;
}

.page__content ul, .page__content ol {
  margin: 0.5em 0 1em;
  padding-left: 1.5em;
}

.page__content li {
  margin-bottom: 0.5em;
  line-height: 1.6;
}

.page__content li em {
  color: #666;
  font-size: 0.95em;
}

.page__content ol li {
  font-size: 0.95em;
  line-height: 1.55;
  margin-bottom: 0.6em;
}

.page__content ol li em {
  color: #888;
}

.page__content p {
  margin: 0.5em 0 1em;
  text-align: justify;
}

.page__content strong {
  color: #333;
}

/* ----- Footer ----- */
.footer {
  clear: both;
  text-align: center;
  padding: 2em 20px;
  margin-top: 2em;
  border-top: 1px solid #f2f3f3;
  color: #999;
  font-size: 0.85em;
}

.footer a {
  color: #777;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    float: none;
    margin-right: 0;
    text-align: center;
    margin-bottom: 1.5em;
  }

  .author__avatar img {
    max-width: 130px;
  }

  .author__urls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 12px;
  }

  .author__urls li {
    margin-bottom: 0;
  }

  .page {
    width: 100%;
    float: none;
  }

  .masthead__menu-item a {
    padding: 10px 10px;
    font-size: 0.85em;
  }

  .visible-links {
    display: none;
    flex-direction: column;
    width: 100%;
    position: absolute;
    top: 48px;
    left: 0;
    background: white;
    border-bottom: 1px solid #f2f3f3;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    z-index: 100;
  }

  .visible-links.open {
    display: flex;
  }

  .greedy-nav {
    flex-wrap: wrap;
  }

  .nav-toggle {
    display: block;
  }
}
