/* ==========================================================================
   site-header.css — Menu tradicional no topo (LAYOUT_MODE = 'topbar')
   Reaproveita o header#mobile-header como header único do site:
   - ≥1024px: barra flutuante com marca, links, idioma, tema e CTA
   - <1024px: pílula com marca + hambúrguer (drawer existente)
   O sidebar legado continua no DOM (soft delete), apenas oculto.
   ========================================================================== */

body.layout-topbar {
  --site-header-h: 64px;
  --site-header-gap: 12px;
}

/* ── Sidebar legado oculto ──────────────────────────────────────────────── */
body.layout-topbar .sidebar-crop { display: none !important; }

/* ── Elementos só do desktop ────────────────────────────────────────────── */
.site-header__nav,
.site-header__lang,
.site-header__theme,
.site-header__cta,
.site-header__role { display: none; }

.site-header__brand-text { display: flex; flex-direction: column; line-height: 1.1; }

@media (min-width: 1024px) {
  /* Conteúdo volta ao fluxo normal da janela (sem "card" fixo) */
  body.layout-topbar .main-wrapper {
    position: static;
    inset: auto;
    margin: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    padding-top: calc(var(--site-header-h) + var(--site-header-gap) * 2);
  }

  body.layout-topbar .mobile-header.site-header {
    display: flex;
    position: fixed;
    top: var(--site-header-gap);
    left: 0;
    right: 0;
    margin-inline: auto;
    width: min(1200px, calc(100% - 32px));
    height: var(--site-header-h);
    padding: 0 0.625rem 0 0.75rem;
    gap: 1.5rem;
    border-radius: 16px;
    z-index: 60;
  }

  /* No desktop o header nunca some (algumas páginas o ocultam no hero mobile) */
  body.layout-topbar .mobile-header.site-header.mobile-header--hidden {
    opacity: 1;
    pointer-events: auto;
    transform: none;
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
  }

  .site-header .mobile-header__menu-btn { display: none; }

  .site-header__brand { gap: 0.625rem; flex-shrink: 0; }
  .site-header__brand .mobile-header__name { font-size: 0.9375rem; }
  .site-header__role {
    display: block;
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.01em;
  }

  .site-header__nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-inline: auto;
  }
  .site-header__nav a {
    position: relative;
    padding: 0.5rem 0.875rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    transition: color 0.2s, background-color 0.2s;
  }
  .site-header__nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.07); }
  .site-header__nav a.active { color: #fff; }
  .site-header__nav a.active::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 2px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #8aa4ff;
    transform: translateX(-50%);
  }

  .site-header__actions { gap: 0.5rem; flex-shrink: 0; }
  .site-header__lang { display: block; }
  .site-header__theme { display: flex; }
  .site-header .theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    height: 34px;
    width: 60px;
  }

  .site-header .lang-switcher__trigger {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.14);
    color: #fff;
    min-height: 34px;
  }
  .site-header .lang-switcher__trigger-chevron { color: rgba(255, 255, 255, 0.6); }

  .site-header__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 42px;
    padding: 0 1.125rem;
    border: 0;
    border-radius: 12px;
    background: #fff;
    color: #0b0c12;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
  }
  .site-header__cta:hover { transform: translateY(-1px); box-shadow: 0 8px 24px -8px rgba(138, 164, 255, 0.7); }
  .site-header__cta svg { transition: transform 0.2s; }
  .site-header__cta:hover svg { transform: translateX(2px); }

  .site-header a:focus-visible,
  .site-header button:focus-visible {
    outline: 2px solid #8aa4ff;
    outline-offset: 2px;
  }
}

/* Telas médias: esconde o rótulo do idioma para caber tudo */
@media (min-width: 1024px) and (max-width: 1279px) {
  .site-header .lang-switcher__trigger-label { display: none; }
  .site-header__nav a { padding-inline: 0.625rem; }
  .site-header__role { display: none; }
}

/* Fundo mais sólido no desktop para legibilidade sobre páginas claras */
@media (min-width: 1024px) {
  body.layout-topbar .mobile-header.site-header { background: rgba(11, 12, 18, 0.84); }
  [data-theme="dark"] body.layout-topbar .mobile-header.site-header,
  [data-theme="dark"] .mobile-header.site-header { background: rgba(14, 15, 22, 0.84); }
}

/* Páginas isoladas (propostas) continuam sem o header global */
body.layout-topbar.propostas-index-mode .mobile-header.site-header,
body.layout-topbar.proposta-mode .mobile-header.site-header { display: none !important; }
@media (min-width: 1024px) {
  body.layout-topbar.propostas-index-mode .main-wrapper,
  body.layout-topbar.proposta-mode .main-wrapper { padding-top: 0 !important; }
}

/* ── Rodapé: 5 colunas equilibradas (marca + navegação + serviços + legal + contato) ── */
@media (min-width: 1024px) {
  body.layout-topbar .site-footer__grid {
    grid-template-columns: minmax(0, 1.4fr) repeat(4, max-content);
    justify-content: space-between;
    column-gap: clamp(2rem, 4vw, 4rem);
  }
}
@media (min-width: 640px) and (max-width: 1023px) {
  body.layout-topbar .site-footer__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 2rem; }
  body.layout-topbar .site-footer__grid > :first-child { grid-column: 1 / -1; }
}

/* Páginas curtas: rodapé encostado no fim da janela */
body.layout-topbar .main-wrapper { min-height: 100vh; }
body.layout-topbar #main-content { flex: 1 0 auto; }

/* ── Auto-hide: some ao rolar para baixo, volta ao subir ou parar ──────────── */
.mobile-header.site-header {
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.3s ease, background-color 0.2s;
}
.mobile-header.site-header.site-header--away {
  transform: translateY(calc(-100% - 24px));
  opacity: 0;
  pointer-events: none;
}
@media (min-width: 1024px) {
  body.layout-topbar .mobile-header.site-header.site-header--away {
    transform: translateY(calc(-100% - 24px));
    opacity: 0;
    pointer-events: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .mobile-header.site-header { transition: opacity 0.15s linear; }
  .mobile-header.site-header.site-header--away { transform: none; }
}
