/* Base Variables */
:root {
    --header-offset: 60px; /* legacy, not used directly */
    --header-height-mobile: 62px; /* mobile header height; 62 + 8 gap = 70px total */
    --nav-panel-margin: 10px;
    --nav-panel-maxwidth: 420px;
    --nav-gap-top: 8px; /* gap below header for panels */
    --nav-panel-margin-right-mobile: 16px; /* extra right margin on small phones */
}

/* Header Styling */
header {
    background: linear-gradient(90deg, #5F07B3, #008DBB);
    color: #fff;
}

/* Layout */
.header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    width: 100%;
}

.header-left,
.header-center,
.header-right {
    display: flex;
    align-items: center;
    min-width: 0; /* allow flex items to shrink */
}

.header-center {
    justify-content: center;
    flex: 1 1 auto;
}

.header-right {
    justify-content: flex-end;
    gap: 12px;
    position: relative;
    flex: 0 0 auto;
}

/* Branding */
.logo { max-width: clamp(110px, 14vw, 150px); flex: 0 0 auto; }
.logo img { width: 100%; height: auto; border-radius: 5px; }

.guidestar-seal img { 
    display: block; 
    height: clamp(48px, 8vw, 80px); 
    width: auto; 
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Navigation Menu */
/*
  Desktop dropdown alignment handled in a desktop media query below.
  Mobile overlay handled inside mobile media queries.
*/
nav {
    position: static; /* default: no special positioning */
}

nav ul {
    display: none;
    flex-direction: column;
    position: absolute; /* used for desktop dropdown + mobile panel content */
    top: 0;
    right: 0;
    transform: none;
    width: 250px;
    background-color: #5F07B3;
    padding: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    z-index: 1001;
}

nav ul.show {
    display: flex;
    animation: slideIn 0.3s forwards;
    /* Pop directly under the hamburger (right-aligned) */
    position: absolute;
    top: var(--nav-gap-top); /* default desktop gap; mobile overrides */
    right: 0;
    left: auto;
    width: auto;
    max-width: min(var(--nav-panel-maxwidth), 90vw);
    max-height: 80vh;
    overflow-y: auto;
}

nav ul li {
    margin-left: 20px;
}

nav ul li a {
    color: white;
    display: block;
    padding: 10px;
    font-size: clamp(14px, 1.8vw, 16px);
    white-space: nowrap;
    position: relative;
    transition: color 0.3s ease;
}

nav ul li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: white;
    transition: width 0.3s ease;
}

nav ul li a:hover::after {
    width: 100%;
}

/* Mobile Menu Trigger */
.menu-icon {
    display: block;
    cursor: pointer;
    font-size: 26px;
    line-height: 1;
    color: #fff;
    position: relative; /* enable z-index to take effect */
    z-index: 1100; /* above overlays */
    padding: 8px;
    margin-right: 4px;
    flex: 0 0 auto; /* never shrink off-screen */
    background: none;
    border: none;
}

/* Use CSS to render the icon for better performance */
.menu-icon::before {
  content: '☰';
}
.menu-icon.is-active::before {
  content: '✕';
}

#main-header { z-index: 900; }




.header-donate-button {
    background: #00b3a4;
    color: #fff;
    border: none;
    border-radius: 25px;
    padding: 10px 28px;
    font-size: 1.1em;
    font-weight: bold;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    margin-right: 5vw;
}

.header-donate-button:hover {
    background: #008DBB;
    color: #fff;
}

/* Tablet */
@media (max-width: 768px) {
  .logo { max-width: clamp(100px, 16vw, 120px); }
  .guidestar-seal img { height: clamp(44px, 9vw, 70px); }

  /* Mobile Overlay Container */
  nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none; /* shown when nav has .open (toggled via JS) */
  }
  nav.open { display: block; }

  /* Mobile Panel Content */
  nav ul {
    left: var(--nav-panel-margin);
    right: var(--nav-panel-margin);
    width: auto;
    max-width: none;
    top: calc(var(--header-height-mobile) + var(--nav-gap-top));
    max-height: calc(100vh - var(--header-height-mobile) - (var(--nav-panel-margin) * 2));
    overflow-y: auto;
  }
  nav ul.show {
    /* keep display: flex; defined above */
  }
}

/* Phones */
@media (max-width: 600px) {
  .header-main { gap: 8px; padding: 6px 10px; }
  .header-right { gap: 8px; }
  .logo { max-width: clamp(92px, 20vw, 110px); }
  .header-center { max-width: 40vw; }

  .header-donate-button {
    padding: 5px 8px;
    font-size: 0.8em;
    border-radius: 14px;
  }
  .header-donate-button i {
    font-size: 1em;
    margin-right: 4px;
  }


  nav ul li {
      margin-left: 0;
      text-align: center;
  }

  nav ul li a {
      padding: 15px 10px;
  }

  /* Slightly more right margin on very small screens */
  nav ul {
      right: var(--nav-panel-margin-right-mobile);
  }
}

/* Simple fade/slide animations for menu panel */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-6px); }
}

/* Desktop-only dropdown alignment for nav */
@media (min-width: 769px) {
  nav {
    position: absolute;
    top: 100%;
    right: 0;
  }
}
