:root {
  --maxw: 1200px;
  --brand-blue: #1e44f1;
  --brand-blue-600: #1235e2;
  --brand-orange: #f08310;
  --text: #0e1633;
  --muted: #6b7280;
  --ring: #9db0ff;

  --shadow-top: 0 2px 4px rgba(0,0,0,.08);
  --shadow-stuck: 0 10px 24px rgba(0,0,0,.12);

  /* Mega menu styling */
  --panel-bg: #ffffff;
  --panel-shadow-1: 0 6px 18px rgba(0,0,0,.10);
  --panel-shadow-2: 0 18px 40px rgba(0,0,0,.12);

  /* Layout */
  --header-height: 64px; /* JS updates this precisely */
}

* { box-sizing: border-box; }

body {
  max-width: var(--maxw);
  margin: 0 auto;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  line-height: 1.35;
  overflow-x: hidden;
}

/* Header + eased shadow on sticky */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  max-width: var(--maxw);
  margin-left: auto;
  margin-right: auto;
  background: #fff;
  box-shadow: var(--shadow-top);
  transition: box-shadow 240ms cubic-bezier(.22,.61,.36,1), backdrop-filter 240ms ease;
  backdrop-filter: saturate(1) blur(0px);
}
.site-header.is-stuck {
  box-shadow: var(--shadow-stuck);
  backdrop-filter: saturate(1.1) blur(2px);
}

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}

.logo img { height: 40px; width: auto; display: block; }

/* Primary nav */
nav[aria-label="Primary"] {
  display: flex;
  justify-content: center;
}

.nav-list {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  margin: 0;
}

/* Base links */
.nav-link,
.nav-parent {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  color: var(--brand-blue);
  white-space: nowrap;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.nav-link:hover,
.nav-parent:hover,
.nav-link:focus-visible,
.nav-parent:focus-visible {
  background: #eef1ff;
  color: var(--brand-blue-600);
  outline: none;
}

/* Active state highlight */
.nav-link.is-active,
.nav-parent.is-active {
  background: var(--brand-blue);
  color: #fff;
  box-shadow: 0 8px 18px rgba(18,53,226,.28);
}

/* ===== MEGA DROPDOWN (two-level list) ===== */
.dropdown.mega { position: relative; }

/* Fixed, page-centred overlay for backdrop + panel */
.dropdown-backdrop,
.dropdown-menu.mega-panel {
  position: fixed;
  left: 50%;
  width: min(1100px, 96vw);
  z-index: 1002;
  transform: translateX(-50%);
}

/* Backdrop (visual elevation only) */
.dropdown-backdrop {
  top: var(--header-height);
  height: 0;
  background: transparent;
  box-shadow: var(--panel-shadow-2);
  filter: blur(0px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, height 0ms linear 180ms, filter 180ms ease;
}

/* Panel — IMPORTANT: override Bootstrap's display:none */
.dropdown-menu.mega-panel {
  /* Bootstrap override */
  display: block;            /* <-- fixes "menu not opening" */

  top: var(--header-height);
  background: var(--panel-bg);
  border-radius: 14px;
  box-shadow: var(--panel-shadow-1);
  padding: 16px;

  /* neutralise Bootstrap dropdown defaults that can interfere */
  margin: 0 !important;
  border: 0;
  min-width: unset;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 10px) scale(.985);
  transform-origin: top center;
  transition:
    opacity 180ms ease,
    transform 220ms cubic-bezier(.22,.61,.36,1),
    box-shadow 220ms ease,
    visibility 0s linear 220ms;
}

/* OPEN state */
.dropdown.mega:hover .dropdown-backdrop,
.dropdown.mega.open .dropdown-backdrop,
.dropdown.mega:focus-within .dropdown-backdrop {
  height: 1px;
  opacity: .6;
  filter: blur(2px);
  transition: opacity 220ms ease, height 0ms, filter 220ms ease;
}
.dropdown.mega:hover .mega-panel,
.dropdown.mega.open .mega-panel,
.dropdown.mega:focus-within .mega-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 16px) scale(1);
  box-shadow: var(--panel-shadow-2);
}

/* Two-level groups (Bootstrap grid is in the HTML; this styles the links) */
.group { display: flex; flex-direction: column; gap: 8px; }

/* Primary (group title) as a link */
.group-title a {
  display: block;
  font-weight: 800;
  font-size: 15px;
  color: #0b1b5e;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  transition: background 140ms ease, color 140ms ease;
}
.group-title a:hover,
.group-title a:focus-visible {
  background: #f3f4f6;  /* light grey */
  outline: none;
}

/* Secondary list */
.group-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.group-list a {
  display: block;
  padding: 8px 12px;
  border-radius: 10px;            /* rounded corners on hover block */
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  transition: background 120ms ease, color 120ms ease, transform 120ms ease;
}
.group-list a:hover,
.group-list a:focus-visible {
  background: #f3f4f6;            /* light grey hover */
  outline: none;
}

/* Panel footer CTA */
.mega-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}
.mega-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--brand-orange);
  color: #fff !important;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(240,131,16,.28);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.mega-cta:hover,
.mega-cta:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(240,131,16,.34);
  background: #d87205;
  outline: none;
}

/* Utility area (Search | Contact | CTA) */
.utility {
  display: flex;
  align-items: center;
  gap: 12px;
}
.utility a {
  text-decoration: none;
  font-weight: 700;
  color: var(--brand-blue);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  transition: background 160ms ease, color 160ms ease;
}
.utility a:hover,
.utility a:focus-visible {
  background: #eef1ff;
  color: var(--brand-blue-600);
  outline: none;
}

/* CTA button (top-right) */
.cta {
  background: var(--brand-orange);
  color: #fff !important;
  padding: 10px 14px !important;
  border-radius: 12px !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 12px rgba(240,131,16,.25);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.cta:hover,
.cta:focus-visible {
  transform: translateY(-1px);
  background: #d87205;
  color: #fff;
  outline: none;
}

/* Search panel (compact) */
.search-wrap { position: relative; }
.search-toggle {
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  color: var(--brand-blue);
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background 160ms ease, color 160ms ease;
}
.search-toggle:hover,
.search-toggle:focus-visible {
  background: #eef1ff;
  color: var(--brand-blue-600);
  outline: none;
}
.search-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #fff;
  padding: 10px;
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(0,0,0,.12);
  display: none;
  width: min(360px, 90vw);
}
.search-wrap[aria-expanded="true"] .search-panel { display: block; }
.search-panel form {
  display: flex;
  gap: 8px;
}
.search-panel input[type="search"]{
  flex: 1;
  padding: 10px 12px;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}
.search-panel button[type="submit"]{
  padding: 10px 12px;
  border-radius: 8px;
  border: 0;
  background: var(--brand-blue);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.search-panel button[type="submit"]:hover { background: var(--brand-blue-600); }

/* Mobile (align with Bootstrap lg breakpoint ~992px) */
.menu-btn {
  display: none;
  background: transparent;
  border: 0;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

@media (max-width: 992px) {
  .header-inner { grid-template-columns: auto auto auto; }

  nav[aria-label="Primary"] {
    position: absolute;
    left: 0; right: 0; top: 64px;
    background: #ffffff;
    border-top: 1px solid #eef2f7;
    display: none;
    padding: 10px 16px 16px;
    box-shadow: 0 10px 16px rgba(0,0,0,.06);
  }
  nav[aria-label="Primary"].show { display: block; }

  .nav-list { flex-direction: column; align-items: stretch; gap: 4px; }
  .nav-link, .nav-parent { padding: 12px; font-size: 16px; }

  /* Mega collapses to simple stacked lists on mobile */
  .dropdown-backdrop { display: none; }

  .dropdown-menu.mega-panel {
    position: static;
    left: auto;
    top: auto;
    transform: none !important;
    width: 100%;
    box-shadow: none;
    padding: 12px;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .utility { display: none; } /* moved into mobile menu */
  .menu-btn { display: inline-block; justify-self: end; }
  .search-wrap { display: none; }
}

/* Focus ring for keyboard users */
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .site-header,
  .dropdown-menu.mega-panel,
  .cta { transition: none; }
}
