.siteHeader {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10000;
  color: var(--warm-white);
  font-family: var(--font-body);
}

.topBar {
  height: var(--topbar-height);
  background: var(--gradient-header);
  transition: opacity 220ms ease, visibility 220ms ease;
}

.topBar__inner,
.mainBar__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topBar__left,
.topBar__right { display: flex; align-items: center; }
.topBar__left { gap: 10px; }
.topBar__right { gap: 10px; }

.socialIcon,
.socialIcon2 {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  transition: background-color 180ms ease, transform 180ms ease;
}

.socialIcon:hover,
.socialIcon2:hover {
  background: rgba(254, 252, 251, 0.12);
  transform: translateY(-1px);
}

.socialIcon img,
.socialIcon2 img { width: 17px; height: 17px; }

.topLink {
  min-height: 32px;
  padding: 7px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--prussian-blue);
  background: var(--warm-white);
  border: 1px solid var(--warm-white);
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.1;
  transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.topLink:hover { color: var(--warm-white); background: var(--prussian-blue); }

.mainBar {
  position: relative;
  height: var(--navbar-height);
  background: var(--gradient-header);
  box-shadow: 0 8px 24px rgba(10, 17, 40, 0.09);
}

.brandBlock { display: inline-flex; flex: 0 0 auto; align-items: center; }
.brandBlock img { width: auto; height: 48px; }

.navList,
.megaLeft ul,
.megaRight ul,
.menuList { margin: 0; padding: 0; list-style: none; }

.navList { display: flex; align-items: center; gap: clamp(10px, 1.25vw, 20px); }
.navList > li { position: relative; }

.navList > li > a {
  position: relative;
  min-height: 44px;
  padding: 11px 5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.navList > li > a::after {
  content: "";
  position: absolute;
  right: 5px;
  bottom: 6px;
  left: 5px;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease;
}

.navList > li > a:hover::after,
.navList > li > a[aria-current="page"]::after,
.navList > li > a:focus-visible::after { transform: scaleX(1); }
.caret { font-size: 0.75rem; opacity: 0.72; }

/* Panel alineado desde el mismo borde izquierdo de “Servicios” */
.megaMenu {
  position: absolute;
  top: calc(100% + 7px);
  left: 5px;
  right: auto;
  width: min(760px, 88vw);
  display: grid;
  grid-template-columns: 220px 1fr;
  overflow: hidden;
  color: var(--warm-white);
  background: var(--gradient-header);
  border: 1px solid rgba(254, 252, 251, 0.12);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(0, 10px);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
}

/* Puente invisible entre el enlace y el panel: evita que el hover se corte
   cuando el puntero cruza los 7 px de separación. */
.megaMenu::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: 100%;
  left: 0;
  height: 14px;
}

.hasMega:hover > .megaMenu,
.hasMega:focus-within > .megaMenu,
.hasMega.is-open > .megaMenu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(0, 0);
}

.megaLeft { padding: 26px 22px; border-right: 1px solid rgba(254, 252, 251, 0.14); }
.megaLeft h4 {
  margin: 0 0 16px;
  color: inherit;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.megaLeft li { opacity: 0.72; transition: opacity 160ms ease; }
.megaLeft li.isActive,
.megaLeft li:hover { opacity: 1; }
.megaLeft a,
.megaRight a { display: block; padding: 9px 0; font-size: 0.9375rem; line-height: 1.35; }
.megaRight { padding: 26px 30px; }
.megaRight .panel { display: none; }
.megaRight .panel.isActive { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 30px; }
.megaRight a { opacity: 0.82; }
.megaRight a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }

.hamburger,
.mobileMenu,
.mobileMenuOverlay { display: none; }

.siteHeader.isScrolled .topBar { opacity: 0; visibility: hidden; }
.siteHeader.isScrolled .mainBar {
  color: var(--deep-navy);
  background: rgba(254, 252, 251, 0.97);
  box-shadow: 0 8px 28px rgba(10, 17, 40, 0.11);
}

@media (min-width: 981px) {
  .siteHeader { transition: transform 260ms ease; }
  .siteHeader.isScrolled { transform: translateY(calc(var(--topbar-height) * -1)); }
}

@media (max-width: 1120px) and (min-width: 981px) {
  .navList { gap: 6px; }
  .navList > li > a { font-size: 0.8125rem; }
}

@media (max-width: 980px) {
  .siteHeader,
  .siteHeader.isScrolled { transform: none; }
  .topBar { display: none; }
  .mainBar { height: var(--mobile-header-height); }
  .brandBlock img { height: 29px; max-width: 190px; }
  .nav { display: none; }

  .hamburger {
    position: relative;
    z-index: 10003;
    width: 44px;
    height: 44px;
    padding: 0;
    display: grid;
    place-items: center;
    color: inherit;
    background: transparent;
    border: 0;
    cursor: pointer;
  }

  .hamburger span {
    position: absolute;
    width: 26px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 220ms ease, opacity 180ms ease, top 220ms ease;
  }

  .hamburger span:nth-child(1) { top: 13px; }
  .hamburger span:nth-child(2) { top: 21px; }
  .hamburger span:nth-child(3) { top: 29px; }
  .hamburger.isActive span:nth-child(1) { top: 21px; transform: rotate(45deg); }
  .hamburger.isActive span:nth-child(2) { opacity: 0; }
  .hamburger.isActive span:nth-child(3) { top: 21px; transform: rotate(-45deg); }

  .mobileMenuOverlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: block;
    background: rgba(10, 17, 40, 0.52);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    backdrop-filter: blur(3px);
    transition: opacity 220ms ease, visibility 220ms ease;
  }
  .mobileMenuOverlay.isOpen { opacity: 1; visibility: visible; pointer-events: auto; }

  .mobileMenu {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 10001;
    width: min(88vw, 390px);
    height: 100dvh;
    display: block;
    overflow: hidden;
    color: var(--warm-white);
    background: var(--gradient-menu);
    box-shadow: 20px 0 50px rgba(10, 17, 40, 0.3);
    transform: translateX(-105%);
    transition: transform 300ms cubic-bezier(.4,0,.2,1);
  }
  .mobileMenu.isOpen { transform: translateX(0); }

  .menuLevel {
    position: absolute;
    inset: 0;
    padding: 78px 24px max(24px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(20%);
    transition: opacity 200ms ease, transform 260ms ease, visibility 200ms ease;
  }
  .menuLevel.isActive { opacity: 1; visibility: visible; pointer-events: auto; transform: translateX(0); }
  .menuHeader {
    color: rgba(254, 252, 251, 0.72);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
  }
  .menuHeader2-back {
    align-self: flex-start;
    padding: 8px 0;
    color: inherit;
    background: transparent;
    border: 0;
    font-weight: 700;
    cursor: pointer;
  }
  .menuList a,
  .menuList button {
    width: 100%;
    min-height: 48px;
    padding: 12px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: inherit;
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(254, 252, 251, 0.12);
    font-size: 1.0625rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
  }
  .menuList .hasChildren::after { content: "›"; font-size: 1.5rem; opacity: 0.65; }
  .mobileActions { margin-top: auto; display: grid; gap: 10px; }
  .mobileActions .topLink { width: 100%; min-height: 44px; }
  .redes-mobile { display: flex; justify-content: center; gap: 12px; }
  .siteHeader:has(.mobileMenu.isOpen) .brandBlock { opacity: 0; pointer-events: none; }
  .siteHeader:has(.mobileMenu.isOpen) .hamburger { color: var(--warm-white); }
}

@media (max-width: 420px) {
  .mobileMenu { width: 92vw; }
  .menuLevel { padding-inline: 20px; }
  .brandBlock img { height: 27px; max-width: 172px; }
}
