/* The account pill in the top nav + its dropdown.
   Rendered by partials/profile_pill.html, driven by /static/js/profile-pill.js.

   Everything is namespaced under .bs-pill because the pages that mount it bring
   their own page stylesheet (settings.css, viewer.css) with bare-element rules.
   Colours are theme tokens only, so light and dark both come for free. */

.bs-pill {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.bs-pill [hidden] {
  display: none !important;
}

.bs-pill .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── The pill itself ──────────────────────────────────────────────────────── */
.bs-pill-btn {
  --pill-accent: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid var(--border2);
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.16s, box-shadow 0.16s, transform 0.16s;
}

.bs-pill-btn:hover {
  border-color: var(--pill-accent);
  transform: translateY(-1px);
}

.bs-pill-btn:focus-visible {
  outline: none;
  border-color: var(--pill-accent);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

/* Open, or sitting on /profile: keep the accent ring on. */
.bs-pill-btn[aria-expanded="true"],
.bs-pill.is-current .bs-pill-btn {
  border-color: var(--pill-accent);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.bs-pill-initials {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--pill-accent);
}

.bs-pill-emoji {
  font-size: 17px;
  line-height: 1;
}

.bs-pill-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── The dropdown ─────────────────────────────────────────────────────────── */
.bs-pill-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 248px;
  max-width: calc(100vw - 32px);
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--card-shadow), 0 12px 32px rgba(0, 0, 0, 0.25);
  z-index: 1100;
}

.bs-pill-head {
  padding: 10px 12px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.bs-pill-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bs-pill-email {
  font-size: 11.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bs-pill-meta {
  margin-top: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--brand);
}

.bs-pill-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.bs-pill-item:hover {
  background: var(--surface2);
}

.bs-pill-item:focus-visible {
  outline: none;
  background: var(--surface2);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.bs-pill-item.is-danger {
  color: var(--red);
}

.bs-pill-item.is-danger:hover {
  background: var(--red-bg);
}

@media (max-width: 600px) {
  .bs-pill-menu {
    width: 232px;
  }
}
