/* ==========================================================================
   FALCTEC - NAVEGAÇÃO (índice de seções, progresso, voltar ao topo)
   ========================================================================== */

:root { --barra-topo-h: 0px; --barras-h: 140px; }

/* Barra de progresso de leitura */
#progresso-leitura {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 300; pointer-events: none;
  transform-origin: left; transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent-green), var(--accent-cyan), var(--accent-amber));
}

/* Link de acessibilidade */
.pular-conteudo {
  position: fixed; left: 12px; top: -60px; z-index: 400; padding: 10px 16px; border-radius: 8px;
  background: var(--accent-green); color: #fff; font-weight: 700; text-decoration: none; transition: top .2s;
}
.pular-conteudo:focus { top: 12px; }
body:not(.light-theme) .pular-conteudo { color: #04210f; }

/* O cabeçalho rola junto com a página; só as barras de navegação ficam fixas */
.site-header { position: static; }
.control-bar-wrapper { top: 0; }

/* Índice de seções */
.indice-secoes {
  position: sticky; top: var(--barra-topo-h); z-index: 80;
  display: flex; gap: 8px; align-items: center; overflow-x: auto; scrollbar-width: none;
  padding: 10px max(16px, calc((100vw - 1240px) / 2 + 20px));
  background: var(--bg-glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  scroll-snap-type: x proximity;
}
.indice-secoes::-webkit-scrollbar { display: none; }
.indice-chip {
  flex: 0 0 auto; scroll-snap-align: center; padding: 7px 14px; border-radius: 999px; min-height: 36px;
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: .78rem; font-weight: 600; text-decoration: none; white-space: nowrap;
  color: var(--text-muted); border: 1px solid var(--border-subtle); background: transparent;
  transition: color .2s, background .2s, border-color .2s, transform .2s;
}
.indice-chip:hover { color: var(--text-main); border-color: var(--border-active); transform: translateY(-1px); }
.indice-chip.ativo { color: var(--accent-green); border-color: var(--accent-green); background: color-mix(in srgb, var(--accent-green) 12%, transparent); }
.indice-chip:focus-visible { outline: 2px solid var(--accent-amber); outline-offset: 2px; }

/* Âncoras compensam as barras fixas */
.secao-ancora, #contatos { scroll-margin-top: var(--barras-h); }

/* Voltar ao topo */
.voltar-topo {
  position: fixed; right: 18px; bottom: 22px; z-index: 150; width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--border-active); background: var(--bg-card); color: var(--accent-green);
  font-size: 1.3rem; font-weight: 800; cursor: pointer; box-shadow: var(--shadow-hud), 0 0 18px var(--accent-green-glow);
  opacity: 0; transform: translateY(16px); pointer-events: none; transition: opacity .25s, transform .25s;
}
.voltar-topo.visivel { opacity: 1; transform: none; pointer-events: auto; }
.voltar-topo:hover { transform: translateY(-3px); }
.voltar-topo:focus-visible { outline: 3px solid var(--accent-amber); outline-offset: 3px; }

@media (max-width: 700px) {
  /* A barra de modos fica na base; o índice vira a única barra fixa no topo */
  .indice-secoes { top: 0; padding: 8px 12px; }
  .secao-ancora, #contatos { scroll-margin-top: 64px; }
  .voltar-topo { bottom: calc(78px + env(safe-area-inset-bottom)); right: 14px; width: 44px; height: 44px; z-index: 135; }
}
@media print { #progresso-leitura, .indice-secoes, .voltar-topo, .pular-conteudo { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .indice-chip, .voltar-topo, #progresso-leitura { transition: none; } }

@media (max-width: 700px) { .indice-secoes { background: color-mix(in srgb, var(--bg-dark) 96%, transparent); } }
