/* Mega menu em telemóvel (menu-mobile.js). Em computador nada disto aparece. */
.sh-burger, .mega { display: none; }

@media (max-width: 767px) {
  /* header: logo à esquerda, botão "Menu" à direita; a pílula com os três links sai (batia no logo em ES/FR) */
  .site-header { flex-wrap: nowrap !important; align-items: center; justify-content: flex-start; }
  .site-header .sh-nav { display: none !important; }
  .site-header .sh-logo { width: 100px; }
  .site-header .sh-logo img { width: 100px; }
  .sh-burger {
    pointer-events: auto; display: inline-flex; align-items: center; gap: 10px; margin-left: auto; flex: none;
    height: var(--sh-h); padding: 0 16px 0 18px; border: 0; border-radius: var(--sh-r); background: #FBF6F3; color: #272727; cursor: pointer;
    font: 400 14px/1 "Neufile Grotesk Regular", sans-serif; -webkit-tap-highlight-color: transparent;
    transition: transform .45s cubic-bezier(.16, 1, .3, 1), background-color .3s ease;
  }
  .sh-burger:active { transform: scale(.95); }
  .sh-burger-ico { position: relative; display: block; width: 14px; height: 8px; }
  .sh-burger-ico::before, .sh-burger-ico::after { content: ""; position: absolute; left: 0; right: 0; height: 1.5px; background: currentColor; border-radius: 2px; transition: transform .4s cubic-bezier(.16, 1, .3, 1); }
  .sh-burger-ico::before { top: 0; } .sh-burger-ico::after { bottom: 0; }
  .sh-burger[aria-expanded="true"] .sh-burger-ico::before { transform: translateY(3.25px) rotate(45deg); }
  .sh-burger[aria-expanded="true"] .sh-burger-ico::after { transform: translateY(-3.25px) rotate(-45deg); }
  html.scrolled .sh-burger { box-shadow: 0 10px 30px rgba(38, 33, 32, .10); }

  /* o ecrã inteiro */
  .mega {
    display: flex; flex-direction: column; position: fixed; inset: 0; z-index: 3000; box-sizing: border-box;
    padding: max(20px, env(safe-area-inset-top)) 6% max(24px, env(safe-area-inset-bottom));
    background: #262120; color: #F3E4DD; overflow-y: auto; overscroll-behavior: contain;
    visibility: hidden; clip-path: inset(0 0 100% 0);
    transition: clip-path .7s cubic-bezier(.76, 0, .24, 1), visibility 0s linear .7s;
  }
  .mega.is-open { visibility: visible; clip-path: inset(0 0 0 0); transition: clip-path .7s cubic-bezier(.76, 0, .24, 1), visibility 0s; }
  html.mega-open { overflow: hidden; }
  html.mega-open .idioma-footer { opacity: 0; pointer-events: none; }

  .mega-top { display: flex; align-items: center; justify-content: space-between; min-height: var(--sh-h); }
  /* troca de logo: o do header sobe e sai, o claro do menu entra por baixo no mesmo sítio (e o inverso ao fechar) */
  .mega-logo { display: block; overflow: hidden; line-height: 0; }
  .mega-logo img { display: block; width: 100px; height: auto; filter: brightness(0) invert(1) sepia(.16) saturate(1.1) brightness(.97); transform: translate3d(0, 115%, 0); transition: transform .45s cubic-bezier(.65, 0, .35, 1); }
  .mega.is-open .mega-logo img { transform: none; transition: transform .8s cubic-bezier(.16, 1, .3, 1) .3s; }
  html.mega-open .sh-logo img { transform: translate3d(0, -115%, 0); transition: transform .4s cubic-bezier(.65, 0, .35, 1); }
  html.mega-closing .sh-logo img { animation: shLogoIn .8s cubic-bezier(.16, 1, .3, 1) .4s both; }
  @keyframes shLogoIn { from { transform: translate3d(0, 115%, 0); } to { transform: none; } }
  .mega-close { display: inline-flex; align-items: center; gap: 12px; padding: 10px 2px 10px 10px; border: 0; background: none; color: inherit; cursor: pointer; font: 400 15px/1 "Neufile Grotesk Regular", sans-serif; -webkit-tap-highlight-color: transparent; }
  .mega-close i { position: relative; width: 18px; height: 18px; display: block; }
  .mega-close i::before, .mega-close i::after { content: ""; position: absolute; left: -2px; right: -2px; top: 50%; height: 1.5px; background: currentColor; transform: rotate(45deg); }
  .mega-close i::after { transform: rotate(-45deg); }

  .mega-nav { display: flex; flex-direction: column; gap: clamp(28px, 8vw, 44px); margin: auto 0; padding: 7vh 0 5vh 0; }
  .mega-link { position: relative; display: block; overflow: hidden; padding: .04em 0 .12em; margin: -.04em 0 -.12em; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent;
    font-family: "Neufile Grotesk Extra Bold", sans-serif; font-weight: 800; font-size: clamp(36px, 11.6vw, 66px); line-height: 1.02; letter-spacing: -.045em; }
  .mega-link-in { display: block; transform: translate3d(0, 110%, 0); transition: transform .9s cubic-bezier(.16, 1, .3, 1); transition-delay: 0s; }
  .mega.is-open .mega-link-in { transform: none; transition-delay: calc(.28s + var(--i, 0) * .08s); }
  /* página atual: o ponto do "i" do logo da Brandit (o quadrado com o canto cortado) */
  .mega-link.is-on .mega-link-in::after { content: ""; display: inline-block; width: .15em; height: .21em; margin-left: .14em; vertical-align: .56em; background: currentColor; clip-path: polygon(0 0, 100% 0, 100% 53.1%, 0 100%); }
  .mega-link:active .mega-link-in { opacity: .6; }

  .mega-foot { display: flex; flex-direction: column; gap: 22px; padding-left: 0; opacity: 0; translate: 0 14px; transition: opacity .5s ease, translate .7s cubic-bezier(.16, 1, .3, 1); }
  .mega.is-open .mega-foot { opacity: 1; translate: 0 0; transition-delay: .55s; }
  .mega-langs { display: flex; gap: 6px; }
  .mega-lang { display: inline-flex; align-items: center; justify-content: center; min-width: 46px; height: 40px; padding: 0 14px; border-radius: 999px; color: inherit; text-decoration: none; font: 400 15px/1 "Neufile Grotesk Regular", sans-serif; opacity: .6; transition: opacity .3s ease, background-color .3s ease; }
  .mega-lang:first-child { margin-left: -14px; }
  .mega-lang.is-on { background: #F3E4DD; color: #262120; opacity: 1; }
  .mega-mail { color: inherit; font: 400 16px/1.2 "Neufile Grotesk Regular", sans-serif; text-decoration: underline; text-underline-offset: 4px; opacity: .85; }
}
@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .mega, .mega.is-open { transition: none; }
  .mega-link-in, .mega-foot { transition: none; }
}
