/* HEADER LAYOUT */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: transparent;
  z-index: 1000;
  pointer-events: none;
}

/* Smooth scrolling for the entire page */
html {
  scroll-behavior: smooth;
}

/* Make interactive elements receive pointer events */
.header nav,
.header button,
.dropdown-container .dropdown,
.header .mobile-menu,
.header .mobile-menu-button {
  pointer-events: auto;
}


.header .container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.5rem 1rem;
  max-width: 1280px;
  margin: 0 auto;
}

.header .logo {
  flex-shrink: 0;
}

.header .logo img {
  height: 60px;
  width: auto;
}

.header nav {
  display: flex;
  align-items: center;
}

/* Main menu list styling */
.header .main-menu {
  background-color: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(10px);
  transition: background-color 0.3s ease;
  display: flex;
  list-style: none;
  margin: 0;
  transform: translateZ(0); /* Force hardware acceleration */
  border-radius: 24px;
  padding: 0 1rem 0 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.header .main-menu:hover {
  background-color: rgba(255, 255, 255, 0.9);
}

.header .main-menu > li {
  position: relative;
  margin-left: 1rem;
  /* Allow items to shrink so labels can wrap */
  min-width: 0;
}

.header .main-menu > li i {
  padding-top: 6px;
}



.header .main-menu > li button {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  padding: 0.5rem 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  transition: color 0.2s ease;
}

/* Wrap label text inside a span so SVG stays aligned */
.header .main-menu > li button span {
  display: inline-block;
  max-width: 140px; /* tweak as needed */
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
  line-height: 1.1;
}

.header .main-menu > li button:hover,
.header .main-menu > li button.active,
.header .main-menu > li button.current,
.header .main-menu > li i:hover,
.header .main-menu > li i.active,
.header .main-menu > li i.current {
  color: #E20613;
}

.header .main-menu > li button svg {
  width: 1rem;
  height: 1rem;
  margin-left: 0.25rem;
  flex-shrink: 0;
}

/* Dropdown container */
.dropdown-container {
  position: fixed;
  top: 50px; /* Adjust based on header height */
  left: 0;
  width: 100%;
  z-index: 999;
  pointer-events: none;
}

/* Dropdown styling */
.dropdown {
  position: absolute;
  background-color: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              visibility 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
  padding: 0.5rem 0rem;
  /* Let dropdown size naturally within viewport while allowing inner content to wrap */
  width: auto;
  min-width: 0;
  max-width: min(900px, 90vw);
  overflow-x: visible;
  will-change: transform, opacity, visibility;
  backface-visibility: hidden;
  -webkit-font-smoothing: subpixel-antialiased;
}

.dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition-duration: 0.25s;
}

/* Membership dropdown - wider for two columns */
.dropdown[data-dropdown="membership"] {
  max-width: min(500px, 90vw);
}

/* Capabilities dropdown - slightly wider */
.dropdown[data-dropdown="capabilities"] {
  max-width: min(500px, 90vw);
}

.dropdown[data-dropdown="events"] {
  max-width: min(400px, 90vw);
}

.dropdown[data-dropdown="improve"] {
  max-width: min(520px, 90vw);
}

.dropdown[data-dropdown="news"] {
  max-width: min(400px, 90vw);
}


/* All other dropdowns - narrower single column */
.dropdown[data-dropdown="grow"],
.dropdown[data-dropdown="innovate"],
.dropdown[data-dropdown="about"] {
  max-width: min(480px, 90vw);
}

.dropdown-header {
  display: flex;
  align-items: center;
  padding: 0 1.5rem 0 1.5rem;
  background-color: rgba(255, 255, 255, 0.7);
  border-radius: 0.5rem 0.5rem 0 0;
  margin: -10px -0rem 1rem -0rem;
  white-space: normal;
}

.dropdown-header img {
  width: 110px;
  height: auto;
  border-radius: 0.3rem;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.dropdown-header .dropdown-summary {
  padding: 1rem;
  /* Critical for flex children: allow shrink so text can wrap */
  min-width: 0;
  flex: 1 1 0%;
  overflow-wrap: anywhere;
  white-space: normal;
}

.dropdown-header .dropdown-summary h2 {
  font-size: 1rem;
  /* color: #1a237e; */
  font-weight: 600;
}

.dropdown-header .dropdown-summary p {
  font-size: 0.8rem;
  margin-bottom: 0;
  padding-bottom: 0;
}

.dropdown ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dropdown li.spacer {
  height: 2.375rem;
  pointer-events: none;
}


/* For dropdowns with grid layout */
.dropdown > .grid {
  margin: 0;
  padding: 0 15px 15px 15px;
}

.dropdown .cta {
  background-color: #3c72ab37;
}

.dropdown a {
  display: block;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  color: #333;
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  hyphens: auto;
  transition: background-color 0.2s ease-in-out;
}

.dropdown a:hover {
  color: #E20613;
  background-color: #fff;
 box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Persistent current state for submenu links: text color only */
.dropdown a.current {
  color: #E20613;
}

/* Menu Buttons */
.header button {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  font-size: 1rem;
  font-weight: 500;
  color: #222;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.header button:hover {
  color: #1976d2;
  border-bottom: 2px solid #1976d2;
}

/* Dropdown Grid Layout */
.grid {
  display: grid;
  gap: 24px;
  padding: 24px;
}

/* Grid columns */
.grid {
  display: grid;
  gap: 30px;
}

.grid.grid-cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.grid-cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.grid-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Dropdown Column Headings */
.dropdown-column h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #1a237e;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 0.5rem;
  padding-left: 1rem;
}

/* Mobile Menu */
.header .mobile-menu-button {
  display: none;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
}

.header .mobile-menu-button svg {
  width: 1.5rem;
  height: 1.5rem;
  color: #333;
}

.header .mobile-menu {
  display: none;
  background-color: white;
  padding: 1rem;
  border-top: 1px solid #e0e0e0;
  width: 100%;
  position: absolute;
  left: 0;
  top: 100%;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  z-index: 99;
}

.header .mobile-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.header .mobile-menu > ul > li {
  margin-bottom: 1rem;
}

.header .mobile-menu > ul > li > a {
  font-weight: 600;
  color: #1a237e;
  display: block;
  padding: 0.75rem 1rem;
  position: relative;
}

.header .mobile-menu > ul > li > a.current {
  color: #E20613;
}

.header .mobile-menu > ul > li > a::after {
  content: '▼';
  font-size: 0.7rem;
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.2s ease;
}

.header .mobile-menu > ul > li > a.active::after {
  transform: translateY(-50%) rotate(180deg);
}

.header .mobile-menu > ul > li > ul {
  padding-left: 0;
  background-color: #f5f5f5;
  border-top: 1px solid #e0e0e0;
  margin-top: 0.25rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.header .mobile-menu > ul > li > ul > li > a {
  padding: 0.75rem 1.5rem;
  display: block;
  color: #333;
  text-decoration: none;
  font-size: 0.875rem;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.header .mobile-menu > ul > li > ul > li:last-child > a {
  border-bottom: none;
}

.header .mobile-menu > ul > li > ul > li > a:hover {
  background-color: rgba(0,0,0,0.03);
  color: #E20613;
}

.header .mobile-menu > ul > li > ul > li > a.current {
  color: #E20613;
}

@media (max-width: 900px) {
  .header nav {
    display: none;
  }

  .header .mobile-menu-button {
    display: block;
  }
  
  .header .mobile-menu-button:hover {
    background: #f0f4ff;
    color: #1976d2;
  }
  
  .header .mobile-menu.active {
    display: block;
  }
  
  .header .mobile-menu > ul > li {
    border-bottom: 1px solid #e0e0e0;
  }
  
  .header .mobile-menu > ul > li:last-child {
    border-bottom: none;
  }
  
  .header .mobile-menu a {
    padding: 12px 16px;
    font-size: 1rem;
    display: block;
    text-decoration: none;
  }
}
