/* ╔══════════════════════════════════════════════════════════════╗
   ║  navbar.css — Top navigation bar                            ║
   ╚══════════════════════════════════════════════════════════════╝ */

/* ── Nav wrapper ── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9000;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(0,0,0,.08), 0 2px 16px rgba(0,0,0,.06);
  transition: box-shadow 0.3s;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 12px 40px;
  padding-top: max(12px, env(safe-area-inset-top));
  padding-left: max(40px, env(safe-area-inset-left));
  padding-right: max(40px, env(safe-area-inset-right));
}
nav.scrolled { box-shadow: 0 1px 0 rgba(0,0,0,.1), 0 4px 24px rgba(0,0,0,.1); }

/* ── Logo ── */
.logo {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex-shrink: 0;
  text-decoration: none;
}
.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--green), var(--green2));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; flex-shrink: 0;
}
.logo-text { line-height: 1.2; }
.logo-text b    { font-size: 1rem; font-weight: 800; color: var(--green); display: block; letter-spacing: .02em; }
.logo-text span { font-size: 0.68rem; color: var(--gray); white-space: nowrap; }

/* ── Desktop nav menu ── */
.nav-menu {
  display: flex;
  flex-direction: row;
  align-items: center;   /* vertically centre every <li> in the bar */
  gap: 2px;
  list-style: none;
  margin: 0; padding: 0;
  flex-wrap: nowrap;
}

/* Every list item: same height, no extra margin */
.nav-item {
  position: relative;
  display: flex;
  align-items: center;  /* keeps the child link centred inside the li */
  margin: 0; padding: 0;
}

/*
  KEY FIX — both <a class="nav-link"> and <button class="nav-link">
  must have identical box model so they sit on the same baseline.
  Browsers give <button> extra padding/margin and a different line-height
  by default; we reset all of that here.
*/
.nav-link,
a.nav-link,
button.nav-link {
  /* reset browser button defaults */
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  line-height: 1;        /* same for <a> and <button> */
  vertical-align: middle;

  /* shared layout */
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  height: 36px;          /* fixed height so every item is exactly the same */
  padding: 0 13px;
  border-radius: 7px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--dark);
  cursor: pointer;
  white-space: nowrap;
  background: none;
  border: none;
  font-family: inherit;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: background 0.18s, color 0.18s;
  box-sizing: border-box;
}
.nav-link:hover,
.nav-link.active { color: var(--green); background: var(--gl); }

.nav-link .arr { font-size: 0.58rem; transition: transform 0.25s; opacity: .7; }
.nav-item:hover > .nav-link .arr { transform: rotate(180deg); }

/* Donate button */
.nav-cta {
  background: var(--green) !important;
  color: #fff !important;
  height: 36px !important;
  padding: 0 18px !important;
  border-radius: 8px !important;
  font-size: 0.83rem !important;
  margin-left: 8px;
}
.nav-cta:hover { background: var(--green2) !important; transform: translateY(-1px); }

/* ── Dropdown ── */
.dropdown {
  position: absolute;
  top: calc(100% + 8px); left: 0;
  min-width: 215px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,.12);
  border: 1px solid #eee;
  padding: 8px;
  opacity: 0; visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s;
  z-index: 9100;
}
.nav-item:hover > .dropdown { opacity: 1; visibility: visible; transform: translateY(0); }

.dd-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  font-size: 0.82rem; font-weight: 500;
  color: var(--dark); cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.dd-link:hover, .dd-link.active { background: var(--gl); color: var(--green); }
.dd-link i { width: 18px; text-align: center; color: var(--green); font-size: 0.83rem; }

/* ── Hamburger ── */
.ham {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  background: none; border: none;
}
.ham span {
  width: 24px; height: 2px;
  background: var(--dark);
  border-radius: 2px;
  transition: all 0.3s; display: block;
}

/* ── Mobile Drawer ── */
.drawer-overlay {
  display: none; position: fixed;
  top: var(--nav-h); left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.4); z-index: 8000;
}
.drawer-overlay.open { display: block; }

.drawer {
  position: fixed; top: var(--nav-h); right: -100%;
  width: min(300px, 85vw); height: calc(100% - var(--nav-h));
  background: #fff; z-index: 8500;
  transition: right 0.32s cubic-bezier(0.4,0,0.2,1);
  display: flex; flex-direction: column; overflow-y: auto;
}
.drawer.open { right: 0; }

.drawer-head {
  display: flex; align-items: center; justify-content: flex-end;
  padding: 10px 16px; border-bottom: 1px solid #eee; flex-shrink: 0;
}
.drawer-head .logo { display: none; }
.drawer-close {
  background: #f5f5f5; border: none; border-radius: 8px;
  width: 36px; height: 36px; font-size: 1.1rem;
  cursor: pointer; color: var(--dark); display: flex;
  align-items: center; justify-content: center;
}
.drawer-nav { padding: 10px 0; flex: 1; }

.drawer-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; font-weight: 600; font-size: 0.9rem; cursor: pointer;
  border-bottom: 1px solid #f5f5f5; color: var(--dark); gap: 10px;
}
.drawer-top span { display: flex; align-items: center; gap: 10px; }
.drawer-top:hover { color: var(--green); background: var(--gl); }
.drawer-top .darr { transition: transform 0.25s; color: var(--gray); font-size: 0.7rem; }
.drawer-item.open .darr { transform: rotate(180deg); }

.drawer-sub { display: none; background: #fafafa; border-bottom: 1px solid #f0f0f0; }
.drawer-item.open .drawer-sub { display: block; }
.drawer-sub a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 32px; font-size: 0.85rem; color: var(--gray); transition: color 0.2s;
}
.drawer-sub a:hover { color: var(--green); }
.drawer-sub i { width: 16px; text-align: center; font-size: 0.8rem; color: var(--green); }

.drawer-donate { margin: 16px 20px; }
.drawer-donate a {
  display: block; text-align: center;
  background: var(--green); color: #fff;
  padding: 13px; border-radius: 9px;
  font-weight: 700; font-size: 0.9rem;
}

/* ── Responsive ── */
@media (max-width: 960px) {
  .nav-menu { display: none; }
  .nav-actions { display: none; }
  .ham { display: flex; }
  nav {
    padding: 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top));
  }
}
