/* ==========================================================================
   Legion Network navbar for Invision Community 5
   --------------------------------------------------------------------------
   Makes the suite's own header look and behave like the navbar on
   legionnetwork.org (the standalone landing page): one 64px bar that sticks
   to the top, blurred and translucent, lockup on the left, quiet text links
   beside it, theme switch and account controls on the right.

   It is a skin, not a replacement. The suite still renders the header, so
   the menu manager, dropdowns, sign-in popup, notifications, messages, cart
   and the member menu all keep working. Nothing outside the header is styled.

   Pair it with legion-navbar.js, which adds the three-way theme switch.
   Everything here is namespaced: custom properties start with --lnb-, and
   every selector starts at the suite's header or mobile header.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens. The same values as the landing page's three themes.
   -------------------------------------------------------------------------- */
html {
  --lnb-bar: rgba(6, 8, 13, 0.72);
  --lnb-solid: #06080D;
  --lnb-raised: #0E121B;
  --lnb-hover: #131927;
  --lnb-line: #161C29;
  --lnb-border: #212A3B;
  --lnb-border-strong: #33405A;
  --lnb-text: #F3F6FB;
  --lnb-text-2: #A3AEC2;
  --lnb-text-3: #76829A;
  --lnb-accent: #08D0F8;
  --lnb-accent-ink: #03131C;
  --lnb-radius: 6px;
  --lnb-radius-panel: 10px;
  --lnb-font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --lnb-height: 64px;
}
html[data-ips-scheme="light"] {
  --lnb-bar: rgba(255, 255, 255, 0.78);
  --lnb-solid: #FFFFFF;
  --lnb-raised: #FFFFFF;
  --lnb-hover: #EEF2F7;
  --lnb-line: #E8ECF2;
  --lnb-border: #D8DFE9;
  --lnb-border-strong: #B4BECE;
  --lnb-text: #081020;
  --lnb-text-2: #46526A;
  --lnb-text-3: #5F6B82;
  --lnb-accent: #1262D8;
  --lnb-accent-ink: #FFFFFF;
}
/* Legion Cyber. 3 is that theme's id on legionnetwork.org; change it here and
   in legion-navbar.js if the id is ever different. */
html[data-ips-theme="3"] {
  --lnb-bar: rgba(3, 4, 7, 0.76);
  --lnb-solid: #030407;
  --lnb-raised: #090C15;
  --lnb-hover: #0E1422;
  --lnb-line: #111B2E;
  --lnb-border: #1B2C4A;
  --lnb-border-strong: #2C4F7C;
  --lnb-text: #EAFBFF;
  --lnb-text-2: #9AB0CA;
  --lnb-text-3: #6F87A8;
  --lnb-accent: #00F0FF;
  --lnb-accent-ink: #001417;
  --lnb-radius: 0px;
  --lnb-radius-panel: 2px;
}

/* --------------------------------------------------------------------------
   2. The bar (desktop header, 980px and up: the suite's own breakpoint)
   -------------------------------------------------------------------------- */
@media (min-width: 980px) {
  /* The header's own box is dropped so the top row can stick to the page
     while the breadcrumb row below it scrolls away as usual. */
  header.ipsHeader { display: contents; }

  .ipsHeader > .ipsHeader__primary {
    position: sticky; top: 0; z-index: 50;
    min-height: var(--lnb-height) !important; padding-block: 0 !important;
    background: var(--lnb-bar) !important;
    -webkit-backdrop-filter: saturate(160%) blur(16px);
    backdrop-filter: saturate(160%) blur(16px);
    border-bottom: 1px solid var(--lnb-line);
    box-shadow: none;
    font-family: var(--lnb-font);
    -webkit-font-smoothing: antialiased;
  }
  .ipsHeader__primary > .ipsHeader__align {
    display: flex; align-items: center; gap: 28px;
    min-height: var(--lnb-height) !important;
    padding-block: 0 !important;
    /* The bar keeps the suite's page width so the lockup lines up with the
       content under it. For the landing page's narrower 1200px bar instead,
       uncomment the next line. */
    /* max-width: min(100% - 48px, 1200px) !important; */
  }
  .ipsHeader__primary [data-ips-header-content="logo"] { flex: none; display: flex; align-items: center; margin: 0; }
  .ipsHeader__primary [data-ips-header-content="navigation"] { flex: 1 1 auto; min-width: 0; margin: 0; }
  .ipsHeader__primary [data-ips-header-content="user"] { flex: none; display: flex; align-items: center; gap: 8px; margin: 0 0 0 auto; }
}

/* Lockup: 26px tall, as on the landing page. */
.ipsHeader__primary .ipsLogo,
.ipsMobileHeader .ipsLogo { display: inline-flex; align-items: center; height: auto !important; min-height: 44px; padding: 0; margin: 0; }
.ipsHeader__primary .ipsLogo img,
.ipsMobileHeader .ipsLogo img { height: 26px !important; width: auto !important; max-width: none; max-height: none; }

/* The suite's header used to be dark in both schemes, so it always showed the
   on-dark lockup. This bar is light in the Light scheme: swap the lockup. */
html[data-ips-scheme="light"]:not([data-ips-theme="3"]) .ipsHeader__primary .lnLockup--dark,
html[data-ips-scheme="light"]:not([data-ips-theme="3"]) .ipsMobileHeader .lnLockup--dark { display: none !important; }
html[data-ips-scheme="light"]:not([data-ips-theme="3"]) .ipsHeader__primary .lnLockup--light,
html[data-ips-scheme="light"]:not([data-ips-theme="3"]) .ipsMobileHeader .lnLockup--light { display: block !important; }

/* --------------------------------------------------------------------------
   3. Primary links: text only, 14px, quiet until hovered
   -------------------------------------------------------------------------- */
.ipsHeader__primary .ipsNav { display: block; width: 100%; min-width: 0; font-family: var(--lnb-font); }
.ipsHeader__primary .ipsNav > i-navigation-menu { display: block; width: 100%; min-width: 0; }
.ipsHeader__primary .ipsNavBar { gap: 2px; align-items: center; justify-content: flex-start; margin: 0; padding: 0; }
.ipsHeader__primary .ipsNavBar > li { align-items: center; gap: 0; background: none !important; border: 0; border-radius: var(--lnb-radius); box-shadow: none; }
.ipsHeader__primary .ipsNavBar > li > a,
.ipsHeader__primary .ipsNavBar > li > button:not(.lnNavDisclosure) {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 12px;
  font-family: inherit; font-size: 14px; font-weight: 400; line-height: 1; letter-spacing: 0; text-transform: none;
  color: var(--lnb-text-2) !important;
  background: none !important; border: 0; border-radius: var(--lnb-radius); box-shadow: none;
  transition: color .16s ease;
}
.ipsHeader__primary .ipsNavBar > li > a:hover,
.ipsHeader__primary .ipsNavBar > li > button:not(.lnNavDisclosure):hover,
.ipsHeader__primary .ipsNavBar > li[data-active] > a,
.ipsHeader__primary .ipsNavBar > li > a[aria-current="page"] { color: var(--lnb-text) !important; }
.ipsHeader__primary .ipsNavBar > li > a::before,
.ipsHeader__primary .ipsNavBar > li > a::after { display: none; }
.ipsHeader__primary .ipsNavBar > li > a .ipsNavBar__icon,
.ipsHeader__primary .ipsNavBar > li > button .ipsNavBar__icon { display: none; }
.ipsHeader__primary .ipsNavBar__label { font: inherit; color: inherit; }

/* The small arrow that opens a submenu sits tight against its link. */
.ipsHeader__primary .ipsNavBar > li > .lnNavDisclosure {
  display: inline-grid; place-items: center;
  width: 22px; height: 44px; padding: 0; margin: 0 2px 0 -10px;
  font-size: 10px; color: var(--lnb-text-3);
  background: none !important; border: 0; border-radius: var(--lnb-radius); box-shadow: none;
  transition: color .16s ease;
}
.ipsHeader__primary .ipsNavBar > li > .lnNavDisclosure:hover,
.ipsHeader__primary .ipsNavBar > li:hover > .lnNavDisclosure { color: var(--lnb-text); }

/* Submenus */
.ipsHeader__primary .ipsNav__dropdown {
  min-width: 220px; padding: 6px;
  font-family: var(--lnb-font);
  background: var(--lnb-raised) !important; color: var(--lnb-text-2);
  border: 1px solid var(--lnb-border); border-radius: var(--lnb-radius-panel) !important;
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.55);
}
.ipsHeader__primary .ipsNav__dropdown a,
.ipsHeader__primary .ipsNav__dropdown button {
  display: flex; align-items: center; gap: 10px;
  min-height: 40px; padding: 0 10px;
  font-size: 14px; font-weight: 400; color: var(--lnb-text-2);
  background: none; border-radius: var(--lnb-radius);
  transition: color .16s ease, background-color .16s ease;
}
.ipsHeader__primary .ipsNav__dropdown a:hover,
.ipsHeader__primary .ipsNav__dropdown button:hover { color: var(--lnb-text); background: var(--lnb-hover); }
.ipsHeader__primary .ipsNav__dropdown .ipsNavBar__icon { display: none; }

/* --------------------------------------------------------------------------
   4. Right side: theme switch, then the suite's own account controls
   -------------------------------------------------------------------------- */
.lnbTheme {
  display: inline-flex; flex: none; padding: 3px; gap: 2px;
  border: 1px solid var(--lnb-border);
  border-radius: calc(var(--lnb-radius) + 3px);
}
.lnbTheme button {
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0;
  color: var(--lnb-text-3); background: none; border: 0; border-radius: var(--lnb-radius); cursor: pointer;
  transition: color .16s ease, background-color .16s ease;
}
.lnbTheme button:hover { color: var(--lnb-text); }
.lnbTheme button[aria-pressed="true"] { color: var(--lnb-text); background: var(--lnb-hover); }
.lnbTheme button[hidden] { display: none; }
.lnbTheme svg { display: block; }

.ipsHeader__primary .ipsUserNav { display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; font-family: var(--lnb-font); }
.ipsHeader__primary .ipsUserNav > li { display: flex; align-items: center; }
.ipsHeader__primary .ipsUserNav > li.ipsHide { display: none; }
.ipsHeader__primary .ipsUserNav__link {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 38px; height: 38px; min-height: 38px; padding: 0 9px;
  font-size: 14px; font-weight: 500; color: var(--lnb-text-2);
  background: none; border: 1px solid transparent; border-radius: var(--lnb-radius); box-shadow: none;
  transition: color .16s ease, background-color .16s ease, border-color .16s ease;
}
.ipsHeader__primary .ipsUserNav__link:hover { color: var(--lnb-text); background: var(--lnb-hover); }
.ipsHeader__primary .ipsUserNav__icon { font-size: 15px; }
.ipsHeader__primary .ipsUserNav__link .ipsUserPhoto { width: 26px; height: 26px; flex: none; }
.ipsHeader__primary .ipsUserNav [data-el="user"] .ipsUserNav__link { padding-inline: 6px 10px; color: var(--lnb-text); }

/* Guests: "Sign In" as the quiet button, "Start Publishing" as the filled one. */
.ipsHeader__primary .ipsUserNav--guest { gap: 8px; }
.ipsHeader__primary .ipsUserNav--guest #elUserSignIn { padding-inline: 13px; font-weight: 500; }
.ipsHeader__primary .ipsUserNav--guest #elUserSignIn:hover { background: none; }
.ipsHeader__primary .ipsUserNav--guest #elUserSignIn > i { display: none; }
.ipsHeader__primary .ipsUserNav__link--sign-up,
.ipsMobileHeader .ipsMobileNavIcons [data-el="publishing"] .ipsMobileNavIcons__button {
  padding-inline: 14px;
  font-weight: 600; white-space: nowrap;
  color: var(--lnb-accent-ink) !important;
  background: var(--lnb-accent) !important;
  border-color: transparent;
}
.ipsHeader__primary .ipsUserNav__link--sign-up:hover,
.ipsMobileHeader .ipsMobileNavIcons [data-el="publishing"] .ipsMobileNavIcons__button:hover {
  background: color-mix(in srgb, var(--lnb-accent) 86%, var(--lnb-text)) !important;
}

/* --------------------------------------------------------------------------
   5. The row under the bar (breadcrumb and search): kept, made quiet
   -------------------------------------------------------------------------- */
@media (min-width: 980px) {
  .ipsHeader > .ipsHeader__secondary {
    background: transparent !important;
    border-bottom: 1px solid var(--lnb-line);
    box-shadow: none;
    font-family: var(--lnb-font);
  }
  .ipsHeader__secondary .ipsBreadcrumb { font-size: 13px; }
  .ipsHeader__secondary .ipsBreadcrumb a { color: var(--lnb-text-3); font-weight: 400; transition: color .16s ease; }
  .ipsHeader__secondary .ipsBreadcrumb a:hover,
  .ipsHeader__secondary .ipsBreadcrumb li:last-child a { color: var(--lnb-text-2); }
  .ipsHeader__secondary .ipsSearchPseudo {
    height: 34px; font-family: var(--lnb-font); font-size: 13px; color: var(--lnb-text-3);
    background: transparent; border: 1px solid var(--lnb-border); border-radius: var(--lnb-radius);
    transition: color .16s ease, border-color .16s ease;
  }
  .ipsHeader__secondary .ipsSearchPseudo:hover { color: var(--lnb-text); border-color: var(--lnb-border-strong); }
}

/* --------------------------------------------------------------------------
   6. Phones and tablets (under 980px): the suite's mobile header
   -------------------------------------------------------------------------- */
@media (max-width: 979px) {
  .ipsMobileHeader {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: var(--lnb-height); padding-block: 0;
    background: var(--lnb-bar) !important;
    -webkit-backdrop-filter: saturate(160%) blur(16px);
    backdrop-filter: saturate(160%) blur(16px);
    border-bottom: 1px solid var(--lnb-line);
    box-shadow: none;
    font-family: var(--lnb-font);
  }
  .ipsMobileHeader .ipsMobileNavIcons { display: flex; align-items: center; gap: 6px; margin: 0; padding: 0; }
  .ipsMobileHeader .ipsMobileNavIcons__button {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 38px; height: 38px; padding: 0 10px;
    font-family: var(--lnb-font); font-size: 14px; font-weight: 500; color: var(--lnb-text-2);
    background: none; border: 1px solid transparent; border-radius: var(--lnb-radius); box-shadow: none;
  }
  .ipsMobileHeader .lnbTheme { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ipsHeader__primary *, .ipsHeader__secondary *, .ipsMobileHeader *, .lnbTheme button { transition: none !important; }
}
