/* Yuan Wu homepage custom layout tweaks. */

/* Hide the upstream al-folio top navigation completely. We inject a stable
   custom sidebar after the site is built, so this avoids Bootstrap collapse
   conflicts and template demo navigation leftovers. */
header,
.navbar,
nav.navbar {
  display: none !important;
}

.yuan-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 230px;
  height: 100vh;
  padding: 32px 24px;
  border-right: 1px solid var(--global-divider-color, #e5e5e5);
  background: var(--global-bg-color, #fff);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.yuan-sidebar-name {
  margin: 0 0 6px 0;
  color: var(--global-text-color, #111);
  font-size: 1.45rem;
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.yuan-sidebar-title {
  margin: 0 0 26px 0;
  color: var(--global-text-color-light, #555);
  font-size: 0.82rem;
  line-height: 1.45;
}

.yuan-sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.yuan-sidebar-links a {
  display: block;
  color: var(--global-text-color, #111);
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1.35;
  padding: 3px 0;
}

.yuan-sidebar-links a:hover,
.yuan-sidebar-links a:focus {
  color: var(--global-theme-color, #b509ac);
  text-decoration: none;
}

.yuan-sidebar-tools {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

@media (min-width: 992px) {
  body {
    padding-left: 230px;
  }

  main,
  .container,
  .post,
  .page-content {
    max-width: 1040px !important;
  }
}

@media (max-width: 991px) {
  body {
    padding-left: 0;
    padding-top: 0;
  }

  .yuan-sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 20px 24px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--global-divider-color, #e5e5e5);
  }

  .yuan-sidebar-title {
    margin-bottom: 14px;
  }

  .yuan-sidebar-links {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px 18px;
  }

  .yuan-sidebar-tools {
    display: none;
  }
}

/* Homepage News section. */
.yuan-news-box {
  max-height: 260px;
  overflow-y: auto;
  margin: 0.75rem 0 2rem 0;
  padding: 0.25rem 1.25rem 0.25rem 0;
  border-right: 1px solid rgba(0, 0, 0, 0.04);
  scrollbar-width: auto;
}

.yuan-news-box::-webkit-scrollbar {
  width: 10px;
}

.yuan-news-box::-webkit-scrollbar-track {
  background: transparent;
}

.yuan-news-box::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
}

.yuan-news-item {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  column-gap: 1.75rem;
  align-items: start;
  padding: 0.55rem 0;
}

.yuan-news-date {
  font-weight: 700;
  color: var(--global-text-color, #111);
  white-space: nowrap;
}

.yuan-news-text {
  color: var(--global-text-color, #111);
  line-height: 1.45;
}

@media (max-width: 767px) {
  .yuan-news-box {
    max-height: 280px;
    padding-right: 0.75rem;
  }

  .yuan-news-item {
    grid-template-columns: 1fr;
    row-gap: 0.15rem;
  }

  .yuan-news-date {
    white-space: normal;
  }
}

/* Publication page: align numbers and entries more cleanly. */
ol.bibliography {
  list-style: none !important;
  counter-reset: publication-counter;
  padding-left: 0 !important;
  margin-left: 0 !important;
}

ol.bibliography > li {
  counter-increment: publication-counter;
  display: grid !important;
  grid-template-columns: 3.2rem minmax(0, 1fr);
  column-gap: 1.2rem;
  align-items: start;
  margin: 0 0 1.35rem 0 !important;
  padding: 0 !important;
}

ol.bibliography > li::before {
  content: counter(publication-counter) ".";
  grid-column: 1;
  text-align: right;
  color: var(--global-text-color, #111);
  line-height: 1.45;
  padding-top: 0.05rem;
}

ol.bibliography > li > * {
  grid-column: 2;
  min-width: 0;
}

ol.bibliography abbr,
ol.bibliography .abbr,
ol.bibliography .badge {
  display: none !important;
}

ol.bibliography .title {
  display: inline !important;
  font-weight: 500;
  color: var(--global-text-color, #111);
}

ol.bibliography .author,
ol.bibliography .periodical {
  margin-top: 0.15rem;
}

ol.bibliography .links,
ol.bibliography .btn-links,
ol.bibliography .badges,
ol.bibliography .biblinks {
  display: inline-flex !important;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0 0.55rem !important;
  vertical-align: baseline;
}

ol.bibliography .links a,
ol.bibliography .btn-links a,
ol.bibliography .biblinks a,
ol.bibliography a.btn,
ol.bibliography button.btn {
  display: inline-flex !important;
  align-items: center;
  min-height: auto !important;
  padding: 0 0.35rem !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--global-theme-color, #b509ac) !important;
  font-size: 0.78rem !important;
  line-height: 1.3 !important;
  box-shadow: none !important;
  text-transform: none !important;
}

ol.bibliography a.btn::before,
ol.bibliography .links::before,
ol.bibliography .btn-links::before,
ol.bibliography .biblinks::before {
  content: "";
}

@media (max-width: 767px) {
  ol.bibliography > li {
    grid-template-columns: 2.4rem minmax(0, 1fr);
    column-gap: 0.8rem;
  }

  ol.bibliography .links,
  ol.bibliography .btn-links,
  ol.bibliography .badges,
  ol.bibliography .biblinks {
    display: flex !important;
    margin: 0.25rem 0 0 0 !important;
  }
}

/* Hide RSS and default custom social icons if the upstream theme leaves them in the rendered page. */
a[href$="/feed.xml"],
a[title="RSS Feed"],
a[aria-label="RSS Feed"],
a[title="Custom Social"],
a[aria-label="Custom Social"],
a[href*="alberteinstein.com"] {
  display: none !important;
}

footer {
  font-size: 0.85rem;
}
