html { scroll-padding-top: 124px; }

.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  isolation: isolate;
  background: var(--ink);
}

.topbar::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 calc(50% - 50vw);
  border-bottom: 1px solid var(--line);
  background: var(--ink);
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 12px;
  left: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #fff;
  color: #071016;
  transform: translateY(-160%);
  transition: transform .15s ease;
}

.skip-link:focus { transform: translateY(0); }

.topbar {
  min-height: 108px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}

.brand { display: flex; align-items: center; gap: 16px; }
.brand img { width: 96px; height: auto; padding: 6px; border-radius: 8px; }
.brand-name { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.brand-sub { margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: .2em; }
.nav-wrap { display: flex; align-items: center; gap: 28px; }
.nav { display: flex; align-items: center; gap: 32px; }
.nav a { display: inline-flex; min-height: 44px; align-items: center; padding: 0 14px; border: 1px solid transparent; border-radius: 8px; color: #c6cdd3; font-size: 14px; transition: color .2s ease, border-color .2s ease; }
.nav a:hover, .nav a:focus-visible { color: var(--sky); }
.nav a.is-active { border-color: #5c6b77; color: var(--paper); }
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--paper);
  font: 500 11px/1 Consolas, "Courier New", monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, color .2s ease;
}
.nav-toggle-icon {
  display: grid;
  width: 18px;
  gap: 5px;
}
.nav-toggle-icon span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle:hover, .nav-toggle:focus-visible { border-color: #5c6b77; color: var(--sky); }
.nav-toggle[aria-expanded="true"] { border-color: var(--blue); background: var(--surface-2); color: var(--sky); }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon span:nth-child(1) { transform: translateY(3.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon span:nth-child(2) { transform: translateY(-3.5px) rotate(-45deg); }
.language-switch { display: flex; overflow: hidden; border: 1px solid #5c6b77; border-radius: 8px; }
.language-switch button { width: 44px; min-height: 44px; padding: 0; border: 0; background: transparent; color: #8f9ba5; font: 500 11px/1 Consolas, "Courier New", monospace; letter-spacing: .08em; cursor: pointer; }
.language-switch button + button { border-left: 1px solid #5c6b77; }
.language-switch button:hover, .language-switch button:focus-visible { color: var(--paper); }
.language-switch button:focus-visible { position: relative; }
.language-switch button[aria-pressed="true"] { background: var(--paper); color: var(--ink); }

@media (max-width: 1150px) {
  .nav-wrap { gap: 16px; }
  .nav { gap: 12px; }
  .nav a { padding-inline: 10px; }
  .brand-sub { display: none; }
}

@media (max-width: 1150px) {
  html { scroll-padding-top: 104px; }
  .topbar { min-height: 90px; }
  .nav-wrap { gap: 12px; }
  .nav-toggle { display: inline-flex; }
  .nav {
    counter-reset: mobile-nav;
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    display: flex;
    visibility: hidden;
    width: min(360px, 100%);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 0;
    border: 1px solid var(--line);
    background: var(--surface);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
  }
  .nav.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    transition-delay: 0s;
  }
  .nav a {
    counter-increment: mobile-nav;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 12px;
    width: 100%;
    min-height: 56px;
    align-items: center;
    padding: 0 18px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    color: var(--body, #c6cdd3);
    font-size: 15px;
  }
  .nav a:last-child { border-bottom: 0; }
  .nav a::before {
    content: "0" counter(mobile-nav);
    color: var(--muted);
    font: 400 10px/1 Consolas, "Courier New", monospace;
    letter-spacing: .08em;
  }
  .nav a::after {
    content: "";
    width: 6px;
    height: 6px;
    border-top: 1px solid currentColor;
    border-right: 1px solid currentColor;
    justify-self: end;
    transform: rotate(45deg);
  }
  .nav a:hover, .nav a:focus-visible {
    background: var(--surface-2);
    color: var(--paper);
  }
  .nav a.is-active {
    border-left: 2px solid var(--blue);
    background: var(--surface-2);
    color: var(--sky);
  }
}

@media (max-width: 600px) {
  .brand img { width: 58px; padding: 4px; }
  .brand-name { font-size: 17px; }
  .brand-sub { display: none; }
  .language-switch button { width: 44px; }
  .nav { right: 0; left: 0; width: 100%; }
}

@media (max-width: 480px) {
  .brand { gap: 0; }
  .brand > div { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .skip-link, .nav, .nav a, .nav-toggle, .nav-toggle-icon span { transition: none; }
}
