/* Header and menu (#2). Figma: header 834:9435 (desktop, 72 px), dropdowns
   768:12376 and 805:9045, mobile header 848:10287 (64 px), mobile menu M02
   907:10294. Desktop from 1024 px; below that a hamburger opens a full-screen
   menu. The height is --header-height, which html's scroll-padding-top uses so
   the sticky header never covers a section the page jumps to. */

.site-header {
  /* Values that only the header uses, from the Figma components. */
  --header-dropdown-shadow: 0 16px 40px -8px rgba(0, 47, 39, 0.14);
  --header-impact-icon-bg: #f1e9dc;
  --header-more-link: #2f6b4f;

  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: var(--color-bg-surface);
  border-bottom: 1px solid var(--color-card-divider);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  height: 100%;
}

.site-header__logo {
  flex: none;
  display: block;
  border-radius: var(--radius-sm);
}
.site-header__logo img {
  width: 124px;
  height: 34px;
}

/* ── Desktop bar ───────────────────────────────────────────────────────── */

.site-nav,
.site-header__actions {
  display: none;
}

.site-nav__list,
.site-menu__list,
.site-menu__sub,
.nav-dropdown ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 1024px) {
  .site-header {
    border-bottom-color: var(--color-border-default);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
  }

  .site-header__logo img {
    width: 157.3px;
    height: 40.8px;
  }

  .site-nav {
    display: block;
  }
  .site-nav__list {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
  }

  /* Nav link (16:100): Body/Small, with a gold indicator under the active page. */
  .site-nav .site-nav__link {
    position: relative;
    display: block;
    padding: 4px 0 8px;
    color: var(--color-text-primary);
    font: var(--text-small);
    text-decoration: none;
    white-space: nowrap;
  }
  .site-nav .site-nav__link::after {
    content: '';
    position: absolute;
    inset: auto 0 0;
    height: 2px;
    background: var(--color-border-accent);
    opacity: 0;
    transition: opacity 0.15s ease;
  }
  .site-nav .site-nav__link:hover::after {
    opacity: 0.5;
  }
  .site-nav .site-nav__link.is-active::after,
  .site-nav__group.is-open > .site-nav__link::after {
    opacity: 1;
  }

  .site-nav__group {
    position: relative;
    display: flex;
    align-items: flex-start;
  }

  .site-nav__toggle {
    display: grid;
    place-items: center;
    width: 20px;
    height: 28px;
    margin-left: 2px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    cursor: pointer;
  }
  .site-nav__toggle img {
    width: 14px;
    height: 14px;
    transition: transform 0.15s ease;
  }
  .site-nav__toggle[aria-expanded='true'] img {
    transform: rotate(180deg);
  }

  .site-header__actions {
    display: flex;
    flex: none;
    justify-content: flex-end;
  }

  /* Right of the menu sits the Get started button; under the dropdown the
     header shows nothing else. */
  .site-header__menu-button,
  .site-menu {
    display: none !important;
  }
}

@media (min-width: 1280px) {
  .site-nav__list {
    gap: 36px;
  }
  /* Room for the EN/FR switch (74 px + 12 px gap in Figma), not built yet. */
  .site-header__actions {
    min-width: 252px;
  }
}

/* ── Dropdowns (768:12376, 805:9045) ───────────────────────────────────── */

.nav-dropdown {
  position: absolute;
  top: calc(100% + 16px);
  left: -24px;
  width: 380px;
  padding: var(--space-sm);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-card-journey);
  box-shadow: var(--header-dropdown-shadow);
}
/* Bridges the gap to the link, so the pointer can travel into the dropdown. */
.nav-dropdown::before {
  content: '';
  position: absolute;
  inset: -17px 0 100%;
}
.nav-dropdown[hidden] {
  display: none;
}
.nav-dropdown ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.nav-dropdown__item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px var(--space-sm);
  border-radius: var(--radius-card);
  color: var(--color-text-primary);
  text-decoration: none;
}
.nav-dropdown__item:hover {
  background: var(--color-bg-subtle);
}

.nav-dropdown__icon,
.site-menu__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
}
.nav-dropdown__icon img {
  width: 20px;
  height: 20px;
}
.nav-dropdown__icon--public img {
  height: 21.75px;
  margin-bottom: -1.75px; /* the flag hangs below its 20 px box, as in Figma */
}
.nav-dropdown__icon--carbon {
  background: color-mix(in srgb, var(--color-journey-carbon) 12%, var(--color-bg-surface));
}
.nav-dropdown__icon--enterprise {
  background: color-mix(in srgb, var(--color-journey-enterprise) 12%, var(--color-bg-surface));
}
.nav-dropdown__icon--public {
  background: color-mix(in srgb, var(--color-journey-public) 12%, var(--color-bg-surface));
}
.nav-dropdown__icon--impact {
  background: var(--header-impact-icon-bg);
  border: 1px solid var(--gold-600); /* Figma #B58223; a border, so not held to the text contrast rule */
}

.nav-dropdown__text {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.nav-dropdown__title {
  font: 400 18px / 1.2 var(--font-serif);
  color: var(--color-text-primary);
}
.nav-dropdown__description {
  font: 400 13px / 1.3 var(--font-sans);
  color: var(--color-text-secondary);
}

.nav-dropdown__more {
  display: flex;
  gap: var(--space-xs);
  margin-top: var(--space-2xs);
  padding: 14px var(--space-sm) 10px;
  border-top: 1px solid var(--color-card-divider);
  color: var(--header-more-link);
  font: var(--text-small-strong);
  text-decoration: none;
}
.nav-dropdown__more:hover {
  text-decoration: underline;
}

/* ── Mobile: hamburger and full-screen menu (848:10287, M02 907:10294) ── */

.site-header__menu-button {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg-surface);
  cursor: pointer;
}
/* Three 20 × 2 bars, 5 px apart; they turn into the ✕ when the menu is open. */
.site-header__menu-icon,
.site-header__menu-icon::before,
.site-header__menu-icon::after {
  position: absolute;
  left: 11px;
  width: 20px;
  height: 2px;
  border-radius: 1px;
  background: var(--color-icon-default);
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.site-header__menu-icon {
  top: 20px;
}
.site-header__menu-icon::before,
.site-header__menu-icon::after {
  content: '';
  left: 0;
}
.site-header__menu-icon::before {
  top: -7px;
}
.site-header__menu-icon::after {
  top: 7px;
}
.site-header__menu-button[aria-expanded='true'] .site-header__menu-icon {
  background: transparent;
}
.site-header__menu-button[aria-expanded='true'] .site-header__menu-icon::before {
  transform: translateY(7px) rotate(45deg) scaleX(0.75);
}
.site-header__menu-button[aria-expanded='true'] .site-header__menu-icon::after {
  transform: translateY(-7px) rotate(-45deg) scaleX(0.75);
}

.site-menu {
  position: fixed;
  inset: var(--header-height) 0 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: var(--space-xl);
  background: var(--color-bg-surface);
}
.site-menu[hidden] {
  display: none;
}

.site-menu__list {
  padding-top: var(--space-xs);
}

.site-menu__row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--color-border-default);
}
.site-menu__group > .site-menu__row {
  border-bottom: 0;
}
.site-menu__group {
  border-bottom: 1px solid var(--color-border-default);
}

.site-menu__link {
  flex: 1 1 auto;
  padding: var(--space-md) 0;
  color: var(--color-text-primary);
  font: 500 18px / 1.25 var(--font-sans);
  text-decoration: none;
}
.site-menu__link.is-active {
  text-decoration: underline 2px var(--color-border-accent);
  text-underline-offset: 6px;
}

.site-menu__toggle {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: -13px; /* the chevron lines up with the right edge, as in M02 */
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  cursor: pointer;
}
.site-menu__toggle img {
  width: 18px;
  height: 18px;
  transition: transform 0.15s ease;
}
.site-menu__toggle[aria-expanded='true'] img {
  transform: rotate(180deg);
}

.site-menu__sub {
  padding-bottom: var(--space-xs);
}
.site-menu__sub[hidden] {
  display: none;
}
.site-menu__sub-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0 var(--space-xs) var(--space-2xs);
  color: var(--color-text-primary);
  font: var(--text-body);
  line-height: 1.25;
  text-decoration: none;
}
.site-menu__icon {
  width: 36px;
  height: 36px;
}
.site-menu__icon img {
  width: 18px;
  height: 18px;
}

.site-menu__bottom {
  padding-top: var(--space-lg);
}
.site-menu__get-started {
  justify-content: center;
  width: 100%;
}

/* While the menu is open the page behind it stays put. */
html.has-open-menu {
  overflow: hidden;
}
