/* Translate-01B: canonical navigation contract for legacy static header variants. */
.nw-header-contract.topbar {
  box-sizing: border-box;
  height: 76px;
  min-height: 76px;
}

.nw-header-contract .desktop-nav.nw-canonical-nav {
  display: none;
  align-items: center;
  gap: 2px;
  margin-left: 22px;
}

.nw-header-contract .desktop-nav.nw-canonical-nav a {
  min-height: 42px;
  padding: 0 11px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #9d9ba7;
  background: transparent;
  font-size: .84rem;
  font-weight: 650;
  white-space: nowrap;
}

.nw-header-contract .desktop-nav.nw-canonical-nav svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.nw-header-contract .desktop-nav.nw-canonical-nav a:hover,
.nw-header-contract .desktop-nav.nw-canonical-nav a.active {
  color: #f5f4f8;
  background: rgba(139, 108, 246, .14);
}

.nw-header-contract .desktop-nav.nw-canonical-nav a.active {
  box-shadow: inset 0 -2px #8b6cf6;
}

.nw-header-contract + main,
.nw-header-contract ~ main { min-width: 0; }

.bottom-nav.nw-canonical-nav {
  grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
}

/* Auth Gating 02: private navigation is absent until a real session is verified. */
html:not([data-nioret-auth="authenticated"]) .desktop-nav a[href*="messages"],
html:not([data-nioret-auth="authenticated"]) .bottom-nav a[href*="messages"] {
  display: none !important;
}

html:not([data-nioret-auth="authenticated"]) .bottom-nav {
  grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
}

.bottom-nav.nw-canonical-nav a {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.bottom-nav.nw-canonical-nav a span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: clip;
}

@media (max-width: 359px) {
  .nw-home .activity { min-width: 0; }
  .nw-notifications .layout > * { min-width: 0; }
}

@media (min-width: 900px) {
  .nw-header-contract .desktop-nav.nw-canonical-nav { display: flex; }
}

@media (min-width: 900px) and (max-width: 1180px) {
  .nw-header-contract .desktop-nav.nw-canonical-nav {
    margin-left: 12px;
    gap: 0;
  }
  .nw-header-contract .desktop-nav.nw-canonical-nav a {
    min-height: 40px;
    padding-inline: 5px;
    gap: 4px;
    font-size: .72rem;
  }
  .nw-header-contract .desktop-nav.nw-canonical-nav svg {
    width: 15px;
    height: 15px;
  }
}

@media (max-width: 899px) {
  .nw-header-contract.topbar {
    height: 72px;
    min-height: 72px;
  }
  .bottom-nav.nw-canonical-nav a { font-size: clamp(.48rem, 1.9vw, .58rem); }
  .bottom-nav.nw-canonical-nav svg { width: 17px; height: 17px; }
}

/* Launch polish: one accessible, shape-following focus treatment on every suite surface. */
a[href]:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible,
[role="combobox"]:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
  outline: 2px solid #a992ff;
  outline-offset: 3px;
}

/* Composite Search owns the ring; its borderless text input keeps real focus without a second box. */
.nw-home .search-field:focus-within,
.nw-communities .search:focus-within,
.nw-messages .search:focus-within {
  outline: 2px solid #a992ff;
  outline-offset: 3px;
}

.nw-home .search-field > input:focus-visible,
.nw-communities .search > input:focus-visible,
.nw-messages .search > input:focus-visible {
  outline: none;
}

/* World Question uses the same composite-control contract for its borderless answer field. */
#composer:focus-within {
  outline: 2px solid #a992ff;
  outline-offset: 3px;
}

#composer > #answer:focus-visible {
  outline: none;
}

/* Legacy Settings fields supplied their own second halo; retain the canonical single outline only. */
.field > input:focus-visible,
.field > textarea:focus-visible,
.field > select:focus-visible {
  box-shadow: none;
}

/* Auth UX Signout 01: the accepted identity pill owns a compact, non-shifting account menu. */
.nw-header-contract .nw-identity-actions {
  position: relative;
}

.nw-header-contract .nw-identity-trigger {
  appearance: none;
  color: inherit;
  font: inherit;
  text-align: left;
}

.nw-header-contract .nw-identity-menu {
  box-sizing: border-box;
  position: absolute;
  z-index: 140;
  top: calc(100% + 10px);
  right: 0;
  width: 196px;
  max-width: calc(100vw - 24px);
  padding: 6px;
  border: 1px solid #292832;
  border-radius: 16px;
  background: #111116;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .42);
}

.nw-header-contract .nw-identity-menu[hidden] {
  display: none;
}

.nw-header-contract .nw-identity-menu [role="menuitem"] {
  box-sizing: border-box;
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  color: #d7d5dd;
  background: transparent;
  font: inherit;
  font-size: .84rem;
  font-weight: 650;
  line-height: 1;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.nw-header-contract .nw-identity-menu [role="menuitem"]:hover,
.nw-header-contract .nw-identity-menu [role="menuitem"]:focus-visible {
  color: #f5f4f8;
  background: rgba(139, 108, 246, .14);
}

.nw-header-contract .nw-identity-menu [data-nw-sign-out] {
  margin-top: 5px;
  border-top: 1px solid #292832;
  border-radius: 0 0 10px 10px;
}

.nw-header-contract .nw-identity-menu [data-nw-sign-out]:disabled {
  cursor: wait;
  opacity: .64;
}

.nw-header-contract .nw-identity-menu-status {
  margin: 0;
  padding: 0 12px;
  color: #d9ceff;
  font-size: .72rem;
  line-height: 1.4;
}

.nw-header-contract .nw-identity-menu-status:not(:empty) {
  padding-block: 8px 6px;
}

/* Shared participation prompt. It reuses the established Nioret auth-sheet language. */
.nw-auth-gate-sheet {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  background: rgba(3, 2, 6, .76);
  backdrop-filter: blur(10px);
}

.nw-auth-gate-sheet[hidden] { display: none; }

.nw-auth-gate-card {
  box-sizing: border-box;
  width: min(100%, 470px);
  padding: 19px 16px calc(18px + env(safe-area-inset-bottom));
  border: 1px solid #292832;
  border-radius: 24px 24px 0 0;
  color: #f5f4f8;
  background: #12101a;
  box-shadow: 0 -24px 60px rgba(0, 0, 0, .4);
}

.nw-auth-gate-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.nw-auth-gate-head span {
  color: #a992ff;
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .14em;
}

.nw-auth-gate-head h2 {
  margin: 6px 0 0;
  font-size: 1.45rem;
  line-height: 1.1;
}

.nw-auth-gate-head button {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 1px solid #292832;
  border-radius: 10px;
  color: #d7d5dd;
  background: rgba(255, 255, 255, .03);
  font: inherit;
  font-size: 1.2rem;
  cursor: pointer;
}

.nw-auth-gate-card > p {
  margin: 14px 0 0;
  color: #aaa7b2;
  font-size: .9rem;
  line-height: 1.55;
}

.nw-auth-gate-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 18px;
}

.nw-auth-gate-actions a {
  min-height: 45px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .84rem;
  font-weight: 800;
  text-decoration: none;
}

.nw-auth-gate-primary {
  border: 1px solid #8b6cf6;
  color: #fff;
  background: #8b6cf6;
}

.nw-auth-gate-primary:hover { background: #a992ff; }

.nw-auth-gate-secondary {
  border: 1px solid #3a3944;
  color: #e1dfe6;
  background: #17171d;
}

.nw-auth-gate-secondary:hover {
  border-color: #5d4d83;
  color: #fff;
}

.nw-messages-route-gate {
  width: min(100% - 28px, 680px);
  margin: clamp(40px, 10vh, 96px) auto;
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid #292832;
  border-radius: 26px;
  color: #f5f4f8;
  background: #111116;
  text-align: center;
}

.nw-messages-route-gate h1 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
}

.nw-messages-route-gate p {
  max-width: 520px;
  margin: 12px auto 0;
  color: #aaa7b2;
  font-size: .95rem;
  line-height: 1.55;
}

.nw-messages-route-gate .nw-auth-gate-actions {
  width: min(100%, 360px);
  margin-inline: auto;
}

@media (min-width: 700px) {
  .nw-auth-gate-sheet { align-items: center; }
  .nw-auth-gate-card { border-radius: 24px; }
}

@media (max-width: 380px) {
  .nw-auth-gate-actions { grid-template-columns: 1fr; }
}
