/* Academic Minimal Theme Main CSS */

/* Base Reset and Variables */
* {
  box-sizing: border-box;
}

html {
  font-family: -apple-system, BlinkMacSystemFont, "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", Arial, sans-serif;
  line-height: 1.6;
  color: #494e52;
  font-size: 16px;
}

body {
  background: #fff;
  margin: 0;
  padding: 0;
}

/* Masthead Navigation */
.masthead {
  position: relative;
  background: #fff;
  border-bottom: 1px solid #f2f3f3;
  z-index: 20;
}

.masthead__inner-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1em;
}

.masthead__menu {
  width: 100%;
  clear: both;
  display: flex;
  align-items: center;
  padding: 0.5em 0;
}

.greedy-nav {
  position: relative;
  display: flex;
  min-height: 2em;
  background: #fff;
  width: 100%;
}

.greedy-nav button {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

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

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

.masthead__menu-item a {
  display: block;
  color: #494e52;
  text-decoration: none;
  padding: 0.5em 1em;
  font-weight: 400;
  transition: color 0.2s;
}

.masthead__menu-item a:hover {
  color: #2c3e50;
}

.masthead__menu-item--lg a {
  font-weight: 700;
  color: #2c3e50;
}

/* Main Content Layout */
#main {
  clear: both;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1em;
  padding-right: 1em;
  max-width: 1280px;
  display: grid;
  grid-template-columns: 1fr 4fr;
  grid-gap: 2em;
  padding-top: 1em;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: fit-content;
}

.sidebar.sticky {
  overflow-y: auto;
  max-height: 100vh;
}

/* Profile Box */
.profile_box {
  background: #fff;
  border: 1px solid #f2f3f3;
  border-radius: 4px;
  padding: 1.5em;
  box-shadow: 0 0 4px rgba(#000, 0.1);
}

.author__avatar {
  display: table-cell;
  vertical-align: top;
  width: 180px;
  height: 180px;
}

.author__avatar img {
  max-width: 160px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.author__content {
  margin-top: 1em;
}

.author__name {
    margin: 0;
    color: #2c3e50;
    font-size: 1.2em;
    font-weight: 600;
}

.author__bio {
  margin: 0.5em 0 0;
  color: #7a8288;
  font-style: italic;
}

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

.author__urls {
  list-style: none;
  margin: 0;
  padding: 0;
}

.author__urls li {
  white-space: nowrap;
  margin-bottom: 0.5em;
}

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

.author__urls a:hover {
  text-decoration: underline;
}

.author__urls_sm {
  display: none;
}

/* Main Content */
.page {
  width: 100%;
}

.page__inner-wrap {
  background: #fff;
  padding: 2em;
  border: 1px solid #f2f3f3;
  border-radius: 4px;
  box-shadow: 0 0 4px rgba(#000, 0.1);
}

.page__content {
  font-size: 1em;
  line-height: 1.6;
}

/* Language Switch */
.language-switch {
  text-align: right;
  margin-bottom: 2em;
}

.lang-btn {
  color: #7a8288;
  text-decoration: none;
  margin-left: 1em;
  padding: 0.25em 0.5em;
  border: 1px solid #f2f3f3;
  border-radius: 3px;
  transition: all 0.2s;
}

.lang-btn.active,
.lang-btn:hover {
  color: #2c3e50;
  border-color: #2c3e50;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 2em 0 0.5em;
  line-height: 1.2;
  font-weight: 600;
  color: #2c3e50;
}

h1 {
    margin-top: 0;
    font-size: 1.8em;
}

h2 {
    font-size: 1.3em;
}

h3 {
    font-size: 1.1em;
}

p {
  margin-bottom: 1.3em;
}

a {
  color: #3498db;
  text-decoration: none;
}

a:hover {
  color: #2980b9;
  text-decoration: underline;
}

/* Lists */
ul {
  margin-bottom: 1.3em;
}

li {
  margin-bottom: 0.5em;
}

/* Code blocks */
code {
  background: #f8f8f8;
  border: 1px solid #e1e1e8;
  border-radius: 3px;
  color: #e96900;
  font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace;
  font-size: 0.875em;
  padding: 0.125em 0.25em;
}

/* Anchors */
.anchor {
  display: block;
  height: 80px;
  margin-top: -80px;
  visibility: hidden;
}

/* Emoji styling */
.page__content h1:first-child {
  margin-top: 0;
}

/* Social icons */
.fa, .fas, .fab {
  font-family: "Font Awesome 5 Free", "Font Awesome 5 Brands";
  font-weight: 900;
}

.fa-fw {
  width: 1.25em;
  text-align: center;
}

.fa-map-marker:before { content: "\f3c5"; }
.fa-envelope:before { content: "\f0e0"; }
.fa-github:before { content: "\f09b"; }
.fa-graduation-cap:before { content: "\f19d"; }

/* Responsive Design */
@media (max-width: 1024px) {
  #main {
    grid-template-columns: 1fr;
    grid-gap: 1em;
  }
  
  .sidebar {
    position: relative;
    order: 2;
  }
  
  .page {
    order: 1;
  }
}

@media (max-width: 768px) {
  /* Override any existing navicon styles on mobile */
  .navicon,
  .navicon::before,
  .navicon::after {
    all: unset !important;
  }
  
  /* Force body to use flexbox layout */
  body {
    display: flex !important;
    flex-direction: column !important;
  }
  
  /* Move sidebar to top on mobile */
  .sidebar {
    order: -1 !important;
    position: static !important;
    width: 100% !important;
    text-align: center !important;
    padding: 1rem !important;
    border-bottom: 1px solid #f2f3f3 !important;
    display: block !important;
    visibility: visible !important;
    overflow: visible !important;
    height: auto !important;
  }
  
  /* Center avatar on mobile */
  .author__avatar {
    width: 120px !important;
    height: 120px !important;
    margin: 0 auto 1rem auto !important;
    display: block !important;
  }
  
  .author__avatar img {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    display: block !important;
    margin: 0 auto !important;
  }
  
  /* Ensure author content is visible on mobile */
  .author__content,
  .author__urls-wrapper,
  .author__urls {
    display: block !important;
    visibility: visible !important;
  }
  
  /* Center all author content */
  .profile_box {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    width: 100% !important;
  }
  
  .author__content {
    text-align: center !important;
    width: 100% !important;
  }
  
  .author__name {
    text-align: center !important;
    margin: 0.5rem 0 !important;
  }
  
  /* Show navigation menu on mobile */
  .masthead {
    display: block !important;
    visibility: visible !important;
    position: relative !important;
  }
  
  .masthead__menu {
    display: block !important;
  }
  
  .masthead__inner-wrap {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    padding: 0.5rem 1rem !important;
  }
  
  .greedy-nav {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
  }
  
  /* Ensure author bio and contact info are visible */
  .author__bio {
    margin: 0.5rem 0 !important;
    font-size: 1rem !important;
  }
  
  .author__urls.social-icons {
    margin-top: 1rem !important;
  }
  
  .author__urls.social-icons li {
    margin-bottom: 0.5rem !important;
    text-align: center !important;
  }
  
  /* Main content below sidebar */
  #main {
    order: 1 !important;
    margin-left: 0 !important;
    width: 100% !important;
  }
  
  /* Navigation toggle button for mobile */
  .greedy-nav button {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 40px !important;
    height: 40px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 4px !important;
    padding: 8px !important;
    margin: 0 !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease !important;
  }
  
  .greedy-nav button:hover {
    background: rgba(0,0,0,0.05) !important;
  }
  
  .greedy-nav button::after {
    content: none !important;
  }
  
  /* Reset and override any existing navicon styles */
  .greedy-nav button .navicon {
    /* Reset all previous styles */
    all: unset !important;
    /* Apply hamburger menu styles */
    display: block !important;
    position: relative !important;
    width: 20px !important;
    height: 2px !important;
    background: #333 !important;
    transition: background 0.2s ease !important;
    /* Clear any existing content */
    font-size: 0 !important;
    text-indent: -9999px !important;
    overflow: hidden !important;
    /* Ensure no borders or other artifacts */
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
  }
  
  .greedy-nav button .navicon * {
    display: none !important;
  }
  
  .greedy-nav button .navicon::before,
  .greedy-nav button .navicon::after {
    content: '' !important;
    position: absolute !important;
    left: 0 !important;
    width: 20px !important;
    height: 2px !important;
    background: #333 !important;
    transition: all 0.2s ease !important;
    /* Reset any inherited styles */
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    transform: none !important;
  }
  
  .greedy-nav button .navicon::before {
    top: -6px !important;
  }
  
  .greedy-nav button .navicon::after {
    top: 6px !important;
  }
  
  /* X icon when menu is open */
  .greedy-nav button.close .navicon {
    background: transparent !important;
  }
  
  .greedy-nav button.close .navicon::before {
    transform: rotate(45deg) !important;
    top: 0 !important;
  }
  
  .greedy-nav button.close .navicon::after {
    transform: rotate(-45deg) !important;
    top: 0 !important;
  }
  
  /* Navigation links with collapse functionality */
  .visible-links {
    display: none !important;
    flex-direction: column !important;
    position: static !important;
    background: #fff !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 6px !important;
    margin: 0.5rem 0 !important;
    padding: 0.5rem !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    animation: slideDown 0.3s ease !important;
  }
  
  .visible-links.show {
    display: flex !important;
  }
  
  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .masthead__menu-item {
    width: 100% !important;
    margin: 0.25rem 0 !important;
  }
  
  .masthead__menu-item a {
    display: block !important;
    padding: 0.75rem 1rem !important;
    background: #f8f9fa !important;
    border: 1px solid #e9ecef !important;
    border-radius: 4px !important;
    color: #495057 !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
  }
  
  .masthead__menu-item a:hover {
    background: #007bff !important;
    color: white !important;
    border-color: #007bff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 4px rgba(0,123,255,0.2) !important;
  }
  
  .author__urls_sm {
    display: flex;
    justify-content: center;
    gap: 1em;
    margin-top: 1em;
  }
  
  .author__urls_sm a {
    font-size: 1.5em;
  }
  
  /* Language switch buttons on mobile */
  .language-switch {
    display: flex !important;
    justify-content: center !important;
    gap: 1rem !important;
    margin: 1rem 0 !important;
    flex-wrap: wrap !important;
  }
  
  .language-switch a {
    padding: 0.5rem 1rem !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    background: #f8f9fa !important;
    color: #333 !important;
  }
  
  .language-switch a.active {
    background: #007bff !important;
    color: white !important;
  }
  
  .social-icons {
    display: none;
  }
  
  #main {
    padding-left: 0.5em;
    padding-right: 0.5em;
  }
  
  .page__inner-wrap {
    padding: 1em;
  }
}

/* Navicon (hamburger menu) */
.navicon {
  display: block;
  width: 1.5rem;
  height: 1.125rem;
  position: relative;
}

.navicon:before,
.navicon:after,
.navicon {
  background: #494e52;
}

.navicon:before,
.navicon:after {
  content: "";
  width: 1.5rem;
  height: 0.125rem;
  position: absolute;
  left: 0;
  transition: 0.3s;
}

.navicon:before {
  top: -0.5rem;
}

.navicon:after {
  bottom: -0.5rem;
}

.navicon {
  background: transparent;
}

.navicon:before {
  transform: rotate(-45deg);
  top: 0;
}

.navicon:after {
  transform: rotate(45deg);
  bottom: 0;
}

/* Print styles */
@media print {
  .sidebar,
  .masthead {
    display: none;
  }
  
  #main {
    grid-template-columns: 1fr;
    padding: 0;
  }
  
  .page__inner-wrap {
    border: none;
    box-shadow: none;
  }
}

/* Title size adjustments for better proportion */
.page__content h1 {
    font-size: 1.6rem !important;
}

.page__content h2 {
    font-size: 1.2rem !important;
}

.author__name {
    font-size: 1.1rem !important;
}

/* Improve spacing in experience section */
.page__content li > ul {
    margin-top: 0.8rem !important;
    margin-bottom: 1rem !important;
}

.page__content li {
    margin-bottom: 1.5rem !important;
}

/* Make experience sub-items more compact */
.page__content li > ul > li {
    margin-bottom: 0.3rem !important;
}

/* Adjust spacing for research interests list only */
#my-research-interests + ul li {
    margin-bottom: 0.5rem !important;
}

/* Chinese version research interests */
#-research-interests + ul li {
    margin-bottom: 0.5rem !important;
}
