/* ============================================================
   P4T GLOBAL — TOP BAR + NAVBAR
   File: css/navbar.css
   Prefix: menu-and-top-bar-p4t1
   ============================================================ */

/* ============================================
   TOP BAR
   ============================================ */
.menu-and-top-bar-p4t1-top-bar {
  background-color: var(--p4t-primary-black);
  width: 100%;
  height: 46px;
  overflow: hidden;
  transition: height 0.3s ease, opacity 0.3s ease;
}
.menu-and-top-bar-p4t1-top-bar.is-hidden {
  height: 0;
  opacity: 0;
  pointer-events: none;
}
.menu-and-top-bar-p4t1-top-bar-content {
  max-width: 100%;
  margin: 0 auto;
  padding: var(--p4t-content-padding);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.menu-and-top-bar-p4t1-top-bar-left,
.menu-and-top-bar-p4t1-top-bar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}
.menu-and-top-bar-p4t1-top-bar-left a {
  font-family: var(--p4t-body-font);
  font-size: 16px;
  color: var(--p4t-light-gray);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.3s ease;
}
.menu-and-top-bar-p4t1-top-bar-left a:visited { color: var(--p4t-light-gray); }
.menu-and-top-bar-p4t1-top-bar-left a:hover   { color: var(--p4t-primary-orange); }
.menu-and-top-bar-p4t1-top-bar-left a i       { font-size: 14px; color: var(--p4t-primary-orange); }

.menu-and-top-bar-p4t1-utility-links {
  display: flex;
  align-items: center;
  gap: 18px;
}
.menu-and-top-bar-p4t1-utility-links a {
  font-family: var(--p4t-body-font);
  font-size: 16px;
  color: var(--p4t-light-gray);
  text-decoration: none;
  position: relative;
  padding-bottom: 1px;
  transition: color 0.3s ease;
}
.menu-and-top-bar-p4t1-utility-links a:visited { color: var(--p4t-light-gray); }
.menu-and-top-bar-p4t1-utility-links a::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 0; height: 1px;
  background-color: var(--p4t-primary-orange);
  transition: width 0.3s ease;
}
.menu-and-top-bar-p4t1-utility-links a:hover        { color: var(--p4t-primary-orange); }
.menu-and-top-bar-p4t1-utility-links a:hover::after { width: 100%; }

.menu-and-top-bar-p4t1-donate-btn-top {
  font-family: var(--p4t-body-font);
  font-size: 16px;
  font-weight: 700;
  background-color: var(--p4t-primary-orange);
  color: var(--p4t-white) !important;
  padding: 5px 16px;
  border-radius: 4px;
  text-decoration: none;
  letter-spacing: 0.03em;
  white-space: nowrap;
  transition: background-color 0.3s ease, transform 0.2s ease;
}
.menu-and-top-bar-p4t1-donate-btn-top:visited { color: var(--p4t-white) !important; }
.menu-and-top-bar-p4t1-donate-btn-top:hover {
  background-color: var(--p4t-sunset);
  color: var(--p4t-white) !important;
  transform: translateY(-1px);
}

/* ============================================
   NAVBAR — DESKTOP
   ============================================ */
.menu-and-top-bar-p4t1-navbar {
  background-color: var(--p4t-white);
  border-bottom: 1px solid var(--p4t-light-gray);
  width: 100%;
  height: 74px;
  /* NOTE: no z-index here on purpose — adding z-index creates a stacking
     context that would trap anything positioned inside the nav */
  position: relative;
}
.menu-and-top-bar-p4t1-navbar.is-sticky {
  position: fixed !important;
  top: 0; left: 0; right: 0;
  width: 100%;
  height: 74px;
  z-index: 900;
  box-shadow: 0 2px 24px rgba(0,0,0,0.10);
  animation: p4t1-slideDown 0.3s ease forwards;
}
@keyframes p4t1-slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
.menu-and-top-bar-p4t1-navbar-content {
  max-width: 100%;
  margin: 0 auto;
  padding: var(--p4t-content-padding);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.menu-and-top-bar-p4t1-logo a {
  display: flex;
  align-items: center;
}
.menu-and-top-bar-p4t1-logo img { height: 46px; width: auto; }

/* ── Desktop Nav Menu ── */
.menu-and-top-bar-p4t1-desktop-nav {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  align-items: center;
  gap: 2px;
}
.menu-and-top-bar-p4t1-nav-item { position: relative; }
.menu-and-top-bar-p4t1-nav-link {
  font-family: var(--p4t-body-font);
  font-size: 18px;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--p4t-primary-black) !important;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: 5px;
  white-space: nowrap;
  transition: color 0.3s ease, background-color 0.3s ease;
}
.menu-and-top-bar-p4t1-nav-link:visited { color: var(--p4t-primary-black) !important; }
.menu-and-top-bar-p4t1-nav-link:hover,
.menu-and-top-bar-p4t1-nav-item:hover > .menu-and-top-bar-p4t1-nav-link {
  color: var(--p4t-primary-orange) !important;
  background-color: var(--p4t-very-light-gray);
}
.menu-and-top-bar-p4t1-nav-link .fa-chevron-down {
  font-size: 13px;
  opacity: 0.6;
  transition: transform 0.3s ease;
}

/* ── Desktop Dropdown ── */
.menu-and-top-bar-p4t1-desktop-nav .menu-and-top-bar-p4t1-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 210px;
  background-color: var(--p4t-white);
  border: 1px solid var(--p4t-light-gray);
  border-top: 3px solid var(--p4t-primary-orange);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 10px 32px rgba(0,0,0,0.10);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
  z-index: 901;
}
.menu-and-top-bar-p4t1-desktop-nav .menu-and-top-bar-p4t1-dropdown:hover
  > .menu-and-top-bar-p4t1-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.menu-and-top-bar-p4t1-desktop-nav .menu-and-top-bar-p4t1-dropdown:hover
  > .menu-and-top-bar-p4t1-nav-link .fa-chevron-down {
  transform: rotate(-180deg);
  opacity: 1;
  color: var(--p4t-primary-orange);
}
.menu-and-top-bar-p4t1-dropdown-right > .menu-and-top-bar-p4t1-dropdown-menu {
  left: auto;
  right: 0;
}
.menu-and-top-bar-p4t1-dropdown-menu-items {
  list-style: none;
  margin: 0; padding: 0;
}
.menu-and-top-bar-p4t1-dropdown-item a {
  display: block;
  font-family: var(--p4t-body-font);
  font-size: 17px;
  font-weight: 500;
  color: var(--p4t-primary-black) !important;
  text-decoration: none;
  padding: 9px 14px;
  border-radius: 5px;
  white-space: nowrap;
  background-color: transparent;
  transition: background-color 0.22s ease, color 0.22s ease, padding-left 0.22s ease;
}
.menu-and-top-bar-p4t1-dropdown-item a:visited { color: var(--p4t-primary-black) !important; }
.menu-and-top-bar-p4t1-dropdown-item a:hover {
  background-color: var(--p4t-very-light-gray) !important;
  color: var(--p4t-primary-orange) !important;
  padding-left: 20px;
}

/* ── Donate button in nav — shows only when sticky ── */
.menu-and-top-bar-p4t1-donate-nav-item {
  margin-left: 8px;
  display: none;
}
.menu-and-top-bar-p4t1-navbar.is-sticky .menu-and-top-bar-p4t1-donate-nav-item {
  display: flex;
  align-items: center;
}
.menu-and-top-bar-p4t1-donate-btn-nav {
  font-family: var(--p4t-body-font);
  font-size: 18px;
  font-weight: 700;
  background-color: var(--p4t-primary-orange);
  color: var(--p4t-white) !important;
  padding: 9px 22px;
  border-radius: 5px;
  text-decoration: none;
  letter-spacing: 0.02em;
  white-space: nowrap;
  display: inline-block;
  transition: background-color 0.3s ease, transform 0.2s ease;
}
.menu-and-top-bar-p4t1-donate-btn-nav:visited { color: var(--p4t-white) !important; }
.menu-and-top-bar-p4t1-donate-btn-nav:hover {
  background-color: var(--p4t-sunset);
  color: var(--p4t-white) !important;
  transform: translateY(-1px);
}

/* ── Active state ── */
.menu-and-top-bar-p4t1-nav-link.is-active {
  color: var(--p4t-primary-orange) !important;
}
.menu-and-top-bar-p4t1-dropdown-item a.is-active {
  color: var(--p4t-primary-orange) !important;
  font-weight: 700;
  background-color: var(--p4t-very-light-gray);
}

/* ── Hamburger button ── */
.menu-and-top-bar-p4t1-mobile-toggle {
  display: none;
  background: none;
  border: 1.5px solid var(--p4t-light-gray);
  border-radius: 5px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--p4t-primary-black);
  font-size: 18px;
  transition: border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease;
  outline: none;
}
.menu-and-top-bar-p4t1-mobile-toggle:hover {
  border-color: var(--p4t-primary-orange);
  background-color: var(--p4t-very-light-gray);
  color: var(--p4t-primary-orange);
}

/* ============================================
   MOBILE BACKDROP
   Direct child of <body> — free stacking context
   ============================================ */
.menu-and-top-bar-p4t1-mobile-backdrop {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1049;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}
.menu-and-top-bar-p4t1-mobile-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
}

/* ============================================
   MOBILE SLIDE PANEL
   Direct sibling of <nav> — NOT inside nav.
   Free of nav's stacking context.
   ============================================ */
.menu-and-top-bar-p4t1-mobile-panel {
  position: fixed;
  top: 0; left: 0;
  width: 82%;
  max-width: 320px;
  height: 100vh;
  height: 100dvh;

  /* Hard white — no rgba, no inherit */
  background: #ffffff;

  /* Above backdrop (1049), well above nav (900) */
  z-index: 1050;

  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 6px 0 32px rgba(0, 0, 0, 0.22);

  /* Slide via transform only — never use left for animation */
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);

  /* Hidden from assistive tech and pointer events when closed */
  visibility: hidden;
  pointer-events: none;

  display: flex;
  flex-direction: column;
}
.menu-and-top-bar-p4t1-mobile-panel.is-open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

/* ── Panel header ── */
.p4t-mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 2px solid #e0e0e0;
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 2;
  flex-shrink: 0;
}
.p4t-mobile-menu-header img { height: 36px; width: auto; }

.p4t-mobile-close-btn {
  background: none;
  border: none;
  font-size: 22px;
  color: #000000;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.p4t-mobile-close-btn:hover {
  color: var(--p4t-primary-orange, #F37021);
  background-color: #f5f5f5;
}

/* ============================================
   RESPONSIVE — MOBILE (max 991px)
   ============================================ */
@media (max-width: 991px) {

  /* Top bar */
  .menu-and-top-bar-p4t1-top-bar { height: auto; }
  .menu-and-top-bar-p4t1-top-bar.is-hidden { height: 0; opacity: 0; }
  .menu-and-top-bar-p4t1-top-bar-content {
    flex-direction: column;
    padding: 8px 20px;
    gap: 6px;
    height: auto;
  }
  .menu-and-top-bar-p4t1-top-bar-left,
  .menu-and-top-bar-p4t1-top-bar-right {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  /* Navbar */
  .menu-and-top-bar-p4t1-navbar {
    height: auto !important;
    min-height: 64px;
  }
  .menu-and-top-bar-p4t1-navbar.is-sticky {
    position: fixed !important;
    height: auto !important;
    min-height: 64px;
  }
  .menu-and-top-bar-p4t1-navbar-content {
    padding: 12px 20px;
    height: auto;
    flex-wrap: nowrap;
    justify-content: space-between;
  }

  /* Show hamburger, hide desktop nav */
  .menu-and-top-bar-p4t1-mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .menu-and-top-bar-p4t1-desktop-nav { display: none !important; }

  /* ── Nav list inside mobile panel ── */
  .menu-and-top-bar-p4t1-mobile-panel .menu-and-top-bar-p4t1-nav-menu {
    list-style: none;
    margin: 0;
    padding: 6px 0 24px;
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
  }

  /* Top-level links */
  .menu-and-top-bar-p4t1-mobile-panel .menu-and-top-bar-p4t1-nav-link {
    padding: 15px 20px;
    border-radius: 0;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    color: #111111 !important;
    font-size: 16px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
    transition: color 0.2s ease, background-color 0.2s ease;
  }
  .menu-and-top-bar-p4t1-mobile-panel .menu-and-top-bar-p4t1-nav-link:visited {
    color: #111111 !important;
  }
  .menu-and-top-bar-p4t1-mobile-panel .menu-and-top-bar-p4t1-nav-link:hover {
    color: var(--p4t-primary-orange, #F37021) !important;
    background-color: #f5f5f5;
  }
  .menu-and-top-bar-p4t1-mobile-panel .menu-and-top-bar-p4t1-nav-link .fa-chevron-down {
    font-size: 13px;
    opacity: 0.45;
    flex-shrink: 0;
    transition: transform 0.25s ease;
  }

  /* Open dropdown — remove bottom border so it merges cleanly with sub-menu */
  .menu-and-top-bar-p4t1-mobile-panel .menu-and-top-bar-p4t1-dropdown.is-open
    > .menu-and-top-bar-p4t1-nav-link {
    color: var(--p4t-primary-orange, #F37021) !important;
    background-color: #f5f5f5;
    border-bottom: none !important;
  }
  .menu-and-top-bar-p4t1-mobile-panel .menu-and-top-bar-p4t1-dropdown.is-open
    > .menu-and-top-bar-p4t1-nav-link .fa-chevron-down {
    transform: rotate(-180deg);
    opacity: 1;
    color: var(--p4t-primary-orange, #F37021);
  }

  /* Sub-menu — hidden by default, shown when parent has .is-open */
  .menu-and-top-bar-p4t1-mobile-panel .menu-and-top-bar-p4t1-dropdown-menu {
    display: none !important;
    background-color: #f7f7f7;
    padding: 0 !important;
    margin: 0 !important;
    /* Reset all desktop dropdown positioning */
    position: static !important;
    top: auto !important;
    left: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    min-width: 0 !important;
    z-index: auto !important;
  }
  .menu-and-top-bar-p4t1-mobile-panel .menu-and-top-bar-p4t1-dropdown.is-open
    > .menu-and-top-bar-p4t1-dropdown-menu {
    display: block !important;
  }
  .menu-and-top-bar-p4t1-mobile-panel .menu-and-top-bar-p4t1-dropdown-menu-items {
    list-style: none;
    margin: 0; padding: 0;
  }
  .menu-and-top-bar-p4t1-mobile-panel .menu-and-top-bar-p4t1-dropdown-item a {
    display: block;
    padding: 13px 20px 13px 34px;
    border-bottom: 1px solid rgba(0,0,0,0.07);
    color: #444444 !important;
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-decoration: none;
    background: transparent;
    white-space: normal;
    transition: color 0.2s ease, background-color 0.2s ease, padding-left 0.2s ease;
  }
  .menu-and-top-bar-p4t1-mobile-panel .menu-and-top-bar-p4t1-dropdown-item a:visited {
    color: #444444 !important;
  }
  .menu-and-top-bar-p4t1-mobile-panel .menu-and-top-bar-p4t1-dropdown-item:last-child a {
    border-bottom: 1px solid #e0e0e0;
  }
  .menu-and-top-bar-p4t1-mobile-panel .menu-and-top-bar-p4t1-dropdown-item a:hover {
    background-color: #eeeeee !important;
    color: var(--p4t-primary-orange, #F37021) !important;
    padding-left: 38px;
  }

  /* Donate row inside panel */
  .menu-and-top-bar-p4t1-mobile-panel .menu-and-top-bar-p4t1-donate-nav-item {
    display: flex !important;
    margin: 0;
    padding: 16px 20px 4px;
  }
  .menu-and-top-bar-p4t1-mobile-panel .menu-and-top-bar-p4t1-donate-btn-nav {
    display: block;
    text-align: center;
    width: 100%;
    font-size: 16px;
    padding: 12px 22px;
  }
}

/* ============================================
   VERY SMALL SCREENS (max 576px)
   ============================================ */
@media (max-width: 576px) {
  .menu-and-top-bar-p4t1-utility-links  { display: none !important; }
  .menu-and-top-bar-p4t1-donate-btn-top { display: none !important; }
}