/* ═══════════════════════════════════════════════════════════
   NAVBAR SUBMENU
   Pure CSS on desktop; the small script handles tap/keyboard.
   Deliberately not Bootstrap's dropdown — the homepage loads
   bootstrap.min.js without Popper, so those would not work there.
   ═══════════════════════════════════════════════════════════ */

.navbar .nav-item.has-sub {
  position: relative;
}

.sub-caret {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 6px;
  border-top: 4px solid currentColor;
  border-right: 3.5px solid transparent;
  border-left: 3.5px solid transparent;
  vertical-align: middle;
  opacity: 0.75;
  transition: transform 0.25s ease;
}

.nav-item.has-sub.is-open .sub-caret {
  transform: rotate(180deg);
}

.sub-menu {
  position: absolute;
  top: 100%;
  left: 15px;
  z-index: 1200;
  min-width: 182px;
  margin: 0;
  padding: 7px 0;
  border: 1px solid rgb(83 83 90 / 12%);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 38px rgb(0 0 0 / 14%);
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    visibility 0.22s;
}

/* A gap between the link and the panel would drop the hover, so bridge it. */
.nav-item.has-sub::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  height: 12px;
}

.nav-item.has-sub:hover .sub-menu,
.nav-item.has-sub:focus-within .sub-menu,
.nav-item.has-sub.is-open .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.sub-menu li {
  margin: 0;
}

.sub-menu a {
  display: block;
  padding: 9px 18px;
  color: #53535a;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2px;
  white-space: nowrap;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    padding-left 0.2s ease;
}

.sub-menu a:hover,
.sub-menu a:focus {
  padding-left: 22px;
  background: rgb(124 144 160 / 10%);
  color: #7c90a0;
  outline: none;
}

/* ── mobile: inline, not floating ── */
@media (max-width: 991.98px) {
  .sub-menu {
    position: static;
    min-width: 0;
    margin: 2px 0 6px;
    padding: 2px 0;
    border: none;
    border-left: 2px solid rgb(124 144 160 / 35%);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    display: none;
  }

  .nav-item.has-sub.is-open .sub-menu {
    display: block;
  }

  /* Hover must not open it on touch — only the explicit tap does. */
  .nav-item.has-sub:hover .sub-menu,
  .nav-item.has-sub:focus-within .sub-menu {
    display: none;
  }

  .nav-item.has-sub.is-open:hover .sub-menu,
  .nav-item.has-sub.is-open:focus-within .sub-menu {
    display: block;
  }

  .sub-menu a {
    padding: 7px 0 7px 14px;
    color: inherit;
    opacity: 0.85;
  }

  .sub-menu a:hover,
  .sub-menu a:focus {
    padding-left: 18px;
    background: transparent;
  }

  .nav-item.has-sub::after {
    display: none;
  }
}
