/* Astra 全站固定导航。仅在脚本确认存在原主题页眉后启用。 */
body.elsh-enabled {
  --elsh-ink: #252525;
  --elsh-hover: #872d2f;
  --elsh-background: transparent;
  --elsh-shadow: none;
  --elsh-border: transparent;
  --elsh-logo-filter: brightness(0);
}

/* 原本使用透明页眉的图片首页：顶部保留浅色导航。 */
body.elsh-enabled.elsh-overlay:not(.elsh-scrolled):not(.elsh-menu-open) {
  --elsh-ink: #fff;
  --elsh-hover: #ffe1e1;
  --elsh-logo-filter: brightness(0) invert(1);
}

body.elsh-enabled.elsh-scrolled,
body.elsh-enabled.elsh-menu-open {
  --elsh-background: #fff;
  --elsh-shadow: 0 5px 24px rgba(33, 22, 24, 0.1);
  --elsh-border: #eee9e9;
}

body.elsh-enabled #masthead {
  position: fixed !important;
  top: var(--elsh-admin-offset, 0px) !important;
  right: 0 !important;
  bottom: auto !important;
  left: 0 !important;
  width: 100% !important;
  margin: 0 !important;
  z-index: 1000;
  background: transparent !important;
}

body.elsh-enabled #masthead .main-header-bar-wrap {
  background: transparent !important;
}

body.elsh-enabled #masthead .main-header-bar {
  background: var(--elsh-background) !important;
  box-shadow: var(--elsh-shadow) !important;
  border-bottom-color: var(--elsh-border) !important;
  transition: background-color 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

/* 普通内页保留页眉原本占据的高度，正文不会被固定栏遮住。 */
.elsh-header-spacer {
  height: var(--elsh-header-height, 0px);
  pointer-events: none;
}
body.elsh-enabled.elsh-overlay .elsh-header-spacer {
  display: none;
}
html.elsh-document {
  scroll-padding-top: calc(var(--elsh-header-height, 0px) + var(--elsh-admin-offset, 0px) + 16px);
}

/* 适配已有白色透明 PNG，以及昨天添加的指南页 Logo 修复规则。 */
body.elsh-enabled #masthead .site-branding .site-logo-img img,
body.elsh-enabled #masthead .site-branding img.custom-logo {
  background: transparent !important;
  filter: var(--elsh-logo-filter) !important;
  transition: filter 180ms ease;
}

body.elsh-enabled #masthead .main-header-menu > .menu-item > a:not(.ast-custom-button-link):not(.ast-button),
body.elsh-enabled #masthead .main-header-menu > .menu-item > .ast-menu-toggle,
body.elsh-enabled #masthead .site-title a,
body.elsh-enabled #masthead .site-description,
body.elsh-enabled #masthead .menu-toggle {
  color: var(--elsh-ink) !important;
  transition: color 180ms ease;
}
body.elsh-enabled #masthead .main-header-menu > .menu-item > a:not(.ast-custom-button-link):not(.ast-button):hover,
body.elsh-enabled #masthead .main-header-menu > .menu-item > a:not(.ast-custom-button-link):not(.ast-button):focus-visible,
body.elsh-enabled #masthead .main-header-menu > .current-menu-item > a:not(.ast-custom-button-link):not(.ast-button) {
  color: var(--elsh-hover) !important;
}
body.elsh-enabled #masthead .menu-toggle {
  background: transparent !important;
  border: 1px solid currentColor !important;
}

/* 保留主题原有联系按钮的底色，文字始终为白色。 */
body.elsh-enabled #masthead a.ast-custom-button,
body.elsh-enabled #masthead a.ast-button,
body.elsh-enabled #masthead .ast-custom-button {
  color: #fff !important;
}

/* 下拉菜单和展开的手机菜单始终使用白底深色字。 */
body.elsh-enabled #masthead .main-header-menu .sub-menu {
  background: #fff !important;
  box-shadow: 0 8px 24px rgba(33, 22, 24, 0.12);
}
body.elsh-enabled #masthead .main-header-menu .sub-menu a,
body.elsh-enabled #masthead .main-header-menu .sub-menu .ast-menu-toggle {
  color: #252525 !important;
}
body.elsh-enabled #masthead .main-header-menu .sub-menu a:hover,
body.elsh-enabled #masthead .main-header-menu .sub-menu a:focus-visible {
  color: #872d2f !important;
}
body.elsh-enabled.ast-header-break-point #masthead .main-header-bar-navigation,
body.elsh-enabled.ast-header-break-point #masthead .main-header-menu {
  background: #fff !important;
}
body.elsh-enabled.ast-header-break-point #masthead .main-header-menu > .menu-item > a,
body.elsh-enabled.ast-header-break-point #masthead .main-header-menu > .menu-item > .ast-menu-toggle {
  color: #252525 !important;
}
body.elsh-enabled.elsh-menu-open #masthead {
  max-height: calc(100vh - var(--elsh-admin-offset, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
}
@supports (height: 100dvh) {
  body.elsh-enabled.elsh-menu-open #masthead {
    max-height: calc(100dvh - var(--elsh-admin-offset, 0px));
  }
}
@media (prefers-reduced-motion: reduce) {
  body.elsh-enabled #masthead * {
    transition: none !important;
  }
}
@media print {
  body.elsh-enabled #masthead {
    position: relative !important;
    top: 0 !important;
  }
  body.elsh-enabled .elsh-header-spacer {
    display: none;
  }
}
