/*
 * GBF - Menu principal
 * Componente independente do widget Menu do Elementor e sem jQuery.
 */

.gbf-main-menu{
  --gbf-menu-accent:#009049;
  --gbf-menu-text:currentColor;
  --gbf-menu-panel-text:#262626;
  --gbf-menu-panel-bg:#fff;
  --gbf-menu-radius:12px;

  position:relative;
  /* Mantém todo o menu acima de filtros, selects e demais camadas da página. */
  z-index:100000;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  width:100%;
  min-width:0;
  color:inherit;
  font:inherit;
}

.gbf-main-menu,
.gbf-main-menu *{
  box-sizing:border-box;
}

.gbf-main-menu__panel{
  display:block;
  min-width:0;
}

.gbf-main-menu__list,
.gbf-main-menu__list .sub-menu{
  margin:0;
  padding:0;
  list-style:none;
}

.gbf-main-menu__list{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:clamp(18px,2vw,30px);
  width:auto;
}

.gbf-main-menu__list li{
  position:relative;
  display:block;
  margin:0;
  padding:0;
}

.gbf-main-menu__list a{
  position:relative;
  display:flex;
  align-items:center;
  margin:0;
  color:var(--gbf-menu-text);
  font:inherit;
  font-weight:500;
  line-height:1.2;
  text-decoration:none;
  transition:color .18s ease,background-color .18s ease;
}

/* Links de primeiro nível. */
.gbf-main-menu__list > li > a{
  min-height:44px;
  padding:6px 0;
  white-space:nowrap;
}

.gbf-main-menu__list > li > a::after{
  content:"";
  position:absolute;
  right:0;
  bottom:4px;
  left:0;
  height:2px;
  border-radius:999px;
  background:var(--gbf-menu-accent);
  opacity:0;
  transform:scaleX(.35);
  transform-origin:center;
  transition:opacity .18s ease,transform .18s ease;
}

.gbf-main-menu__list > li > a:hover,
.gbf-main-menu__list > li > a:focus-visible,
.gbf-main-menu__list > .current-menu-item > a,
.gbf-main-menu__list > .current_page_item > a,
.gbf-main-menu__list > .current-menu-ancestor > a,
.gbf-main-menu__list > .current-menu-parent > a{
  color:var(--gbf-menu-accent);
}

.gbf-main-menu__list > li > a:hover::after,
.gbf-main-menu__list > li > a:focus-visible::after,
.gbf-main-menu__list > .current-menu-item > a::after,
.gbf-main-menu__list > .current_page_item > a::after,
.gbf-main-menu__list > .current-menu-ancestor > a::after,
.gbf-main-menu__list > .current-menu-parent > a::after{
  opacity:1;
  transform:scaleX(1);
}

.gbf-main-menu__list a:focus-visible,
.gbf-main-menu__toggle:focus-visible,
.gbf-main-menu__submenu-toggle:focus-visible{
  outline:2px solid var(--gbf-menu-accent);
  outline-offset:3px;
}

.gbf-main-menu__toggle,
.gbf-main-menu__backdrop,
.gbf-main-menu__submenu-toggle{
  display:none;
}

/* Submenu no desktop: abre por hover e também por foco de teclado. */
@media (min-width:1025px){
  .gbf-main-menu__list > .menu-item-has-children > a{
    padding-right:17px;
  }

  /*
   * Seta desenhada por máscara SVG: mantém o mesmo centro visual aberta e fechada.
   * O traço de 2.5px fica mais próximo do peso do texto sem parecer pesado demais.
   */
  .gbf-main-menu__list > .menu-item-has-children > a::before{
    content:"";
    position:absolute;
    top:50%;
    right:0;
    width:12px;
    height:8px;
    background:currentColor;
    -webkit-mask:url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2012%208'%3E%3Cpath%20d='M1%201.25%206%206.25%2011%201.25'%20fill='none'%20stroke='black'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3E%3C/svg%3E") center/12px 8px no-repeat;
    mask:url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2012%208'%3E%3Cpath%20d='M1%201.25%206%206.25%2011%201.25'%20fill='none'%20stroke='black'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3E%3C/svg%3E") center/12px 8px no-repeat;
    transform:translateY(-50%);
    transform-origin:center;
    transition:transform .18s ease;
  }

  .gbf-main-menu__list > .menu-item-has-children:hover > a::before,
  .gbf-main-menu__list > .menu-item-has-children:focus-within > a::before{
    transform:translateY(-50%) rotate(180deg);
  }

  .gbf-main-menu__list .sub-menu{
    position:absolute;
    top:100%;
    right:0;
    z-index:120;
    display:block;
    width:max-content;
    min-width:250px;
    max-width:min(320px,calc(100vw - 24px));
    padding:8px;
    border:1px solid rgba(0,0,0,.08);
    border-radius:12px;
    background:#fff;
    box-shadow:0 16px 44px rgba(0,0,0,.18);
    opacity:0;
    visibility:hidden;
    transform:translate3d(0,-7px,0);
    transform-origin:top right;
    pointer-events:none;
    transition:opacity .18s ease,transform .18s cubic-bezier(.22,.61,.36,1),visibility 0s linear .18s;
  }

  .gbf-main-menu__list > li:hover > .sub-menu,
  .gbf-main-menu__list > li:focus-within > .sub-menu{
    opacity:1;
    visibility:visible;
    transform:none;
    pointer-events:auto;
    transition:opacity .18s ease,transform .18s cubic-bezier(.22,.61,.36,1),visibility 0s linear 0s;
  }

  .gbf-main-menu__list .sub-menu li{
    width:100%;
  }

  .gbf-main-menu__list .sub-menu a{
    width:100%;
    min-height:42px;
    padding:10px 12px;
    border-radius:8px;
    color:#262626;
    font-weight:500;
    white-space:normal;
  }

  .gbf-main-menu__list .sub-menu a::before,
  .gbf-main-menu__list .sub-menu a::after{
    display:none;
  }

  .gbf-main-menu__list .sub-menu a:hover,
  .gbf-main-menu__list .sub-menu a:focus-visible,
  .gbf-main-menu__list .sub-menu .current-menu-item > a,
  .gbf-main-menu__list .sub-menu .current_page_item > a{
    background:rgba(0,144,73,.08);
    color:var(--gbf-menu-accent);
  }

  /* Na Home, textos de primeiro nível continuam brancos no hover e no estado ativo. */
  body.home .gbf-main-menu__list > li > a:hover,
  body.home .gbf-main-menu__list > li > a:focus-visible,
  body.home .gbf-main-menu__list > .current-menu-item > a,
  body.home .gbf-main-menu__list > .current_page_item > a,
  body.home .gbf-main-menu__list > .current-menu-ancestor > a,
  body.home .gbf-main-menu__list > .current-menu-parent > a{
    color:inherit;
  }

  /* Na Home, hover e página ativa recebem apenas linha branca. */
  body.home .gbf-main-menu__list > li > a:hover::after,
  body.home .gbf-main-menu__list > li > a:focus-visible::after,
  body.home .gbf-main-menu__list > .current-menu-item > a::after,
  body.home .gbf-main-menu__list > .current_page_item > a::after,
  body.home .gbf-main-menu__list > .current-menu-ancestor > a::after,
  body.home .gbf-main-menu__list > .current-menu-parent > a::after{
    background:#fff;
  }
}

@media (max-width:1024px){
  .gbf-main-menu{
    width:auto;
    margin-left:auto;
  }

  /* Botão flat: a área de toque continua 44x44, mas visualmente aparecem só os três traços.
     A cor vem do próprio contêiner do Elementor por currentColor. */
  .gbf-main-menu__toggle,
  .gbf-main-menu__toggle:hover,
  .gbf-main-menu__toggle:focus,
  .gbf-main-menu__toggle:active{
    position:relative;
    z-index:10022;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:44px;
    height:44px;
    margin:0;
    padding:0;
    border:0!important;
    border-radius:0;
    background:transparent!important;
    color:inherit!important;
    box-shadow:none!important;
    cursor:pointer;
    appearance:none;
    -webkit-appearance:none;
    -webkit-tap-highlight-color:transparent;
  }

  .gbf-main-menu__toggle-lines{
    position:relative;
    display:block;
    width:20px;
    height:16px;
  }

  .gbf-main-menu__toggle-lines span{
    position:absolute;
    left:0;
    display:block;
    width:20px;
    height:2px;
    border-radius:999px;
    background:currentColor;
    transform-origin:center;
    /* Fechamento instantâneo. A animação é aplicada apenas no estado aberto. */
    transition:none;
  }

  .gbf-main-menu.is-open .gbf-main-menu__toggle-lines span{
    transition:top .2s ease,transform .2s ease,opacity .15s ease;
  }

  .gbf-main-menu__toggle-lines span:nth-child(1){top:0;}
  .gbf-main-menu__toggle-lines span:nth-child(2){top:7px;}
  .gbf-main-menu__toggle-lines span:nth-child(3){top:14px;}

  .gbf-main-menu.is-open .gbf-main-menu__toggle-lines span:nth-child(1){
    top:7px;
    transform:rotate(45deg);
  }

  .gbf-main-menu.is-open .gbf-main-menu__toggle-lines span:nth-child(2){
    opacity:0;
    transform:scaleX(.4);
  }

  .gbf-main-menu.is-open .gbf-main-menu__toggle-lines span:nth-child(3){
    top:7px;
    transform:rotate(-45deg);
  }

  .gbf-main-menu__backdrop{
    position:fixed;
    inset:0;
    z-index:10010;
    display:block;
    width:100%;
    height:100%;
    margin:0;
    padding:0;
    border:0;
    background:rgba(0,0,0,.38);
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    cursor:default;
    appearance:none;
    -webkit-appearance:none;
    will-change:opacity;
    backface-visibility:hidden;
    /* Fechamento instantâneo: evita quadros intermediários de transparência. */
    transition:none;
    user-select:none;
    -webkit-user-select:none;
    touch-action:manipulation;
  }

  .gbf-main-menu__panel{
    position:fixed;
    top:var(--gbf-menu-panel-top,72px);
    right:12px;
    left:12px;
    z-index:10020;
    display:block;
    max-height:calc(100dvh - var(--gbf-menu-panel-top,72px) - 12px);
    overflow:auto;
    overscroll-behavior:contain;
    border:1px solid rgba(0,0,0,.08);
    border-radius:var(--gbf-menu-radius);
    background:var(--gbf-menu-panel-bg);
    color:var(--gbf-menu-panel-text);
    box-shadow:0 18px 54px rgba(0,0,0,.22);
    opacity:0;
    visibility:hidden;
    transform:translate3d(0,-10px,0);
    transform-origin:top right;
    pointer-events:none;
    will-change:opacity,transform;
    backface-visibility:hidden;
    /* Fechamento instantâneo; a animação existe somente ao abrir. */
    transition:none;
  }

  .gbf-main-menu.is-open .gbf-main-menu__backdrop{
    opacity:1;
    visibility:visible;
    pointer-events:auto;
    /* Animação somente na abertura. */
    transition:opacity .2s ease,visibility 0s linear 0s;
  }

  .gbf-main-menu.is-open .gbf-main-menu__panel{
    opacity:1;
    visibility:visible;
    transform:none;
    pointer-events:auto;
    /* Fade + leve deslocamento somente na abertura. */
    transition:opacity .22s ease,transform .22s cubic-bezier(.22,.61,.36,1),visibility 0s linear 0s;
  }

  .gbf-main-menu__list{
    display:flex;
    flex-direction:column;
    align-items:stretch;
    justify-content:flex-start;
    gap:3px;
    width:100%;
    margin:0;
    padding:8px;
  }

  .gbf-main-menu__list > li{
    width:100%;
  }

  /* Sem divisórias: cada item é definido pela própria área de toque,
     e o item ativo já recebe fundo verde-claro. */
  .gbf-main-menu__list > li + li{
    border-top:0;
  }

  .gbf-main-menu__list > li > a{
    width:100%;
    min-height:50px;
    padding:13px 14px;
    border-radius:9px;
    color:var(--gbf-menu-panel-text);
    font-weight:500;
    white-space:normal;
  }

  .gbf-main-menu__list > li.menu-item-has-children > a{
    padding-right:58px;
  }

  .gbf-main-menu__list > li > a::after{
    display:none;
  }

  .gbf-main-menu__list > li > a:hover,
  .gbf-main-menu__list > li > a:focus-visible,
  .gbf-main-menu__list > .current-menu-item > a,
  .gbf-main-menu__list > .current_page_item > a,
  .gbf-main-menu__list > .current-menu-ancestor > a,
  .gbf-main-menu__list > .current-menu-parent > a{
    background:rgba(0,144,73,.08);
    color:var(--gbf-menu-accent);
  }

  /* Botão independente: o texto “Comprar” continua sendo link para a listagem geral. */
  .gbf-main-menu__submenu-toggle,
  .gbf-main-menu__submenu-toggle:hover,
  .gbf-main-menu__submenu-toggle:focus,
  .gbf-main-menu__submenu-toggle:active{
    position:absolute;
    top:3px;
    right:3px;
    z-index:2;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:44px;
    height:44px;
    margin:0;
    padding:0;
    border:0!important;
    border-radius:9px;
    background:transparent!important;
    color:var(--gbf-menu-panel-text)!important;
    box-shadow:none!important;
    cursor:pointer;
    appearance:none;
    -webkit-appearance:none;
    -webkit-tap-highlight-color:transparent;
  }

  /*
   * Usa a mesma seta do desktop. Como o botão já é flex, ela permanece
   * geometricamente centralizada sem translateY.
   */
  .gbf-main-menu__submenu-toggle-icon{
    display:block;
    width:12px;
    height:8px;
    background:currentColor;
    -webkit-mask:url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2012%208'%3E%3Cpath%20d='M1%201.25%206%206.25%2011%201.25'%20fill='none'%20stroke='black'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3E%3C/svg%3E") center/12px 8px no-repeat;
    mask:url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2012%208'%3E%3Cpath%20d='M1%201.25%206%206.25%2011%201.25'%20fill='none'%20stroke='black'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3E%3C/svg%3E") center/12px 8px no-repeat;
    transform:rotate(0deg);
    transform-origin:center;
    transition:transform .18s ease;
  }

  .gbf-main-menu__submenu-toggle[aria-expanded="true"] .gbf-main-menu__submenu-toggle-icon{
    transform:rotate(180deg);
  }

  /* Acordeão dos subitens. */
  .gbf-main-menu__list .sub-menu{
    position:static;
    display:none;
    width:100%;
    margin:2px 0 4px;
    padding:4px 4px 4px 14px;
    border:0;
    border-radius:9px;
    background:rgba(0,0,0,.025);
    box-shadow:none;
  }

  .gbf-main-menu__list .menu-item-has-children.is-submenu-open > .sub-menu{
    display:block;
  }

  .gbf-main-menu__list .sub-menu li{
    width:100%;
  }

  .gbf-main-menu__list .sub-menu a{
    width:100%;
    min-height:44px;
    padding:10px 12px;
    border-radius:8px;
    color:#4a4a4a;
    font-size:.95em;
    font-weight:500;
    white-space:normal;
  }

  .gbf-main-menu__list .sub-menu a::before,
  .gbf-main-menu__list .sub-menu a::after{
    display:none;
  }

  .gbf-main-menu__list .sub-menu a:hover,
  .gbf-main-menu__list .sub-menu a:focus-visible,
  .gbf-main-menu__list .sub-menu .current-menu-item > a,
  .gbf-main-menu__list .sub-menu .current_page_item > a{
    background:rgba(0,144,73,.08);
    color:var(--gbf-menu-accent);
  }
}

.gbf-main-menu__backdrop,
.gbf-main-menu__backdrop:hover,
.gbf-main-menu__backdrop:focus,
.gbf-main-menu__backdrop:focus-visible,
.gbf-main-menu__backdrop:active{
  background:rgba(0,0,0,.38)!important;
  border:0!important;
  border-radius:0!important;
  outline:0!important;
  box-shadow:none!important;
  filter:none!important;
  color:transparent!important;
  -webkit-tap-highlight-color:transparent;
  appearance:none!important;
  -webkit-appearance:none!important;
}

@media (prefers-reduced-motion:reduce){
  .gbf-main-menu *,
  .gbf-main-menu *::before,
  .gbf-main-menu *::after{
    scroll-behavior:auto!important;
    transition:none!important;
  }
}
