/* Shared compact masthead for the editor and workbench. */
:root {
  --cs-header-height: 48px;
  --cs-header-inset: env(safe-area-inset-top, 0px);
  --cs-header-total: calc(var(--cs-header-height) + var(--cs-header-inset));
  --cs-header-gutter: max(clamp(16px, 4.5vw, 82px), calc((100% - 1680px) / 2));
  --cs-header-font: "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --cs-header-ink: #393d20;
  --cs-header-line: #d8dcd2;
  --cs-header-paper: #fcfcfa;
  --cs-header-hover: #f3f3ed;
}

body > .cs-header {
  display: flex;
  align-items: stretch;
  gap: 0;
  height: var(--cs-header-total);
  padding-block: var(--cs-header-inset) 0;
  padding-inline:
    max(var(--cs-header-gutter), env(safe-area-inset-left, 0px))
    max(var(--cs-header-gutter), env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--cs-header-line);
  background: var(--cs-header-paper);
  color: var(--cs-header-ink);
  font: 400 13px/1.3 var(--cs-header-font);
  -webkit-font-smoothing: antialiased;
}

.cs-header :is(.brand, .workspace-brand) {
  display: inline-flex;
  flex: none;
  flex-direction: row;
  align-items: center;
  gap: 0;
  width: auto;
  min-height: 44px;
  color: #343627;
  font-size: clamp(15px, 1.4vw, 19px);
  font-weight: 720;
  letter-spacing: -.055em;
  text-decoration: none;
  white-space: nowrap;
}

.cs-header :is(.brand, .workspace-brand) span {
  display: inline;
  color: inherit;
  font: inherit;
  font-weight: 400;
  letter-spacing: inherit;
}

body > .cs-header :is(#language, #workspace-language) {
  --language-background: #171816;
  align-self: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  margin-inline-start: 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: linear-gradient(var(--language-background), var(--language-background))
    center / 32px clamp(16px, 1.4vw, 19px) no-repeat;
  color: #fff;
  font: 600 12px/1 var(--cs-header-font);
}

.cs-header .cs-header-actions {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-inline-start: auto;
  border-inline-start: 1px solid var(--cs-header-line);
}

.cs-header .cs-header-actions > :is(a, button) {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  height: auto;
  padding: 6px clamp(9px, 1.5vw, 25px);
  border: 0;
  border-inline-end: 1px solid var(--cs-header-line);
  border-radius: 0;
  font: inherit;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.cs-header .cs-header-actions > :not(.primary) {
  color: var(--cs-header-ink);
  background: transparent;
}

.cs-header .cs-header-actions > .primary {
  color: var(--cs-header-paper);
  background: var(--cs-header-ink);
}

body > .cs-header :is(a, button):focus-visible {
  outline: 2px solid var(--cs-header-ink);
  outline-offset: -3px;
}

.cs-header .cs-header-actions > .primary:focus-visible { outline-color: var(--cs-header-paper); }

@media (hover: hover) {
  body > .cs-header :is(#language, #workspace-language):hover { --language-background: #2b2c28; }
  .cs-header .cs-header-actions > :not(.primary):hover {
    border-color: var(--cs-header-line);
    background: var(--cs-header-hover);
  }
  .cs-header .cs-header-actions > .primary:hover { background: #343627; }
}

@media (max-width: 400px) {
  body > .cs-header :is(#language, #workspace-language) { margin-inline-start: 6px; }
}

@media (max-width: 360px) {
  .cs-header :is(.brand, .workspace-brand) { font-size: 14px; }
}
