/* Shared mobile top-nav + logo theme fit (all skins) */

/* ------------------------------------------------------------
   Logo: compact + theme-aware
   ------------------------------------------------------------ */
.topbar-logo,
.bd-brand .topbar-logo,
.navbar-brand .topbar-logo,
.ax-rail-brand img{
  height: 28px;
  width: auto;
  max-width: 36px;
  object-fit: contain;
  background: transparent !important;
}

@media (max-width: 991.98px){
  .topbar-logo,
  .bd-brand .topbar-logo,
  .navbar-brand .topbar-logo{
    height: 24px;
    max-width: 32px;
  }
}

/* Dual mark: show light or dark asset (avoid invert — white plate becomes blank) */
.topbar-logo--dark,
.bd-brand .topbar-logo--dark,
.navbar-brand .topbar-logo--dark,
.ax-rail-brand .topbar-logo--dark,
.login-logo--dark,
.ax-auth-logo--dark,
.bd-auth-brand .login-logo--dark{
  display: none;
}
html[data-bs-theme="dark"] .topbar-logo--light,
html[data-bs-theme="dark"] .bd-brand .topbar-logo--light,
html[data-bs-theme="dark"] .navbar-brand .topbar-logo--light,
html[data-bs-theme="dark"] .ax-rail-brand .topbar-logo--light,
html[data-bs-theme="dark"] .login-logo--light,
html[data-bs-theme="dark"] .ax-auth-logo--light,
html[data-bs-theme="dark"] .bd-auth-brand .login-logo--light,
body.theme-dark .topbar-logo--light,
body.theme-dark .bd-brand .topbar-logo--light,
body.theme-dark .navbar-brand .topbar-logo--light,
body.theme-dark .ax-rail-brand .topbar-logo--light,
body.theme-dark .login-logo--light,
body.theme-dark .ax-auth-logo--light,
body.theme-dark .bd-auth-brand .login-logo--light{
  display: none;
}
html[data-bs-theme="dark"] .topbar-logo--dark,
html[data-bs-theme="dark"] .bd-brand .topbar-logo--dark,
html[data-bs-theme="dark"] .navbar-brand .topbar-logo--dark,
html[data-bs-theme="dark"] .ax-rail-brand .topbar-logo--dark,
html[data-bs-theme="dark"] .login-logo--dark,
html[data-bs-theme="dark"] .ax-auth-logo--dark,
html[data-bs-theme="dark"] .bd-auth-brand .login-logo--dark,
body.theme-dark .topbar-logo--dark,
body.theme-dark .bd-brand .topbar-logo--dark,
body.theme-dark .navbar-brand .topbar-logo--dark,
body.theme-dark .ax-rail-brand .topbar-logo--dark,
body.theme-dark .login-logo--dark,
body.theme-dark .ax-auth-logo--dark,
body.theme-dark .bd-auth-brand .login-logo--dark{
  display: inline-block;
}

/* Soft mystical purple presence on cream auth screens (no multiply — assets are already purple) */
html:not([data-bs-theme="dark"]) .bd-auth-brand .login-logo--light,
html:not([data-bs-theme="dark"]) .bd-auth-brand .login-logo{
  filter: drop-shadow(0 8px 20px rgba(123, 94, 138, .16));
}

/* Dark: proper light-on-dark mark — no invert/filter */
html[data-bs-theme="dark"] .topbar-logo,
html[data-bs-theme="dark"] .bd-brand .topbar-logo,
html[data-bs-theme="dark"] .navbar-brand .topbar-logo,
html[data-bs-theme="dark"] .ax-rail-brand img,
html[data-bs-theme="dark"] .login-logo,
html[data-bs-theme="dark"] .ax-auth-logo,
html[data-bs-theme="dark"] .bd-auth-brand .login-logo,
body.theme-dark .topbar-logo,
body.theme-dark .bd-brand .topbar-logo,
body.theme-dark .navbar-brand .topbar-logo,
body.theme-dark .ax-rail-brand img,
body.theme-dark .login-logo,
body.theme-dark .ax-auth-logo,
body.theme-dark .bd-auth-brand .login-logo{
  filter: none;
  opacity: 1;
  mix-blend-mode: normal;
  background: transparent !important;
}

/* Light topbar: transparent, theme-tinted glass */
html:not([data-bs-theme="dark"]) .bd-topbar{
  background: color-mix(in srgb, var(--bd-bg, #f6f4ef) 42%, transparent) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: color-mix(in srgb, var(--bd-border, #d8d2c8) 70%, transparent);
}
html[data-bs-theme="dark"] .bd-topbar{
  background: color-mix(in srgb, var(--bd-surface, #141414) 72%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ------------------------------------------------------------
   Mobile / tablet: fixed 4 + arrow "more" (no horizontal scroll)
   ------------------------------------------------------------ */
@media (max-width: 991.98px){
  #tabs-wrap{
    overflow: visible !important;
  }
  /* Kill scroll-fade hints from skins that had a sliding strip */
  #tabs-wrap::before,
  #tabs-wrap::after{
    content: none !important;
    display: none !important;
  }

  #mainNav{
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: stretch !important;
    gap: 4px !important;
    width: 100%;
    overflow: visible !important;
    overflow-x: visible !important;
    -webkit-overflow-scrolling: auto !important;
    scroll-snap-type: none !important;
  }
  #mainNav::-webkit-scrollbar{ display: none !important; height: 0 !important; }

  #mainNav > .nav-item.bd-nav-primary{
    flex: 1 1 0;
    min-width: 0;
  }
  #mainNav > .nav-item.bd-nav-primary .nav-link{
    width: 100%;
    justify-content: center;
    padding-left: 6px !important;
    padding-right: 6px !important;
    font-size: 12px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #mainNav > .nav-item.bd-nav-more{
    flex: 0 0 auto;
    position: relative;
  }

  button.bd-nav-more-toggle.nav-link{
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    line-height: inherit;
    margin: 0;
  }
  .bd-nav-more-toggle{
    width: 40px;
    min-width: 40px;
    padding-left: 0 !important;
    padding-right: 0 !important;
    justify-content: center;
    cursor: pointer;
  }
  .bd-nav-more-caret{
    display: inline-block;
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .18s ease;
  }
  .bd-nav-more.is-open .bd-nav-more-caret{
    transform: rotate(-135deg) translateY(-1px);
  }

  .bd-nav-more-panel{
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 40;
    min-width: min(220px, 72vw);
    margin: 0;
    padding: 6px;
    list-style: none;
    border-radius: 14px;
    background: var(--bd-surface, #fff);
    border: 1px solid var(--bd-border, rgba(127,127,127,.28));
    box-shadow: 0 14px 36px rgba(0,0,0,.22);
  }
  .bd-nav-more.is-open .bd-nav-more-panel{
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .bd-nav-more-panel .nav-item{ width: 100%; }
  .bd-nav-more-panel .nav-link{
    width: 100%;
    justify-content: flex-start !important;
    text-align: left;
    white-space: nowrap;
  }
}

/* Desktop / wide: flatten "more" so every link is a normal pill/rail item */
@media (min-width: 992px){
  #mainNav > .nav-item.bd-nav-more{
    display: contents;
  }
  .bd-nav-more-toggle{
    display: none !important;
  }
  .bd-nav-more-panel{
    display: contents;
    position: static;
    border: 0;
    box-shadow: none;
    background: transparent;
    padding: 0;
    min-width: 0;
  }
}
