/* Site navigation — mega menu, compact desktop typography */

.nav {
  position: relative;
}

.nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nav-item__trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.nav-item__trigger:hover,
.nav-item.is-open .nav-item__trigger,
.nav-item__trigger[aria-expanded="true"] {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.nav-item__trigger svg {
  width: 10px;
  height: 10px;
  opacity: 0.65;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-item.is-open .nav-item__trigger svg,
.nav-item__trigger[aria-expanded="true"] svg {
  transform: rotate(180deg);
  opacity: 1;
}

.nav-item > a.nav-link {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  border-radius: 999px;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease;
}

.nav-item > a.nav-link:hover,
.nav-item > a.nav-link[aria-current="page"] {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

/* —— Mega menu panel —— */
.mega-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  z-index: 300;
  width: min(1040px, calc(100vw - 40px));
  max-height: min(72vh, 560px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 18px 20px 16px;
  background:
    linear-gradient(165deg, rgba(22, 24, 30, 0.98) 0%, rgba(10, 11, 14, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 28px 70px rgba(0, 0, 0, 0.55),
    0 0 48px rgba(126, 148, 184, 0.08);
  backdrop-filter: blur(22px) saturate(1.25);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 10px) scale(0.98);
  transform-origin: top center;
  transition:
    opacity 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.24s;
  pointer-events: none;
}

.mega-menu::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  mix-blend-mode: overlay;
}

.mega-menu > * {
  position: relative;
  z-index: 1;
}

.nav-item--services .mega-menu {
  left: 0;
  transform: translate(0, 10px) scale(0.98);
  transform-origin: top left;
}

.nav-item--niches .mega-menu {
  left: auto;
  right: 0;
  width: min(400px, calc(100vw - 40px));
  max-height: none;
  transform: translate(0, 10px) scale(0.98);
  transform-origin: top right;
}

.nav-item.is-open .mega-menu,
.nav-item:focus-within .mega-menu {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0) scale(1);
  pointer-events: auto;
}

.nav-item--services.is-open .mega-menu,
.nav-item--services:focus-within .mega-menu {
  transform: translate(0, 0) scale(1);
}

.nav-item--niches.is-open .mega-menu,
.nav-item--niches:focus-within .mega-menu {
  transform: translate(0, 0) scale(1);
}

.mega-menu__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px 18px;
}

.mega-menu__grid--services {
  grid-template-columns: 1.15fr 0.92fr 0.92fr 0.88fr 0.88fr;
  gap: 14px 16px;
}

.mega-menu__col-title--promo a {
  color: #fff !important;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.mega-menu__col--target,
.mega-menu__col--seo {
  padding: 10px 10px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.mega-menu__col--target {
  border-color: rgba(184, 154, 201, 0.22);
  background: linear-gradient(165deg, rgba(157, 142, 196, 0.12), rgba(255, 255, 255, 0.02));
}

.mega-menu__col--seo {
  border-color: rgba(184, 201, 154, 0.22);
  background: linear-gradient(165deg, rgba(184, 201, 154, 0.1), rgba(255, 255, 255, 0.02));
}

.mega-menu__link--promo {
  font-weight: 500 !important;
  color: rgba(255, 255, 255, 0.82) !important;
}

.mobile-nav-accordion__subhead {
  display: block;
  margin: 10px 0 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}

.mega-menu__grid--niches {
  grid-template-columns: 1fr;
}

.mega-menu__grid--niches .mega-menu__links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 12px;
}

.mega-menu__col-title {
  margin: 0 0 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}

.mega-menu__col-title a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  transition: color 0.2s ease;
}

.mega-menu__col-title a:hover {
  color: #fff;
}

.mega-menu__links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.mega-menu__links > li > a {
  display: block;
  padding: 3px 0;
  font-size: 11px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.68);
  text-decoration: none;
  transition: color 0.15s ease, transform 0.15s ease;
}

.mega-menu__links > li > a:hover {
  color: #fff;
  transform: translateX(2px);
}

/* Google Ads nested branch */
.mega-menu__branch {
  margin: 4px 0 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.mega-menu__branch-head {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9) !important;
}

.mega-menu__branch-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.mega-menu__branch-list > li > a {
  display: block;
  padding: 2px 0;
  font-size: 10.5px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.58);
  text-decoration: none;
}

.mega-menu__branch-list > li > a:hover {
  color: rgba(255, 255, 255, 0.95);
}

.mega-menu__branch-group {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.mega-menu__branch-label {
  display: block;
  margin-bottom: 4px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(184, 201, 154, 0.75);
}

.mega-menu__branch-group .mega-menu__branch-nested {
  margin: 0;
  padding: 0 0 0 8px;
  list-style: none;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.mega-menu__branch-group .mega-menu__branch-nested a {
  display: block;
  padding: 2px 0;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.52);
  text-decoration: none;
}

.mega-menu__branch-group .mega-menu__branch-nested a:hover {
  color: #fff;
}

/* Legacy flat sub list (fallback) */
.mega-menu__sub {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 4px 0 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border-left: none;
}

.mega-menu__sub a {
  display: block;
  padding: 2px 0;
  font-size: 10.5px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.58);
  text-decoration: none;
}

.mega-menu__sub a:hover {
  color: #fff;
}

.mega-menu__footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.mega-menu__footer a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent, #e8e4dc);
  text-decoration: none;
}

.mega-menu__footer a:hover {
  color: #fff;
}

.mega-menu__grid--niches .mega-menu__links > li > a {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  font-size: 11px;
}

.mega-menu__grid--niches .mega-menu__links > li > a:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

/* —— Mobile accordion —— */
.mobile-nav-accordion {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-nav-accordion__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 0;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.mobile-nav-accordion__trigger::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.5;
  transition: transform 0.2s ease;
}

.mobile-nav-accordion.is-open .mobile-nav-accordion__trigger::after {
  transform: rotate(-135deg);
  margin-top: 4px;
}

.mobile-nav-accordion__panel {
  display: none;
  padding: 0 0 12px 4px;
  max-height: 50vh;
  overflow-y: auto;
}

.mobile-nav-accordion.is-open .mobile-nav-accordion__panel {
  display: block;
}

.mobile-nav-accordion__panel a {
  display: block;
  padding: 7px 0;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}

.mobile-nav-accordion__panel a:hover {
  color: var(--text);
}

.mobile-nav-accordion__group {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.mobile-nav-accordion__group strong {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.mobile-nav-accordion__nested {
  padding-left: 12px;
  margin: 4px 0 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-nav-accordion__nested a {
  font-size: 13px;
  padding: 6px 0;
}

.service-hub__children {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.service-hub__children a {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.service-hub__children a:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
}

.service-hub__children span {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .mega-menu__grid,
  .mega-menu__grid--services {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-item--services .mega-menu {
    width: min(760px, calc(100vw - 32px));
  }
}

@media (max-width: 767px) {
  .nav .nav-item--dropdown {
    display: none;
  }

  .mobile-nav-accordion {
    display: block;
  }
}

@media (min-width: 768px) {
  .mobile-nav-accordion {
    display: none;
  }
}

@media (hover: hover) and (min-width: 768px) {
  .nav-item--dropdown:hover .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0) scale(1);
    pointer-events: auto;
  }

  .nav-item--services.nav-item--dropdown:hover .mega-menu {
    transform: translate(0, 0) scale(1);
  }

  .nav-item--niches.nav-item--dropdown:hover .mega-menu {
    transform: translate(0, 0) scale(1);
  }
}

/* Homepage floating header */
.page-home .nav-item__trigger,
.page-home .nav-item > a.nav-link {
  font-size: 11.5px;
  padding: 5px 9px;
  color: var(--x-muted, rgba(255, 255, 255, 0.65));
}

.page-home .nav-item__trigger:hover,
.page-home .nav-item > a.nav-link:hover,
.page-home .nav-item > a.nav-link[aria-current="page"],
.page-home .nav-item.is-open .nav-item__trigger {
  color: var(--x-text, #fff);
  background: rgba(255, 255, 255, 0.08);
}

.page-home .mega-menu {
  top: calc(100% + 14px);
}

@media (min-width: 768px) {
  .page-home .nav {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 1px;
    max-width: min(58vw, 720px);
  }
}

@media (min-width: 1100px) {
  .page-home .nav {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mega-menu,
  .nav-item__trigger svg {
    transition: none;
  }
}
