/* =====================================================================
   iGC MEGA-NAV — 5-trigger IA, Style B (Featured + Index)
   Hover-with-intent opens (120ms), click toggles, Esc / outside / pick
   closes. One panel at a time. Light + dark via existing .igc-light
   class. Uses site tokens (--igc-bg, --igc-text, --igc-accent…) so the
   theme follows whatever the rest of the site does. Mobile: triggers
   hide, fall back to the existing .igc-hamburger drawer with the same
   5 sections stacked vertically.
   ===================================================================== */

/* ----- Trigger row inside the header (replaces .igc-nav__list) ----- */
.igc-meganav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 auto 0 1.5rem;
}
.igc-meganav__trigger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  font: 500 0.92rem/1.2 inherit;
  color: var(--igc-text-dim);
  background: transparent;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--igc-ease, ease), color 0.15s var(--igc-ease, ease);
}
.igc-meganav__trigger:hover,
.igc-meganav__trigger[aria-expanded="true"] {
  color: var(--igc-text);
  background: var(--igc-bg-glass);
}
.igc-meganav__trigger svg {
  width: 11px; height: 11px;
  opacity: 0.55;
  transition: transform 160ms var(--igc-ease, ease), opacity 160ms var(--igc-ease, ease);
}
.igc-meganav__trigger[aria-expanded="true"] svg {
  transform: rotate(180deg);
  opacity: 1;
}

/* ----- Mega panel (full-width band under header) ----- */
.igc-megapanel {
  position: fixed;
  /* -1px pulls the panel under the header's border-bottom so there's no
     sub-pixel seam between them. */
  top: calc(var(--igc-header-h, 80px) - 1px);
  left: 0; right: 0;
  z-index: 95;
  background: var(--igc-bg-elev);
  border-top: 1px solid var(--igc-border);
  box-shadow: 0 30px 80px rgba(0,0,0,0.45), 0 8px 24px rgba(0,0,0,0.25);
  opacity: 0; pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 180ms var(--igc-ease, ease), transform 180ms var(--igc-ease, ease);
}
.igc-light .igc-megapanel {
  box-shadow: 0 30px 80px rgba(15,30,60,0.18), 0 8px 24px rgba(15,30,60,0.10);
}
.igc-megapanel[data-open="true"] {
  opacity: 1; pointer-events: auto;
  transform: translateY(0);
}
.igc-megapanel__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2.25rem 2rem 2rem;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 3rem;
}
.igc-megapanel__index {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
}
.igc-megapanel__col-eyebrow {
  font: 600 11px/1 var(--igc-font-mono, 'DM Mono', monospace);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--igc-text-faint);
  margin: 0 0 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--igc-border);
}
.igc-megapanel__links {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.igc-megapanel__link {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  color: var(--igc-text);
  font-size: 0.88rem;
  line-height: 1.35;
  text-decoration: none;
  transition: background 0.15s var(--igc-ease, ease), color 0.15s var(--igc-ease, ease);
}
.igc-megapanel__link:hover {
  background: var(--igc-accent-soft);
  color: var(--igc-accent);
}
.igc-light .igc-megapanel__link:hover { color: var(--igc-accent-deep); }
.igc-megapanel__link-flag {
  font-size: 14px; line-height: 1;
  width: 18px; flex-shrink: 0;
  padding-top: 1px;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}
.igc-megapanel__link-body { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.igc-megapanel__link-title { font-weight: 500; }
.igc-megapanel__link-desc {
  font-size: 0.76rem;
  color: var(--igc-text-faint);
  line-height: 1.35;
}
.igc-megapanel__link-tag {
  font: 500 9px/1 var(--igc-font-mono, 'DM Mono', monospace);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--igc-accent);
  background: var(--igc-accent-soft);
  padding: 3px 6px; border-radius: 4px;
  align-self: flex-start;
  margin-top: 2px;
}
.igc-megapanel__link[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}
.igc-megapanel__link[aria-disabled="true"] .igc-megapanel__link-tag {
  color: var(--igc-text-faint);
  background: var(--igc-border);
}

/* ----- Featured side (right 40%) ----- */
.igc-megapanel__featured {
  display: flex; flex-direction: column;
  gap: 1rem;
}
.igc-megapanel__feature-eyebrow {
  font: 600 11px/1 var(--igc-font-mono, 'DM Mono', monospace);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--igc-text-faint);
  margin: 0 0 0.25rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--igc-border);
}
.igc-megapanel__feature {
  display: block;
  background: var(--igc-bg-glass);
  border: 1px solid var(--igc-border);
  border-radius: 12px;
  padding: 1.1rem 1.15rem;
  color: var(--igc-text);
  text-decoration: none;
  transition: border-color 0.15s var(--igc-ease, ease), background 0.15s var(--igc-ease, ease), transform 0.15s var(--igc-ease, ease);
}
.igc-megapanel__feature:hover {
  border-color: var(--igc-border-mid);
  background: var(--igc-accent-soft);
  transform: translateY(-1px);
}
.igc-megapanel__feature--brand {
  border-top: 3px solid var(--igc-accent);
  border-radius: 0 0 12px 12px;
}
.igc-megapanel__feature--data {
  border-top: 3px solid #10b981;
  border-radius: 0 0 12px 12px;
}
.igc-megapanel__feature--data .igc-megapanel__feature-tag {
  color: #10b981;
  background: rgba(16, 185, 129, 0.10);
}
.igc-megapanel__feature--data .igc-megapanel__feature-meta::after { color: #10b981; }
.igc-megapanel__feature-tag {
  display: inline-block;
  font: 600 10px/1 var(--igc-font-mono, 'DM Mono', monospace);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--igc-accent);
  background: var(--igc-accent-soft);
  padding: 4px 8px; border-radius: 4px;
  margin-bottom: 0.65rem;
}
.igc-megapanel__feature-title {
  font-size: 1rem; font-weight: 600; line-height: 1.3;
  margin: 0 0 0.4rem;
  color: var(--igc-text);
}
.igc-megapanel__feature-desc {
  font-size: 0.85rem;
  color: var(--igc-text-muted);
  line-height: 1.5;
  margin: 0 0 0.65rem;
}
.igc-megapanel__feature-meta {
  font-size: 0.78rem;
  color: var(--igc-text-faint);
  display: flex; align-items: center; gap: 6px;
}
.igc-megapanel__feature-meta::after {
  content: '→';
  margin-left: auto;
  color: var(--igc-accent);
  font-size: 0.95rem;
  transition: transform 0.15s var(--igc-ease, ease);
}
.igc-megapanel__feature:hover .igc-megapanel__feature-meta::after { transform: translateX(2px); }
.igc-megapanel__feature--static { cursor: default; }
.igc-megapanel__feature--static:hover { transform: none; }
.igc-megapanel__feature--static .igc-megapanel__feature-meta::after { display: none; }

/* ----- Footer CTA strip inside the panel ----- */
.igc-megapanel__cta {
  grid-column: 1 / -1;
  margin-top: 0.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--igc-border);
  display: flex; align-items: center; gap: 1rem;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--igc-text-muted);
}
.igc-megapanel__cta-primary {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--igc-accent);
  font-weight: 500;
  text-decoration: none;
}
.igc-megapanel__cta-primary::after { content: '→'; transition: transform 0.15s var(--igc-ease, ease); }
.igc-megapanel__cta-primary:hover::after { transform: translateX(3px); }

/* ----- Backdrop dimmer ----- */
.igc-megabackdrop {
  position: fixed;
  top: var(--igc-header-h, 80px);
  left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.20);
  z-index: 90;
  opacity: 0; pointer-events: none;
  transition: opacity 180ms var(--igc-ease, ease);
}
.igc-light .igc-megabackdrop { background: rgba(15,30,60,0.12); }
.igc-megabackdrop[data-open="true"] { opacity: 1; pointer-events: auto; }

/* Lock body scroll while any mega panel is open. Compensate for the
   missing scrollbar with padding-right so the header doesn't shift. */
body.igc-megapanel-open {
  overflow: hidden;
  padding-right: var(--igc-scrollbar-w, 0px);
}

/* ----- Plain (non-mega) primary nav items can sit alongside ----- */
.igc-meganav__plain {
  display: inline-flex; align-items: center;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  font: 500 0.92rem/1.2 inherit;
  color: var(--igc-text-dim);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s var(--igc-ease, ease), color 0.15s var(--igc-ease, ease);
}
.igc-meganav__plain:hover {
  color: var(--igc-text);
  background: var(--igc-bg-glass);
}

/* =====================================================================
   MOBILE — hide mega triggers, show triggers as accordion in the
   existing .igc-header--open drawer. Works alongside the existing
   .igc-hamburger script.
   ===================================================================== */
@media (max-width: 980px) {
  .igc-meganav { display: none; }
  .igc-megapanel,
  .igc-megabackdrop { display: none !important; }
}

/* =====================================================================
   DENSITY PASS for the Featured column (right side of every mega-panel).
   On 13" MacBook viewports (~800px effective after browser chrome) the
   third feature card was clipping off-screen. Tighten padding + type so
   the three cards plus the eyebrow + CTA fit on the smallest desktop
   viewport we support, and add a safety scroll for anything shorter.
===================================================================== */
.igc-megapanel__featured { gap: 0.55rem; }
.igc-megapanel__feature-eyebrow { padding-bottom: 0.45rem; margin: 0 0 0.15rem; }
.igc-megapanel__feature { padding: 0.75rem 0.95rem; border-radius: 10px; }
.igc-megapanel__feature--brand,
.igc-megapanel__feature--data { border-top-width: 2px; }
.igc-megapanel__feature-tag {
  font-size: 9.5px;
  padding: 2.5px 6px;
  margin-bottom: 0.4rem;
}
.igc-megapanel__feature-title {
  font-size: 0.93rem;
  line-height: 1.25;
  margin: 0 0 0.25rem;
}
.igc-megapanel__feature-desc {
  font-size: 0.78rem;
  line-height: 1.4;
  margin: 0 0 0.4rem;
  /* Cap to two lines so a long description cannot push the third card
     off-screen on short viewports. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.igc-megapanel__feature-meta { font-size: 0.74rem; }
.igc-megapanel__feature-meta::after { font-size: 0.88rem; }

/* INDEX COLUMN density - the middle column (Regulator Profiles on the
   Jurisdictions panel) has 9 items, the most of any column. At default
   density each link is ~50px so the column was 470px+ - same problem as
   the Featured side, different culprit. Shrink the link cell so 9 items
   fit comfortably without scrolling. */
.igc-megapanel__col-eyebrow { padding-bottom: 0.5rem; margin: 0 0 0.55rem; }
.igc-megapanel__links { gap: 1px; }
.igc-megapanel__link {
  padding: 0.32rem 0.5rem;
  font-size: 0.85rem;
  line-height: 1.3;
  gap: 9px;
}
.igc-megapanel__link-body { gap: 0; }
.igc-megapanel__link-title { line-height: 1.25; }
.igc-megapanel__link-desc {
  font-size: 0.73rem;
  line-height: 1.3;
}
.igc-megapanel__link-flag { font-size: 13px; width: 16px; }
.igc-megapanel__link-tag {
  font-size: 8.5px;
  padding: 2px 5px;
}

/* Safety: cap the panel's inner height to the viewport minus the sticky
   header, and scroll internally if a viewport is REALLY short. With the
   density pass above this rarely kicks in, but it keeps the layout from
   visibly clipping on unusually short windows. */
.igc-megapanel__inner {
  max-height: calc(100vh - var(--igc-header-h, 80px) - 1rem);
  overflow-y: auto;
}

/* Extra-tight pass on short viewports (e.g. 13" MacBook with dev tools
   or bookmarks bar open). Lets every column - including the 9-item
   Regulator Profiles - fit without scrolling. */
@media (max-height: 900px) {
  .igc-megapanel__inner { padding: 1.4rem 2rem 1.1rem; }
  .igc-megapanel__col-eyebrow {
    padding-bottom: 0.4rem;
    margin: 0 0 0.4rem;
    font-size: 10.5px;
  }
  .igc-megapanel__link {
    padding: 0.22rem 0.5rem;
    font-size: 0.83rem;
  }
  .igc-megapanel__link-desc {
    font-size: 0.71rem;
    line-height: 1.25;
  }
  .igc-megapanel__featured { gap: 0.5rem; }
  .igc-megapanel__feature { padding: 0.6rem 0.85rem; }
  .igc-megapanel__feature-title { font-size: 0.88rem; }
  .igc-megapanel__feature-desc { font-size: 0.74rem; margin-bottom: 0.3rem; }
  .igc-megapanel__feature-tag { margin-bottom: 0.3rem; }
}

/* The mobile equivalent — stacked sections shown inside the
   .igc-header--open drawer (rendered by header.php as .igc-meganav-mobile).
   Hidden by default; revealed when the header carries .igc-header--open
   (the existing hamburger script handles that class toggle). */
.igc-meganav-mobile {
  display: none;
}
@media (max-width: 980px) {
  /* Force hamburger visible at 768-980px too (main.css gates it at 768px) */
  .igc-hamburger { display: flex !important; }

  /* Ensure header is positioned so the absolute drawer anchors to its bottom edge */
  .igc-header { position: sticky; }
  /* Drawer container */
  .igc-meganav-mobile {
    display: block;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: color-mix(in srgb, var(--igc-bg) 96%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--igc-border);
    max-height: 0;
    overflow: hidden;
    overflow-y: auto;
    transition: max-height 0.3s var(--igc-ease, ease);
    padding: 0 1.25rem;
  }
  .igc-header { position: sticky; }
  .igc-header__inner { position: relative; }
  .igc-header--open .igc-meganav-mobile {
    max-height: calc(100vh - var(--igc-header-h, 80px));
    padding: 1rem 1.25rem 1.5rem;
  }
  .igc-meganav-mobile__section { margin-bottom: 1.25rem; }
  .igc-meganav-mobile__section:last-child { margin-bottom: 0; }
  .igc-meganav-mobile__title {
    font: 600 11px/1 var(--igc-font-mono, 'DM Mono', monospace);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--igc-text-faint);
    margin: 0 0 0.5rem;
  }
  .igc-meganav-mobile__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
  .igc-meganav-mobile__list a {
    display: block;
    padding: 0.65rem 0.5rem;
    color: var(--igc-text);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.15s var(--igc-ease, ease);
  }
  .igc-meganav-mobile__list a:hover { background: var(--igc-bg-glass); }
}
