/**
 * TrueNodes community top chrome — editorial / product-feel (not marketing SaaS chrome).
 * Design: hairline + solid surface, left-weighted brand, quiet text links, avatar-first account.
 * Tokens only (--tl-*). Pair with tl-truenodes-nav.js.
 * [2026-07-19 / Cursor] Refine: remove AI-generic glass / teal pills / centered icon rail.
 */

body.tl-tn-chrome {
  padding-top: 56px !important;
}

/* [2026-07-19 / Cursor] TrueNodes app chrome — never show main-site marketing footer */
body.tl-tn-chrome #tl-global-footer {
  display: none !important;
}

#tl-tn-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 220;
  height: 56px;
  background: var(--tl-bg-elevated);
  border-bottom: 1px solid var(--tl-border-subtle, var(--tl-border));
}

#tl-tn-topbar .tn-bar-inner {
  max-width: 1240px;
  margin: 0 auto;
  height: 56px;
  padding: 0 var(--tl-space-5);
  display: flex;
  align-items: center;
  gap: var(--tl-space-6);
}

/* ── Brand (left weight · wordmark is the hero signal) ── */
#tl-tn-topbar .tn-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--tl-text);
  flex: none;
  min-height: 44px;
}
#tl-tn-topbar .tn-brand:focus-visible {
  outline: var(--tl-ring-width, 2px) solid var(--tl-ring);
  outline-offset: var(--tl-ring-offset, 2px);
  border-radius: var(--tl-radius-sm);
}
#tl-tn-topbar .tn-brand-mark {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex: none;
  opacity: 0.95;
}
#tl-tn-topbar .tn-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.05;
  min-width: 0;
}
#tl-tn-topbar .tn-brand-name {
  font-family: var(--tl-font-sans);
  font-weight: var(--tl-weight-black, 900);
  font-size: 15px;
  letter-spacing: -0.03em;
  color: var(--tl-text);
  white-space: nowrap;
}
#tl-tn-topbar .tn-brand-sub {
  font-size: 11px;
  font-weight: var(--tl-weight-medium, 600);
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--tl-text-subtle, var(--tl-text-muted));
  white-space: nowrap;
}

/* ── Primary links: text-first, left of center, hairline active ── */
#tl-tn-topbar .tn-links {
  display: flex;
  align-items: stretch;
  gap: var(--tl-space-1);
  min-width: 0;
  flex: 1;
  justify-content: flex-start;
  height: 100%;
}
#tl-tn-topbar .tn-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0;
  min-height: 100%;
  padding: 0 var(--tl-space-3);
  border-radius: 0;
  color: var(--tl-text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: var(--tl-weight-medium, 600);
  letter-spacing: -0.01em;
  white-space: nowrap;
  background: transparent;
  transition: color 160ms ease;
}
#tl-tn-topbar .tn-link i {
  display: none; /* desktop: text only — icons live in mobile panel */
}
#tl-tn-topbar .tn-link:hover {
  color: var(--tl-text);
  background: transparent;
}
#tl-tn-topbar .tn-link.is-active {
  color: var(--tl-text);
  background: transparent;
}
#tl-tn-topbar .tn-link.is-active::after {
  content: '';
  position: absolute;
  left: var(--tl-space-3);
  right: var(--tl-space-3);
  bottom: 0;
  height: 2px;
  background: var(--tl-line-nodes);
  border-radius: 1px 1px 0 0;
}
#tl-tn-topbar .tn-link:focus-visible {
  outline: var(--tl-ring-width, 2px) solid var(--tl-ring);
  outline-offset: -4px;
  border-radius: var(--tl-radius-sm);
}

/* ── Right cluster ── */
#tl-tn-topbar .tn-right {
  display: flex;
  align-items: center;
  gap: var(--tl-space-3);
  margin-left: auto;
  flex: none;
}

#tl-tn-topbar .tn-account {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--tl-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: var(--tl-weight-medium, 600);
  letter-spacing: -0.01em;
  max-width: 180px;
}
#tl-tn-topbar .tn-account:hover .tn-account-label {
  color: var(--tl-text);
}
#tl-tn-topbar .tn-account:hover .tn-avatar {
  box-shadow: 0 0 0 1px var(--tl-line-nodes-border);
}
#tl-tn-topbar .tn-account:focus-visible {
  outline: var(--tl-ring-width, 2px) solid var(--tl-ring);
  outline-offset: 3px;
  border-radius: var(--tl-radius-sm);
}
#tl-tn-topbar .tn-avatar {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: var(--tl-radius-full);
  background: var(--tl-bg-elevated-2, var(--tl-bg-inset));
  color: var(--tl-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  flex: none;
  font-size: 11px;
  border: 1px solid var(--tl-border-subtle, var(--tl-border));
}
#tl-tn-topbar .tn-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--tl-radius-full);
  display: block;
}
#tl-tn-topbar .tn-avatar-status {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 9px;
  height: 9px;
  border-radius: var(--tl-radius-full);
  border: 2px solid var(--tl-bg-elevated);
  background: var(--tl-text-subtle);
}
#tl-tn-topbar .tn-avatar-status.is-ok {
  background: var(--tl-success);
}
#tl-tn-topbar .tn-avatar-status.is-need {
  background: var(--tl-gold);
}
#tl-tn-topbar .tn-account-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  color: var(--tl-text-muted);
  transition: color 160ms ease;
}

/* Quiet login — not a loud CTA pill */
#tl-tn-topbar .tn-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--tl-border);
  border-radius: var(--tl-radius-sm);
  background: transparent;
  color: var(--tl-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: var(--tl-weight-medium, 600);
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: border-color 160ms ease, background 160ms ease;
}
#tl-tn-topbar .tn-login:hover {
  border-color: var(--tl-border-strong, var(--tl-border));
  background: var(--tl-bg-elevated-2, var(--tl-bg-inset));
}
#tl-tn-topbar .tn-login:focus-visible {
  outline: var(--tl-ring-width, 2px) solid var(--tl-ring);
  outline-offset: 2px;
}
#tl-tn-topbar .tn-login i {
  display: none;
}

#tl-tn-topbar .tn-burger {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: var(--tl-radius-sm);
  background: transparent;
  color: var(--tl-text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex: none;
}
#tl-tn-topbar .tn-burger:hover {
  background: var(--tl-bg-elevated-2, var(--tl-bg-inset));
}
#tl-tn-topbar .tn-burger:focus-visible {
  outline: var(--tl-ring-width, 2px) solid var(--tl-ring);
  outline-offset: 2px;
}

/* ── Mobile panel ── */
#tl-tn-panel {
  display: none;
  border-top: 1px solid var(--tl-border-subtle, var(--tl-border));
  background: var(--tl-bg-elevated);
  padding: var(--tl-space-2) var(--tl-space-4) var(--tl-space-4);
}
#tl-tn-panel.is-open {
  display: block;
}
#tl-tn-panel .tn-panel-link {
  display: flex;
  align-items: center;
  gap: var(--tl-space-3);
  min-height: 48px;
  padding: 0 var(--tl-space-2);
  border-radius: var(--tl-radius-sm);
  color: var(--tl-text-muted);
  text-decoration: none;
  font-weight: var(--tl-weight-medium, 600);
  font-size: var(--tl-text-base);
  letter-spacing: -0.01em;
}
#tl-tn-panel .tn-panel-link i {
  color: var(--tl-text-subtle, var(--tl-text-muted));
  width: 18px;
  text-align: center;
  font-size: 0.9em;
}
#tl-tn-panel .tn-panel-link:hover {
  color: var(--tl-text);
  background: var(--tl-bg-elevated-2, var(--tl-bg-inset));
}
#tl-tn-panel .tn-panel-link.is-active {
  color: var(--tl-text);
  background: transparent;
  box-shadow: inset 2px 0 0 var(--tl-line-nodes);
}
#tl-tn-panel .tn-panel-link.is-active i {
  color: var(--tl-line-nodes);
}
#tl-tn-panel .tn-panel-link:focus-visible {
  outline: var(--tl-ring-width, 2px) solid var(--tl-ring);
  outline-offset: -2px;
}

body.tl-tn-chrome .rail-left,
body.tl-tn-chrome .rail-right {
  top: 72px;
}

@media (max-width: 900px) {
  #tl-tn-topbar .tn-bar-inner {
    gap: var(--tl-space-3);
    padding: 0 var(--tl-space-4);
  }
  #tl-tn-topbar .tn-links {
    display: none;
  }
  #tl-tn-topbar .tn-burger {
    display: inline-flex;
  }
  #tl-tn-topbar .tn-account-label {
    display: none;
  }
  #tl-tn-topbar .tn-brand-sub {
    display: none;
  }
}

@media (max-width: 420px) {
  #tl-tn-topbar .tn-bar-inner {
    padding: 0 var(--tl-space-3);
  }
}

@media (prefers-reduced-motion: reduce) {
  #tl-tn-topbar .tn-link,
  #tl-tn-topbar .tn-login,
  #tl-tn-topbar .tn-account-label {
    transition: none;
  }
}
