/* ==========================================================================
   UV DigiTech - Mega menu  ("Technology Solutions & Services")
   --------------------------------------------------------------------------
   One markup, two presentations (breakpoint matches the theme's navbar-expand-lg):
     >= 992px   Desktop : full-width flyout, category rail + services panel
     <  992px   Tablet & mobile : touch accordion inside the theme's off-canvas
                drawer (.mo-left .header-nav, 280px wide, scrolls by itself)
   Colours follow the active skin (skin-2.css custom properties) with fallbacks.
   Everything is scoped to .uv-mega so it cannot leak into the rest of the theme.
   ========================================================================== */

.uv-mega {
  --uv-teal: var(--color-primary, #00b6bc);
  --uv-teal-dark: var(--color-hover, #007c80);
  --uv-navy: var(--color-secondry, #152332);
  --uv-text: #46535f;
  --uv-line: #dce5e9;
  --uv-tint: #eef8f9;
  --uv-tint: color-mix(in srgb, var(--uv-teal) 8%, #ffffff);
  --uv-rail-w: 300px;
  --uv-row: 46px;
  --uv-ease: cubic-bezier(.2, .7, .2, 1);
}

/* --------------------------------------------------------------------------
   Reset the bits of the theme that would otherwise leak into the menu
   -------------------------------------------------------------------------- */
.site-header .uv-mega ul,
.site-header .uv-mega li {
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-header .uv-mega p { margin: 0; }
.site-header .uv-mega ul.uv-mega__tabs,
.site-header .uv-mega ul.uv-mega__links {
  display: block;
  position: static;
  /* inherit, so a closed/collapsed panel really hides its links from Tab and screen readers
     (the theme forces visibility: visible on every nav <ul> below 992px) */
  visibility: inherit;
  opacity: 1;
  width: auto;
  background: transparent;
  box-shadow: none;
  border: 0;
}
.site-header .uv-mega .uv-mega__panel a { text-transform: none; }

/* --------------------------------------------------------------------------
   Category tab (rail row on desktop/tablet, accordion header on mobile)
   -------------------------------------------------------------------------- */
.site-header .uv-mega .uv-mega__tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: var(--uv-row);
  margin: 0;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--uv-navy);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .18s ease, box-shadow .18s ease, color .18s ease;
}
.uv-mega__label { flex: 1 1 auto; min-width: 0; }

.site-header .uv-mega .uv-mega__chev {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--uv-teal-dark);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .18s ease, transform .18s ease;
}

.site-header .uv-mega .uv-mega__tab:hover,
.site-header .uv-mega .uv-mega__cat.is-active > .uv-mega__tab {
  background: #fff;
  box-shadow: 0 1px 2px rgba(21, 35, 50, .06), 0 6px 16px -6px rgba(21, 35, 50, .16);
}
.site-header .uv-mega .uv-mega__cat.is-active > .uv-mega__tab { color: var(--uv-teal-dark); }
.site-header .uv-mega .uv-mega__tab:hover .uv-mega__chev,
.site-header .uv-mega .uv-mega__cat.is-active > .uv-mega__tab .uv-mega__chev {
  opacity: 1;
  transform: none;
}

/* Keyboard focus - always visible */
.site-header .uv-mega .uv-mega__tab:focus-visible,
.site-header .uv-mega .uv-mega__links a:focus-visible,
.site-header .uv-mega .uv-mega__viewall:focus-visible,
.site-header .uv-mega .uv-mega__all:focus-visible {
  outline: 2px solid var(--uv-teal-dark);
  outline-offset: 2px;
}
.site-header .uv-mega > .uv-mega__trigger:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Services panel contents
   -------------------------------------------------------------------------- */
.uv-mega__pane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--uv-navy);
}
.site-header .uv-mega .uv-mega__pane-title {
  color: var(--uv-navy);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.01em;
}
.site-header .uv-mega .uv-mega__viewall {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--uv-navy);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  transition: color .15s ease;
}
.site-header .uv-mega .uv-mega__viewall .fas { font-size: 10px; transition: transform .18s var(--uv-ease); }
.site-header .uv-mega .uv-mega__viewall:hover { color: var(--uv-teal-dark); }
.site-header .uv-mega .uv-mega__viewall:hover .fas { transform: translateX(3px); }

.site-header .uv-mega ul.uv-mega__links { column-gap: 28px; }
.site-header .uv-mega ul.uv-mega__links.cols-2 { column-count: 2; }
.site-header .uv-mega ul.uv-mega__links.cols-3 { column-count: 3; }
.site-header .uv-mega ul.uv-mega__links.cols-4 { column-count: 4; }
.site-header .uv-mega ul.uv-mega__links > li {
  break-inside: avoid;
  page-break-inside: avoid;
}
.site-header .uv-mega .uv-mega__links a {
  display: block;
  padding: 8px 0;
  color: var(--uv-text);
  font-size: 14.5px;
  font-weight: 400;
  line-height: 1.4;
  text-decoration: none;
  background: transparent;
  transition: color .15s ease;
}
.site-header .uv-mega .uv-mega__links a:hover {
  color: var(--uv-teal-dark);
  background: transparent;
  text-decoration: underline;
  text-decoration-color: var(--uv-teal);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
}
.site-header .uv-mega .uv-mega__empty {
  padding: 8px 0;
  color: #7b8791;
  font-size: 14.5px;
}

/* "View All Services" - the original last item of the dropdown */
.site-header .uv-mega .uv-mega__all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--uv-navy);
  color: #fff;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color .18s ease;
}
.site-header .uv-mega .uv-mega__all .fas { font-size: 12px; transition: transform .18s var(--uv-ease); }
.site-header .uv-mega .uv-mega__all:hover { background: var(--uv-teal-dark); color: #fff; }
.site-header .uv-mega .uv-mega__all:hover .fas { transform: translateX(3px); }

.site-header .uv-mega .uv-mega__rail-title {
  margin: 0 0 12px;
  padding: 0 6px 12px;
  border-bottom: 1px solid var(--uv-navy);
  color: var(--uv-navy);
  font-size: 15px;
  font-weight: 500;
}

/* ==========================================================================
   TWO-PANE LAYOUT  (>= 992px)
   ========================================================================== */
@media (min-width: 992px) {
  .uv-mega__body {
    position: relative;
    display: flex;
    min-height: 380px;
    max-height: calc(100vh - 150px);
  }
  .uv-mega__rail {
    flex: 0 0 var(--uv-rail-w);
    width: var(--uv-rail-w);
    display: flex;
    flex-direction: column;
    padding: 22px 14px 14px;
    background: var(--uv-tint);
    min-height: 0;
  }
  .site-header .uv-mega ul.uv-mega__tabs {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    margin: 0 -4px;
    padding: 0 4px;
    scrollbar-width: thin;
    overscroll-behavior: contain;
  }
  .site-header .uv-mega ul.uv-mega__tabs > li + li { margin-top: 3px; }

  /* The pane is a child of its category <li> but is laid out in the right column */
  .uv-mega__pane {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--uv-rail-w);
    right: 0;
    display: none;
    padding: 26px 32px 24px;
    overflow-y: auto;
    background: #fff;
    overscroll-behavior: contain;
  }
  .uv-mega__cat.is-active > .uv-mega__pane {
    display: block;
    animation: uv-mega-pane .2s var(--uv-ease);
  }
  @keyframes uv-mega-pane {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
  }
}

/* ==========================================================================
   DESKTOP FLYOUT  (>= 992px)
   ========================================================================== */
@media (min-width: 992px) {
  /* The <li> stops being the positioning context so the panel can span the
     whole header bar (.main-bar is position: relative / fixed). */
  .header-nav .nav > li.uv-mega { position: static; }

  .site-header .uv-mega > .uv-mega__trigger .fas {
    transition: transform .2s var(--uv-ease);
  }
  .site-header .uv-mega.is-open > .uv-mega__trigger .fas { transform: rotate(180deg); }

  /* Same white pill outline the theme draws on :hover, also for keyboard/click */
  .navstyle2 .main-bar.bg-primary .header-nav .nav > li.uv-mega.is-open > a:after {
    box-shadow: inset 0 0 0 2px #fff;
  }

  .uv-mega__panel {
    position: absolute;
    top: 100%;
    left: 50%;
    z-index: 99;
    width: min(1140px, calc(100% - 32px));
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 8px);
    transition: opacity .18s ease, transform .22s var(--uv-ease), visibility 0s linear .22s;
  }
  .uv-mega.is-open > .uv-mega__panel {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
    transition-delay: 0s;
  }
  /* Invisible bridge so the pointer can travel from the link to the panel
     without crossing a dead zone that would close the menu. */
  .uv-mega__panel::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -28px;
    height: 28px;
  }
  .uv-mega__inner {
    overflow: hidden;
    border-radius: 0 0 18px 18px;
    background: #fff;
    box-shadow: 0 28px 56px -14px rgba(21, 35, 50, .34), 0 0 0 1px rgba(21, 35, 50, .05);
  }
}

/* Narrower laptops: keep three columns at most so links never get cramped */
@media (min-width: 992px) and (max-width: 1199px) {
  .uv-mega { --uv-rail-w: 270px; }
  .uv-mega__pane { padding: 24px 26px; }
  .site-header .uv-mega ul.uv-mega__links.cols-4 { column-count: 3; }
}

/* ==========================================================================
   DRAWER  (< 992px): the menu lives inside the theme's off-canvas drawer
   ========================================================================== */
@media (max-width: 991px) {
  .uv-mega__panel {
    display: grid;
    grid-template-rows: 0fr;
    visibility: hidden;
    transition: grid-template-rows .3s var(--uv-ease), visibility 0s linear .3s;
  }
  .uv-mega.is-open > .uv-mega__panel {
    grid-template-rows: 1fr;
    visibility: visible;
    transition-delay: 0s;
  }
  .uv-mega__inner {
    min-height: 0;
    overflow: hidden;
    /* line up with the link text of the other drawer items (navstyle2 link padding) */
    margin: 0 15px 0 20px;
  }
}

/* ==========================================================================
   TABLET + MOBILE ACCORDION  (< 992px)
   ========================================================================== */
@media (max-width: 991px) {
  .site-header .uv-mega .uv-mega__tab:focus-visible { outline-offset: -2px; }
  .site-header .uv-mega .uv-mega__chev { opacity: 1; transform: none; }
  .uv-mega__body {
    display: block;
    min-height: 0;
    border: 0;
    border-radius: 0;
    overflow: visible;
    margin: 6px 0 10px;
  }
  .uv-mega__rail {
    display: block;
    width: auto;
    padding: 0;
    background: transparent;
  }
  .uv-mega__rail-title { display: none; }
  .site-header .uv-mega ul.uv-mega__tabs { margin: 0; padding: 0; overflow: visible; }
  .site-header .uv-mega ul.uv-mega__tabs > li {
    border-bottom: 1px solid var(--uv-line);
  }
  .site-header .uv-mega ul.uv-mega__tabs > li:last-child { border-bottom: 0; }

  .site-header .uv-mega .uv-mega__tab {
    min-height: 52px;
    padding: 8px 2px;
    gap: 14px;
    border-radius: 0;
    font-size: 16px;
    background: transparent;
    box-shadow: none;
  }
  .site-header .uv-mega .uv-mega__tab:hover,
  .site-header .uv-mega .uv-mega__cat.is-active > .uv-mega__tab {
    background: transparent;
    box-shadow: none;
  }
  .site-header .uv-mega .uv-mega__chev {
    width: 28px;
    text-align: center;
    font-size: 12px;
    color: var(--uv-navy);
    transition: transform .25s var(--uv-ease);
  }
  .site-header .uv-mega .uv-mega__cat.is-active > .uv-mega__tab .uv-mega__chev {
    transform: rotate(90deg);
    color: var(--uv-teal-dark);
  }

  /* Pane becomes the accordion body, animated with grid rows (no JS heights) */
  .uv-mega__pane,
  .uv-mega__cat.is-active > .uv-mega__pane {
    position: static;
    display: grid;
    grid-template-rows: 0fr;
    padding: 0;
    overflow: visible;
    background: transparent;
    visibility: hidden;
    animation: none;
    transition: grid-template-rows .28s var(--uv-ease), visibility 0s linear .28s;
  }
  .uv-mega__cat.is-active > .uv-mega__pane {
    grid-template-rows: 1fr;
    visibility: visible;
    transition-delay: 0s;
  }
  .uv-mega__pane-in {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: 0 0 0 14px;
  }
  .uv-mega__pane-head {
    order: 2;
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
  }
  .site-header .uv-mega .uv-mega__pane-title { display: none; }
  .site-header .uv-mega ul.uv-mega__links { order: 1; padding-top: 2px; }
  .site-header .uv-mega ul.uv-mega__links.cols-2,
  .site-header .uv-mega ul.uv-mega__links.cols-3,
  .site-header .uv-mega ul.uv-mega__links.cols-4 { column-count: 1; }

  /* 44px+ touch targets */
  .site-header .uv-mega .uv-mega__links a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 6px 4px 6px 0;
    font-size: 15.5px;
  }
  .site-header .uv-mega .uv-mega__links a:hover { text-decoration: none; }
  .site-header .uv-mega .uv-mega__viewall {
    min-height: 44px;
    margin-bottom: 8px;
    color: var(--uv-teal-dark);
    font-size: 15px;
    font-weight: 600;
  }
  .site-header .uv-mega .uv-mega__all {
    margin-top: 12px;
    min-height: 48px;
    padding: 12px 16px;
  }
}

/* --------------------------------------------------------------------------
   Respect "reduce motion"
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .uv-mega *,
  .uv-mega *::before,
  .uv-mega *::after {
    animation: none !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
  }
}
