/* ==========================================================================
   1337 MOBILE HEADER POLISH v90
   Clean, balanced top bar for phones: compact theme toggle (single round
   icon), even 38px icon buttons with comfortable gaps, no logo/pill overlap
   on small screens, wordmark visible again on >=414px.
   ========================================================================== */

/* --- 0) Base: uniform flex centering of every header control --- */
@media (max-width: 991px) {
  html .navbar-fixed-top .navbar-right {
    align-items: center !important;
  }
  html #head_menu_rght > li {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 56px !important;
  }
  html #head_menu_rght > li > a.sixteen-font-size,
  html #head_menu_rght > li > a.h1337-logout-btn {
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    margin: 0 2px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  html #head_menu_rght > li > a.sixteen-font-size svg {
    width: 22px !important;
    height: 22px !important;
  }
  /* avatar circle stays round and centered */
  html #head_menu_rght > li.h1337-acc > a.user-menu-combination {
    width: 38px !important;
    height: 38px !important;
    margin: 0 2px !important;
  }
  html #head_menu_rght > li.h1337-acc > a.user-menu-combination img {
    width: 34px !important;
    height: 34px !important;
  }
  /* unread badges sit neatly on the round icons */
  html #head_menu_rght .new-update-alert:not(.hidden) {
    top: 6px !important;
    right: 4px !important;
  }
}

/* --- 1) Compact theme toggle: single 34px round button on phones ---
   Only the TARGET mode icon is shown inside the circle: if you're in night
   mode you see the sun (tap it -> day), if you're in day mode you see the
   moon (tap it -> night). One-tap toggle, CSS-only, JS untouched. */
@media (max-width: 991px) {
  html #head_menu_rght .macos-theme-switcher {
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid rgba(15, 23, 42, .08) !important;
    background: rgba(255, 255, 255, .7) !important;
    box-shadow: 0 2px 8px -2px rgba(15, 23, 42, .18) !important;
    overflow: hidden;
  }
  html[data-site-mode="night"] #head_menu_rght .macos-theme-switcher {
    background: rgba(255, 255, 255, .08) !important;
    border-color: rgba(255, 255, 255, .14) !important;
    box-shadow: 0 2px 10px -2px rgba(0, 0, 0, .5) !important;
  }
  /* Inside the circle: current mode hidden, target mode shown centered */
  html #head_menu_rght .macos-theme-switcher .macos-theme-btn {
    position: absolute !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    border-radius: 50% !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    z-index: 1 !important;
  }
  html #head_menu_rght .macos-theme-switcher .macos-theme-btn.active {
    display: none !important;
  }
  html #head_menu_rght .macos-theme-switcher .macos-theme-btn:not(.active) {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #64748b !important;
  }
  html[data-site-mode="night"] #head_menu_rght .macos-theme-switcher .macos-theme-btn:not(.active) {
    color: #e2e8f0 !important;
  }
  html #head_menu_rght .macos-theme-switcher .macos-theme-btn:hover {
    color: #0a84ff !important;
  }
  html #head_menu_rght .macos-theme-switcher .macos-theme-btn svg {
    width: 17px !important;
    height: 17px !important;
  }
  /* The pill becomes a tiny tap target in header; bump hitslop via wrapper li */
  html #head_menu_rght > li.macos-theme-header-item {
    margin: 0 !important;
    padding: 0 3px !important;
  }
}

/* --- 2) Medium phones (414px+): show the full 1337FORUM wordmark again ---
   At the default 390px the wordmark is hidden (brand badge only) to give the
   icon cluster room; on bigger phones we restore it cleanly. */
@media (min-width: 414px) and (max-width: 991px) {
  html .navbar .macos-header-brand .brand-title {
    display: inline-flex !important;
    font-size: 18px !important;
  }
  html .navbar .macos-header-brand {
    gap: 7px !important;
    padding-right: 10px !important;
  }
}

/* --- 3) Small phones: keep wordmark hidden, give the logo a touch more
   breathing room so it never touches the theme toggle. --- */
@media (max-width: 413px) {
  html .navbar .macos-header-brand .brand-title {
    display: none !important;
  }
  html .navbar .wow_hdr_innr_left {
    padding-right: 6px !important;
  }
  html .navbar-fixed-top .container-fluid {
    gap: 0 !important;
  }
}

/* --- 4) Icon cluster breathing room: even 3px gaps, no zero gaps --- */
@media (max-width: 991px) {
  html #head_menu_rght {
    gap: 3px !important;
  }
  html #head_menu_rght > li > a.sixteen-font-size,
  html #head_menu_rght > li > a.h1337-logout-btn,
  html #head_menu_rght > li.h1337-acc > a.user-menu-combination {
    margin: 0 !important;
  }
}

/* --- 5) Very small phones (<=340px): shave icon size 1px so all fit --- */
@media (max-width: 340px) {
  html #head_menu_rght > li > a.sixteen-font-size,
  html #head_menu_rght > li > a.h1337-logout-btn,
  html #head_menu_rght > li.h1337-acc > a.user-menu-combination {
    width: 36px !important;
    height: 36px !important;
  }
  html #head_menu_rght .macos-theme-switcher {
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    height: 32px !important;
  }
  html #head_menu_rght {
    gap: 1px !important;
  }
}
