/*
  The qStored app switcher (js/qstored-switcher.js). It uses the page's own colours where the page has
  the shared ones (no5tyle.css: --surface, --text, --muted, --hover, --border, --tint), and its own otherwise.
  The same file is in programmer, qstored-internal and qstored-account. Change all three together.
*/
qs-app-switcher {
  --qs-switch-size: 36px;
  --qs-surface: var(--surface, #fff);
  --qs-text: var(--text, #1d1d1f);
  --qs-muted: var(--muted, #6e6e73);
  --qs-hover: var(--hover, rgba(118, 118, 128, 0.1));
  --qs-border: var(--border, rgba(60, 60, 67, 0.16));
  --qs-tint: var(--tint, #007aff);
  --qs-tint-fill: var(--tint-fill, rgba(0, 122, 255, 0.12));
  --qs-focus: var(--focus-ring, rgba(0, 122, 255, 0.35));
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
}
@media (prefers-color-scheme: dark) {
  qs-app-switcher {
    --qs-surface: var(--surface, #1c1c1e);
    --qs-text: var(--text, #f2f2f7);
    --qs-muted: var(--muted, #98989f);
    --qs-hover: var(--hover, rgba(118, 118, 128, 0.24));
    --qs-border: var(--border, rgba(84, 84, 88, 0.6));
    --qs-tint: var(--tint, #0a84ff);
    --qs-tint-fill: var(--tint-fill, rgba(10, 132, 255, 0.2));
  }
}

/* Once the switcher has drawn itself, the stand-in it held is hidden (but left in place) */
qs-app-switcher.qs-switch > :not(.qs-switch-btn, .qs-switch-menu, .qs-switch-backdrop) {
  display: none !important;
}

.qs-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 0;
  margin: -4px;
  padding: 4px 3px 4px 4px;
  border: 0;
  border-radius: calc(var(--qs-switch-size) * 0.28 + 4px);
  background: transparent;
  color: var(--qs-muted);
  font: inherit;
  cursor: pointer;
  transition: background-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.qs-switch-btn:hover,
.qs-switch-btn[aria-expanded='true'] {
  background: var(--qs-hover);
  color: var(--qs-text);
}
.qs-switch-btn:focus-visible {
  outline: 3px solid var(--qs-focus);
  outline-offset: 2px;
}
.qs-switch-icon,
.qs-switch-icon svg {
  display: block;
  width: var(--qs-switch-size);
  height: var(--qs-switch-size);
}
.qs-switch-chevron {
  width: 12px;
  height: 12px;
  flex: none;
  transition: transform 0.2s;
}
.qs-switch-btn[aria-expanded='true'] .qs-switch-chevron {
  transform: rotate(180deg);
}

.qs-switch-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999;
}
.qs-switch-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: -4px;
  z-index: 1000;
  display: grid;
  gap: 2px;
  width: min(20rem, calc(100vw - 24px));
  padding: 6px;
  border-radius: 1.375rem;
  background: var(--qs-surface);
  color: var(--qs-text);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.16), 0 0 0 0.5px var(--qs-border);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.3;
  text-align: left;
  transform-origin: top left;
  animation: qs-switch-in 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}
.qs-switch-backdrop[hidden],
.qs-switch-menu[hidden] {
  display: none;
}
@keyframes qs-switch-in {
  from { opacity: 0; transform: scale(0.92); }
}
@media (prefers-reduced-motion: reduce) {
  .qs-switch-menu { animation: none; }
}

.qs-switch-head {
  padding: 6px 10px 4px;
  color: var(--qs-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.qs-switch-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 52px;
  padding: 6px 10px;
  border-radius: 0.75rem;
  color: var(--qs-text);
  text-decoration: none;
}
.qs-switch-item:hover,
.qs-switch-item:focus-visible {
  background: var(--qs-hover);
  outline: none;
  text-decoration: none;
}
.qs-switch-item[aria-current='page'] {
  background: var(--qs-tint-fill);
}
.qs-switch-item-icon,
.qs-switch-item-icon svg {
  display: block;
  width: 36px;
  height: 36px;
  flex: none;
}
.qs-switch-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}
.qs-switch-name {
  font-weight: 600;
}
.qs-switch-tagline {
  overflow: hidden;
  color: var(--qs-muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qs-switch-check {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--qs-tint);
}
@media print {
  qs-app-switcher { display: none !important; }
}
