/* Shared top bar styles */
.topbar-nav,
.topbar-header,
.topbar-about,
.topbar-switch,
.topbar-menu-button {
  mix-blend-mode: difference;
  color: #fff;
  position: relative;
  z-index: 2;
}

.topbar-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 1rem 1.5rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: -0.015em;
  text-transform: uppercase;
}

.topbar-header a {
  color: inherit;
  text-decoration: none;
}
.topbar-header a:hover {
  opacity: 0.7;
}

.topbar-nav {
  position: fixed;
  top: 1rem;
  left: 1.5rem;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  z-index: 3;
}
.topbar-nav a {
  color: inherit;
  text-decoration: none;
  margin-right: 1.2rem;
  transition: opacity 0.2s;
}
.topbar-nav a:hover {
  opacity: 0.6;
}

.topbar-about {
  position: fixed;
  top: 1rem;
  right: 5.2rem;
  z-index: 3;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  mix-blend-mode: difference;
  text-decoration: none;
  transition: opacity 0.2s;
}

.topbar-menu-button {
  display: none;
}

.topbar-mobile-menu {
  display: none;
}

.topbar-switch {
  position: fixed;
  top: 1rem;
  right: 1.5rem;
  z-index: 2;
  width: 40px;
  height: 20px;
  background: color-mix(in srgb, currentColor 15%, transparent);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
  transition: background 0.3s ease;
}

.topbar-knob {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: currentColor;
  transform: translateX(0);
  transition: transform 0.3s cubic-bezier(0.25, 1.5, 0.5, 1), background 0.3s ease;
}

@media (max-width: 768px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  body.topbar-menu-open {
    overflow: hidden;
  }

  .topbar-header {
    position: fixed;
    top: calc(var(--topbar-visual-offset, 0px) + env(safe-area-inset-top));
    left: 3.25rem;
    width: calc(100% - 7.25rem);
    z-index: 10010;
    font-size: 0.8rem;
    padding: 0.6rem 0;
    overflow: hidden;
    white-space: nowrap;
  }

  .topbar-nav {
    display: none;
  }

  .topbar-menu-button {
    position: fixed;
    top: calc(var(--topbar-visual-offset, 0px) + env(safe-area-inset-top) + 0.62rem);
    left: 1rem;
    z-index: 10010;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.28rem;
    width: 1.5rem;
    height: 1.2rem;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
  }

  .topbar-menu-button span {
    display: block;
    width: 100%;
    height: 1px;
    background: currentColor;
    transition: transform 0.2s ease;
  }

  .topbar-menu-button[aria-expanded="true"] span:first-child {
    transform: translateY(0.145rem) rotate(45deg);
  }

  .topbar-menu-button[aria-expanded="true"] span:last-child {
    transform: translateY(-0.145rem) rotate(-45deg);
  }

  .topbar-mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: none;
    background: #fff;
    color: #000;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  }

  .topbar-mobile-menu[aria-hidden="false"] {
    display: block;
  }

  .topbar-mobile-menu nav {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
    padding: calc(env(safe-area-inset-top) + 5rem) 1rem 1rem;
    font-size: 1.25rem;
    line-height: 1;
  }

  .topbar-mobile-menu a {
    color: inherit;
    text-decoration: none;
  }

  .topbar-mobile-menu a {
    font-size: 2.4rem;
  }

  body.dark .topbar-mobile-menu {
    background: #000;
    color: #fff;
  }

  .topbar-switch {
    position: fixed;
    right: 1rem;
    top: calc(var(--topbar-visual-offset, 0px) + env(safe-area-inset-top) + 0.58rem);
    z-index: 10010;
  }

  .topbar-about {
    display: none;
  }
}
