/* ========================================
   MEGA MENU WITH LEFT TABBING
   New Structure: inner-tabbing (left) + inner-tabbing-content (right)
   ======================================== */

/* Kill the generic sitewide dropdown arrow decoration (from main.css:
   ".main-menu ul li .submenu li a::after") which unintentionally matches
   every link nested inside this mega menu (it's technically a ".submenu"
   too) and was rendering as a stray rotated-square "arrow" on the left of
   the active tab and other links. */
.main-menu ul li .submenu.mega-menu li a::after {
  content: none !important;
  display: none !important;
}
.main-menu ul li .submenu.mega-menu .inner-tabbing li a::before {
  content: none !important;
  display: none !important;
}

/* Another generic rule (".main-menu ul li .submenu li a") was also winning
   the specificity battle and forcing display:block on our tab links,
   which dropped the triangle indicator onto its own line below the text
   instead of sitting inline next to it. Force flex back with higher
   specificity. */
.main-menu ul li .submenu.mega-menu .inner-tabbing li a.Mainitem {
  display: flex !important;
  align-items: center !important;
  white-space: nowrap;
}

/* Mega Menu Container */
.submenu.mega-menu {
  display: block;
  position: absolute;
  left: 0;
  top: calc(100% + 30px);
  margin: 0;
  padding: 0;
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  background: #ffffff;
  box-shadow: 0px 5px 30px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  width: 100vw;
  border-radius: 0 0 8px 8px;
  left: 50%;
  transform: translateX(-50%);
}

.menu-item-has-children:hover > .submenu.mega-menu {
  opacity: 1;
  visibility: visible;
  top: 100%;
}

.submenu.mega-menu > li {
  width: 100%;
  list-style: none;
}

/* Mega Menu Content Wrapper */
.mega-menu-content {
  width: 100%;
  max-width: 100%;
  /* max-width: 1200px; */
  margin: 0 auto;
}

/* Inner Panel - holds left and right sections */
.inner-panel {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: 450px;
  max-height: 75vh;
  position: relative;
}

/* ========================================
   LEFT SIDEBAR - INNER TABBING
   ======================================== */

.inner-tabbing {
  width: 340px;
  background: var(--color-body);
  /* background: var(--color-white); */
  flex-shrink: 0;
  padding: 20px 12px;
  overflow-y: auto;
  overflow-x: hidden;
}

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

.inner-tabbing ul li {
  width: 100%;
  display: block;
  margin: 0 0 4px;
  padding: 0;
}

.inner-tabbing ul li:last-child {
  margin-bottom: 0;
}

.inner-tabbing ul li a.Mainitem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px !important;
  color: var(--color-heading);
  font-family: var(--font-heading);
  font-size: 24px 15px;
  font-weight: 500;
  border-radius: 8px;
  border-left: 3px solid transparent;
  transition: all 0.3s ease;
  position: relative;
  background: transparent;
  text-decoration: none;
  letter-spacing: 0.2px;
  line-height: 1.4;
}

.inner-tabbing ul li:hover a.Mainitem,
.inner-tabbing ul li.active a.Mainitem {
  background: #f2efff;
  color: var(--color-primary);
  border-left-color: var(--color-primary);
}

.inner-tabbing ul li a.Mainitem .triangle-right {
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid var(--color-primary);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.Mainitem-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.Mainitem-icon {
  flex-shrink: 0;
  /* inherits currentColor, so it follows .Mainitem's own color/hover states */
}

.inner-tabbing ul li:hover a.Mainitem .triangle-right,
.inner-tabbing ul li.active a.Mainitem .triangle-right {
  opacity: 1;
}

/* ========================================
   RIGHT CONTENT - INNER TABBING CONTENT
   ======================================== */

.inner-tabbing-content {
  flex: 1;
  background: #ffffff;
  border-left: 1px solid #e5e7eb;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
}

.inner-tabbing-content .contectArea {
  display: none;
  padding: 18px 24px;
  width: 100%;
  animation: fadeInContent 0.4s ease-in-out;
}

/* Themed scrollbar matching the site's brand purple, used wherever this
   mega menu (or its off-canvas mobile counterpart) scrolls. */
.inner-tabbing,
.inner-tabbing-content,
.xb-header-menu-scroll,
.xb-header-nav .sub-menu {
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) transparent;
}
.inner-tabbing::-webkit-scrollbar,
.inner-tabbing-content::-webkit-scrollbar,
.xb-header-menu-scroll::-webkit-scrollbar,
.xb-header-nav .sub-menu::-webkit-scrollbar {
  width: 5px;
}
.inner-tabbing::-webkit-scrollbar-track,
.inner-tabbing-content::-webkit-scrollbar-track,
.xb-header-menu-scroll::-webkit-scrollbar-track,
.xb-header-nav .sub-menu::-webkit-scrollbar-track {
  background: transparent;
}
.inner-tabbing::-webkit-scrollbar-thumb,
.inner-tabbing-content::-webkit-scrollbar-thumb,
.xb-header-menu-scroll::-webkit-scrollbar-thumb,
.xb-header-nav .sub-menu::-webkit-scrollbar-thumb {
  background-color: var(--color-primary);
  border-radius: 4px;
}
.inner-tabbing::-webkit-scrollbar-button,
.inner-tabbing-content::-webkit-scrollbar-button,
.xb-header-menu-scroll::-webkit-scrollbar-button,
.xb-header-nav .sub-menu::-webkit-scrollbar-button {
  display: none;
}

@keyframes fadeInContent {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* First content area visible by default */
.inner-tabbing-content .contectArea:first-child {
  display: block;
}

/* Active state for content areas - controlled by JS */
.inner-tabbing-content .contectArea.active {
  display: block;
}

/* Service Links Styling
   Uses CSS Grid instead of Bootstrap's negative-margin row/col pattern
   (margin: 0 -12px) which was bleeding past the panel's right edge and
   getting clipped/cut off. Grid keeps everything contained without any
   negative margins.
   Scoped to ".col-lg-12 > .row" specifically (the inner row that actually
   holds the col-lg-6 links) - not the outer ".row.w-100" wrapper, which
   was also being matched by a broader selector and turning into an
   unwanted second grid column with nothing in it. */
.contectArea .col-lg-12 > .row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  /* grid-template-columns: repeat(2, minmax(0, 1fr)); */
  gap: 0;
  width: 100%;
  margin: 0;
}

.contectArea .col-lg-12 > .row > .col-lg-6 {
  padding: 0;
  min-width: 0;
  margin-bottom: 0;
  width: 100%;
}

.contectArea .row a {
  display: block;
  padding: 12px 14px;
  color: var(--color-heading);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  border-radius: 0;
  /* Only right/bottom borders by default, so adjoining cells share a
     single hairline instead of doubling up. The outer edges of the whole
     grid are then trimmed below (no border-left on the first column, no
     border-top on the first row, no border-right on the last column, no
     border-bottom on the last row). */
  border: 0 solid #eef0f2;
  border-right-width: 1px;
  border-bottom-width: 1px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  background: #f8f9fa;
  position: relative;
  height: auto;
  min-height: 44px;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  font-family: var(--font-heading);
  width: 100%;
  box-sizing: border-box;
}

/* Rightmost column: no border-right (outer edge). */
.contectArea .col-lg-12 > .row > .col-lg-6:nth-child(3n) a {
  border-right-width: 0;
}

/* Bottommost row: no border-bottom (outer edge). Using nth-last-child
   keeps this correct even when the last row isn't fully filled (e.g. 4 or
   5 links in a 3-column grid). */
.contectArea .col-lg-12 > .row > .col-lg-6:nth-last-child(-n + 3) a {
  border-bottom-width: 0;
}

.contectArea-link-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.contectArea-link-icon {
  flex-shrink: 0;
  color: var(--color-primary);
}

.contectArea .row a::before {
  content: "";
  position: absolute;
  left: -1px;
  top: -1px;
  bottom: -1px;
  width: 4px;
  border-radius: 10px 0 0 10px;
  background: var(--color-primary);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

/* .contectArea .row a:hover,
.contectArea .row a:focus-visible {
  background: #ffffff;
  border-color: var(--color-primary);
  box-shadow: 0 8px 20px rgba(104, 64, 255, 0.15);
  transform: translateY(-2px);
} */

.contectArea .row a:hover::before,
.contectArea .row a:focus-visible::before {
  transform: scaleY(1);
}

.contectArea .row a:hover span,
.contectArea .row a:focus-visible span {
  color: var(--color-primary);
}

.contectArea .row a span {
  display: block;
  font-size: 11px;
  color: #6b7280;
  font-weight: 400;
  margin-top: 4px;
  line-height: 1.5;
  transition: color 0.3s;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  max-width: 100%;
  width: 100%;
}

/* Links without description - smaller height */
.contectArea .row a span:empty {
  display: none;
}

.contectArea .row a:has(span:empty) {
  min-height: 44px;
  padding: 12px 14px;
}

/* ========================================
   MOBILE OFF-CANVAS MENU FIXES (991px and down)
   ======================================== */

/* Lock the page behind the off-canvas menu so scrolling moves the menu,
   not the body underneath it. Toggled via main.js on open/close.
   Works natively for mouse wheel on desktop. On real mobile touch devices
   this alone can still leak scroll to the background (iOS Safari quirk),
   which is why main.js also has a touchmove guard as a safety net. */
html.xb-menu-open,
body.xb-menu-open {
  overflow: hidden;
  height: 100vh;
}

/* The panel itself (.xb-header-menu) is fixed with overflow:hidden and
   height:100vh, but its inner content wrapper never had overflow-y set,
   so long menus had no way to scroll at all - forcing users to scroll the
   body behind it instead. */
.xb-header-menu-scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

@media (max-width: 991px) {
  /* Hide desktop menu */
  .main-menu__wrap {
    display: none !important;
  }

  /* Show mobile hamburger */
  .header-bar-mobile {
    display: block !important;
  }

  /* Top-level sub-menu (e.g. "Our Services") expands fully and scrolls via
     the outer .xb-header-menu-scroll panel. */
  .xb-header-nav .menu-item-has-children > .sub-menu {
    max-height: none;
    overflow: visible;
  }

  /* Nested 2nd-level sub-menu (e.g. "Trademark Services" list) gets its own
     capped height + scroll, since it can hold many links. Now that Lenis
     is excluded from these containers via data-lenis-prevent, this scrolls
     correctly with both mouse wheel and touch. */
  .xb-header-nav .menu-item-has-children .menu-item-has-children > .sub-menu {
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .submenu.mega-menu {
    position: static;
    width: 100%;
    transform: none;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    top: 0;
    left: 0;
    border-radius: 0;
  }

  .inner-panel {
    flex-direction: column;
    min-height: auto;
  }

  .inner-tabbing {
    width: 100%;
    padding: 15px 0;
    background: #ffffff;
  }

  .inner-tabbing-content {
    width: 100%;
    border-left: none;
    border-top: 1px solid #e5e7eb;
  }

  .inner-tabbing ul li {
    margin-bottom: 0;
    border-bottom: 1px solid #f0f0f0;
  }

  .inner-tabbing ul li a.Mainitem {
    background: #fff;
    border-left: none;
    border-radius: 0;
    padding: 16px 20px !important;
    font-size: 15px;
  }

  .inner-tabbing ul li:hover a.Mainitem,
  .inner-tabbing ul li.active a.Mainitem {
    background: var(--color-secondary);
    border-left: none;
    padding-left: 20px !important;
    box-shadow: none;
  }

  .inner-tabbing ul li a.Mainitem .triangle-right {
    display: none;
  }

  .inner-tabbing-content .contectArea {
    padding: 20px;
    background: #f9fafb;
    max-height: none;
  }

  .contectArea .col-lg-12 > .row {
    margin: 0;
  }

  .contectArea .col-lg-12 > .row > .col-lg-6 {
    padding: 0;
    margin-bottom: 12px;
  }

  .contectArea .row a {
    padding: 15px 18px;
    font-size: 14px;
    min-height: auto;
    background: #ffffff;
  }

  .contectArea .row a span {
    font-size: 12px;
    margin-top: 5px;
  }
}
@media (max-width: 1199px) {
  .contectArea .col-lg-12 > .row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .contectArea .col-lg-6,
  .contectArea .col-lg-9,
  .contectArea .col-lg-3 {
    width: 100%;
  }
  /* The "last column"/"last row" edges shift with 2 columns instead of 3 -
     undo the desktop (3-column) rules and reapply for 2 columns. */
  .contectArea .col-lg-12 > .row > .col-lg-6:nth-child(3n) a {
    border-right-width: 1px;
  }
  .contectArea .col-lg-12 > .row > .col-lg-6:nth-last-child(-n + 3) a {
    border-bottom-width: 1px;
  }
  .contectArea .col-lg-12 > .row > .col-lg-6:nth-child(2n) a {
    border-right-width: 0;
  }
  .contectArea .col-lg-12 > .row > .col-lg-6:nth-last-child(-n + 2) a {
    border-bottom-width: 0;
  }
}
@media (max-width: 768px) {
  .contectArea .col-lg-12 > .row {
    grid-template-columns: 1fr;
  }
  .contectArea .col-lg-6,
  .contectArea .col-lg-9,
  .contectArea .col-lg-3 {
    width: 100%;
  }
  /* Single column: no vertical dividers at all, and every row gets a
     divider below it except the very last one. */
  .contectArea .col-lg-12 > .row > .col-lg-6:nth-child(n) a {
    border-right-width: 0;
  }
  .contectArea .col-lg-12 > .row > .col-lg-6:nth-last-child(-n + 3) a {
    border-bottom-width: 1px;
  }
  .contectArea .col-lg-12 > .row > .col-lg-6:last-child a {
    border-bottom-width: 0;
  }
}
