header.site-header.wp-block-template-part {
  display: block !important;
}
#wp--skip-link--target {
  margin-top: 0;
}
#mg-mobile-drawer {
  margin: 0 !important;
  max-width: 100% !important;
}
.mg-no-scroll {
  overflow: hidden !important;
}

/* ===== HEADER ===== */
.mg-header {
  background: #fff;
  z-index: 100000;
  position: relative; /* clave para stacking */
}

.mg-header__bar {
  min-height: 72px;
  padding: 12px 16px;
  gap: 16px;
  height: 80px;
  position: relative; /* clave para que el mega se posicione bien */
  z-index: 2;
}

/* Button */
.mg-btn--primary .wp-block-button__link,
.mg-btn.mg-btn--full {
  background: #0b0c0c;
  color: #fff;
  border-radius: 0;
  padding: 10px 18px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0.5px;
  font-family: var(--font-geely);
  height: 48px;
}
.mg-btn--primary .wp-block-button__link {
  width: 110px;
}
.mg-header__cta {
  margin-left: 8px;
}

/* ===== NAV DESKTOP CUSTOM (mg-nav) ===== */
.mg-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.mg-nav__item {
  position: relative;
}

.mg-nav__link,
.mg-nav__trigger {
  text-decoration: none;
  color: #212529;
  font-family: var(--font-inter);
  font-weight: 600;
  font-size: 16px;
  line-height: 20px;

  min-height: 60px;
  display: inline-flex;
  align-items: center;
  gap: 8px;

  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
}

/* Flecha */
.mg-nav__arrow {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -2px;
  transition: transform 0.18s ease;
}

.mg-nav__item--has-mega.is-open .mg-nav__arrow {
  transform: rotate(225deg);
}

/* ===== MEGA MENU (DESKTOP) ===== */
.mg-mega {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  width: min(504px, 90vw);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.16);
  padding: 0px;
  z-index: 999999;
  display: none; /* CLAVE: oculto por defecto */
}

.mg-nav__item--has-mega.is-open > .mg-mega {
  display: block;
}

.mg-mega__grid {
  display: grid;
  grid-template-columns: 244px 1fr;
  align-items: stretch;
}

.mg-mega__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

.mg-mega__title {
  display: inline-block;
  font-family: var(--font-inter);
  font-weight: 700;
  font-size: 16px;
  line-height: 20px;
  color: #212529;
  text-decoration: none;
  margin-bottom: 6px;
}

.mg-mega__title:hover {
  text-decoration: underline;
}

.mg-mega__desc {
  margin: 0 0 14px 0;
  font-family: var(--font-inter);
  font-size: 14px;
  line-height: 18px;
  color: #2b2b2b;
  opacity: 0.9;
}

.mg-mega__content {
  padding: 33px 16px;
}

.mg-mega__links {
  display: grid;
  gap: 12px;
}

.mg-mega__link {
  text-decoration: none;
  color: #0b0c0c;
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  transition: background 0.15s ease;
}
.mg-mega__link:hover {
  background: rgba(0, 0, 0, 0.05);
}

.mg-mega__link strong {
  display: block;
  font-family: var(--font-inter);
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 2px;
}
.mg-mega__link span {
  display: block;
  font-family: var(--font-inter);
  font-size: 13px;
  line-height: 18px;
  opacity: 0.75;
}

/* ===== BURGER ===== */
.mg-header__burger {
  display: none;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  cursor: pointer;
  margin-left: auto;
}
.mg-burger {
  display: inline-block;
  width: 18px;
  height: 2px;
  background: #111;
  position: relative;
}
.mg-burger::before,
.mg-burger::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: #111;
}
.mg-burger::before {
  top: -6px;
}
.mg-burger::after {
  top: 6px;
}

/* ===== DRAWER ===== */
.mg-drawer {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
}
.mg-drawer.is-open {
  display: block;
}

.mg-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.mg-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(420px, 92vw);
  background: #1f2427;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.mg-drawer__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0px;
}

.mg-drawer__close {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
}

.mg-drawer__nav {
  flex: 1;
  overflow: auto;
  padding-top: 6px;
}

.mg-drawer__bottom {
  padding-top: 14px;
}
.mg-btn--full {
  width: 100%;
}

/* ===== MOBILE: el mega pasa a acordeón ===== */
.mg-nav--in-drawer .mg-mega {
  position: static;
  transform: none;
  display: none;
  width: 100%;
  min-width: 0;
  box-shadow: none;
  padding: 12px 0 0;
  background: transparent;
}

.mg-nav--in-drawer .mg-mega__grid {
  grid-template-columns: 1fr;
}

.mg-nav--in-drawer .mg-mega__img {
  max-height: 180px;
}

.mg-nav--in-drawer .mg-nav__item--has-mega.is-subopen .mg-mega {
  display: block;
}

.mg-nav--in-drawer .mg-nav {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.mg-nav--in-drawer .mg-nav__item {
  padding: 12px 0;
  border-bottom: 0;
}

.mg-nav--in-drawer .mg-nav__item.is-subopen .mg-mobile-row .mg-nav__link{
  text-decoration: underline;
}

.mg-nav--in-drawer .mg-nav__link,
.mg-nav--in-drawer .mg-nav__trigger {
  color: #fff;
  min-height: auto;
  padding: 10px 0;
  width: 100%;
  justify-content: space-between;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .mg-header__bar .mg-header__nav,
  .mg-header__bar .mg-header__cta {
    display: none !important;
  }

  .mg-header__burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .mg-header__bar {
    height: 56px;
  }
  .wp-block-site-logo img {
    max-width: 100px;
  }

  .mg-btn--full {
    background: #ffffff !important;
    color: #0b0c0c !important;
  }
  .mg-drawer__panel {
    padding: 40px;
  }
  .mg-nav {
    display: flex;
    align-items: start;
    gap: 12px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-direction: column;
  }
  .mg-nav--in-drawer .mg-nav__item {
    padding: 6px 0;
  }
}

/* =========================
   HEADER OVERLAY
========================= */

.mg-header--overlay {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  z-index: 100000;
  background: transparent;
}

.mg-header--overlay .mg-header__bar {
  background: transparent;
}

.mg-header--overlay .mg-nav__link,
.mg-header--overlay .mg-nav__trigger {
  color: #fff;
}

.mg-header--overlay .custom-logo {
  filter: invert(1) brightness(2);
}

.mg-header--overlay .mg-btn--primary .wp-block-button__link {
  background: #fff;
  color: #000;
}

.mg-header--overlay .mg-burger,
.mg-header--overlay .mg-burger::before,
.mg-header--overlay .mg-burger::after {
  background: #fff;
}

/* mega oscuro en overlay */
.mg-header--overlay .mg-mega {
  background: #0b0c0c;
}
.mg-header--overlay .mg-mega__title,
.mg-header--overlay .mg-mega__link,
.mg-header--overlay .mg-mega__desc,
.mg-header--overlay .mg-mega__link span,
.mg-header--overlay .mg-mega__link strong {
  color: #fff;
}
.mg-header--overlay .mg-mega__link:hover {
  background: rgba(255, 255, 255, 0.08);
}
.mg-nav--in-drawer .mg-mobile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 0;
}

.mg-nav--in-drawer .mg-mobile-toggle {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  color: #fff;
}

.mg-nav--in-drawer .mg-mobile-toggle .mg-nav__arrow {
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -7px; /* quitar el -2px */
  transition: transform 0.18s ease;
}

.mg-nav--in-drawer .mg-nav__item.is-subopen .mg-mobile-toggle .mg-nav__arrow {
  transform: rotate(225deg);
}

.mg-nav--in-drawer .mg-mobile-submenu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mg-nav--in-drawer .mg-nav__item.is-subopen .mg-nav__arrow {
  transform: rotate(225deg);
}
