/* Replace the old header HTML. Load this after the site's styles.css. */
.hg-nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 1100;
  padding: 24px 24px 0;
  pointer-events: none;
}

.hg-nav__bar {
  max-width: 1280px;
  min-height: 68px;
  margin: auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: transparent;
  transition: background .25s, box-shadow .25s, border-color .25s;
  pointer-events: auto;
}

.hg-nav__brand {
  display: none;
  color: #fff;
  font: 700 18px/1.2 Arial, sans-serif;
  text-decoration: none;
  white-space: nowrap;
}

.hg-nav__brand small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 1.2px;
  margin-top: 4px;
}

.hg-nav__links {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.hg-nav__links li {
  display: block;
  margin: 0;
  padding: 0;
  width: auto;
  font-size: inherit;
}

.hg-nav__links li::before,
.hg-nav__links li::after {
  display: none;
}

.hg-nav__links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #00533f;
  font: 700 17px/1.4 Arial, sans-serif;
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s;
}

.hg-nav__links a:hover {
  color: #80631d;
}

.hg-nav__links a[aria-current="location"] {
  text-decoration: underline;
  text-decoration-color: #ba9130;
  text-underline-offset: 8px;
  text-decoration-thickness: 2px;
}

.hg-nav__toggle {
  display: none;
  border: 0;
  padding: 12px;
  background: transparent;
  color: #00533f;
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
  font: 700 15px Arial, sans-serif;
  align-items: center;
  gap: 10px;
}

.hg-nav__burger {
  display: grid;
  gap: 5px;
  width: 22px;
}

.hg-nav__burger span {
  display: block;
  height: 2px;
  width: 22px;
  background: currentColor;
  transition: transform .2s, opacity .2s;
}

.hg-nav.is-scrolled .hg-nav__bar,
.hg-nav.is-open .hg-nav__bar {
  background: rgba(0, 83, 63, .98);
  border-color: rgba(255, 255, 255, .16);
  box-shadow: 0 10px 32px rgba(0, 55, 40, .14);
}

.hg-nav.is-scrolled .hg-nav__brand {
  display: block;
  margin-right: auto;
}

.hg-nav.is-scrolled .hg-nav__links a,
.hg-nav.is-open .hg-nav__links a,
.hg-nav.is-scrolled .hg-nav__toggle,
.hg-nav.is-open .hg-nav__toggle {
  color: #fff;
}

.hg-nav.is-scrolled .hg-nav__links a:hover {
  color: #e8d59b;
}

.hg-nav a:focus-visible,
.hg-nav button:focus-visible {
  outline: 2px solid #80631d;
  outline-offset: 4px;
  border-radius: 4px;
}

.hg-nav.is-scrolled a:focus-visible,
.hg-nav.is-open a:focus-visible,
.hg-nav.is-scrolled button:focus-visible,
.hg-nav.is-open button:focus-visible {
  outline-color: #fff;
}

/* Covers both mobile and tablet, including tablet landscape. */
@media(max-width:1100px) {
  .hg-nav {
    padding: 12px 12px 0;
  }

  .hg-nav__bar {
    position: relative;
    min-height: 60px;
    padding: 0 16px;
    border-radius: 14px;
  }

  .hg-nav__toggle {
    display: inline-flex;
  }

  .hg-nav__links {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    padding: 12px;
    background: #00533f;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 14px;
    box-shadow: 0 14px 32px rgba(0, 55, 40, .16);
    max-height: calc(100dvh - 100px);
    overflow-y: auto;
    flex-direction: column;
    gap: 0;
    align-items: stretch;
  }

  .hg-nav.is-open .hg-nav__links {
    display: flex;
  }

  .hg-nav__links li {
    width: 100%;
    margin: 0;
  }

  .hg-nav__links a {
    color: #fff;
    display: flex;
    padding: 12px 16px;
    font-size: 18px;
    border-radius: 8px;
  }

  .hg-nav__links a:hover {
    color: #fff;
    background: rgba(255, 255, 255, .08);
  }

  .hg-nav.is-open .hg-nav__burger span:first-child {
    transform: translateY(7px) rotate(45deg);
  }

  .hg-nav.is-open .hg-nav__burger span:nth-child(2) {
    opacity: 0;
  }

  .hg-nav.is-open .hg-nav__burger span:last-child {
    transform: translateY(-7px) rotate(-45deg);
  }
}

@media(prefers-reduced-motion:reduce) {
  .hg-nav * {
    transition: none;
  }
}

.hg-nav__brand img {
  display: block;
  width: auto;
  height: 64px;
  object-fit: contain;
}

.hg-nav.is-scrolled .hg-nav__brand {
  display: flex;
  align-items: center;
  margin-right: auto;
}

.hg-nav.is-scrolled .hg-nav__bar {
  min-height: 84px;
}

@media (max-width: 1100px) {
  .hg-nav__brand img {
    height: 48px;
  }

  .hg-nav.is-scrolled .hg-nav__bar {
    min-height: 64px;
  }
}

/* Logo stays visible at the top and while scrolling */
.hg-nav__brand,
.hg-nav.is-scrolled .hg-nav__brand {
  display: flex;
  align-items: center;
  margin-right: auto;
  flex-shrink: 0;
}

.hg-nav__brand img {
  display: block;
  width: auto;
  height: 70px;
  object-fit: contain;
}

/* Transparent navigation at the top */
.hg-nav {
  padding: 18px 24px 0;
}

.hg-nav__bar {
  min-height: 88px;
  padding: 8px 28px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 20px;
  box-shadow: none;
  transition:
    background 0.3s ease,
    box-shadow 0.3s ease,
    border-color 0.3s ease,
    transform 0.3s ease;
}

/* White floating card after scrolling */
.hg-nav.is-scrolled .hg-nav__bar,
.hg-nav.is-open .hg-nav__bar {
  min-height: 88px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 83, 63, 0.1);
  box-shadow:
    0 12px 36px rgba(0, 60, 42, 0.1),
    0 2px 8px rgba(0, 60, 42, 0.04);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transform: translateY(-4px);
}

/* Emerald menu text in every state */
.hg-nav .hg-nav__links a,
.hg-nav.is-scrolled .hg-nav__links a,
.hg-nav.is-open .hg-nav__links a {
  position: relative;
  color: #00533f;
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
}

.hg-nav .hg-nav__links a:hover,
.hg-nav.is-scrolled .hg-nav__links a:hover {
  color: #087457;
}

/* Refined underline for hover and active page */
.hg-nav__links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 3px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, #00533f, #ba9130);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.hg-nav__links a:hover::after,
.hg-nav__links a[aria-current="page"]::after {
  transform: scaleX(1);
}

.hg-nav .hg-nav__links a[aria-current="page"] {
  color: #00533f;
  text-decoration: none;
}

/* Mobile menu button */
.hg-nav .hg-nav__toggle,
.hg-nav.is-scrolled .hg-nav__toggle,
.hg-nav.is-open .hg-nav__toggle {
  color: #00533f;
}

.hg-nav a:focus-visible,
.hg-nav button:focus-visible,
.hg-nav.is-scrolled a:focus-visible,
.hg-nav.is-open a:focus-visible,
.hg-nav.is-scrolled button:focus-visible,
.hg-nav.is-open button:focus-visible {
  outline: 2px solid #087457;
  outline-offset: 5px;
}

/* Mobile and tablet */
@media (max-width: 1100px) {
  .hg-nav {
    padding: 12px 14px 0;
  }

  .hg-nav__bar,
  .hg-nav.is-scrolled .hg-nav__bar,
  .hg-nav.is-open .hg-nav__bar {
    min-height: 72px;
    padding: 8px 16px;
    border-radius: 16px;
  }

  .hg-nav__brand img {
    height: 54px;
  }

  .hg-nav__links {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(0, 83, 63, 0.1);
    border-radius: 16px;
    box-shadow: 0 16px 36px rgba(0, 60, 42, 0.12);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .hg-nav .hg-nav__links a {
    color: #00533f;
    font-size: 18px;
  }

  .hg-nav .hg-nav__links a:hover {
    color: #087457;
    background: #f1f7f3;
  }

  .hg-nav__links a::after {
    left: 16px;
    right: auto;
    width: 32px;
    bottom: 6px;
  }

  .hg-nav .hg-nav__links a[aria-current="page"] {
    background: #f1f7f3;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hg-nav__bar,
  .hg-nav__links a::after {
    transition: none;
  }
}