.part--header {
  --header-height: var(--header-bar, 80px);
  position: relative;
  color: var(--color-text);
  font-family: var(--font-body);
}
.part--header .header__bar {
  position: relative;
  z-index: 60;
  border-bottom: 1px solid var(--color-border);
  transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.35s ease;
}
.part--header.is-plain .header__bar {
  border-bottom: 0;
}
.part--header.is-sticky.is-stuck .header__bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--sc-ground, var(--color-background));
}
.part--header.is-sticky.is-stuck .header__spacer {
  height: var(--header-room, var(--header-height));
}
.part--header.is-up.is-stuck.is-away .header__bar {
  transform: translateY(-102%);
}
.part--header.is-scrolled .header__bar {
  box-shadow: 0 6px 24px -12px color-mix(in srgb, var(--color-heading) 35%, transparent);
}
.part--header .header__inner {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.4vw, 40px);
  max-width: calc(var(--space-content-width) + 160px);
  min-height: var(--header-height);
  margin: 0 auto;
  padding: 0 var(--space-gutter);
}
.part--header.header--content .header__inner {
  max-width: calc(var(--space-content-width) + var(--space-gutter) * 2);
}
.part--header.header--wide .header__inner {
  max-width: calc(var(--space-content-wide) + var(--space-gutter) * 2);
}
.part--header.header--full .header__inner {
  max-width: none;
}
.part--header .header__brand {
  display: flex;
  align-items: center;
  flex: none;
  min-width: 0;
}
.part--header .header__panel {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  gap: clamp(16px, 2vw, 32px);
  min-width: 0;
}
.part--header .header__nav {
  display: flex;
  justify-content: flex-end;
  flex: 1 1 auto;
  min-width: 0;
}
.part--header .header__right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: none;
}
.part--header .header__right:empty,
.part--header .header__nav:empty {
  display: none;
}
.part--header .header__toggle {
  display: none;
}

/* Logo in the middle, the menu on its own row beneath. */
.part--header.is-center .header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  row-gap: 0;
  padding-top: 18px;
}
.part--header.is-center .header__brand {
  grid-column: 2;
  justify-content: center;
}
.part--header.is-center .header__panel {
  display: contents;
}
.part--header.is-center .header__right {
  grid-column: 3;
  grid-row: 1;
  justify-content: flex-end;
}
.part--header.is-center .header__nav {
  grid-column: 1 / -1;
  justify-content: center;
  padding: 10px 0 4px;
}
.part--header.is-center {
  --header-height: calc(var(--header-bar, 80px) + 56px);
}

/* Logo and the right side on one row, the menu on its own beneath, under a line. */
.part--header.is-rows {
  --header-height: calc(var(--header-bar, 80px) + 52px);
}
.part--header.is-rows .header__inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: var(--header-bar, 80px) 52px;
  row-gap: 0;
}
.part--header.is-rows .header__panel {
  display: contents;
}
.part--header.is-rows .header__right {
  grid-column: 2;
  grid-row: 1;
  justify-content: flex-end;
}
.part--header.is-rows .header__nav {
  grid-column: 1 / -1;
  grid-row: 2;
  align-self: stretch;
  align-items: center;
  justify-content: flex-start;
  margin-inline: calc(var(--space-gutter) * -1);
  padding-inline: var(--space-gutter);
  border-top: 1px solid var(--color-border);
}

/* Transparent over the first section, with the text colours of a dark background, until the page
   scrolls. */
.part--header.is-overlay {
  --sc-ground: var(--color-background);
}
.part--header.is-overlay .header__bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: transparent;
  transition: background-color 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, transform 0.35s ease;
}
.part--header.is-overlay.is-sticky.is-stuck .header__bar {
  position: fixed;
}
.part--header.is-overlay .header__spacer {
  display: none;
}
.part--header.is-overlay.is-scrolled .header__bar,
.part--header.is-overlay.is-open .header__bar {
  background: var(--sc-ground);
  border-bottom-color: transparent;
}

/* Tablets and small laptops: the menu gets a row of its own under the logo. */
@media (max-width: 1279px) and (min-width: 768px) {
  .part--header,
  .part--header.is-center,
  .part--header.is-rows {
    --header-height: calc(var(--header-bar, 80px) + 48px);
  }
  .part--header .header__inner,
  .part--header.is-center .header__inner,
  .part--header.is-rows .header__inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: none;
    row-gap: 0;
    padding-top: 12px;
  }
  .part--header .header__brand,
  .part--header.is-center .header__brand {
    grid-column: 1;
    grid-row: 1;
    justify-content: flex-start;
  }
  .part--header .header__panel {
    display: contents;
  }
  .part--header .header__right,
  .part--header.is-center .header__right {
    grid-column: 2;
    grid-row: 1;
    justify-content: flex-end;
  }
  .part--header .header__nav,
  .part--header.is-center .header__nav,
  .part--header.is-rows .header__nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    margin-inline: 0;
    padding: 6px 0 2px;
    border-top: 0;
  }
}

@media (max-width: 767px) {
  .part--header,
  .part--header.is-center,
  .part--header.is-rows {
    --header-height: var(--header-bar-mobile, 64px);
  }
  .part--header .header__inner,
  .part--header.is-center .header__inner,
  .part--header.is-rows .header__inner {
    display: flex;
    justify-content: space-between;
    padding-top: 0;
  }
  .part--header .header__toggle {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    margin-right: -10px;
    padding: 0 11px;
    border: 0;
    border-radius: var(--radius-small);
    background: transparent;
    color: inherit;
    cursor: pointer;
  }
  .part--header .header__toggle:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
  }
  .part--header .header__toggle-line {
    display: block;
    height: 2px;
    width: 22px;
    border-radius: 2px;
    background: currentColor;
    transition: transform 0.3s ease, opacity 0.2s ease;
  }
  .part--header.is-open .header__toggle-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .part--header.is-open .header__toggle-line:nth-child(2) {
    opacity: 0;
  }
  .part--header.is-open .header__toggle-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
  .part--header .header__panel,
  .part--header.is-center .header__panel,
  .part--header.is-rows .header__panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 24px;
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
    padding: 16px var(--space-gutter) 32px;
    background: var(--sc-ground, var(--color-background));
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 24px 40px -24px color-mix(in srgb, var(--color-heading) 40%, transparent);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, transform 0.3s ease, visibility 0s linear 0.3s;
  }
  .part--header.is-open .header__panel {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity 0.25s ease, transform 0.3s ease;
  }
  .part--header .header__nav,
  .part--header.is-center .header__nav,
  .part--header.is-rows .header__nav {
    justify-content: flex-start;
    margin-inline: 0;
    padding: 0;
    border-top: 0;
  }
  .part--header .header__nav > .sc-element {
    flex: 1 1 auto;
  }
  .part--header .header__right,
  .part--header.is-center .header__right,
  .part--header.is-rows .header__right {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
  }
}

@media (prefers-reduced-motion: reduce) {
  .part--header .header__bar,
  .part--header .header__panel,
  .part--header .header__toggle-line {
    transition: none;
  }
}
