/* Sticky Nav - Desktop */
.supernav {
  position: sticky;
  top: 0;
  width: 100%;
  background-color: var(--bg-body);
  z-index: 10;
  box-shadow: var(--shadow-nav);
}

.supernav > .supercontainer {
  display: flex;
  flex-flow: row nowrap;
  justify-content: space-between;
  align-items: center;
  padding: 0 1rem;
}

/* Desktop links */
.subnav-desktop {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  gap: 0.5rem;
}

/* Mobile tab bar - hidden on desktop */
.mobile-tabbar {
  display: none;
}

/* Nav buttons (desktop) */
.supernav-button {
  background-color: transparent;
  border: none;
  text-decoration: none;
  color: var(--text-heading);
  font-weight: 600;
  font-size: 1.1rem;
  font-family: "Poppins", sans-serif;
  padding: 0.75rem 1rem;
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: color 0.3s;
  border-radius: 0.5rem;
}

.supernav-button:hover {
  color: var(--color-accent);
}

/* Active indicator line (desktop) */
.supernav-button::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  background-color: var(--color-primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.supernav-button.active::before {
  width: 60%;
}

.supernav-button:hover::before {
  width: 40%;
}

.supernav-button.active:hover::before {
  width: 60%;
}

.supernav-button.active {
  color: var(--color-accent);
}

/* Home / brand button - no underline */
#supernav-button-home {
  font-size: 1.2rem;
  font-weight: 600;
  gap: 0.5rem;
}

.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-primary);
}

#supernav-button-home::before {
  display: none;
}

/* Theme toggle button */
.theme-toggle-btn {
  background: none;
  border: none;
  color: var(--text-heading);
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  border-radius: 50%;
  transition: background-color 0.2s;
  margin-left: 0.25rem;
}

.theme-toggle-btn:hover {
  background-color: var(--bg-hover-overlay);
}

.theme-toggle-btn .icon-moon { display: none; }
[data-theme="light"] .theme-toggle-btn .icon-sun { display: none; }
[data-theme="light"] .theme-toggle-btn .icon-moon { display: block; }

/* ===== Tablet (max 1280px) ===== */
@media screen and (max-width: 1280px) {
  .supernav > .supercontainer {
    max-width: 720px;
  }
}

/* ===== Mobile (max 720px) ===== */
@media screen and (max-width: 720px) {
  /* Hide desktop nav bar */
  .supernav > .supercontainer {
    display: none;
  }

  /* Fixed bottom tab bar */
  .supernav {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    box-shadow: none;
    border-top: 1px solid var(--border-nav-mobile-top);
    background: var(--bg-nav-mobile);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    padding-bottom: env(safe-area-inset-bottom, 0.5rem);
  }

  .mobile-tabbar {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    padding: 0.5rem 0 0.35rem;
    max-width: 400px;
    margin: 0 auto;
  }

  /* Tab bar buttons */
  .tabbar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    background: none;
    border: none;
    color: var(--text-subtle);
    font-family: "Poppins", sans-serif;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    transition: color 0.2s ease;
    min-width: 3rem;
    -webkit-tap-highlight-color: transparent;
    position: relative;
  }

  .tabbar-btn svg {
    width: 24px;
    height: 24px;
    transition: color 0.2s ease, transform 0.15s ease;
  }

  .tabbar-btn.active {
    color: var(--color-accent);
  }

  .tabbar-btn.active svg {
    transform: scale(1.05);
  }

  /* Active dot indicator */
  .tabbar-btn.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--color-accent);
  }

  .tabbar-btn:active {
    transform: scale(0.92);
  }

  /* Theme toggle on mobile: float top-right */
  .theme-toggle-btn {
    position: fixed;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 11;
    background: var(--bg-nav-mobile);
    border-radius: 50%;
    padding: 0.45rem;
    box-shadow: var(--shadow-toggle-mobile);
  }

  /* Space for the fixed bottom nav + system nav */
  body {
    padding-bottom: 5.5rem;
    padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0.5rem));
  }

}
