/* Cabecalho (custom_views/components/topo.phtml + menu-show.phtml).
   Linkado pelo layout.phtml com ?v=filemtime (cache immutable de 1 ano).
   Usa os tokens do assets/css/style.css (--navy, --yellow, --gutter, --content).
   Sem backdrop-filter no .topo: ele prende o position:fixed da gaveta mobile. */

.topo {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fffffffa;
  box-shadow: 0 10px 30px -24px #17254340;
}

.topo-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  min-height: 94px;
  padding: 12px max(var(--gutter), calc((100% - var(--content)) / 2));
}

.topo-marca {
  display: block;
  flex-shrink: 0;
}

.topo-marca:hover {
  opacity: .85;
}

.topo-marca img {
  display: block;
  height: 80px;
  width: auto;
}

.topo-menu {
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.2vw, 32px);
}

.topo-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Menu "Principal" */
.topo-nav {
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.2vw, 32px);
  font-size: .875rem;
  font-weight: 600;
}

.topo-nav > li {
  position: relative;
}

.topo-nav > li > a {
  display: block;
  position: relative;
  padding-block: 10px;
}

.topo-nav a:hover,
.topo-nav > li > a[aria-current=page] {
  color: #216b9f;
}

.topo-nav > li > a[aria-current=page]:after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 3px;
  border-radius: 3px;
  background: var(--yellow);
}

/* Menu "Topo": botao pilula */
.topo-acoes {
  display: flex;
  gap: 12px;
}

.topo-acoes a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 30px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: .9375rem;
  font-weight: 700;
  line-height: 1.4;
}

.topo-acoes a:hover {
  background: #315b90;
  box-shadow: 0 6px 18px #17254318;
  transform: translateY(-2px) scale(1.02);
}

/* Submenu (1 nivel): abre no hover/foco */
.topo .submenu {
  position: absolute;
  top: 100%;
  left: -18px;
  min-width: 220px;
  padding: 10px 0;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 40px -18px #17254355;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .2s, transform .2s, visibility .2s;
}

.topo .has-sub:hover > .submenu,
.topo .has-sub:focus-within > .submenu {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.topo .submenu a {
  display: block;
  padding: 9px 18px;
}

.topo-burger {
  display: none;
  position: relative;
  z-index: 2;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 46px;
  height: 46px;
  padding: 0 12px;
  border: 1px solid #c9d5e2;
  border-radius: 999px;
  background: #fff;
}

.topo-burger span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--navy);
  transition: transform .2s, opacity .2s;
}

.topo-fundo {
  display: none;
}

/* Mobile: o .topo-menu vira gaveta lateral; a classe menu-aberto vai no body */
@media (max-width: 1100px) {
  .topo-inner {
    min-height: 84px;
  }

  .topo-marca img {
    height: 64px;
  }

  .topo-burger {
    display: flex;
  }

  .topo-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    width: min(340px, 86vw);
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
    padding: 100px 24px 32px;
    background: #fff;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform .25s;
  }

  .topo-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    font-size: 1rem;
  }

  .topo-nav > li > a {
    padding: 12px 8px;
    border-bottom: 1px solid #edf1f5;
  }

  .topo-nav > li > a[aria-current=page]:after {
    display: none;
  }

  .topo .submenu {
    position: static;
    padding: 0 0 0 14px;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .topo-acoes {
    flex-direction: column;
  }

  .topo-acoes a {
    width: 100%;
  }

  .topo-fundo {
    display: block;
    position: fixed;
    inset: 0;
    background: #17254355;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s, visibility .25s;
  }

  .menu-aberto {
    overflow: hidden;
  }

  /* sombra so aberta: fechada, ela vazaria na borda direita da tela */
  .menu-aberto .topo-menu {
    transform: none;
    box-shadow: -20px 0 40px -30px #17254380;
  }

  .menu-aberto .topo-fundo {
    opacity: 1;
    visibility: visible;
  }

  .menu-aberto .topo-burger span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .menu-aberto .topo-burger span:nth-child(2) {
    opacity: 0;
  }

  .menu-aberto .topo-burger span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

@media (max-width: 540px) {
  .topo-marca img {
    height: 56px;
  }
}
