.site-header {
  --header-blue: #0867dc;
  --header-blue-dark: #064ea8;
  --header-ink: #142033;
  --header-line: #27313f;
  --header-surface: #ffffff;
  --header-control-width: 60px;
  --header-aux-control-width: 1.35rem;
  border-bottom: 1px solid var(--header-line);
  background: var(--header-surface);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  line-height: 1.45;
}

.site-header *,
.site-header *::before,
.site-header *::after {
  box-sizing: border-box;
}

.site-header a:hover {
  color: var(--header-blue-dark);
  text-decoration: none;
}

.site-header :focus-visible {
  outline: 3px solid #ffbf47;
  outline-offset: 3px;
}

.header-main {
  width: min(100% - 2rem, 1270px);
  min-height: 0;
  margin-inline: auto;
  padding-block: 4px;
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) auto;
  grid-template-rows: 26px 26px;
  grid-template-areas:
    "brand primary language"
    "brand secondary help";
  column-gap: 1rem;
  row-gap: 4px;
  align-content: center;
  align-items: center;
}

.brand-link {
  grid-area: brand;
  display: inline-flex;
  width: max-content;
}

.brand-logo {
  display: block;
  width: 118px;
  height: auto;
}

.header-navigation {
  grid-area: primary;
  min-width: 0;
  min-height: 0;
  height: 26px;
  margin-block: 0;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.nav-button,
.section-menu summary,
.language-select,
.site-header .tab-button {
  box-sizing: border-box;
  height: 26px;
  min-height: 26px;
  border: 1px solid var(--header-line);
  border-radius: 6px;
  background: var(--header-surface);
  color: var(--header-ink);
  font: inherit;
  font-weight: 700;
}

.nav-button,
.section-menu summary,
.site-header .tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.18rem 0.65rem;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.nav-button[aria-current="page"] {
  border-color: var(--header-blue);
  color: #ffffff;
  background: var(--header-blue);
}

.site-header .tab-button {
  flex: 0 0 auto;
}

.site-header .tab-button[aria-selected="true"] {
  border-color: var(--header-blue);
  color: #ffffff;
  background: var(--header-blue);
}

.site-header .tab-button[aria-selected="true"]:hover {
  color: #ffffff;
  background: var(--header-blue-dark);
}

.nav-button[aria-current="page"]:hover {
  color: #ffffff;
  background: var(--header-blue-dark);
}

.nav-button.is-prerequisite-locked,
.site-header .tab-button.is-prerequisite-locked,
.nav-button.is-prerequisite-locked[aria-current="page"],
.site-header .tab-button.is-prerequisite-locked[aria-selected="true"] {
  border-color: #b6bcc3;
  background: #eef0f2;
  color: #626971;
  cursor: help;
}

.nav-button.is-prerequisite-locked:hover,
.nav-button.is-prerequisite-locked:focus-visible,
.site-header .tab-button.is-prerequisite-locked:hover,
.site-header .tab-button.is-prerequisite-locked:focus-visible {
  border-color: #737980;
  background: #e4e7ea;
  color: #555b61;
}

.prerequisite-popover {
  position: fixed;
  z-index: 2400;
  display: grid;
  width: min(320px, calc(100vw - 16px));
  gap: 8px;
  padding: 10px;
  border: 1px solid #737980;
  border-radius: 7px;
  background: #ffffff;
  color: var(--header-ink);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
}

.prerequisite-popover[hidden] {
  display: none;
}

.prerequisite-popover p {
  margin: 0;
  line-height: 1.35;
}

.prerequisite-popover-action {
  width: 100%;
}

.section-menu {
  position: relative;
  flex: 0 0 auto;
}

.section-menu summary {
  list-style: none;
}

.section-menu summary::-webkit-details-marker {
  display: none;
}

.section-menu summary::after {
  content: "\25BE";
  margin-left: 0.6rem;
  font-size: 0.8rem;
}

.section-links {
  position: absolute;
  z-index: 200;
  top: calc(100% + 0.35rem);
  left: 0;
  width: max-content;
  min-width: 210px;
  padding: 0.35rem;
  border: 1px solid var(--header-line);
  border-radius: 6px;
  background: var(--header-surface);
  box-shadow: 0 8px 20px rgb(20 32 51 / 18%);
}

.section-links a {
  display: block;
  padding: 0.55rem 0.65rem;
  border-radius: 4px;
  color: var(--header-ink);
  text-decoration: none;
}

.section-links a:hover,
.section-links a:focus-visible,
.section-links a[aria-current="page"] {
  color: #ffffff;
  background: var(--header-blue);
}

.header-language {
  grid-area: language;
  display: grid;
  grid-template-columns: var(--header-control-width) var(--header-aux-control-width);
  gap: 0;
  justify-self: end;
  align-self: center;
}

.header-language-control {
  display: inline-flex;
  min-width: 0;
}

.language-select {
  width: 100%;
  min-width: 0;
  padding: 0.18rem 0.3rem;
  cursor: pointer;
}

.header-scroll-top {
  display: inline-grid;
  width: var(--header-aux-control-width);
  height: 26px;
  min-height: 26px;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--header-blue);
  font: inherit;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.header-scroll-top:disabled {
  color: #b6bcc3;
  cursor: default;
}

.header-scroll-top:not(:disabled):hover {
  color: var(--header-blue-dark);
}

.header-help {
  grid-area: help;
  width: calc(var(--header-control-width) + var(--header-aux-control-width));
  justify-self: end;
  align-self: center;
}

.header-secondary {
  grid-area: secondary;
  min-width: 0;
}

.build-save-strip {
  position: absolute;
  z-index: 1;
  top: calc(100% - 1px);
  left: 0;
  right: 0;
  height: 30px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-x: auto;
}

.build-save-strip-inner {
  width: max-content;
  max-width: calc(100vw - 1rem);
  min-height: 26px;
  padding: 2px 4px 3px;
  border: 0;
  border-right: 1px solid var(--header-line);
  border-bottom: 1px solid var(--header-line);
  border-left: 1px solid var(--header-line);
  border-radius: 0 0 6px 6px;
  background: var(--header-surface);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.build-save-strip-inner[hidden] {
  display: none;
}

.site-header .build-save-strip button {
  width: auto;
  height: 24px;
  min-height: 24px;
  padding: 0 0.65rem;
  border-radius: 5px;
  font-size: 0.88rem;
  line-height: 1;
  white-space: nowrap;
}

.site-header .build-save-strip #buildQuickSaveBtn:not(:disabled) {
  border-color: var(--header-blue);
  color: #ffffff;
  background: var(--header-blue);
}

.site-header .build-save-strip #buildQuickSaveBtn.is-current {
  color: #5c646c;
  background: #eef0f2;
}

.build-save-local-status {
  color: #343b43;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.has-build-save-strip .main {
  padding-top: 46px;
}

.user-page-tabs {
  width: 100%;
  min-width: 0;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  overflow-x: auto;
}

.site-header .code-tab-button {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.site-header .code-char-fixed {
  display: inline-block;
  padding: 0 0.18em;
  border-radius: 0.16em;
  background: #0094ff;
  color: #ffffff;
  line-height: 1.1;
}

.site-header .code-seg-muted {
  color: #000000;
}

.site-header .code-seg-strong {
  display: inline-block;
  padding: 0 0.18em;
  border-radius: 0.16em;
  background: #000000;
  color: #ffffff;
  line-height: 1.1;
}

.site-header .code-tab-button[aria-selected="true"] .code-seg-muted {
  color: #ffffff;
}

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

@media (max-width: 850px) {
  .header-main {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .brand-logo {
    width: 96px;
  }
}

@media (max-width: 650px) {
  .site-header {
    font-size: 16px;
  }

  .header-main {
    width: min(100% - 1rem, 1270px);
    grid-template-columns: auto 1fr;
    grid-template-rows: auto 26px 26px;
    grid-template-areas:
      "brand language"
      "primary primary"
      "help help";
    column-gap: 1rem;
    row-gap: 4px;
  }

  .has-header-secondary .header-main {
    grid-template-rows: auto 26px 26px 26px;
    grid-template-areas:
      "brand language"
      "primary primary"
      "secondary secondary"
      "help help";
  }

  .header-navigation {
    justify-content: center;
    overflow-x: auto;
  }

  .header-language {
    justify-self: end;
  }

  .header-help {
    justify-self: center;
  }
}
