/* Page header, the same on every page: .topbar (js/ui/site-header.js, signed-in pages) and .auth-topbar
   (login and sign-up), plus the account menu. Dark panel with a gold glow and gold top edge, like the
   Predictions "big picture" card. Tokens come from css/surfaces.css.
   Load order: styles.css, surfaces.css, header.css, then page CSS. */

/* Bar. No overflow clipping here: the account menu opens below it. */
.topbar,
.auth-topbar {
  position: relative;
  display: grid;
  min-height: 64px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding: 9px 16px;
  border: 1px solid var(--surface-dark-border);
  border-radius: 20px;
  background: var(--surface-dark-bg);
  box-shadow: 0 12px 28px -16px rgb(37 37 35 / 70%);
  color: var(--white);
}
.topbar::before,
.auth-topbar::before {
  position: absolute;
  inset: 0 18px auto;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--gold-edge);
  content: "";
  pointer-events: none;
}
.auth-topbar { grid-template-columns: minmax(0, 1fr) auto; }

.brand {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 11px;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 780;
  letter-spacing: -.04em;
}
.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--gold-coin);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 55%), 0 2px 5px -1px rgb(160 120 20 / 45%);
  color: var(--ink);
  font-size: 19px;
}
.topbar .brand-mark { transition: transform .2s ease; }
.topbar .brand:hover .brand-mark { transform: rotate(18deg); }
.topbar-label { color: #e2cf8d; }
.topbar .brand:focus-visible,
.auth-topbar .brand:focus-visible { outline: 2px solid var(--yellow); outline-offset: 4px; }

/* Account button and menu */
.profile-menu { position: relative; justify-self: end; }
.avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 2px solid rgb(255 254 250 / 85%);
  border-radius: 50%;
  background: var(--gold-coin);
  box-shadow: 0 0 0 1px rgb(245 214 83 / 45%), 0 3px 10px rgb(0 0 0 / 30%);
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}
.profile-menu-trigger { cursor: pointer; transition: box-shadow .18s, transform .18s; }
.profile-menu-trigger:hover,
.profile-menu-trigger[aria-expanded="true"] { box-shadow: 0 0 0 4px rgb(245 214 83 / 38%), 0 3px 10px rgb(0 0 0 / 30%); transform: translateY(-1px); }
.topbar .profile-menu-trigger:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }
.account-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 21px);
  right: 0;
  display: grid;
  width: 246px;
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--gold-border);
  border-radius: 18px;
  background: var(--surface-paper-bg);
  box-shadow: 0 20px 46px -8px rgb(37 37 35 / 30%);
  animation: account-menu-in .16s ease-out;
  color: var(--ink);
}
@keyframes account-menu-in {
  from { opacity: 0; transform: translateY(-5px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.account-menu-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
  padding: 12px;
  border: 1px solid var(--surface-dark-border);
  border-radius: 13px;
  background: var(--surface-dark-bg);
  color: var(--white);
}
.account-menu-mark {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--gold-coin);
  color: var(--ink);
  font-size: 16px;
}
.account-menu-heading div { display: grid; gap: 3px; }
.account-menu-heading strong { font-size: 11.5px; }
.account-menu-heading small { color: #e2cf8d; font-size: 9.5px; }
.account-menu a,
.account-menu button {
  display: flex;
  width: 100%;
  min-height: 41px;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  text-align: left;
  transition: background .16s, border-color .16s, color .16s;
}
.account-menu a:hover { border-color: var(--gold-line); background: var(--gold-50); }
.account-menu a[aria-current="page"] { border-color: #ebdfb8; background: var(--surface-header-bg); font-weight: 750; }
.account-menu-icon {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  place-items: center;
  border-radius: 50%;
  background: var(--gold-100);
  color: var(--gold-ink);
  font-size: 13px;
}
.account-menu a[aria-current="page"] .account-menu-icon { background: var(--gold-coin); color: var(--ink); }
.account-menu-arrow { margin-left: auto; color: var(--gold-label); font-size: 18px; line-height: 1; }
.account-menu button { position: relative; margin-top: 10px; color: #8d3935; }
.account-menu button::before { position: absolute; top: -8px; right: 8px; left: 8px; height: 1px; background: var(--gold-line); content: ""; }
.account-menu button:hover { border-color: #eed3cf; background: #fbf0ee; }
.account-menu button .account-menu-icon { background: #f8e6e3; color: #8d3935; }
.account-menu a:focus-visible,
.account-menu button:focus-visible { outline: 2px solid var(--gold-ink); outline-offset: -2px; }

@media (max-width: 780px) {
  .topbar,
  .auth-topbar { min-height: 56px; grid-template-columns: minmax(0, 1fr) auto; margin-bottom: 12px; padding: 7px 10px; border-radius: 17px; }
  .topbar-label { display: none; }
  .brand-mark { width: 34px; height: 34px; }
  .account-menu { max-width: calc(100vw - 24px); }
}
@media (prefers-reduced-motion: reduce) {
  .account-menu { animation: none; }
  .topbar .brand:hover .brand-mark, .profile-menu-trigger:hover { transform: none; }
}
