/* top nav bar (includes/header.php) - logo, menu links, cart icon, hamburger.
   mobile menu open/close logic is in assets/js/nav.js */

.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1.25rem;
  gap: 1rem;
}

.logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--color-primary-dark);
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: .3rem;
  flex-wrap: wrap;
}

.primary-nav ul {
  display: flex;
  gap: .2rem;
  align-items: center;
  flex-wrap: wrap;
}

/* grey pill highlight on hover. the active page link (class added by
   header.php) gets a solid filled pill instead -- kept grey/black not
   the accent color so it doesn't compete with the accent buttons */
.primary-nav a {
  display: inline-block;
  padding: .5rem .9rem;
  border-radius: 999px;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition);
}

.primary-nav a:hover {
  background: rgba(0, 0, 0, .05);
  color: var(--color-primary-dark);
}

.primary-nav a.active {
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
}

/* .btn-nav (sign up button) is inside .primary-nav too, so the hover
   rules above would leak onto it otherwise -- primary-nav a:hover would
   swap the copper bg for a near-white tint and the white text would
   basically vanish. same specificity as those rules, so this only wins
   because it's written after them in the file */
.primary-nav a.btn-nav,
.primary-nav a.btn-nav:hover {
  color: #fff;
  background: var(--color-accent-dark);
}

.primary-nav a.btn-nav:hover {
  background: var(--color-primary-dark);
}

.nav-utility {
  border-left: 1px solid var(--color-border);
  padding-left: 1rem;
  margin-left: .5rem;
}

.cart-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

/* little number bubble on the cart icon -- position: relative on
   .cart-link above anchors this to the icon, not the whole nav bar.
   using --color-primary-dark not --color-accent bc accent is pure white
   in the White theme (white text on a white circle = invisible) */
.cart-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-dark);
  color: #fff;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: var(--shadow-sm);
}

/* hamburger menu button, hidden until screen gets narrow - see media query below */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: .4rem;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--color-primary-dark);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* small screens: nav becomes a dropdown */
@media (max-width: 760px) {
  .nav-toggle {
    display: flex;
  }

  .primary-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    gap: 1rem;
    box-shadow: var(--shadow-md);
  }

  /* nav.js toggles this class when the hamburger is clicked */
  .primary-nav.open {
    display: flex;
  }

  .primary-nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: .3rem;
    width: 100%;
  }

  .primary-nav a {
    display: block;
    width: 100%;
  }
/* utility links (cart, login, signup) move into the dropdown too so they
     don't get cut off on small screens */
  .nav-utility {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
    border-top: 1px solid var(--color-border);
    padding-top: .8rem;
  }
}
