.navbar {
  background-color: transparent; /* keep transparent so hero color shows through */
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* soften/remove the shadow so the transparent navbar looks clean over the hero */
  box-shadow: none;
  position: fixed; /* fix to viewport so it sits on top of the hero */
  left: 0;
  right: 0;
  top: 0;
  z-index: 1000; /* high enough to overlay hero and dropdowns */
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 0;
  border: 1px solid transparent;
}

.navbar.scrolled {
  background-color: var(--color-accent, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  padding: 0.75rem 2rem;

  /* Floating Pill Style */
  width: 92%;
  max-width: 1200px;
  top: 1.5rem;
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.navbar.scrolled .logo,
.navbar.scrolled .navbar-nav li a,
.navbar.scrolled .navbar-toggle {
  color: var(--color-text-inverted);
}

.navbar:not(.scrolled) .dropdown-item {
  color: var(--color-accent);
}

.navbar.scrolled .navbar-nav li a:hover {
  color: var(--color-accent-extra2-hover);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo {
  font-family: 'ClashDisplay', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-text-inverted);
  text-decoration: none;
  display: flex;
  align-items: center;
  transition: 0.5s ease;
}
.logo:hover {
  color: var(--color-accent-hover);
  text-decoration: none;
  font-size: xx-large;
}
.logo img {
  height: 2.5rem;
  margin-right: 0.5rem;
}

.navbar.scrolled .banner p,
.navbar.scrolled .banner-link {
  color: var(--color-accent);
}

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--color-text-inverted);
   padding: 0.5rem;
  line-height: 1;
  transition: color 0.3s ease;
}
.navbar-toggle:hover {
  color: var(--color-accent-hover);
}

.navbar-nav {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  width: auto;
  position: static;
  box-sizing: border-box;
}

.navbar-nav li a {
  text-decoration: none;
  color: var(--color-text-inverted);

  transition: color 0.3s ease;
  padding: 0.5rem 0;
  display: inline-block;
  position: relative;
}
.navbar-nav li a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  bottom: 0;
  background-color: var(--color-accent-extra2-hover);
  /* use transform for smoother direction control and better performance */
  transform: scaleX(0);
  transform-origin: right; /* default: collapse toward the right when hiding */
  transition: transform 0.28s cubic-bezier(0.2, 0, 0, 1);
}
.navbar-nav li a:hover {
  color: var(--color-accent-extra2-hover);
}
.navbar-nav li a:hover::after,
.navbar-nav li a:focus::after {
  transform-origin: left; /* grow left->right when this link is activated */
  transform: scaleX(1);
}

.skip-link {
  position: absolute;
  left: 0;
  top: -150px;
  background: var(--color-accent);
  color: var(--color-text-inverted);
  padding: 0.5rem 1rem;
  z-index: 1100; /* above the fixed navbar for accessibility */
  border-radius: 0 0 8px 8px;
  transition: top 0.2s;
  text-decoration: none;

}
.skip-link:focus {
  top: 0;
  outline: 2px solid #2a3628;
}

.navbar-toggle:focus,
.nav-link:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  background: rgba(52, 69, 50, 0.08);
}

/* Dropdown Menu Styles */
.dropdown {
  position: relative;
}

.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 0.5rem 0;
  list-style: none;
  margin: 0;
}

.dropdown-menu li {
  list-style: none;
  margin: 0;
  padding: 0 1rem;
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  background-color: var(--color-accent);
}

.dropdown-item {
  display: block;
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 0.95rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: rgba(42, 54, 40, 0.05);
  color: var(--color-accent);
  outline: none;
}

.dropdown-item:focus {
  box-shadow: inset 0 0 0 2px var(--color-accent);
}


/* Mobile styles */
@media (max-width: 768px) {
  /* Reset pill style when menu is open to ensure full screen overlay */
  .navbar.open {
    width: 100% !important;
    max-width: 100% !important;
    top: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
  }

  .navbar {
    padding: 1rem;
  }

  .banner {
    display: block;
    font-size: 0.8rem;
  }

  .banner p {
    font-size: 0.8rem;
  }

  .banner-link {
    font-size: 0.8rem;
  }

  .navbar-brand {
    width: auto;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    z-index: 1001; /* ensure brand elements sit above nav toggles/overlays */
  }

  .logo {
    font-size: 1.3rem;
    position: relative;
    z-index: 1001;
  }

  .navbar-toggle {
    display: block;
    z-index: 1002;
    margin-left: auto;
    position: relative;
  }

  /* Full Screen Overlay Menu */
  .navbar-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--color-accent);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    padding: 2rem;

    /* Animation state: Closed */
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    display: flex;
    opacity: 0;
    pointer-events: none; /* Prevent clicks when closed */

    box-shadow: none;
    border-radius: 0;
    box-sizing: border-box;
    z-index: 1000; /* Behind logo/toggle but above content */
  }

  .navbar.open .navbar-nav {
    transform: translateX(0);
    opacity: 1;
    pointer-events: all;
    border: none;
  }

  .navbar-nav li {
    width: 100%;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  .navbar.open .navbar-nav li {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.1s;
  }

  /* Stagger animation for items */
  .navbar.open .navbar-nav li:nth-child(1) { transition-delay: 0.1s; }
  .navbar.open .navbar-nav li:nth-child(2) { transition-delay: 0.15s; }
  .navbar.open .navbar-nav li:nth-child(3) { transition-delay: 0.2s; }
  .navbar.open .navbar-nav li:nth-child(4) { transition-delay: 0.25s; }

  .navbar-nav li a {
    display: inline-block;
    font-family: 'ClashDisplay', sans-serif;
    font-size: 2rem;
    font-weight: 600;
    color: var(--color-text-inverted);
    border-bottom: none;
    padding: 0.5rem;
    transition: color 0.2s;
  }

  .navbar-nav li a::after {
    display: none;
  }

  .navbar-nav li a:hover {
    color: var(--color-accent-extra2);
    background: none;
  }

  .navbar.scrolled .navbar-nav li a {
    color: var(--color-text-inverted); /* Always white in mobile menu */
  }

  /* Mobile Dropdown */
  .dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-top: 1rem;
    transform: none;
    opacity: 1;
    visibility: visible;
    display: none;
    width: 100%;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    padding: 0; /* Reset default padding */
  }

  .dropdown.open .dropdown-menu {
    display: block;
    padding: 0.5rem;
    background-color: rgba(255, 255, 255, 0.05);
  }

  /* Reset LI padding inside dropdown to prevent overflow */
  .navbar-nav .dropdown-menu li {
    padding: 0;
    width: 100%;
  }

  /* Increase specificity to override .navbar-nav li a */
  .navbar-nav .dropdown-menu li a.dropdown-item {
    display: block;
    padding: 0.5rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
    width: 100%;
    font-weight: 400;
  }

  .navbar-nav .dropdown-menu li a.dropdown-item:last-child {
    border-bottom: none;
  }

  .dropdown-item:last-child {
    border-bottom: none;
  }

  .navbar:not(.scrolled) .dropdown-item {
    color: rgba(255, 255, 255, 0.8);
  }
}
