/* Header — the white site header holding the gov.bb logo (the link home),
   optional consumer-provided controls, and the site menu. Renders on every
   page, directly below the official banner. The logo, controls, and nav share
   one width container so they form one row when space permits. A hairline rule
   closes the band against the page. On narrower containers the nav becomes a
   full-width tinted panel below the logo/Menu row. The header module
   (data-govbb-module="header") reveals the toggle after enhancement; without
   JavaScript, the navigation remains available. */

.govbb-header {
  color: var(--govbb-color-ink);
  background: var(--govbb-color-surface);
  border-block-end: 1px solid var(--govbb-blue-20);
  container-type: inline-size;
}

.govbb-header__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: var(--govbb-space-s);
  padding-block: var(--govbb-space-s);
}

.govbb-header__home {
  min-inline-size: 0;
  justify-self: start;
}

.govbb-header__logo {
  display: block;
  max-inline-size: 100%;
  width: auto;
  height: 1.5rem; /* 24px */
}

.govbb-header__controls {
  display: flex;
  grid-column: 2;
  grid-row: 1;
  gap: var(--govbb-space-s);
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

/* Layout only — visual styling and interaction colours come from the
   govbb-button--ghost variant. */
.govbb-header__toggle {
  flex: none;
  min-block-size: 2.75rem;
}

/* The mobile panel bleeds through the width-container gutter while its content
   remains aligned with the logo. The negative block-end margin consumes the
   container's bottom padding so the tint ends flush with the header. */
.govbb-header__nav {
  grid-column: 1 / -1;
  margin-block: var(--govbb-space-s) calc(-1 * var(--govbb-space-s));
  margin-inline: calc(-1 * var(--govbb-page-gutter));
  padding-inline: var(--govbb-page-gutter);
  font-size: var(--govbb-font-size-body);
  background: var(--govbb-blue-10);
}

.govbb-header__nav .govbb-link {
  font-weight: 700;
}

.govbb-header__nav .govbb-button {
  align-self: stretch;
  order: -1;
  font-weight: 400;
}

.govbb-header__nav-inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--govbb-space-s);
  padding-block: var(--govbb-space-s);
}

@container (width < 50rem) {
  .govbb-header[data-govbb-header-enhanced]
    .govbb-header__nav[data-expanded='false'] {
    display: none;
  }
}

@container (width >= 50rem) {
  .govbb-header__inner {
    display: flex;
    gap: var(--govbb-space-xm);
    padding-block: var(--govbb-space-xm);
  }

  .govbb-header__logo {
    height: 2.1875rem; /* 35px */
  }

  /* The logo keeps its width; navigation wraps onto further rows instead. */
  .govbb-header__home {
    flex: none;
  }

  .govbb-header__controls {
    margin-inline-start: auto;
  }

  .govbb-header__toggle {
    display: none;
  }

  .govbb-header__nav {
    margin: 0;
    padding: 0;
    background: transparent;
  }

  .govbb-header__nav-inner {
    flex-flow: row wrap;
    align-items: center;
    gap: var(--govbb-space-s) var(--govbb-space-l);
    padding-block: 0;
  }

  /* nav links read as menu items: ink, underlined only on interaction */
  .govbb-header__nav .govbb-link:not(:hover, :active, :focus-visible) {
    color: var(--govbb-color-ink);
    text-decoration: none;
  }

  .govbb-header__nav .govbb-button {
    align-self: auto;
    order: 0;
  }
}
