/*
 * Top bar styles. Colors and fonts come from Redoc 3 theme tokens, which Redoc
 * defines on :root and redefines when its color mode switcher is used, so the
 * bar follows the Redoc light/dark mode automatically. Fallbacks match the
 * Redoc light theme for the moment before the bundle has loaded.
 */
:root {
  --topbar-height: 56px;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-color, #ffffff);
  color: var(--text-color-primary, #1a1c21);
  font-family: var(--font-family-base, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}

#topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  box-sizing: border-box;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  background: var(--bg-color, #ffffff);
  border-bottom: 1px solid var(--border-color-primary, #ededf2);
}

.brand-group,
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  align-items: baseline;
  color: #1871a5;
  font-size: 36px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.brand-logo {
  display: block;
  width: 1cap;
  height: 1cap;
}

.brand-name {
  font-size: 0.95em;
  text-box: trim-both cap alphabetic;
}

.brand:focus-visible,
.brand-sub:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.brand-logo-dark {
  display: none;
}

:root:has(.redoc.dark) .brand {
  color: #fff;
}

:root:has(.redoc.dark) .brand-logo-light {
  display: none;
}

:root:has(.redoc.dark) .brand-logo-dark {
  display: block;
}

.brand-sub {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-color-secondary, #3b3c45);
  text-decoration: none;
  padding-left: 10px;
  border-left: 1px solid var(--border-color-primary, #ededf2);
  line-height: 1;
}

.controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.control-label {
  color: var(--text-color-secondary, #3b3c45);
}

.control select {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  height: 32px;
  padding: 0 28px 0 10px;
  font: inherit;
  font-size: 13px;
  color: var(--text-color-primary, #1a1c21);
  background-color: var(--bg-color, #ffffff);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%239b9ca8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  border: 1px solid var(--border-color-primary, #ededf2);
  border-radius: 6px;
  cursor: pointer;
}

.control select:hover,
.theme-toggle:hover {
  border-color: var(--color-warm-grey-5, #9b9ca8);
}

.control select:focus-visible,
.theme-toggle:focus-visible {
  outline: 2px solid var(--color-primary-500, #3f6ad8);
  outline-offset: 1px;
}

.control select:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Theme toggle: cycles auto -> light -> dark, the icon shows the current mode. */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--text-color-secondary, #3b3c45);
  background-color: var(--bg-color, #ffffff);
  border: 1px solid var(--border-color-primary, #ededf2);
  border-radius: 6px;
  cursor: pointer;
}

.theme-icon {
  display: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon-auto path {
  fill: currentColor;
}

/* Match Redoc: moon on the light theme, sun on the dark theme. */
.theme-toggle[data-mode="auto"] .theme-icon-auto,
.theme-toggle[data-mode="light"] .theme-icon-moon,
.theme-toggle[data-mode="dark"] .theme-icon-sun {
  display: block;
}

#notice {
  padding: 10px 20px;
  font-size: 13px;
  background: var(--color-warm-grey-2, #ededf2);
  color: var(--text-color-primary, #1a1c21);
  border-bottom: 1px solid var(--border-color-primary, #ededf2);
}

#notice[hidden] {
  display: none;
}

@media (max-width: 640px) {
  #topbar {
    padding: 0 12px;
    gap: 8px;
  }

  .brand-sub {
    display: none;
  }

  .control-label {
    display: none;
  }

  .controls {
    gap: 8px;
  }
}

@media (max-width: 420px) {
  .brand {
    gap: 6px;
    font-size: 25px;
  }
}
