/* The new top bar (Noctis Studio > Site look > Menu bar > New top bar), the slim dark bar from the bug report page,
   on every page of islanoctis.com. The Studio adds this stylesheet to a page only while "New top bar" is picked, so
   picking "Classic" brings the old bar straight back. Nothing in the page templates changes.

   It styles both kinds of page:
   - the main pages (front/_base.html): the bar is "body > nav.nav". It moves from under the banner to the very top,
     with the server strip right under it, like on the member pages.
   - the member and staff pages (_partials/site_header.html): the bar is "nav.site-nav".
   Logo on the left, links on the right, Management Hub in amber, My Noctis in cyan, Discord as a small pill.
   Where the links don't fit on one line (phones, tablets, small windows, a long menu): the logo, My Noctis and a
   Menu button that opens every link as a tile. assets/night-bar.js measures that and marks the bar: .nb-tight (a
   little tighter) and, when that isn't enough, .nb-small (folded). Without scripts: one row that scrolls sideways,
   Management Hub and My Noctis first. */

:root { --nb-h: 3.6rem; }

/* ------------------------------------------------------------------ main pages: the bar goes to the top */
body:has(> nav.nav) { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
body:has(> nav.nav) > nav.nav { order: -2; }
body:has(> nav.nav) > .status-strip { order: -1; }
body:has(> nav.nav) > :is(.wrap, .banner, footer) { width: 100%; }
body:has(> nav.nav) > footer { margin-top: auto; }
html:has(> body > nav.nav) { scroll-padding-top: calc(var(--nb-h) + 1rem); }
body:has(> nav.nav) main > section { scroll-margin-top: calc(var(--nb-h) + 1rem); }
body:has(> nav.nav) aside { top: calc(var(--nb-h) + 1rem); }

/* ------------------------------------------------------------------ the bar */
:is(body > nav.nav, nav.site-nav) {
  position: sticky; top: 0; left: auto; right: auto; z-index: 30; display: block; margin: 0; gap: 0;
  padding: env(safe-area-inset-top, 0px) 0 0;
  background: rgba(5, 13, 18, .96); border-bottom: 1px solid var(--vine, #16303b);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
:is(body > nav.nav, nav.site-nav) > :is(.wrap, .site-wrap) {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .15rem 1.3rem;
  min-height: var(--nb-h); padding-block: .3rem;
}
:is(body > nav.nav, nav.site-nav) a {
  position: relative; margin: 0; padding: .45rem 0; color: #cfe3e8; text-decoration: none; white-space: nowrap;
  font: 600 .9rem/1.2 "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif; text-transform: none; letter-spacing: .01em;
  box-shadow: none; opacity: 1; transition: color .15s, text-shadow .15s;
}
/* The Site look's "font with one weight" rule thins ".nav a"; the bar keeps its own font and weight. */
:is(body > nav.nav, nav.site-nav) a:not(.brand-logo) { font-weight: 600 !important; }
:is(body > nav.nav, nav.site-nav) a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: .1rem; height: 2px; border-radius: 2px;
  background: currentColor; transform: scaleX(0); transform-origin: 50% 50%; transition: transform .2s ease;
}
:is(body > nav.nav, nav.site-nav) a:hover { color: var(--glow, var(--cyan, #3fe3f2)); }
:is(body > nav.nav, nav.site-nav) a:hover::after { transform: scaleX(1); }
:is(body > nav.nav, nav.site-nav) a:focus-visible { outline: 2px solid var(--ember, var(--amber, #e8953c)); outline-offset: 3px; border-radius: 4px; }
:is(body > nav.nav, nav.site-nav) a[aria-current="page"] { color: var(--glow, var(--cyan, #3fe3f2)); box-shadow: none;
  text-shadow: 0 0 14px rgba(63, 227, 242, .45); }
:is(body > nav.nav, nav.site-nav) a[aria-current="page"]::after { transform: scaleX(1); box-shadow: 0 0 10px currentColor; }

/* the logo, on the left */
:is(body > nav.nav, nav.site-nav) .brand-logo { display: inline-flex; align-items: center; gap: 0; margin-right: auto; padding: .2rem 0; }
:is(body > nav.nav, nav.site-nav) .brand-logo::after { display: none; }
:is(body > nav.nav, nav.site-nav) .brand-logo img { display: block; width: auto; height: 2.15rem; max-width: none; margin: 0;
  border: 0; border-radius: 0; box-shadow: none; filter: drop-shadow(0 0 10px rgba(63, 227, 242, .22)); transition: filter .2s; }
:is(body > nav.nav, nav.site-nav) .brand-logo:hover img { filter: drop-shadow(0 0 14px rgba(63, 227, 242, .45)); }

/* Management Hub (staff), My Noctis or Log in, and Discord */
/* every link sits on the right, after the logo (the classic bar pushed these three to the far right) */
:is(body > nav.nav, nav.site-nav) :is(.nav-hub, .nav-member, .discord) { margin-left: 0; }
:is(body > nav.nav, nav.site-nav) .nav-hub { color: var(--ember, var(--amber, #e8953c)); }
:is(body > nav.nav, nav.site-nav) .nav-hub:hover { color: #ffb766; }
:is(body > nav.nav, nav.site-nav) .nav-member { color: var(--glow, var(--cyan, #3fe3f2)); }
:is(body > nav.nav, nav.site-nav) a.discord { margin-left: .15rem; padding: .4rem .85rem; border-radius: 999px; color: #dfe3ff;
  background: rgba(88, 101, 242, .16); border: 1px solid rgba(120, 132, 250, .55); transition: background .15s, border-color .15s, color .15s; }
:is(body > nav.nav, nav.site-nav) .discord::after { display: none; }
:is(body > nav.nav, nav.site-nav) .discord:hover { color: #fff; background: rgba(88, 101, 242, .34); border-color: #8f9aff; }

/* A little tighter, and Discord as a round chat button, so a long menu stays on one line: on mid-size screens from
   the start, and on any screen where the script finds the links don't fit at full size (.nb-tight). */
@media (max-width: 90rem) {
  :is(body > nav.nav, nav.site-nav) > :is(.wrap, .site-wrap) { column-gap: .85rem; }
  :is(body > nav.nav, nav.site-nav) a { font-size: .85rem; }
  :is(body > nav.nav, nav.site-nav) a.discord { display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; padding: 0;
    font-size: 0 !important; line-height: 0; }
  :is(body > nav.nav, nav.site-nav) a.discord::before { content: ""; width: 1.05rem; height: 1.05rem; background: currentColor;
    -webkit-mask: var(--nb-chat) center / contain no-repeat; mask: var(--nb-chat) center / contain no-repeat; }
}
:is(body > nav.nav, nav.site-nav).nb-tight > :is(.wrap, .site-wrap) { column-gap: .85rem; }
:is(body > nav.nav, nav.site-nav).nb-tight a { font-size: .85rem; }
:is(body > nav.nav, nav.site-nav).nb-tight a.discord { display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; padding: 0;
  font-size: 0 !important; line-height: 0; }
:is(body > nav.nav, nav.site-nav).nb-tight a.discord::before { content: ""; width: 1.05rem; height: 1.05rem; background: currentColor;
  -webkit-mask: var(--nb-chat) center / contain no-repeat; mask: var(--nb-chat) center / contain no-repeat; }
:root { --nb-chat: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-8.6l-4.7 3.6A.6.6 0 0 1 5.7 21v-3H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zm4 6.2a1.3 1.3 0 1 0 0 2.6 1.3 1.3 0 0 0 0-2.6zm4 0a1.3 1.3 0 1 0 0 2.6 1.3 1.3 0 0 0 0-2.6zm4 0a1.3 1.3 0 1 0 0 2.6 1.3 1.3 0 0 0 0-2.6z'/%3E%3C/svg%3E"); }
/* ------------------------------------------------------------------ phones, tablets and small windows
   Without the Menu button (scripts off, before the script has run, or a short menu): one row that scrolls sideways
   instead of two rows; the logo stays put on the left, and Management Hub and My Noctis come first. */
@media (max-width: 76rem) {
  :is(body > nav.nav, nav.site-nav):not(.nb-menu) > :is(.wrap, .site-wrap) {
    flex-wrap: nowrap; justify-content: flex-start; gap: 1.05rem; padding-block: 0; padding-right: 2.2rem; overflow-x: auto; overscroll-behavior-x: contain;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 2rem), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 2rem), transparent);
  }
  :is(body > nav.nav, nav.site-nav):not(.nb-menu) > :is(.wrap, .site-wrap)::-webkit-scrollbar { display: none; }
  :is(body > nav.nav, nav.site-nav):not(.nb-menu) .brand-logo { position: sticky; left: 0; z-index: 1; order: -3; flex: none; padding-right: .7rem;
    background: linear-gradient(90deg, rgb(5, 13, 18) 82%, rgba(5, 13, 18, 0)); }
  :is(body > nav.nav, nav.site-nav):not(.nb-menu) .nav-hub { order: -2; }
  :is(body > nav.nav, nav.site-nav):not(.nb-menu) .nav-member { order: -1; }
}

/* ------------------------------------------------------------------ the Menu button and its sheet (assets/night-bar.js makes
   them and puts .nb-menu on the bar). Where the links don't fit on one line the script adds .nb-small, and the bar
   is: logo, Management Hub, My Noctis, Menu. The sheet under the bar has every link as a tile. Where the links fit,
   neither shows. */
:is(body > nav.nav, nav.site-nav) :is(.nb-toggle, .nb-sheet) { display: none; }
:is(body > nav.nav, nav.site-nav).nb-menu.nb-small > :is(.wrap, .site-wrap) { flex-wrap: nowrap; gap: 0 1.05rem; padding-block: 0; }
:is(body > nav.nav, nav.site-nav).nb-menu.nb-small > :is(.wrap, .site-wrap) > a:not(.brand-logo, .nav-hub, .nav-member) { display: none; }
:is(body > nav.nav, nav.site-nav).nb-menu.nb-small .brand-logo { flex: none; }
:is(body > nav.nav, nav.site-nav).nb-small .nb-toggle { display: inline-flex; align-items: center; gap: .5rem; flex: none; height: 2.25rem; margin: 0; padding: 0 .85rem 0 .75rem;
  border-radius: 999px; border: 1px solid rgba(140, 220, 230, .35); background: rgba(63, 227, 242, .07); color: #e6f6f8; cursor: pointer;
  font: 600 .88rem/1 "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif; letter-spacing: .01em;
  -webkit-tap-highlight-color: transparent; transition: background .15s, border-color .15s, color .15s; }
:is(body > nav.nav, nav.site-nav) .nb-toggle:hover { border-color: var(--glow, var(--cyan, #3fe3f2)); color: #fff; }
:is(body > nav.nav, nav.site-nav) .nb-toggle:focus-visible { outline: 2px solid var(--ember, var(--amber, #e8953c)); outline-offset: 3px; }
:is(body > nav.nav, nav.site-nav) .nb-toggle[aria-expanded="true"] { border-color: var(--glow, var(--cyan, #3fe3f2)); background: rgba(63, 227, 242, .16); color: #fff; }
/* three bars; a cross while the sheet is open */
:is(body > nav.nav, nav.site-nav) .nb-bars { position: relative; width: 1rem; height: .75rem; transition: transform .18s ease;
  background: linear-gradient(currentColor, currentColor) top / 100% 2px no-repeat, linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat,
              linear-gradient(currentColor, currentColor) bottom / 100% 2px no-repeat; }
:is(body > nav.nav, nav.site-nav) .nb-toggle[aria-expanded="true"] .nb-bars { background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat; transform: rotate(45deg); }
:is(body > nav.nav, nav.site-nav) .nb-toggle[aria-expanded="true"] .nb-bars::after { content: ""; position: absolute; inset: 0; transform: rotate(90deg);
  background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat; }

:is(body > nav.nav, nav.site-nav).nb-small .nb-sheet:not([hidden]) { display: grid; }
:is(body > nav.nav, nav.site-nav) .nb-sheet { position: absolute; left: 0; right: 0; top: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem;
  padding: .85rem max(1rem, env(safe-area-inset-right, 0px)) 1.1rem max(1rem, env(safe-area-inset-left, 0px));
  max-height: calc(100vh - var(--nb-h) - 1rem); max-height: calc(100dvh - var(--nb-h) - env(safe-area-inset-top, 0px));
  overflow-y: auto; overscroll-behavior: contain; background: rgb(5, 13, 18); border-top: 1px solid var(--vine, #16303b);
  border-bottom: 1px solid rgba(63, 227, 242, .35); box-shadow: 0 22px 44px rgba(0, 0, 0, .6); transition: opacity .18s ease-out, transform .18s ease-out; }
/* it drops in from just above (browsers without @starting-style show it at once) */
@starting-style { :is(body > nav.nav, nav.site-nav) .nb-sheet:not([hidden]) { opacity: 0; transform: translateY(-6px); } }
:is(body > nav.nav, nav.site-nav) .nb-sheet a { display: flex; align-items: center; gap: .55rem; min-height: 2.9rem; margin: 0; padding: .6rem .9rem;
  border-radius: 12px; border: 1px solid rgba(140, 220, 230, .16); background: rgba(140, 220, 230, .05); color: #e6f6f8;
  font-size: .95rem; line-height: 1.2; white-space: normal; text-shadow: none; }
:is(body > nav.nav, nav.site-nav) .nb-sheet a::after { display: none; }
:is(body > nav.nav, nav.site-nav) .nb-sheet a:hover { border-color: rgba(63, 227, 242, .55); color: #fff; }
:is(body > nav.nav, nav.site-nav) .nb-sheet a[aria-current="page"] { border-color: var(--glow, var(--cyan, #3fe3f2)); background: rgba(63, 227, 242, .12);
  color: var(--glow, var(--cyan, #3fe3f2)); }
:is(body > nav.nav, nav.site-nav) .nb-sheet .nav-hub { border-color: rgba(232, 149, 60, .5); background: rgba(232, 149, 60, .09); color: #ffc98f; }
:is(body > nav.nav, nav.site-nav) .nb-sheet .nav-member { border-color: rgba(63, 227, 242, .45); background: rgba(63, 227, 242, .09);
  color: var(--glow, var(--cyan, #3fe3f2)); }
:is(body > nav.nav, nav.site-nav) .nb-sheet a.discord { display: flex; align-items: center; width: auto; height: auto; padding: .6rem .9rem; border-radius: 12px;
  font-size: .95rem !important; line-height: 1.2; color: #dfe3ff; background: rgba(88, 101, 242, .16); border-color: rgba(120, 132, 250, .55); }
:is(body > nav.nav, nav.site-nav) .nb-sheet a.discord::before { content: ""; flex: none; width: 1.05rem; height: 1.05rem; background: currentColor;
  -webkit-mask: var(--nb-chat) center / contain no-repeat; mask: var(--nb-chat) center / contain no-repeat; }
@media (min-width: 34rem) { :is(body > nav.nav, nav.site-nav) .nb-sheet { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 54rem) { :is(body > nav.nav, nav.site-nav) .nb-sheet { grid-template-columns: repeat(4, minmax(0, 1fr)); padding-inline: max(2rem, env(safe-area-inset-left, 0px)); } }
/* a phone: Management Hub moves into the sheet, so the logo, My Noctis and Menu always fit */
@media (max-width: 40rem) { :is(body > nav.nav, nav.site-nav).nb-menu.nb-small > :is(.wrap, .site-wrap) > .nav-hub { display: none; } }
@media (max-width: 40rem) {
  :root { --nb-h: 3.2rem; }
  :is(body > nav.nav, nav.site-nav) .brand-logo img { height: 1.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  :is(body > nav.nav, nav.site-nav) a, :is(body > nav.nav, nav.site-nav) a::after, :is(body > nav.nav, nav.site-nav) .nb-toggle, :is(body > nav.nav, nav.site-nav) .nb-bars { transition: none; }
  :is(body > nav.nav, nav.site-nav) .nb-sheet { transition: none; }
}
@media print { :is(body > nav.nav, nav.site-nav) { position: static; } :is(body > nav.nav, nav.site-nav) :is(.nb-toggle, .nb-sheet) { display: none !important; } }
