/* The one menu bar for the whole site, drawn by js/site-header.js.
   Everything here is self-contained so the bar looks identical on every page. */

html {
  /* Keep "#resources"-style jumps from hiding under the bar */
  scroll-padding-top: calc(var(--site-header-h, 70px) + 1rem);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  /* Dark, slightly see-through bar so the night sky shows through it */
  background: rgba(7, 11, 31, 0.78);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  color: #f1eefa;
  font-family: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: normal;
}

/* On a phone the bar wraps onto several lines, so it would cover too much of
   the screen if it stayed put: let it scroll away with the page instead. */
@media (max-width: 700px) {
  .site-header {
    position: relative;
  }
  html {
    scroll-padding-top: 1rem;
  }
}

.site-header-inner {
  max-width: 66rem;
  margin: 0 auto;
  padding: 11px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}

/* Signed in, the menu is longer: give it more room */
.signed-in .site-header-inner {
  max-width: 1280px;
}

.site-header .site-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.site-header .brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #f1eefa;
}

.site-header .brand-link img {
  height: 44px;
  width: auto;
  display: block;
  border-radius: 6px;
}

.site-header .brand {
  font-family: Georgia, "Iowan Old Style", serif;
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.2;
}

/* Signed-in email, tucked under the site name */
.site-header .session-email {
  font-size: 13px;
  color: #c3bfdc;
  padding-left: 54px;
  margin-top: -6px;
  overflow-wrap: anywhere;
}

.site-header .session-email:empty {
  display: none;
}

.site-header nav {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
}

.site-header nav a {
  display: inline-block;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  color: #f1eefa;
  text-decoration: none;
  font-size: 1rem;
}

.signed-in .site-header nav a {
  padding-left: 0.7rem;
  padding-right: 0.7rem;
}

.site-header nav a:hover {
  background: rgba(199, 168, 227, 0.18);
  color: #fff;
}

.site-header nav a[aria-current="page"] {
  background: rgba(199, 168, 227, 0.26);
  font-weight: 700;
}

.site-header nav a:focus-visible {
  outline: 3px solid #7ab8ff;
  outline-offset: 3px;
}

.site-header nav a.login {
  border: 2px solid #c7a8e3;
  font-weight: 700;
  padding: 0.4rem 0.85rem;
}

/* ---- Pull-down menus (Explore, Members, Admin) ---- */
.site-header .nav-menu {
  position: relative;
}

.site-header .nav-menu-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0.5rem 0.85rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #f1eefa;
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
  cursor: pointer;
}

.site-header .nav-menu-button:hover,
.site-header .nav-menu-button[aria-expanded="true"] {
  background: rgba(199, 168, 227, 0.18);
  color: #fff;
}

/* The menu holding the page you're on */
.site-header .nav-menu-button.is-current {
  background: rgba(199, 168, 227, 0.26);
  font-weight: 700;
}

.site-header .nav-menu-button:focus-visible {
  outline: 3px solid #7ab8ff;
  outline-offset: 3px;
}

.site-header .caret {
  width: 12px;
  height: 12px;
  transition: transform 0.15s;
}

.site-header .nav-menu-button[aria-expanded="true"] .caret {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  .site-header .caret { transition: none; }
}

.site-header .nav-menu-list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #0d1230;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
  z-index: 110;
}

.site-header .nav-menu-list[hidden] {
  display: none;
}

.site-header .nav-menu-list a {
  display: block;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  white-space: nowrap;
}

/* Admin menu sits at the far right after a thin divider */
.site-header .nav-admin-group {
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.22);
}

@media print {
  .site-header {
    display: none;
  }
}
