/* =============================================================
   Mindtrades mega-menu — full-width navigation
   =============================================================
   Accenture/Bain-pattern: top-nav hover reveals a full-width
   slide-down panel with multi-column links + featured content.
   Loaded by MindtradesPage.astro layout. Inert on legacy HTML
   pages (no .mt-mega markup → no styles fire).

   Black/white only, Inter + JetBrains Mono, square-ish corners,
   subtle Motion-style cubic-bezier easings.
   ============================================================= */

/* =============================================================
   NAV SHELL — locked height, generous gutters, vertical center
   =============================================================
   Overrides the Webflow defaults so the brand wordmark, menu
   items, and CTA all land on the same horizontal baseline at
   every viewport. Tightened to the 1200px / 40px-gutter / 72px
   register used by Faculty AI, ThoughtWorks, EPAM.
   ============================================================= */
.navbar-no-shadow-container-2 {
  min-height: 72px;
  max-width: 1200px !important;
  padding: 0 40px;
  display: flex;
  align-items: center;
}
.navbar-wrapper-2 {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}
.nav-menu-wrapper-2 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-menu-2 {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
}
.navbar-brand-2 {
  display: inline-flex;
  align-items: center;
  padding: 8px 0;
  text-decoration: none;
  flex-shrink: 0;
}
.navbar-brand-2:focus-visible {
  outline: 2px solid #0a0a0a;
  outline-offset: 4px;
  border-radius: 2px;
}

/* =============================================================
   BRAND LOGO — original PNG wordmark, pixel-perfect at every DPR
   =============================================================
   Locked to 140px desktop / 120px mobile, height auto. The
   image's `sizes` attribute matches these CSS widths so the
   browser picks the right srcset variant without over-fetching.
   image-rendering ensures crisp edges on retina.
   ============================================================= */
.image-2 {
  width: 140px;
  height: auto;
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  transition: opacity 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.navbar-brand-2:hover .image-2 { opacity: 0.78; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =============================================================
   RESPONSIVE BREAKPOINTS — pixel-perfect on every device
   ============================================================= */
@media (max-width: 1199px) {
  .navbar-no-shadow-container-2 { padding: 0 32px; }
}
@media (max-width: 991px) {
  .navbar-no-shadow-container-2 { padding: 0 24px; min-height: 64px; }
  .navbar-wrapper-2 { gap: 16px; }
  .image-2 { width: 130px; }
}
@media (max-width: 767px) {
  .navbar-no-shadow-container-2 { padding: 0 20px; min-height: 60px; }
  .image-2 { width: 120px; }
}

/* =============================================================
   TRIGGERS — replace the old Webflow dropdown toggles
   ============================================================= */
.mt-mega-trigger {
  /* match .nav-link-2 typography so the bar reads identically */
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: inherit;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.mt-mega-trigger::after {
  /* underline-grow indicator matches .nav-link-2 from homepage-modernize.css */
  content: "";
  position: absolute;
  left: 12px;
  right: 28px;
  bottom: 4px;
  height: 1.5px;
  background: #161616;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}
.mt-mega-trigger:hover::after,
.mt-mega-trigger[aria-expanded="true"]::after {
  transform: scaleX(1);
}
.mt-mega-caret {
  display: inline-block;
  width: 10px;
  height: 6px;
  color: currentColor;
  opacity: 0.55;
  transform-origin: center;
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1),
              opacity 0.18s ease;
  flex-shrink: 0;
}
.mt-mega-trigger:hover .mt-mega-caret { opacity: 0.9; }
.mt-mega-trigger[aria-expanded="true"] .mt-mega-caret {
  transform: rotate(180deg);
  opacity: 1;
}

/* =============================================================
   BACKDROP — dims page behind the open panel
   ============================================================= */
.mt-mega-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 49;
  background: rgba(22, 22, 22, 0.16);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.mt-mega-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* =============================================================
   PANEL — full-width slide-down
   =============================================================
   Lives in the DOM at .mt-mega-wrap; each panel has data-mega
   matching its trigger's data-mega-trigger.
   ============================================================= */
.mt-mega-wrap {
  position: fixed;
  top: 0;
  left: 0; right: 0;
  z-index: 50;
  pointer-events: none;
}
.mt-mega {
  position: absolute;
  top: 0;
  left: 0; right: 0;
  background: #ffffff;
  border-bottom: 1px solid #161616;
  box-shadow: 0 16px 40px rgba(22, 22, 22, 0.10);
  transform: translateY(-12px);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1),
              opacity 0.24s cubic-bezier(0.2, 0.8, 0.2, 1),
              visibility 0s 0.24s;
}
.mt-mega.is-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1),
              opacity 0.24s cubic-bezier(0.2, 0.8, 0.2, 1),
              visibility 0s 0s;
}

.mt-mega-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 44px clamp(24px, 4vw, 56px) 36px;
  display: grid;
  grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr);
  gap: clamp(32px, 4vw, 64px);
}
@media (max-width: 991px) {
  .mt-mega-inner {
    grid-template-columns: 1fr;
    padding: 32px 24px 28px;
  }
}

/* =============================================================
   LINK COLUMNS
   ============================================================= */
.mt-mega-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
@media (max-width: 767px) {
  .mt-mega-cols { grid-template-columns: 1fr; }
}

.mt-mega-card {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  gap: 4px 14px;
  padding: 14px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: #161616;
  transition: background 0.15s ease;
}
.mt-mega-card:hover { background: #fafafa; }
.mt-mega-card:focus-visible {
  outline: 2px solid #161616;
  outline-offset: -2px;
}

.mt-mega-icon {
  grid-row: 1 / span 3;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  color: #161616;
  margin-top: 2px;
}
.mt-mega-icon svg { width: 100%; height: 100%; }

.mt-mega-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #161616;
  line-height: 1.2;
}
.mt-mega-tag {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #6b6b6b;
  text-transform: uppercase;
  grid-column: 2;
}
.mt-mega-desc {
  font-size: 13px;
  line-height: 1.5;
  color: #43464d;
  grid-column: 2;
  margin-top: 2px;
}

/* =============================================================
   FEATURED COLUMN (right side)
   ============================================================= */
.mt-mega-featured {
  border-left: 1px solid #e6e6e6;
  padding-left: clamp(24px, 3vw, 48px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (max-width: 991px) {
  .mt-mega-featured {
    border-left: 0;
    border-top: 1px solid #e6e6e6;
    padding-left: 0;
    padding-top: 24px;
    margin-top: 8px;
  }
}
.mt-mega-feat-eyebrow {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #6b6b6b;
  text-transform: uppercase;
}
.mt-mega-feat-h {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: #161616;
}
.mt-mega-feat-d {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: #43464d;
  max-width: 32ch;
}
.mt-mega-feat-link {
  margin-top: auto;
  padding-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #161616;
  text-decoration: none;
  transition: gap 0.18s ease;
}
.mt-mega-feat-link:hover { gap: 12px; }
.mt-mega-feat-link span { font-family: inherit; }

/* =============================================================
   BOTTOM FOOT BAR — "view all" links across the panel
   ============================================================= */
.mt-mega-foot {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid #e6e6e6;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
}
.mt-mega-foot-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #6b6b6b;
  text-transform: uppercase;
}
.mt-mega-foot-link {
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #161616;
  text-decoration: none;
  transition: opacity 0.15s ease;
}
.mt-mega-foot-link:hover { opacity: 0.6; }

/* =============================================================
   HIDE MEGA ON MOBILE — fall back to Webflow hamburger
   ============================================================= */
@media (max-width: 991px) {
  .mt-mega-wrap, .mt-mega-backdrop { display: none !important; }
}

/* =============================================================
   REDUCED MOTION
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .mt-mega-trigger::after,
  .mt-mega-caret,
  .mt-mega-backdrop,
  .mt-mega,
  .mt-mega-feat-link {
    transition: none !important;
  }
}

/* =============================================================
   SKIP LINK — first focusable element on every page (A11Y-07)
   =============================================================
   Visually hidden until keyboard-focused, then fixed at top-left
   with a black/white pill that lands focus on #main. Honors
   reduced-motion (no transition declared so nothing to disable).
   ============================================================= */
.skip-link {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  white-space: nowrap;
}
.skip-link:focus,
.skip-link:focus-visible {
  position: fixed;
  left: 20px;
  top: 20px;
  width: auto;
  height: auto;
  padding: 12px 20px;
  background: #0a0a0a;
  color: #fff;
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  border-radius: 2px;
  z-index: 9999;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* =============================================================
   MOBILE DRAWER STAND-ALONE STYLES (post-Webflow-JS strip)
   =============================================================
   Webflow's w-nav runtime previously toggled inline `display`
   styles on `.w-nav-menu` when the hamburger was tapped. Now
   that the runtime is gone, /js/mobile-nav.js adds/removes the
   `.w--open` class — these rules handle the visual transitions
   without any inline JS-set style. Stays inert on desktop where
   the mega-menu owns the nav.
   ============================================================= */
@media (max-width: 991px) {
  /* Hide the drawer by default on mobile (matches Webflow's
     `.w-nav[data-collapse="medium"] .w-nav-menu` rule). */
  .nav-menu-wrapper-2 {
    display: none;
  }
  /* Open state — slides down beneath the navbar. Full-width card
     with the same gray-100 background Webflow set inline. */
  .nav-menu-wrapper-2.w--open {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid #e6e6e6;
    box-shadow: 0 16px 40px rgba(22, 22, 22, 0.10);
    padding: 8px 20px 20px;
    z-index: 50;
  }
  .nav-menu-wrapper-2.w--open .nav-menu-2 {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
  }
  .nav-menu-wrapper-2.w--open .nav-link-2,
  .nav-menu-wrapper-2.w--open .mt-mega-trigger {
    display: block;
    width: 100%;
    padding: 14px 12px;
    border-bottom: 1px solid #f0f0f0;
    text-align: left;
  }
  /* Suppress the desktop-only caret in the mobile drawer (the
     mega-menu is hidden on mobile anyway). */
  .nav-menu-wrapper-2.w--open .mt-mega-caret {
    display: none;
  }
  .nav-menu-wrapper-2.w--open .button-6 {
    display: inline-block;
    margin-top: 16px;
    width: 100%;
    text-align: center;
  }
  /* Hamburger trigger — make sure it's a clickable, full-tap
     surface even without Webflow's runtime adding inline styles. */
  .menu-button-2 {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .menu-button-2:focus-visible {
    outline: 2px solid #161616;
    outline-offset: 2px;
    border-radius: 2px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .nav-menu-wrapper-2,
  .nav-menu-wrapper-2.w--open {
    transition: none !important;
  }
}

/* =============================================================
   :has() STATE-DRIVEN STYLING (MOD26-04)
   =============================================================
   Pure-CSS state for the mega-menu panel; backs up JS aria
   updates so visual state remains coherent even if JS races
   or temporarily lags. Wrapped in @supports so legacy browsers
   without :has() ignore the entire block.
   ============================================================= */
@supports selector(:has(*)) {

  /* Body-level signal when ANY mega panel is open. Custom property
     can be read by other rules if ever needed. Visually inert beyond
     what .mt-mega-backdrop already provides. */
  body:has(.mt-mega.is-open) {
    --mt-mega-state: open;
  }

  /* Defensive: if a trigger is aria-expanded=true but the JS-driven
     .is-open class somehow lags on the panel, still treat the
     trigger underline as active. */
  .nav-menu-2:has(.mt-mega-trigger[aria-expanded="true"]) .mt-mega-trigger[aria-expanded="true"]::after {
    transform: scaleX(1);
  }

  /* Subtle backdrop dim signal on main content while any mega panel
     is open. Uses :has() to reach up from the panel; opacity nudged
     down slightly without obscuring page. */
  body:has(.mt-mega.is-open) main {
    transition: opacity 0.18s ease;
  }

}
