/* ============================================================
   Floating glass icon-pill header
   Self-contained. Loads after tokens.css so custom properties
   resolve. Replaces the old <nav id="nav"> text menu on every
   page.
   ============================================================ */

.app-header {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 8px 32px rgba(20, 30, 45, 0.08);
  font-family: var(--font-text);
}

/* On the landing page, start hidden; header-tooltip.js fades the pill in
   as the user scrolls through #hero, so it has no opacity before JS runs. */
body:has(#hero) .app-header {
  opacity: 0;
  pointer-events: none;
}

.ah-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--mint);
  cursor: pointer;
  object-fit: cover;
  transition: transform 200ms var(--ease-spring);
  text-decoration: none;
  display: inline-block;
  overflow: hidden;
  flex: 0 0 40px;
}
.ah-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.ah-avatar:hover,
.ah-avatar:focus-visible { transform: scale(1.06); outline: none; }

.ah-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--graphite);
  font-size: 18px;
  position: relative;
  transition: color 180ms ease, transform 180ms var(--ease-spring);
  text-decoration: none;
}
.ah-icon:hover,
.ah-icon:focus-visible {
  color: var(--mint);
  transform: translateY(-2px);
  outline: none;
}
.ah-icon[aria-current="page"] { color: var(--mint); }

.ah-tooltip {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: #fff;
  color: var(--ink);
  font: 600 11px/1 var(--font-text);
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms var(--ease-spring);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 1001;
}
.ah-icon:hover .ah-tooltip,
.ah-icon:focus-visible .ah-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ah-more {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  border-radius: 50%;
  color: var(--graphite);
  font-size: 18px;
  cursor: pointer;
}
.ah-more:hover { color: var(--mint); }

.ah-popover {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 8px;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 12px 32px rgba(20, 30, 45, 0.12);
  min-width: 140px;
  flex-direction: column;
  gap: 4px;
}
.ah-popover.open { display: flex; }
.ah-popover .ah-icon { width: 100%; height: 36px; justify-content: flex-start; padding: 0 10px; border-radius: 10px; }

@media (max-width: 768px) {
  .app-header .ah-icon:nth-child(n+6):not(.ah-avatar) { display: none; }
  .ah-more { display: inline-flex; }
  .app-header { position: relative; top: 0; transform: none; left: 0; max-width: 100%; margin: 12px auto; }
  body:not(:has(#hero)) { padding-top: 12px !important; }
}

@media (prefers-reduced-motion: reduce) {
  .ah-avatar,
  .ah-icon,
  .ah-tooltip { transition: none; }
  .ah-avatar:hover { transform: none; }
  .ah-icon:hover { transform: none; }
}
