.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--background) 80%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  color: var(--text);
}
.nav-logo-img {
  height: 40px;
  width: auto;
  display: block;
  letter-spacing: -0.01em;
}
@media (prefers-color-scheme: dark) {
  /* The dark-variant artwork is dark-on-light; lift it to stay legible on the
     dark nav background. */
  .nav-logo-img { filter: invert(1) hue-rotate(180deg); }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: center;
}

.nav-link {
  position: relative;
  padding: 8px 14px;
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  opacity: 0.9;
  border-radius: var(--radius-pill);
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.nav-link:hover { color: var(--text); background-color: var(--surface)}
.nav-link.is-active {
  color: var(--unique);
}

.nav-cta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Dropdown menus */
.menu-host { position: relative; }
.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: none;
  z-index: 50;
}
.menu.is-open { display: block; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
}
.menu-item:hover { background: var(--surface); }
.menu-item .menu-icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
  color: var(--text-muted);
}
.menu-item:hover .menu-icon { color: var(--unique); }
.menu-item .menu-sub {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Avatar button */
.avatar-btn {
  width: 50px; height: 50px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface);
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  font-weight: 600;
  color: var(--text);
}
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }

/* Notification bell */
.notif-bell {
  position: relative;
  width: 50px; height: 50px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  border-radius: 50%;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.notif-bell:hover {
  background: var(--surface);
  color: var(--text);
}
.notif-bell:active { transform: scale(0.92); }
.notif-bell.has-unread { color: var(--unique); }

.notif-bell i { font-size: 20px; line-height: 1; }
/* Subtle ring on unread — animates once when the page loads and pauses on hover. */
.notif-bell .ringing {
  transform-origin: top center;
  animation: bell-ring 2.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) 0.6s 1;
}
.notif-bell:hover .ringing { animation: none; }
@keyframes bell-ring {
  0%   { transform: rotate(0); }
  3%   { transform: rotate(14deg); }
  6%   { transform: rotate(-12deg); }
  9%   { transform: rotate(10deg); }
  12%  { transform: rotate(-8deg); }
  15%  { transform: rotate(6deg); }
  18%  { transform: rotate(-4deg); }
  21%  { transform: rotate(0); }
  100% { transform: rotate(0); }
}

/* Badge — pill with a faint pulse halo and a clean entry */
.notif-bell .badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border: 2px solid var(--background);
  box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.45);
  animation: badge-in 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28), badge-pulse 2.2s ease-out 1.5s infinite;
}
@keyframes badge-in {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
@keyframes badge-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(225, 29, 72, 0.45); }
  70%  { box-shadow: 0 0 0 8px rgba(225, 29, 72, 0); }
  100% { box-shadow: 0 0 0 0   rgba(225, 29, 72, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .notif-bell .ringing,
  .notif-bell .badge { animation: none; }
}

/* Mobile (rudimentary, desktop-first) */
@media (max-width: 768px) {
  .nav-inner { gap: 12px; padding: 0 16px; }
  .nav-links { display: none; }
}
