/** mega-nav: rich hover-activated mega menu (Job Seekers / Employers / Certificates) **/

/**
 * A SINGLE shared panel, not one per dropdown -- rendered as a sibling of
 * <ul class="navigation"> in partials/megaNav.php, not nested inside any of
 * the three trigger <li> elements. Visibility is toggled by mega-nav.js
 * adding/removing .mega-nav-open on trigger/panel hover; which content mode
 * shows is set by mega-nav.js ONLY on trigger-link hover (data-active-menu),
 * never by moving the cursor around inside the panel itself. See
 * partials/megaNav.php's top comment for why that split matters: with one
 * panel per dropdown (the earlier design), all three rendered at the same
 * full-width screen position, and a stray hover match on a neighboring
 * trigger while the cursor crossed an already-open panel would flip which
 * one was showing. A single panel whose content is keyed only to explicit
 * trigger hover removes that failure mode by construction.
 */
.mega-nav-panel{
  position: absolute;
  left: 0px;
  top: 100%;
  width: 100%;
  margin-top: 15px;
  padding: 30px;
  z-index: 100;
  background: #14171b;
  border-radius: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 400ms ease, visibility 400ms ease, margin-top 400ms ease;
}

.mega-nav-panel.mega-nav-open{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  margin-top: 0px;
}

.mega-nav-menu{
  display: none;
}

.mega-nav-panel[data-active-menu="seekers"] .mega-nav-menu[data-mega-menu="seekers"],
.mega-nav-panel[data-active-menu="employers"] .mega-nav-menu[data-mega-menu="employers"],
.mega-nav-panel[data-active-menu="certificates"] .mega-nav-menu[data-mega-menu="certificates"]{
  display: block;
}

.mega-nav-inner{
  display: flex;
  align-items: flex-start;
  gap: 40px;
}

.mega-nav-list__wrapper{
  flex: 0 0 320px;
}

.mega-nav-list__title{
  width: -webkit-max-content;
  width: max-content;
  margin-bottom: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.mega-nav-list{
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 320px;
  margin: 0px;
  padding: 0px;
  list-style: none;
}

.mega-nav-list__cta{
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mega-nav-list__cta .theme-btn{
  display: block;
  width: 100%;
  padding: 14px 20px;
  font-size: 15px;
}

.mega-nav-list__item{
  position: relative;
  width: 100%;
  cursor: pointer;
}

.mega-nav-list__item-row{
  display: flex;
  align-items: center;
  padding: 10px 14px 10px 8px;
  gap: 14px;
  border-radius: 14px;
  transition: background-color 300ms ease;
}

.mega-nav-list__item-icon{
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(120, 235, 84, 0.12);
  flex-shrink: 0;
}

.mega-nav-list__item-icon i{
  font-size: 20px;
  color: var(--theme-color);
}

.mega-nav-list__item-link{
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
}

.mega-nav-list__item-title{
  font-family: var(--title-font);
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  line-height: 20px;
}

.mega-nav-list__item-subtitle{
  font-family: var(--text-font);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.mega-nav-list__item-arrow{
  margin-left: auto;
  color: #ffffff;
  opacity: 0;
  visibility: hidden;
  flex-shrink: 0;
  transition: all 300ms ease;
}

.mega-nav-list__item.active > .mega-nav-list__item-row{
  background: rgba(255, 255, 255, 0.06);
}

/**
 * Scoped to .mega-nav-panel.mega-nav-open, not just .active -- visibility
 * and pointer-events set on a descendant override an ancestor's hidden
 * state rather than staying subject to it, so an unqualified `.active{
 * visibility:visible}` here would make the default-active item's arrow (and,
 * worse, the default-active .mega-nav-content's links below) visible and
 * clickable even while the whole panel is closed. Requiring .mega-nav-open
 * on the ancestor is what actually keeps closed == fully hidden/inert.
 */
.mega-nav-panel.mega-nav-open .mega-nav-list__item.active > .mega-nav-list__item-row .mega-nav-list__item-arrow{
  opacity: 1;
  visibility: visible;
}

/**
 * All .mega-nav-content panels for a dropdown share the same grid cell, so
 * this stack's height is always the tallest panel among them -- even ones
 * currently hidden via opacity. That's what keeps the dark .mega-nav-panel
 * background sized to fit whichever panel is showing, instead of collapsing
 * to the (usually shorter) category list on the left and letting a taller
 * panel spill out underneath it.
 */
.mega-nav-content__stack{
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
}

.mega-nav-content__stack > .mega-nav-content{
  grid-column: 1;
  grid-row: 1;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 300ms ease, visibility 300ms ease;
}

/**
 * Scoped to .mega-nav-panel.mega-nav-open -- same reasoning as the list-item
 * arrow rule above. Without this, the default-active .mega-nav-content
 * (data-panel="0", .active from the initial PHP render) stays visible and
 * its links stay clickable even while the panel is closed, since .active's
 * visibility/pointer-events override the closed panel's hidden state
 * instead of being subject to it.
 */
.mega-nav-panel.mega-nav-open .mega-nav-content__stack > .mega-nav-content.active{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mega-nav-content__title{
  font-family: var(--title-font);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 20px;
}

.mega-nav-content__grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.mega-nav-card{
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  padding: 10px 10px 18px;
  text-decoration: none;
  transition: all 300ms ease;
}

.mega-nav-card:hover{
  border-color: rgba(255, 255, 255, 0.2);
}

.mega-nav-card__img{
  display: block;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  aspect-ratio: 4 / 3;
}

.mega-nav-card__img img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease;
}

.mega-nav-card:hover .mega-nav-card__img img{
  transform: scale(1.05);
}

.mega-nav-card__title{
  padding: 0px 4px;
  font-family: var(--title-font);
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 8px;
}

.mega-nav-card__text{
  padding: 0px 4px;
  font-family: var(--text-font);
  font-size: 12px;
  line-height: 18px;
  color: rgba(255, 255, 255, 0.5);
}

/** certificates dropdown: single detail panel instead of a card grid **/

.mega-nav-content__detail{
  display: flex;
  gap: 24px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  padding: 20px;
  height: 100%;
}

.mega-nav-detail__img{
  display: block;
  flex: 0 0 220px;
  align-self: flex-start;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.mega-nav-detail__img img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mega-nav-detail__info{
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.mega-nav-detail__issuer{
  display: block;
  font-family: var(--text-font);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 6px;
}

.mega-nav-detail__title{
  font-family: var(--title-font);
  font-size: 20px;
  color: #ffffff;
  margin-bottom: 10px;
}

.mega-nav-detail__text{
  font-family: var(--text-font);
  font-size: 13px;
  line-height: 20px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 16px;
}

.mega-nav-detail__list{
  margin: 0px 0px 20px;
  padding: 0px 0px 0px 18px;
}

.mega-nav-detail__list li{
  font-family: var(--text-font);
  font-size: 13px;
  line-height: 20px;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 6px;
}

.mega-nav-detail__btns{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: auto;
}

.mega-nav-detail__btns .theme-btn{
  padding: 10px 22px;
  font-size: 13px;
}

@media (hover: hover) and (pointer: fine){
  .mega-nav-list__item:hover > .mega-nav-list__item-row{
    background: rgba(255, 255, 255, 0.06);
  }

  .mega-nav-list__item:hover > .mega-nav-list__item-row .mega-nav-list__item-arrow{
    opacity: 1;
    visibility: visible;
  }
}

@media screen and (max-width: 1400px){
  .mega-nav-list__wrapper{
    flex-basis: 260px;
  }

  .mega-nav-list{
    max-width: 260px;
  }
}

/**
 * mobile-menu: the shared desktop panel is cloned in too (it's part of
 * .main-menu's innerHTML) but there's no mechanism to open it on mobile --
 * it's a sibling of .navigation now, not nested in a trigger <li>, so the
 * template's dropdown-btn/.prev('.megamenu') accordion can't reach it. Hide
 * it outright so it can't contribute stray layout.
 *
 * Each trigger <li> instead gets its own plain <ul class="mega-nav-mobile-
 * list"> (rendered in partials/megaNav.php), which the template's existing
 * accordion already knows how to open with zero extra JS -- script.js finds
 * that <ul>, appends a dropdown-btn arrow after it, and toggles it on tap.
 * That <ul> is force-hidden below in the .main-menu (desktop) context so it
 * never appears there -- desktop keeps using the shared panel exclusively,
 * unchanged.
 */
.mobile-menu .mega-nav-panel{
  display: none;
}

.mobile-menu{
  width: 100%;
  padding-right: 0px;
}

.main-menu .navigation > li > ul.mega-nav-mobile-list{
  display: none !important;
}

.mobile-menu .navigation li.dropdown .mega-nav-mobile-list li > a{
  text-transform: none;
}
