/* =========================================
   TOPBAR — branco, nav central, acentos da logo
   ========================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

.topbar {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: var(--nav-height, 72px);
  background: var(--color-surface, #fff);
  box-shadow: 0 1px 0 rgba(0,40,128,0.1);
  z-index: 1000;
  transition: box-shadow 0.3s ease;
}

.topbar.scrolled {
  box-shadow: 0 2px 16px rgba(0,0,0,0.12);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2rem;
}

/* ── Logo ── */
.topbar-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  text-decoration: none;
}
.topbar-logo img {
  height: 36px;
  width: auto;
  display: block;
}

/* ── Nav central ── */
.topbar-nav {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 0;
  flex: 1;
}

.topbar-nav li {
  position: relative;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 1.1rem;
  height: var(--nav-height);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-ink);
  white-space: nowrap;
  transition: color 0.2s;
  border-bottom: 3px solid transparent;
  cursor: pointer;
}

/* Reset de <button> usado como gatilho do dropdown "Serviços" */
button.nav-item {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font: inherit;
  font-family: var(--font-body);
  font-weight: 600;
}

.nav-item:hover,
.has-dropdown:hover .nav-item,
.has-dropdown.open .nav-item {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.nav-arrow {
  font-size: 1rem;
  line-height: 1;
  display: inline-block;
  transition: transform 0.2s;
}
.has-dropdown:hover .nav-arrow,
.has-dropdown.open .nav-arrow {
  transform: rotate(180deg);
}

/* Separador vertical entre primário e secundário */
.nav-sep {
  width: 1px;
  height: 24px;
  background: #e0e0e0;
  margin: 0 0.5rem;
  pointer-events: none;
}

/* ── Dropdown ── */
.dropdown-panel {
  display: none;
  position: absolute;
  top: calc(var(--nav-height) - 3px);
  left: 0;
  min-width: 220px;
  background: #fff;
  border-top: 3px solid var(--color-accent);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  padding: 0.5rem 0;
  z-index: 200;
}

.has-dropdown:hover .dropdown-panel,
.has-dropdown.open .dropdown-panel {
  display: block;
  animation: dropIn 0.18s ease;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-panel a {
  display: block;
  padding: 0.75rem 1.25rem;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-ink);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.dropdown-panel a:hover {
  background: var(--color-bg);
  color: var(--color-accent);
}

/* ── Mega-menu "Serviços": 3 botões lado a lado ──
   (seletor repetido com .has-dropdown para vencer, em especificidade,
   a regra "display:block" do hover/open acima) */
.dropdown-panel--services {
  min-width: 620px;
  padding: 0.85rem;
  gap: 0.6rem;
}

.has-dropdown:hover .dropdown-panel--services,
.has-dropdown.open .dropdown-panel--services {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.service-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 1.1rem 1rem;
  border-radius: var(--radius-card, 12px);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.service-btn:hover {
  border-color: var(--color-accent);
  background: var(--color-surface);
  transform: translateY(-2px);
}

.service-btn-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
}
.service-btn-icon svg { width: 100%; height: 100%; }

.service-btn-label {
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-ink);
}

.service-btn-desc {
  font-family: var(--font-body);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--color-muted);
}

/* ── Direita ── */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  margin-left: auto;
}

.topbar-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  background: none;
  border: none;
  color: var(--color-ink);
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s;
}
.topbar-search-btn:hover { background: #f0f0f0; }

.topbar-cta {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1.35rem;
  background: var(--color-ink);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-btn, 8px);
  white-space: nowrap;
  transition: background 0.2s, transform 0.15s;
}
.topbar-cta:hover {
  background: var(--color-ink-soft);
  transform: translateY(-1px);
}

/* ── Hamburguer ── */
.topbar-mobile-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px; height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.topbar-mobile-btn span {
  display: block;
  width: 22px; height: 2px;
  background: var(--color-ink);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}
.topbar.open .topbar-mobile-btn span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.topbar.open .topbar-mobile-btn span:nth-child(2) { opacity: 0; }
.topbar.open .topbar-mobile-btn span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 900px) {
  .topbar-mobile-btn { display: flex; }
  .topbar-cta { display: none; }
  .topbar-search-btn { display: none; }

  .topbar-nav {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    width: 100%;
    background: #fff;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    border-top: 1px solid #eee;
  }

  .topbar.open .topbar-nav { display: flex; }

  .topbar-nav li { width: 100%; }

  .nav-item {
    height: auto;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    border-left: none;
  }

  .nav-item--trigger {
    width: 100%;
    justify-content: space-between;
  }

  .nav-sep { display: none; }

  .dropdown-panel {
    position: static;
    border-top: none;
    border-left: 3px solid var(--color-accent);
    box-shadow: none;
    border-radius: 0;
    margin-left: 1rem;
    display: none;
  }

  /* No mobile não há hover — o painel só abre via clique (.open, ver topbar.js) */
  .has-dropdown.open .dropdown-panel {
    display: block;
  }

  .dropdown-panel--services,
  .has-dropdown.open .dropdown-panel--services {
    min-width: 0;
    display: block;
    padding: 0.75rem 0.5rem;
  }

  .service-btn {
    background: var(--color-surface);
    margin-bottom: 0.5rem;
  }
  .service-btn:last-child { margin-bottom: 0; }
}
