/* Adaptive header: JS toggles .header-expanded from .site-header__bar overflow */

html.header-expanded .site-header__logo-mobile {
  display: none !important;
}
html.header-expanded .site-header__logo-desktop {
  display: block !important;
}
html:not(.header-expanded) .site-header__logo-mobile {
  display: block !important;
}
html:not(.header-expanded) .site-header__logo-desktop {
  display: none !important;
}
.header-logo-divider {
  display: none;
}
html.header-expanded .header-logo-divider {
  display: block;
}

.site-header__brand {
  align-self: center;
}

.site-header__bar {
  align-items: center;
}

.site-header__probe {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
}

.site-header__middle {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  margin-left: 1rem;
}

.site-header__actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  min-width: 0;
  margin-left: auto;
  justify-content: flex-end;
}

#headerProfileOpen {
  margin-left: 0.15rem;
}

.site-header__nav {
  gap: 0.15rem !important;
}

.site-header nav.site-header__nav .nav-tab {
  padding-left: 0.72rem;
  padding-right: 0.72rem;
}

/* Prevent auth CTA from pushing nav tabs on medium widths */
#headerSignInBtn {
  max-width: 8.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Collapsed: hide central nav block; keep right actions visible */
html:not(.header-expanded) .site-header__middle {
  display: none !important;
}

html:not(.header-expanded) .site-header__inline-actions {
  display: flex !important;
  align-items: center;
}

html:not(.header-expanded) #headerOAuthGoogle,
html:not(.header-expanded) #headerOAuthPatreon,
html:not(.header-expanded) #getStartedBtn {
  display: none !important;
}

html:not(.header-expanded) #headerSignInBtn {
  display: inline-flex !important;
}

html:not(.header-expanded) .site-header__burger {
  display: flex !important;
}

html.header-expanded .site-header__burger {
  display: none !important;
}

/* Desktop rescue: hide only oauth circles if they overlap Community tab. */
html.header-hide-oauth-circles #headerOAuthGoogle,
html.header-hide-oauth-circles #headerOAuthPatreon {
  display: none !important;
}

/* Drawer: always available; visibility controlled by transform (not md:hidden) */
#mobileMenuBackdrop {
  z-index: 45;
}

#mobileMenuPanel {
  z-index: 50;
  width: min(20rem, 92vw);
  max-width: 22rem;
  padding-bottom: max(5rem, calc(env(safe-area-inset-bottom, 0px) + 4.5rem));
  background: rgba(10, 10, 10, 0.98);
  border-left: 1px solid rgba(64, 64, 64, 0.75);
  box-shadow: -12px 0 48px rgba(0, 0, 0, 0.45);
}

html[data-theme='light'] #mobileMenuPanel {
  background: #ffffff !important;
  border-left: 1px solid rgba(148, 163, 184, 0.55) !important;
  box-shadow: none !important;
}

html[data-theme='light'] .header-logo-divider {
  display: none !important;
}

html[data-theme='light'] .site-header__logo-mobile,
html[data-theme='light'] .site-header__logo-desktop {
  filter: brightness(0) saturate(100%);
}

.mobile-drawer__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.mobile-drawer__section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgb(115, 115, 115);
  margin-bottom: 0.35rem;
  padding-left: 0.125rem;
}

.mobile-drawer__nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 0.85rem 0.875rem;
  border-radius: 0.625rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: rgb(229, 229, 229);
  border: 1px solid transparent;
  background: transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

a.mobile-drawer__nav-item {
  text-decoration: none;
}

.mobile-drawer__nav-item:hover,
.mobile-drawer__nav-item:focus-visible {
  background: rgba(39, 39, 39, 0.65);
  border-color: rgba(64, 64, 64, 0.9);
  color: rgb(255, 255, 255);
  outline: none;
}

.mobile-drawer__nav-item.active {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.35);
  color: rgb(216, 180, 254);
}

.site-header__burger {
  display: flex !important;
  order: 2;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 0.5rem;
  cursor: pointer;
  color: rgb(212, 212, 212);
}

.site-header__inline-actions {
  order: 1;
}

.site-header__burger:hover,
.site-header__burger:focus-visible {
  background: rgba(38, 38, 38, 0.85);
  color: rgb(255, 255, 255);
  outline: none;
}

.site-header__burger-icon {
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

/* Randomize: стили как у Compact/Dense/Full Neck (классы в app.html) */

/* Notifications bell */
#notificationsBell {
  padding: 0.35rem !important;
}

#notificationsBell svg {
  width: 1rem !important;
  height: 1rem !important;
  stroke-width: 1.35 !important;
}

/* Notifications panel when header bell is hidden (compact / drawer) */
#notificationsDropdown.notifications-dropdown--fixed {
  position: fixed !important;
  left: 1rem !important;
  right: 1rem !important;
  top: max(4.25rem, calc(env(safe-area-inset-top, 0px) + 3.25rem)) !important;
  width: auto !important;
  max-height: min(70dvh, 24rem) !important;
  z-index: 70 !important;
  margin-top: 0 !important;
}

/* Main: extra bottom space for mobile browser chrome */
main {
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0px)) !important;
}

@media (max-width: 768px) {
  main {
    padding-bottom: max(2.25rem, calc(env(safe-area-inset-bottom, 0px) + 1rem)) !important;
  }
}
