/* ==========================================================================
   Site header
   --------------------------------------------------------------------------
   Everything is scoped under .eco-nav so it can't be reached by (or reach
   into) style.css, which sets a global `img { width: 100% }`, forces
   `.navbar { text-transform: uppercase; opacity: .9 }` and restyles bare
   h1-h3. Colours are the same tokens footer.css uses, so the header and the
   footer read as one system.
   ========================================================================== */

.eco-nav {
  /* Surfaces */
  --eco-forest: #2f3f33;
  --eco-rule: rgba(47, 63, 51, 0.1);
  --eco-sage-tint: #e4ebdc;

  /* Brand accents */
  --eco-sage: #acc39b;
  --eco-terracotta: #f3987b;
  --eco-terracotta-deep: #f36b42;
  --eco-terracotta-ink: #b84e26;

  /* Text */
  --eco-ink: #2f3f33;
  --eco-ink-soft: #5a6355;

  --eco-shell: 1180px;

  position: relative;
  z-index: 1010;
  padding: 0;
  background-color: #fff;
  border-bottom: 1px solid var(--eco-rule);
  /* style.css washes every .navbar out to 0.9 and shouts in uppercase. */
  opacity: 1;
  text-transform: none;
  font-size: 1rem;
  line-height: 1.5;
}

.eco-nav *,
.eco-nav *::before,
.eco-nav *::after {
  box-sizing: border-box;
}

.eco-nav img {
  width: auto;
  max-width: 100%;
}

.eco-nav svg {
  display: block;
  flex-shrink: 0;
}

/* One focus ring for every interactive thing in the header. */
.eco-nav a:focus-visible,
.eco-nav button:focus-visible {
  outline: 2px solid var(--eco-terracotta-deep);
  outline-offset: 3px;
  border-radius: 6px;
}

.eco-nav__shell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: var(--eco-shell);
  margin: 0 auto;
  padding: 0.5rem 1.25rem;
}

.eco-nav__visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   1. Brand + strapline
   -------------------------------------------------------------------------- */

.eco-nav__brand {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}

/* The asset is a full lockup (mark + "ecorustics" wordmark), so the brand
   needs no text beside it - it just needs to be big enough to read. */
.eco-nav__brand img {
  height: 52px;
  width: auto;
}

/* Deliberately not a heading: the page's own <h1> should own the document
   outline, and style.css sizes bare h2 at 15px anyway. */
.eco-nav__strap {
  display: none;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  margin-left: 0.35rem;
}

.eco-nav__strap-title {
  margin: 0;
  color: var(--eco-ink);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.eco-nav__strap-sub {
  display: none;
  margin: 0;
  color: var(--eco-ink-soft);
  font-size: 0.8125rem;
  line-height: 1.35;
}

.eco-nav__strap-sub a {
  color: var(--eco-terracotta-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.eco-nav__strap-sub a:hover,
.eco-nav__strap-sub a:focus {
  color: var(--eco-terracotta-deep);
}

/* Held back to lg rather than md: in the 768-991px band the logo, the links,
   the language pill and the auth buttons already fill the row, and adding the
   strapline there pushed the menu onto a second line. */
@media (min-width: 992px) {
  .eco-nav__strap {
    display: flex;
  }

  .eco-nav__strap-sub {
    display: block;
  }
}

/* --------------------------------------------------------------------------
   2. Always-visible actions (messages + burger)
   --------------------------------------------------------------------------
   Sits outside the collapse so the unread badge stays glanceable on a phone
   without opening the menu. On desktop `order` floats it back to the end.
   -------------------------------------------------------------------------- */

.eco-nav__actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

.eco-nav__toggler {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--eco-rule);
  border-radius: 10px;
  background-color: #fff;
  color: var(--eco-ink);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.eco-nav__toggler:hover,
.eco-nav__toggler:focus {
  background-color: var(--eco-sage-tint);
  border-color: var(--eco-sage);
}

.eco-nav__toggler-bars,
.eco-nav__toggler-bars::before,
.eco-nav__toggler-bars::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background-color: currentColor;
  content: "";
}

.eco-nav__toggler-bars {
  position: relative;
}

.eco-nav__toggler-bars::before {
  position: absolute;
  top: -6px;
}

.eco-nav__toggler-bars::after {
  position: absolute;
  top: 6px;
}

@media (min-width: 768px) {
  .eco-nav__actions {
    order: 3;
    margin-left: 0;
  }

  .eco-nav__toggler {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   3. Icon buttons (messages)
   -------------------------------------------------------------------------- */

.eco-nav__icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--eco-ink);
  background-color: transparent;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.eco-nav__icon-btn:hover,
.eco-nav__icon-btn:focus {
  background-color: var(--eco-sage-tint);
  color: var(--eco-ink);
  text-decoration: none;
}

/* Exactly one of the two messages buttons is visible at any width - see the
   comment in navbar.html. */
.eco-nav__msg-item {
  display: none;
}

@media (min-width: 768px) {
  .eco-nav__msg-item {
    display: block;
  }

  .eco-nav__icon-btn--mobile {
    display: none;
  }
}

.eco-nav__badge {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  background-color: var(--eco-terracotta-deep);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   4. The collapsing menu
   -------------------------------------------------------------------------- */

.eco-nav__menu {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.15rem;
  width: 100%;
  margin: 0;
  padding: 0.5rem 0 0.75rem;
  list-style: none;
}

.eco-nav__link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.35rem;
  border-radius: 10px;
  color: var(--eco-ink);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.eco-nav__link:hover,
.eco-nav__link:focus {
  background-color: var(--eco-sage-tint);
  color: var(--eco-ink);
  text-decoration: none;
}

.eco-nav__link .eco-nav__link-icon {
  width: 1.1rem;
  color: var(--eco-ink-soft);
  text-align: center;
  flex-shrink: 0;
}

/* Divider between groups inside the mobile panel. */
.eco-nav__sep {
  height: 1px;
  margin: 0.5rem 0;
  background-color: var(--eco-rule);
}

@media (min-width: 768px) {
  .eco-nav__menu {
    flex-direction: row;
    align-items: center;
    gap: 0.2rem;
    width: auto;
    padding: 0;
    margin-left: auto;
  }

  .eco-nav__link {
    padding: 0.45rem 0.7rem;
    font-size: 0.95rem;
    white-space: nowrap;
  }

  .eco-nav__sep {
    width: 1px;
    height: 24px;
    margin: 0 0.5rem;
  }
}

/* --------------------------------------------------------------------------
   5. Auth actions
   -------------------------------------------------------------------------- */

.eco-nav__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1.15rem;
  border: 1px solid var(--eco-terracotta-deep);
  border-radius: 999px;
  background-color: var(--eco-terracotta-deep);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.eco-nav__cta:hover,
.eco-nav__cta:focus {
  background-color: var(--eco-terracotta-ink);
  border-color: var(--eco-terracotta-ink);
  color: #fff;
  text-decoration: none;
}

@media (max-width: 767.98px) {
  /* Full-width on the mobile panel so it reads as the primary action. */
  .eco-nav__cta {
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.75rem 1.15rem;
  }
}

/* --------------------------------------------------------------------------
   6. Avatar + account menu
   -------------------------------------------------------------------------- */

.eco-nav__avatar-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.35rem;
  border-radius: 999px;
  color: var(--eco-ink);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.eco-nav__avatar-btn:hover,
.eco-nav__avatar-btn:focus {
  background-color: var(--eco-sage-tint);
  color: var(--eco-ink);
  text-decoration: none;
}

.eco-nav__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--eco-rule);
  object-fit: cover;
  flex-shrink: 0;
}

.eco-nav__avatar-name {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
}

/* Bootstrap draws its own triangle on .dropdown-toggle; we ship a chevron
   icon instead, so suppress the built-in one rather than showing both. */
.eco-nav .dropdown-toggle::after {
  display: none !important;
}

.eco-nav__caret {
  color: var(--eco-ink-soft);
  font-size: 0.7rem;
  transition: transform 0.15s ease;
}

.show > .eco-nav__avatar-btn .eco-nav__caret {
  transform: rotate(180deg);
}

@media (max-width: 767.98px) {
  /* The account block is already inside the open panel - a nested dropdown
     on a phone is one tap too many, so the links are laid out flat instead. */
  .eco-nav__avatar-btn {
    padding: 0.5rem 0.35rem;
    pointer-events: none;
  }

  .eco-nav__caret {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   7. Dropdown menus (desktop)
   -------------------------------------------------------------------------- */

@media (min-width: 768px) {
  .eco-nav .dropdown-menu {
    right: 0;
    left: auto;
    margin-top: 0.5rem;
    padding: 0.4rem;
    border: 1px solid var(--eco-rule);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(47, 63, 51, 0.12);
    min-width: 15rem;
  }

  .eco-nav .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.7rem;
    border-radius: 9px;
    color: var(--eco-ink);
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
  }

  .eco-nav .dropdown-item:hover,
  .eco-nav .dropdown-item:focus {
    background-color: var(--eco-sage-tint);
    color: var(--eco-ink);
  }

  .eco-nav .dropdown-item i {
    width: 1.05rem;
    color: var(--eco-ink-soft);
    text-align: center;
  }

  .eco-nav .dropdown-divider {
    margin: 0.35rem 0.2rem;
    border-top-color: var(--eco-rule);
  }
}

/* On a phone the menu is already open inside the panel: render it inline,
   stripped of its floating-card chrome. */
@media (max-width: 767.98px) {
  .eco-nav .dropdown-menu {
    display: block;
    position: static !important;
    float: none;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background-color: transparent;
    box-shadow: none;
  }

  .eco-nav .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.35rem 0.65rem 1.1rem;
    border-radius: 10px;
    color: var(--eco-ink);
    font-size: 1rem;
    font-weight: 500;
  }

  .eco-nav .dropdown-item:hover,
  .eco-nav .dropdown-item:focus {
    background-color: var(--eco-sage-tint);
  }

  .eco-nav .dropdown-item i {
    width: 1.1rem;
    color: var(--eco-ink-soft);
    text-align: center;
  }

  .eco-nav .dropdown-divider {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   8. Language switcher
   -------------------------------------------------------------------------- */

.eco-nav__lang {
  display: flex;
  align-items: center;
}

.eco-nav__lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--eco-rule);
  border-radius: 999px;
  background-color: #fff;
  color: var(--eco-ink);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.eco-nav__lang-btn:hover,
.eco-nav__lang-btn:focus {
  background-color: var(--eco-sage-tint);
  border-color: var(--eco-sage);
  color: var(--eco-ink);
  text-decoration: none;
}

.eco-nav__flag {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
}

@media (max-width: 767.98px) {
  /* One tap to switch, rather than a dropdown nested in the open panel. */
  .eco-nav__lang {
    padding: 0.35rem 0.35rem 0;
  }

  .eco-nav__lang-btn {
    width: 100%;
    justify-content: center;
    padding: 0.7rem 0.9rem;
  }
}
