/**
 * IDSA mega menu — scoped under .site-header
 * Ecosystem Decision Center: 4 categories + Quick Start (no scroll, no entity links)
 */

.site-header .idsa-mega-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.site-header .idsa-mega-menu__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 41px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: #1b2f4c;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  min-height: 44px;
}

.site-header .idsa-mega-menu__trigger:hover,
.site-header .idsa-mega-menu__trigger[aria-expanded="true"] {
  background: linear-gradient(135deg, #f4f8ff, #e9f1ff);
  border-color: #d6e2f7;
  color: var(--idsa-blue, #0f4ba2);
  box-shadow: 0 4px 10px rgba(15, 75, 162, 0.08);
}

.site-header .idsa-mega-menu__trigger:focus-visible {
  outline: 3px solid color-mix(in oklab, var(--idsa-focus, #2563eb) 35%, transparent);
  outline-offset: 2px;
}

.site-header .idsa-mega-menu__chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s ease;
}

.site-header .idsa-mega-menu__trigger[aria-expanded="true"] .idsa-mega-menu__chevron {
  transform: rotate(-135deg) translateY(1px);
}

.site-header .idsa-mega-menu__panel {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 1100;
  background: #fff;
  border-top: 1px solid var(--idsa-border, #dbeafe);
  box-shadow: 0 18px 40px rgba(6, 26, 58, 0.14);
  overflow: visible;
}

.site-header .idsa-mega-menu__panel-inner {
  padding: 14px 0 12px;
}

.site-header .idsa-mega-menu__layout {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr) 210px;
  gap: 14px;
  align-items: stretch;
}

.site-header .idsa-mega-menu__links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  overflow: visible;
}

.site-header .idsa-mega-menu__links--single-col {
  grid-template-columns: 1fr;
}

.site-header .idsa-mega-menu__links--mobile {
  grid-template-columns: 1fr;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.site-header .idsa-mega-nav-link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #0f172a;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.site-header .idsa-mega-nav-link:hover,
.site-header .idsa-mega-nav-link:focus-visible {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #0f4ba2;
  outline: none;
}

.site-header .idsa-mega-nav-link--secondary {
  background: #fff;
  border-color: #cbd5e1;
  color: #334155;
  font-weight: 700;
  cursor: pointer;
  opacity: 1;
}

.site-header .idsa-mega-nav-link--primary {
  background: #16a34a;
  border-color: #15803d;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  opacity: 1;
}

.site-header .idsa-mega-nav-link--primary:hover,
.site-header .idsa-mega-nav-link--primary:focus-visible {
  background: #15803d;
  border-color: #166534;
  color: #fff;
  outline: 3px solid color-mix(in oklab, #16a34a 45%, transparent);
  outline-offset: 2px;
}

.site-header .idsa-mega-nav-link--secondary:hover,
.site-header .idsa-mega-nav-link--secondary:focus-visible {
  border-color: #93c5fd;
  background: #f8fafc;
  color: #0f4ba2;
  outline: 3px solid color-mix(in oklab, var(--idsa-focus, #2563eb) 35%, transparent);
  outline-offset: 2px;
}

.site-header .idsa-mega-nav-link--mobile {
  min-height: 48px;
}

.site-header .idsa-mega-quick-start {
  border-left: 1px solid #e2e8f0;
  padding: 4px 0 4px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.site-header .idsa-mega-quick-start--mobile {
  border-left: 0;
  padding: 0 0 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid #e2e8f0;
}

.site-header .idsa-mega-quick-start__title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.site-header .idsa-mega-quick-start__links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Quick Start: primary must win over generic link reset (higher specificity) */
.site-header .idsa-mega-quick-start__links .idsa-mega-nav-link--primary {
  background: #16a34a;
  border-color: #15803d;
  color: #fff;
  font-weight: 800;
  min-height: 46px;
  box-shadow: 0 4px 14px rgba(22, 101, 52, 0.24);
}

.site-header .idsa-mega-quick-start__links .idsa-mega-nav-link--primary:hover,
.site-header .idsa-mega-quick-start__links .idsa-mega-nav-link--primary:focus-visible {
  background: #15803d;
  border-color: #166534;
  color: #fff;
  outline: 3px solid color-mix(in oklab, #16a34a 45%, transparent);
  outline-offset: 2px;
}

.site-header .idsa-mega-quick-start__links .idsa-mega-nav-link--secondary {
  background: #fff;
  border-color: #cbd5e1;
  color: #334155;
}

.site-header .idsa-mega-quick-start__links .idsa-mega-nav-link--secondary:hover,
.site-header .idsa-mega-quick-start__links .idsa-mega-nav-link--secondary:focus-visible {
  border-color: #93c5fd;
  background: #f8fafc;
  color: #0f4ba2;
  outline: 3px solid color-mix(in oklab, var(--idsa-focus, #2563eb) 35%, transparent);
  outline-offset: 2px;
}

.site-header .idsa-mega-quick-start--mobile .idsa-mega-quick-start__links .idsa-mega-nav-link--primary {
  width: 100%;
  justify-content: center;
  min-height: 48px;
  font-size: 0.88rem;
}

.site-header .idsa-mega-quick-start--mobile .idsa-mega-quick-start__links .idsa-mega-nav-link--secondary {
  width: 100%;
  justify-content: center;
}

.site-header .idsa-mega-menu__rail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.site-header .idsa-mega-menu__rail-btn {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.site-header .idsa-mega-menu__rail-btn:hover,
.site-header .idsa-mega-menu__rail-btn:focus-visible {
  background: #eff6ff;
  color: #0f4ba2;
}

.site-header .idsa-mega-menu__rail-btn.is-active,
.site-header .idsa-mega-menu__rail-btn[aria-selected="true"] {
  background: #dbeafe;
  color: #0f4ba2;
  box-shadow: inset 0 0 0 1px #93c5fd;
}

.site-header .idsa-mega-menu__rail-btn:focus-visible {
  outline: 3px solid color-mix(in oklab, var(--idsa-focus, #2563eb) 35%, transparent);
  outline-offset: 2px;
}

.site-header .idsa-mega-menu__stage {
  position: relative;
  min-width: 0;
}

.site-header .idsa-mega-menu__pane {
  display: none;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}

.site-header .idsa-mega-menu__pane.is-active {
  display: flex;
}

.site-header .idsa-mega-menu__pane-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.site-header .idsa-mega-menu__pane-purpose {
  margin: 0 0 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  line-height: 1.4;
}

.site-header .idsa-mega-menu__pane-purpose--mobile {
  margin: 0 0 6px;
  padding: 0 2px;
}

/* Mobile accordion — visible in mobile panel only */
.site-header .idsa-mega-mobile {
  display: none;
}

.site-header .idsa-mega-mobile__heading {
  margin: 8px 0 4px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #64748b;
}

.site-header .idsa-mega-accordion {
  border: 1px solid #dbeafe;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.site-header .idsa-mega-accordion + .idsa-mega-accordion {
  margin-top: 8px;
}

.site-header .idsa-mega-accordion__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 12px 14px;
  border: 0;
  background: #f6f8fc;
  color: #0f172a;
  font-weight: 800;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
}

.site-header .idsa-mega-accordion__trigger:focus-visible {
  outline: 3px solid color-mix(in oklab, var(--idsa-focus, #2563eb) 35%, transparent);
  outline-offset: -2px;
}

.site-header .idsa-mega-accordion__trigger[aria-expanded="true"] {
  background: #e8f1ff;
  color: #0f4ba2;
}

.site-header .idsa-mega-accordion__chevron {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.site-header .idsa-mega-accordion__trigger[aria-expanded="true"] .idsa-mega-accordion__chevron {
  transform: rotate(-135deg);
}

.site-header .idsa-mega-accordion__panel {
  padding: 8px;
  display: grid;
  gap: 8px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

@media (min-width: 1241px) {
  .site-header .idsa-mega-menu__trigger {
    height: 38px;
    padding: 0 9px;
    font-size: 12.5px;
  }
}

@media (max-width: 1240px) {
  .site-header .idsa-mega-menu {
    display: none;
  }

  .site-header .idsa-mega-menu__panel {
    display: none !important;
  }

  .site-header .idsa-mega-mobile {
    display: block;
    margin-top: 4px;
  }

  /* Mobile drawer: scrollable panel, safe bottom for thumb reach */
  body.mobile-nav-open .mobile-panel {
    max-height: calc(100dvh - 60px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  body.mobile-nav-open .mobile-panel-inner {
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    gap: 6px;
  }

  /* Hide WhatsApp float while mobile drawer is open */
  body.mobile-nav-open .wa-float {
    display: none !important;
  }

  /* Neutralize site.css .mobile-panel a bleed on mega menu links */
  body.mobile-nav-open .mobile-panel .idsa-mega-mobile a.idsa-mega-nav-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 700;
    opacity: 1;
    cursor: pointer;
  }

  body.mobile-nav-open .mobile-panel .idsa-mega-mobile .idsa-mega-quick-start__links a.idsa-mega-nav-link--primary {
    background: #16a34a;
    border-color: #15803d;
    color: #fff;
    font-weight: 800;
    min-height: 48px;
    padding: 12px 14px;
    box-shadow: 0 4px 14px rgba(22, 101, 52, 0.28);
  }

  body.mobile-nav-open .mobile-panel .idsa-mega-mobile .idsa-mega-quick-start__links a.idsa-mega-nav-link--primary:hover,
  body.mobile-nav-open .mobile-panel .idsa-mega-mobile .idsa-mega-quick-start__links a.idsa-mega-nav-link--primary:focus-visible {
    background: #15803d;
    border-color: #166534;
    color: #fff;
    outline: 3px solid color-mix(in oklab, #16a34a 45%, transparent);
    outline-offset: 2px;
  }

  body.mobile-nav-open .mobile-panel .idsa-mega-mobile .idsa-mega-quick-start__links a.idsa-mega-nav-link--secondary {
    background: #fff;
    border-color: #cbd5e1;
    color: #334155;
    min-height: 44px;
    padding: 10px 12px;
    font-weight: 700;
  }

  body.mobile-nav-open .mobile-panel .idsa-mega-mobile .idsa-mega-menu__links--mobile a.idsa-mega-nav-link {
    background: #fff;
    border-color: #e2e8f0;
    color: #0f172a;
    min-height: 44px;
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  body.mobile-nav-open .mobile-panel .idsa-mega-mobile .idsa-mega-menu__links--mobile a.idsa-mega-nav-link:hover,
  body.mobile-nav-open .mobile-panel .idsa-mega-mobile .idsa-mega-menu__links--mobile a.idsa-mega-nav-link:focus-visible {
    border-color: #93c5fd;
    background: #f8fafc;
    color: #0f4ba2;
    outline: 3px solid color-mix(in oklab, var(--idsa-focus, #2563eb) 35%, transparent);
    outline-offset: 2px;
  }

  .site-header .idsa-mega-quick-start--mobile {
    background: linear-gradient(180deg, #f0fdf4 0%, #f8fafc 100%);
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 10px 10px 8px;
    margin: 4px 0 6px;
  }

  .site-header .idsa-mega-quick-start--mobile .idsa-mega-quick-start__title {
    color: #0f172a;
  }

  .site-header .idsa-mega-mobile__heading {
    margin: 6px 0 2px;
  }

  .site-header .idsa-mega-accordion + .idsa-mega-accordion {
    margin-top: 5px;
  }

  .site-header .idsa-mega-accordion__trigger {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 0.88rem;
  }

  .site-header .idsa-mega-accordion__panel {
    padding: 6px;
    gap: 5px;
  }

  .site-header .idsa-mega-menu__pane-purpose--mobile {
    margin: 0 0 4px;
    padding: 0 2px;
    font-size: 0.72rem;
    font-weight: 500;
    color: #94a3b8;
    line-height: 1.35;
  }

  .site-header .idsa-mega-nav-link--mobile {
    min-height: 44px;
  }
}

@media (min-width: 1241px) and (max-width: 1380px) {
  .site-header .idsa-mega-menu__layout {
    grid-template-columns: 160px minmax(0, 1fr) 196px;
    gap: 12px;
  }
}

body.idsa-mega-open {
  overflow: hidden;
}

@media (min-width: 1241px) {
  body.idsa-mega-open {
    overflow: auto;
  }
}
