/* site-nav.css — Unified WikiMapping navigation bar
   Used across: projects.html, project-edit.html, data.html, gallery.html
   Brand: #1568A0 (nav blue)  #8BC441 (accent green)

   The nav background color can be overridden via --site-nav-bg custom property.
   Gallery pages set this from their brand_color after fetching metadata.
*/

/* ── Skip-to-main link (a11y) ──────────────────────── */
.skip-nav-link:focus {
  position: fixed !important;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100; /* above site-nav (1040) */
  background: #fff;
  color: var(--menu-color, #1568A0);
  padding: .5rem 1.25rem;
  border-radius: .375rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
}

/* ── Main nav container ─────────────────────────────── */
.site-nav {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1040;
  background: var(--site-nav-bg, #1568A0);
  height: 56px;
}

.site-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 1rem;
}

/* ── Left group: hamburger + brand + optional title ── */
.site-nav-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0; /* allow shrink on small screens */
}

/* Hamburger — hidden by default; shown on mobile via .has-sidebar */
.site-nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.25rem;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  line-height: 1;
}

/* Brand lockup: logo + "WikiMapping" */
.site-nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  text-decoration: none;
}
.site-nav-brand:hover {
  opacity: 0.9;
  color: #fff;
}

.site-nav-brand img {
  height: 32px;
  width: auto;
}

.site-nav-brand-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

/* Optional page/project title next to brand */
.site-nav-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.site-nav-title::before {
  content: '/';
  margin: 0 0.45rem;
  opacity: 0.5;
}

/* ── Right group: page actions + auth ────────────────── */
.site-nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Shared base for action buttons */
.site-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, opacity 0.15s;
  line-height: 1.4;
}

/* Light style — solid white background */
.site-nav-btn-light {
  background: #fff;
  color: #333;
}
.site-nav-btn-light:hover {
  background: #f0f0f0;
  color: #333;
}

/* Outline style — transparent with white border */
.site-nav-btn-outline {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,0.6);
}
.site-nav-btn-outline:hover {
  background: rgba(255,255,255,0.15);
  border-color: #fff;
  color: #fff;
}

/* Icon-only button (bell, info, etc.) */
.site-nav-btn-icon {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 0.3rem 0.5rem;
  position: relative;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}
.site-nav-btn-icon:hover {
  background: rgba(255,255,255,0.12);
}

/* Notification badge (on bell) */
.site-nav-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #e74c3c;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 7px;
  line-height: 14px;
  text-align: center;
  display: none;
}

/* Gentle pulse when unread announcements exist */
@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.6); }
  50%      { box-shadow: 0 0 6px 3px rgba(231, 76, 60, 0); }
}
.site-nav-badge.pulse {
  animation: badge-pulse 2s ease-in-out infinite;
}

/* Bell highlight — gold when unread messages exist */
#bell.bell-has-unread {
  color: #ffd700;
  border-color: rgba(255, 215, 0, 0.6);
}
#bell.bell-has-unread:hover {
  background: rgba(255, 215, 0, 0.15);
}

/* Vertical divider between actions and auth */
.site-nav-divider {
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,0.3);
  margin: 0 0.15rem;
}

/* ── Auth section (login/register or logout) ─────────── */
.site-nav-auth {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.site-nav-login {
  color: #fff;
  text-decoration: none;
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 4px;
  transition: background 0.15s;
}
.site-nav-login:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.site-nav-register {
  background: #8BC441;
  color: #fff;
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.15s;
}
.site-nav-register:hover {
  background: #79b035;
  color: #fff;
}

.site-nav-logout {
  background: transparent;
  border: none;
  color: #fff;
  padding: 0.3rem 0.5rem;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0.85;
  line-height: 1;
}
.site-nav-logout:hover {
  opacity: 1;
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 767.98px) {
  /* Show hamburger only when a sidebar is configured */
  .site-nav-hamburger.has-sidebar {
    display: inline-flex;
  }

  /* Hide button text labels on mobile; keep icons */
  .site-nav-btn .btn-label {
    display: none;
  }

  /* Hide "WikiMapping" text on mobile to save space */
  .site-nav-brand-text {
    display: none;
  }

  /* Shrink title on mobile */
  .site-nav-title {
    max-width: 120px;
  }
  .site-nav-title::before {
    display: none;
  }

  /* Hide non-essential action buttons on mobile to make room for hamburger */
  .site-nav-actions {
    gap: 0.25rem;
  }
  .site-nav-actions .site-nav-btn-outline {
    display: none;
  }
  .site-nav-btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
  }
}

@media (min-width: 768px) {
  .site-nav-inner {
    padding: 0 1.5rem;
  }
}

/* ── project-edit.html layout fix ───────────────────── */
/* The fixed nav is out of document flow; body padding-top (set by site-nav.js)
   pushes content below it.  pe-shell's own padding is zeroed to avoid doubling.
   --pe-hdr-h = 66px = 56px nav + 10px gap for viewport-height calculations. */
.site-nav ~ .pe-shell {
  padding-top: 0;
}
.site-nav ~ .pe-shell {
  --pe-hdr-h: 66px;
}
