/* Admin top bar: a full-width band across the viewport with its contents
   aligned to the same container as the page below. Rendered by
   partials/head.ejs on every page, so individual views carry no navigation. */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--border);
  /* Falls back to the flat surface colour where backdrop-filter is unsupported. */
  backdrop-filter: saturate(140%) blur(8px);
}

.topbar-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 20px;
}

/* The brand doubles as the link home once signed in. */
.topbar .brand {
  margin-bottom: 0;
  gap: 9px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

/* A hairline between the brand and the section links, so the two clusters read
   as separate things rather than one long row of text. */
.topbar .brand-sub {
  padding-left: 9px;
  border-left: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  /* The links never wrap onto a second line; a cramped bar scrolls instead. */
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar {
  display: none;
}

.nav-link {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.12s ease, background-color 0.12s ease;
}
.nav-link:hover {
  color: var(--text);
  background: var(--surface-2);
}

/* Current section, marked by a filled pill so it stays legible without relying
   on colour alone. */
.nav-link.is-active {
  color: var(--text);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border);
}

.nav-account {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

/* The signed-in address, shown as a quiet chip so it doesn't compete with the
   section links. */
.nav-email {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-dim);
  max-width: 26ch;
  overflow: hidden;
  white-space: nowrap;
}

.nav-avatar {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
  text-transform: uppercase;
}

.nav-email-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-account form {
  display: flex;
}

/* The bar's own button sits tighter than the page-level default. */
.nav-account .btn {
  padding: 7px 14px;
  font-size: 13px;
}

/* Narrow screens: the links drop onto their own scrollable row under the brand,
   and the bar stops sticking so a small viewport isn't mostly chrome. */
@media (max-width: 720px) {
  .topbar {
    position: static;
  }
  .topbar-inner {
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .nav {
    order: 3;
    flex-basis: 100%;
    /* Full-bleed scroll strip: the row spans the gutters so a link scrolled to
       the edge isn't clipped mid-word. */
    margin: 0 calc(var(--gutter) * -1);
    padding: 0 var(--gutter);
  }
  .nav-email {
    max-width: none;
  }
  .nav-email-text {
    display: none;
  }
}
