/* ============================================================
   TOPBAR
   ============================================================ */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px var(--sp-xl);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  transition: transform 240ms ease;
}

/* Compensate for the fixed topbar so first-section content doesn't slide
   under it. Hero already subtracts this value from its min-height. */
body { padding-top: 68px; }

/* Auto-hide on scroll down, reveal on scroll up (driven by topbar.js) */
.topbar.is-hidden {
  transform: translateY(-100%);
}

.topbar__left   { display: flex; align-items: center; gap: var(--sp-2xl); }
.topbar__right  { display: flex; align-items: center; gap: 20px; }

.topbar__brand  { display: flex; align-items: center; gap: 10px; }
.topbar__logo   { height: 31px; width: auto; display: block; }
.topbar__logo-text {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-weight: var(--fw-bold);
  color: var(--color-display);
  letter-spacing: 0.04em;
}
.topbar__logo-text-accent { color: var(--color-mint); }

.topbar__nav { display: flex; gap: 28px; }

.topbar__status {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  color: var(--color-disabled);
  letter-spacing: var(--ls-meta);
  text-transform: uppercase;
}

/* ───── Hamburger button (hidden on desktop) ───── */

.topbar__menu-btn {
  display: none;
  position: relative;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
}

.topbar__menu-btn-line {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--color-display);
  transition: transform 220ms ease, opacity 180ms ease;
  transform-origin: center;
}

.topbar__menu-btn.is-open .topbar__menu-btn-line:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.topbar__menu-btn.is-open .topbar__menu-btn-line:nth-child(2) {
  opacity: 0;
}
.topbar__menu-btn.is-open .topbar__menu-btn-line:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* ───── Mobile menu panel ───── */

.topbar-mobile-menu {
  position: fixed;
  inset: 0;
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  padding: 96px var(--sp-xl) var(--sp-xl);
  gap: var(--sp-xl);
  z-index: 30;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px);
  transition: opacity 240ms ease, transform 240ms ease, visibility 240ms;
}

.topbar-mobile-menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.topbar-mobile-menu__nav {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.topbar-mobile-menu__nav .nav-link {
  font-size: 22px;
  padding: 8px 0;
  color: #036c4d;
}

.topbar-mobile-menu__actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  margin-top: auto;
}

/* ───── Mobile layout (≤ 720px) ───── */

@media (max-width: 720px) {
  body { padding-top: 60px; }

  .topbar {
    padding: 14px var(--sp-md);
  }

  .topbar__left { gap: var(--sp-md); }
  .topbar__right { gap: var(--sp-sm); }

  /* hide desktop-only items */
  .topbar__nav,
  .topbar__status,
  .topbar__right > .btn--ghost,
  .topbar__right > .btn--primary {
    display: none;
  }

  /* show hamburger */
  .topbar__menu-btn {
    display: inline-flex;
  }
}
