:root {
  --nav-height: 72px;
  --nav-bg: #0f172a;
  --nav-bg-scrolled: #0f172a;
  --nav-accent: #1e40af;
  --brand-start: #0025CA;
  --brand-end: #0093CD;
  --brand-gradient: linear-gradient(90deg, var(--brand-start), var(--brand-end));
  --hover-gradient: linear-gradient(90deg, #0025CA, #00F0F0);
}

.nav-wrap {
  width: 100%;
  max-width: none;
  height: var(--nav-height);
  min-height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 48px;
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 30;
  padding: 0;
  border-radius: 0;
  background: var(--nav-bg);
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: none;
  box-sizing: border-box;
  transition: background 0.3s ease;
}

.nav-wrap *,
.nav-wrap *::before,
.nav-wrap *::after {
  box-sizing: border-box;
}

.nav-wrap a,
.nav-wrap button {
  margin: 0;
  font-family: inherit;
  line-height: 1;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.nav-wrap button {
  appearance: none;
}

.nav-wrap.scrolled {
  height: var(--nav-height);
  min-height: var(--nav-height);
  background: var(--nav-bg-scrolled);
}

.nav-wrap .logo-box {
  width: 220px;
  height: 36px;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  margin: 0 20px 0 0;
}

.nav-wrap .logo-box img {
  display: block;
  width: 100%;
  height: auto;
}

.nav-wrap .site-nav {
  display: flex;
  align-items: center;
  gap: 34px;
  margin: 0;
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
}

.nav-wrap .site-nav a {
  height: var(--nav-height);
  display: grid;
  place-items: center;
  position: relative;
  padding: 0 4px;
  color: rgba(255,255,255,.75);
  background: transparent;
  border: 0;
  border-radius: 0;
  outline: 0;
  line-height: 1;
  transition: color 0.2s ease;
}

.nav-wrap .site-nav a:hover,
.nav-wrap .site-nav a.active {
  color: #fff;
  background: transparent;
}

.nav-wrap .site-nav a::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 14px;
  width: auto;
  height: 4px;
  border-radius: 4px;
  transform: scaleX(0);
  transform-origin: center;
  background: var(--brand-gradient);
  transition: transform .22s ease;
}
.nav-wrap .site-nav a.active::after,
.nav-wrap .site-nav a:hover::after { transform: scaleX(1); }

.nav-wrap .site-auth-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.nav-wrap .auth-action {
  min-width: 78px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  border: none;
  border-radius: 999px;
  color: #fff;
  background: transparent;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  outline: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.34);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.nav-wrap .auth-action:hover,
.nav-wrap .auth-action-register:hover,
.nav-wrap .auth-action-center:hover,
.nav-wrap .auth-action-logout:hover {
  color: #0f172a;
  border: none;
  background: var(--hover-gradient);
  color: #fff;
  box-shadow: none;
}

.nav-wrap .site-search-link {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  position: relative;
  border: none;
  border-radius: 50%;
  color: #fff;
  background: rgba(255,255,255,.06);
  outline: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.nav-wrap .site-search-link:hover {
  border: none;
  background: var(--hover-gradient);
  color: #fff;
  box-shadow: none;
}

.nav-wrap .site-search-link span {
  width: 14px;
  height: 14px;
  display: block;
  position: relative;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.nav-wrap .site-search-link span::after {
  content: "";
  width: 7px;
  height: 2px;
  position: absolute;
  right: -6px;
  bottom: -3px;
  border-radius: 1px;
  background: currentColor;
  transform: rotate(45deg);
}

.nav-wrap .menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  margin-left: auto;
  position: relative;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  color: #fff;
  cursor: pointer;
  outline: 0;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.nav-wrap .menu-toggle span,
.nav-wrap .menu-toggle::before,
.nav-wrap .menu-toggle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  width: 18px;
  height: 2px;
  margin: 0;
  background: #fff;
  border-radius: 1px;
  transform: translate(-50%, -50%);
  transform-origin: center;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-wrap .menu-toggle::before { transform: translate(-50%, calc(-50% - 6px)); }
.nav-wrap .menu-toggle::after { transform: translate(-50%, calc(-50% + 6px)); }
body.menu-open .nav-wrap .menu-toggle span { opacity: 0; }
body.menu-open .nav-wrap .menu-toggle::before { transform: translate(-50%, -50%) rotate(45deg); }
body.menu-open .nav-wrap .menu-toggle::after { transform: translate(-50%, -50%) rotate(-45deg); }

@media (max-width: 1100px) {
  .nav-wrap { gap: 24px; }
  .nav-wrap .site-nav { gap: 18px; font-size: 18px; }
}

@media (min-width: 1181px) and (max-width: 1500px) {
  .nav-wrap {
    gap: 16px;
    padding-inline: 16px;
  }

  .nav-wrap .logo-box {
    width: 188px;
    margin-right: 0;
  }

  .nav-wrap .site-nav {
    gap: 12px;
    font-size: 16px;
  }

  .nav-wrap .site-auth-actions {
    gap: 8px;
  }

  .nav-wrap .auth-action {
    min-width: 0;
    height: 40px;
    padding-inline: 16px;
    font-size: 16px;
  }

  .nav-wrap .site-search-link {
    width: 38px;
    height: 38px;
  }
}

@media (min-width: 1181px) and (max-width: 1280px) {
  .nav-wrap {
    gap: 12px;
    padding-inline: 12px;
  }

  .nav-wrap .logo-box {
    width: 174px;
  }

  .nav-wrap .site-nav {
    gap: 8px;
    font-size: 15px;
  }

  .nav-wrap .site-auth-actions {
    gap: 6px;
  }

  .nav-wrap .auth-action {
    padding-inline: 10px;
    font-size: 15px;
  }

  .nav-wrap .site-search-link {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 1180px) {
  body.menu-open {
    overflow: hidden;
  }

  body.menu-open::before {
    content: "";
    position: fixed;
    inset: 60px 0 0;
    z-index: 29;
    background: rgba(2, 6, 23, .58);
  }

  .nav-wrap {
    height: auto;
    min-height: 60px;
    max-height: 60px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px 40px;
    grid-template-areas:
      "logo search toggle"
      "menu menu menu"
      "auth auth auth";
    grid-template-rows: 60px auto auto;
    align-items: center;
    justify-content: stretch;
    gap: 0 8px;
    padding: 0 16px;
    overflow: hidden;
    background: var(--nav-bg-scrolled);
    border-bottom: 1px solid rgba(255,255,255,.08);
    transition: max-height .28s cubic-bezier(.22, 1, .36, 1);
  }

  body.menu-open .nav-wrap {
    max-height: calc(100dvh - 8px);
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    box-shadow: 0 8px 8px rgba(0, 10, 42, .22);
  }

  .nav-wrap .logo-box {
    grid-area: logo;
    width: min(220px, 100%);
    height: 32px;
    margin: 0;
  }

  .nav-wrap .site-search-link {
    grid-area: search;
    width: 40px;
    height: 40px;
    margin: 0;
  }

  .nav-wrap .menu-toggle {
    grid-area: toggle;
    display: flex;
    width: 40px;
    height: 40px;
    margin: 0;
  }

  .nav-wrap .site-nav {
    grid-area: menu;
    position: static;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    margin: 0;
    padding: 8px 0 4px;
    max-height: calc(100dvh - 144px);
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px);
    color: #fff;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    transition: opacity .18s ease, transform .24s cubic-bezier(.22, 1, .36, 1), visibility .18s ease;
  }

  body.menu-open .nav-wrap .site-nav {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  .nav-wrap .site-nav a {
    min-height: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 14px;
    border: 0;
    border-radius: 6px;
    color: rgba(255,255,255,.86);
    background: transparent;
    font-size: 16px;
    font-weight: 600;
  }

  .nav-wrap .site-nav a::after {
    display: none;
  }

  .nav-wrap .site-nav a.active {
    color: #fff;
    background: rgba(37, 99, 235, .2);
  }

  .nav-wrap .site-nav a:hover,
  .nav-wrap .site-nav a:focus-visible {
    color: #fff;
    background: rgba(255,255,255,.08);
  }

  .nav-wrap .site-auth-actions {
    grid-area: auth;
    position: static;
    inset: auto;
    z-index: auto;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin: 6px 0 0;
    padding: 12px 0 0;
    border-top: 1px solid rgba(255,255,255,.12);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity .18s ease, transform .24s cubic-bezier(.22, 1, .36, 1), visibility .18s ease;
  }

  body.menu-open .nav-wrap .site-auth-actions {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  .nav-wrap .auth-action {
    min-width: 0;
    min-height: 44px;
    width: 100%;
    height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 6px;
    color: #fff;
    background: #1e40af;
    font-size: 15px;
    font-weight: 700;
    box-shadow: none;
  }

  .nav-wrap .auth-action:hover,
  .nav-wrap .auth-action:focus-visible {
    color: #fff;
    background: #2563eb;
    box-shadow: none;
  }

  .nav-wrap .auth-action-logout {
    background: #334155;
  }
}

@media (max-width: 380px) {
  .nav-wrap {
    grid-template-columns: minmax(0, 1fr) 38px 38px;
    gap: 0 6px;
    padding-inline: 12px;
  }

  .nav-wrap .logo-box {
    width: min(184px, 100%);
  }

  .nav-wrap .site-search-link,
  .nav-wrap .menu-toggle {
    width: 38px;
    height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-wrap,
  .nav-wrap .site-nav,
  .nav-wrap .site-auth-actions {
    transition: none;
  }
}
