/*
 * ============================================================
 * NAVIGATION  —  nav.css
 * ============================================================
 * Covers the sticky site header, scroll-progress bar,
 * the two-tone brand wordmark, nav links, and mobile toggle.
 *
 * Behaviour (managed by assets/js/nav.js)
 * ----------------------------------------
 * At the top of the page  →  header is fully transparent
 * Scrolled past 24px      →  header gets solid bg + shadow
 *                             (.is-scrolled class toggled by JS)
 *
 * To change nav link size →  .nav-list a { font-size }
 * To change brand size    →  .brand-name { font-size }
 * To change header height →  .site-header { padding }
 * ============================================================
 */

/* --- Scroll progress bar ----------------------------------- */
#scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: var(--rg-green-mid);
  z-index: 200;
  border-radius: 0 2px 2px 0;
  transition: width 0.08s linear;
  pointer-events: none;
}

/* --- Site header ------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 10px 0;
  background: rgba(240, 235, 224, 0);
  transition:
    background  0.35s ease,
    box-shadow  0.35s ease;
}

/* Once the user scrolls past 24px */
.site-header.is-scrolled {
  background: rgba(240, 235, 224, 0.97);
  box-shadow: 0 1px 16px rgba(0, 0, 0, 0.07);
}

/* Inner flex row */
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--rg-max);
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Brand link (logo + wordmark) -------------------------- */
.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-words {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* Two-tone "ReGreen Springfield" */
.brand-name {
  font-family: var(--rg-font-display);
  font-size: 15px;
  line-height: 1.1;
  display: block;
  white-space: nowrap;
}
.brand-name .re          { color: var(--rg-green-dark); }
.brand-name .green       { color: var(--rg-green-lime); }
.brand-name .springfield { color: var(--rg-charcoal);   }

/* "Urban Forestry • Urban Ecology • Community" */
.brand-tagline {
  font-family: var(--rg-font-body);
  font-size: 9px;
  font-weight: 600;
  color: var(--rg-green-lime);
  letter-spacing: 0.04em;
  display: block;
  white-space: nowrap;
}

/* "Springfield MA • Est. 2011" */
.brand-location {
  font-family: var(--rg-font-body);
  font-size: 8.5px;
  color: var(--rg-muted);
  letter-spacing: 0.03em;
  display: block;
  white-space: nowrap;
}

/* --- Nav links --------------------------------------------- */
.site-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav-list a {
  font-family: var(--rg-font-body);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--rg-charcoal);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--rg-ease);
}

.nav-list a:hover,
.nav-list .current-menu-item > a {
  color: var(--rg-green-lime);
}

/* --- Mobile hamburger -------------------------------------- */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-direction: column;
  gap: 5px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--rg-charcoal);
  border-radius: 1px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Toggle animation when open */
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* --- Tablet (641–900px): no dropdown — links wrap onto a
       second row under the brand, always visible ------------- */
@media (max-width: 900px) and (min-width: 641px) {
  .header-inner {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 8px;
  }
  .brand-link { margin-right: auto; }
  .site-nav {
    flex-basis: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
    padding-bottom: 4px;
  }
  .nav-list { flex-wrap: wrap; justify-content: center; gap: 14px; }
}

/* --- Phone (≤640px): full-screen overlay menu instead of a
       cramped dropdown panel -------------------------------- */
@media (max-width: 640px) {

  .nav-toggle {
    display: flex;
    position: relative;
    z-index: 220; /* stays above the overlay so it becomes the close (X) button */
  }

  .site-nav {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 210;
    background: rgba(240, 235, 224, 0.99);
    padding: 96px 32px 40px;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 26px;
    overflow-y: auto;
  }

  .site-nav.is-open { display: flex; }

  .nav-list {
    flex-direction: column;
    align-items: center;
    gap: 22px;
    width: 100%;
  }

  .nav-list a {
    font-family: var(--rg-font-display);
    font-size: 26px;
    color: var(--rg-green-dark);
  }

  .site-nav .btn-donate {
    margin-top: 10px;
    font-size: 16px;
    padding: 14px 34px;
  }
}
