[data-theme="dark"] #signature {
  filter: invert(1);
}
:root {
  --bg: #ffffff;
  --fg: #0f1515;
  --border: #e5e5e5;
}

#signature {
  height: 50px;
  width: auto;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 50px;
  background: red;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  align-items: center;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 960px;
  padding: 12px 16px;
  position: relative; /* anchor the mobile menu */
}

.header-home-link {
  align-items: center;
  display: inline-flex;
  flex-shrink: 0;
}

.nav {
  align-items: center;
  display: flex;
  flex-shrink: 1;
  gap: 32px;
  font-size: 24px;
  min-width: 0;
}

.nav a {
  display: block;
  text-decoration: none;
  opacity: 0.85;
  white-space: nowrap;
}

.nav a:hover,
.nav a:focus {
  opacity: 1;
}

.nav a.active {
  text-decoration: underline;
  opacity: 1;
}

/* Push the toggle to the far right */
.theme-toggle {
  margin-left: auto;
  flex-shrink: 0;
}

/* Hamburger button (hidden on wide screens) */
.menu-button {
  display: none;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  border-radius: 8px;
  cursor: pointer;
  line-height: 1;
}

[data-theme="dark"] .menu-button-icon {
  filter: invert(1);
}

.menu-button-icon {
  border: none;
  display: block;
  height: 24px;
  width: auto;
}

@media (min-width: 651px) and (max-width: 960px) {
  #signature {
    height: 40px;
  }

  .header-inner {
    gap: 12px;
    padding: 10px 12px;
  }

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

/* Mobile layout */
@media (max-width: 650px) {
  #signature {
    height: 40px;
  }

  .header-inner {
    gap: 12px;
    padding: 10px 12px;
  }

  .menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .nav {
    display: none;
  }

  .nav.open {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    padding: 8px 16px;
    z-index: 20;
  }

  .nav.open a {
    display: block;
    padding: 10px 0;
  }
}
