/* Approved Stanza Labs lockup: original vector symbol and outlined STIX Two Text wordmark.
   Cropped SVG viewBox keeps artwork crisp and eliminates extra padding.
   Invert its transparent black artwork for the existing dark portal theme. */
.site-header .brand-lockup {
  flex: 0 0 auto;
  max-width: 100%;
  min-height: 44px;
  gap: 0;
  line-height: 0;
}
.site-header .brand-logo {
  display: block;
  width: 210px;
  max-width: 100%;
  height: auto;
  filter: invert(1);
}

/* Desktop: keep the established single-row layout; group the account actions. */
.site-header.site-header--authenticated nav {
  margin-left: auto;
}
.site-header .site-account-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 14px;
}
.site-header .site-account-actions .nav-divider {
  flex: 0 0 1px;
}

/* On narrower screens the three navigation pills cannot share a row with
   a full-size lockup and account controls. Use two deliberate grid rows
   instead of competing flex-wrap / fixed-height rules in earlier layers. */
@media (max-width: 980px) {
  .site-header { height: auto; }

  .site-header.site-header--authenticated {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    height: auto;
    min-height: 0;
    padding-top: 12px;
    padding-bottom: 14px;
    gap: 12px;
  }
  .site-header.site-header--authenticated .brand-lockup {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    min-width: 0;
  }
  .site-header.site-header--authenticated .site-account-actions {
    grid-column: 2;
    grid-row: 1;
    gap: 10px;
  }
  .site-header.site-header--authenticated .nav-divider {
    display: none;
  }
  .site-header.site-header--authenticated nav {
    display: block;
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    margin: 0;
  }
  .site-header.site-header--authenticated .site-nav-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch; /* Keep wrapped admin labels and shorter pills equal-height. */
    gap: 8px;
    width: 100%;
    max-width: 660px;
  }
  .site-header.site-header--authenticated .site-nav-actions:not(:has(.nav-button:nth-child(3))) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .site-header.site-header--authenticated .nav-button {
    min-width: 0;
    min-height: 40px;
    padding: 7px 9px;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
  }
}

/* The tagline is supplementary: drop it before it can squeeze the
   public header at tablet sizes. Contact and Log in stay visible. */
@media (max-width: 900px) {
  .site-header:not(.site-header--authenticated) .nav-mono {
    display: none;
  }
}

@media (max-width: 700px) {
  .site-header .brand-logo { width: clamp(140px, 37vw, 184px); }

  /* Override older wrap rules that pushed public navigation off-center. */
  .site-header:not(.site-header--authenticated) {
    height: auto;
    min-height: 72px;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
  }
  .site-header:not(.site-header--authenticated) nav {
    display: flex;
    flex-wrap: nowrap;
    flex: 0 0 auto;
    gap: 10px;
    margin-left: auto;
  }
  .site-header:not(.site-header--authenticated) .nav-text {
    max-width: none;
    white-space: nowrap;
  }
  .site-header:not(.site-header--authenticated) .pill-small {
    gap: 10px;
    padding: 0 13px;
  }
}

/* Very narrow devices get a deliberate two-line public header rather than
   an overflowing logo/button collision. */
@media (max-width: 350px) {
  .site-header:not(.site-header--authenticated) {
    flex-wrap: wrap;
  }
  .site-header:not(.site-header--authenticated) nav {
    width: 100%;
    justify-content: flex-end;
  }
}
