.site-header {
  position: sticky;
  top: 14px;
  z-index: 1050;
  margin-bottom: 6px;
}

.tg-navbar {
  padding: 14px 18px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 249, 255, 0.86)),
    var(--card-strong);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.tg-navbar .container {
  padding: 0;
}

.tg-navbar__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex: 0 0 auto;
}

.tg-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-right: 0;
}

.tg-brand-copy {
  display: grid;
  gap: 2px;
}

.tg-brand-text {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}

.tg-brand-sub {
  color: var(--text-dim);
  font-size: 0.84rem;
  line-height: 1.15;
}

.tg-navbar .navbar-collapse {
  align-items: center;
}

.tg-navbar .navbar-nav {
  gap: 0.2rem;
}

.tg-navlink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 500;
  color: var(--text) !important;
  opacity: 0.88;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.tg-navlink:hover,
.tg-navlink:focus,
.tg-navlink.dropdown-toggle.show,
.tg-navbar .tg-navlink.active {
  color: var(--text) !important;
  opacity: 1;
  border-color: rgba(37, 99, 235, 0.18);
  background: rgba(37, 99, 235, 0.08);
}

.tg-dropdown {
  min-width: 220px;
  margin-top: 12px;
  padding: 10px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 249, 255, 0.94)),
    var(--card-strong);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.tg-dropdown .dropdown-divider {
  border-top-color: var(--border);
}

.tg-dropdown .dropdown-item {
  min-height: 44px;
  display: flex;
  align-items: center;
  border-radius: 14px;
  padding: 10px 14px;
  color: var(--text);
  font-weight: 600;
}

.tg-dropdown .dropdown-item:hover,
.tg-dropdown .dropdown-item:focus,
.tg-dropdown .dropdown-item.active {
  background: rgba(37, 99, 235, 0.08);
  color: var(--text) !important;
}

.pub-nav-controls {
  display: flex;
  align-items: center;
}

.pub-nav-controls-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle-btn {
  width: 46px;
  min-width: 46px;
  height: 46px;
  border-radius: 16px;
  border: 1px solid var(--border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.theme-toggle-btn:hover,
.theme-toggle-btn:focus {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.24);
  background: rgba(37, 99, 235, 0.08);
}

.tg-toggler {
  display: none;
  width: 48px;
  min-width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 16px;
  border: 1px solid var(--border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.tg-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.14);
}

.tg-toggler-icon {
  width: 18px;
  height: 14px;
  display: inline-grid;
  gap: 4px;
  justify-items: center;
  align-content: center;
  margin: 0 auto;
}

.tg-toggler-icon span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  justify-self: center;
}

html[data-bs-theme="dark"] .tg-navbar {
  background:
    linear-gradient(180deg, rgba(16, 22, 19, 0.94), rgba(12, 17, 14, 0.92)),
    var(--card-strong);
}

html[data-bs-theme="dark"] .tg-navlink:hover,
html[data-bs-theme="dark"] .tg-navlink:focus,
html[data-bs-theme="dark"] .tg-navlink.dropdown-toggle.show,
html[data-bs-theme="dark"] .tg-navbar .tg-navlink.active {
  border-color: rgba(77, 134, 255, 0.22);
  background: rgba(77, 134, 255, 0.14);
}

html[data-bs-theme="dark"] .tg-dropdown {
  background:
    linear-gradient(180deg, rgba(18, 24, 21, 0.98), rgba(12, 17, 14, 0.96)),
    var(--card-strong);
}

html[data-bs-theme="dark"] .tg-dropdown .dropdown-item:hover,
html[data-bs-theme="dark"] .tg-dropdown .dropdown-item:focus,
html[data-bs-theme="dark"] .tg-dropdown .dropdown-item.active {
  background: rgba(77, 134, 255, 0.14);
}

html[data-bs-theme="dark"] .theme-toggle-btn,
html[data-bs-theme="dark"] .tg-toggler {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
}

html[data-bs-theme="dark"] .theme-toggle-btn:hover,
html[data-bs-theme="dark"] .theme-toggle-btn:focus,
html[data-bs-theme="dark"] .tg-toggler:hover,
html[data-bs-theme="dark"] .tg-toggler[aria-expanded="true"] {
  border-color: rgba(77, 134, 255, 0.28);
  background: rgba(77, 134, 255, 0.16);
}

@media (max-width: 991.98px) {
  .tg-navbar {
    padding: 14px 16px 16px;
  }

  .tg-navbar__bar {
    flex: 1 0 100%;
    width: 100%;
  }

  .tg-brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .tg-brand-copy {
    min-width: 0;
  }

  .tg-toggler {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    flex: 0 0 auto;
  }

  .tg-navbar .navbar-collapse {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
  }

  .tg-navbar .navbar-nav {
    gap: 0.45rem;
  }

  .tg-navlink {
    width: 100%;
    justify-content: flex-start;
    border-radius: 18px;
  }

  .tg-dropdown {
    margin-top: 8px;
  }

  .pub-nav-controls {
    width: 100%;
    margin-top: 4px;
  }

  .pub-nav-controls-row {
    display: grid;
    grid-template-columns: 46px repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .pub-nav-controls-row .btn {
    width: 100%;
  }
}

@media (max-width: 575.98px) {
  .site-header {
    top: 8px;
  }

  .tg-navbar {
    padding: 12px 14px 14px;
    border-radius: 24px;
  }

  .tg-brand {
    gap: 12px;
  }

  .tg-brand-text {
    font-size: 1rem;
  }

  .tg-brand-sub {
    font-size: 0.79rem;
  }

  .pub-nav-controls-row {
    grid-template-columns: 1fr;
  }

  .theme-toggle-btn {
    width: 100%;
  }
}
