/* ---------------------------------------------------------
   NAVEGAÇÃO — header minimalista, menu overlay, controles
   --------------------------------------------------------- */

/* Barra de progresso de leitura (mobile): oculta no desktop */
.mobile-progress { display: none; }

/* ===== Header topo ===== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 22px clamp(24px, 3vw, 40px);
  pointer-events: none;
  mix-blend-mode: normal;
  transition: color var(--dur-med) var(--ease-out);
}
.topbar > * { pointer-events: auto; }

.topbar__spacer {
  pointer-events: none;
}

.topbar__title {
  justify-self: center;
  color: currentColor;
  text-decoration: none;
  font-family: 'Just Sans', sans-serif;
  font-size: clamp(11px, 0.8vw, 14px);
  font-weight: 500;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: .88;
  transition: opacity var(--dur-fast) var(--ease-out);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.topbar__title:hover { opacity: 1; }
.topbar__subtitle {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.65;
}

body.is-past-first .topbar__title {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-self: end;
}

.topbar__meta {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: var(--fs-caption);
  letter-spacing: 0.24em;
  text-transform: uppercase;
}
.topbar__chapter {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar__chapter-idx {
  font-weight: 700;
  color: var(--faj-orange);
}
.topbar__chapter-name {
  opacity: .7;
}

/* Menu button */
.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: currentColor;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.menu-toggle:hover { opacity: .7; }
.menu-toggle__burger {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 18px;
}
.menu-toggle__burger span {
  display: block;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}
body.menu-open .menu-toggle__burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.menu-open .menu-toggle__burger span:nth-child(2) { opacity: 0; }
body.menu-open .menu-toggle__burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Auto-invert on light chapters */
body[data-tone="light"] .topbar { color: var(--faj-navy); }
body[data-tone="light"] .menu-toggle { color: var(--faj-navy); }

/* ===== Menu overlay ===== */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: var(--faj-navy-deep);
  color: var(--faj-white);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-med) var(--ease-out);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 120px clamp(40px, 6vw, 120px) 80px;
}
body.menu-open .menu-overlay {
  opacity: 1;
  pointer-events: auto;
}

.menu-overlay__index {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1vh, 14px);
}
.menu-overlay__item {
  display: block;
}
.menu-overlay__link {
  display: grid;
  grid-template-columns: 60px 1fr;
  align-items: baseline;
  gap: 24px;
  padding: 6px 0;
  font-family: 'Just Sans', sans-serif;
  font-weight: 300;
  font-size: clamp(18px, 2.2vw, 38px);
  letter-spacing: -0.01em;
  line-height: 1.05;
  color: rgba(255,255,255,.55);
  transition: color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  transform: translateY(20px);
  opacity: 0;
}
body.menu-open .menu-overlay__link {
  transform: translateY(0);
  opacity: 1;
  transition-delay: calc(80ms * var(--i, 0));
}
.menu-overlay__link:hover,
.menu-overlay__link.is-current {
  color: var(--faj-white);
}
.menu-overlay__link:hover .menu-overlay__num,
.menu-overlay__link.is-current .menu-overlay__num {
  color: var(--faj-orange);
}
.menu-overlay__num {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: rgba(255,255,255,.4);
  transition: color var(--dur-fast) var(--ease-out);
}
.menu-overlay__label strong { font-weight: 600; }

.menu-overlay__side {
  align-self: end;
  text-align: right;
  font-size: var(--fs-caption);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255,255,255,.6);
  line-height: 1.9;
}
.menu-overlay__side strong {
  color: var(--faj-white);
  font-weight: 600;
}

/* ===== Barra de progresso VERTICAL (lateral direita) — só a linha ===== */
.progress {
  position: fixed;
  top: 50%;
  right: clamp(18px, 2vw, 28px);
  transform: translateY(-50%);
  z-index: 40;
  height: min(48vh, 420px);
  color: currentColor;
  pointer-events: none;
  transition: color var(--dur-med) var(--ease-out);
}

.progress__bar {
  position: relative;
  width: 1px;
  height: 100%;
  background: rgba(255,255,255,.14);
  overflow: hidden;
}
.progress__fill {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 0%;
  background: var(--faj-orange);
  transform-origin: top center;
  transition: height var(--dur-med) var(--ease-out);
}

body[data-tone="light"] .progress { color: var(--faj-navy); }
body[data-tone="light"] .progress__bar { background: rgba(4,25,66,.16); }

/* Contador de slide (bottom-right) */
.slide-count {
  position: fixed;
  right: clamp(20px, 3vw, 40px);
  bottom: 24px;
  z-index: 41;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: currentColor;
  opacity: .85;
  pointer-events: none;
  transition: color var(--dur-med) var(--ease-out);
}
.slide-count__cur { font-weight: 700; color: var(--faj-orange); font-size: 13px; }
.slide-count__sep { opacity: .5; }
.slide-count__tot { opacity: .75; }
body[data-tone="light"] .slide-count { color: var(--faj-navy); }

/* Setas de navegação (agora verticais ▲/▼) */
.arrow-controls {
  position: fixed;
  right: clamp(24px, 3vw, 40px);
  bottom: 64px;
  z-index: 45;
  display: none;
  flex-direction: column;
  gap: 10px;
  color: currentColor;
  transition: color var(--dur-med) var(--ease-out);
}
@media (hover: hover) and (min-width: 861px) {
  .arrow-controls { display: flex; }
}
.arrow-btn {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.arrow-btn:hover { background: rgba(255,255,255,.10); }
.arrow-btn:active { transform: scale(.95); }
.arrow-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; }
body[data-tone="light"] .arrow-btn { border-color: rgba(4,25,66,.3); color: #041942; }
body[data-tone="light"] .arrow-btn:hover { background: rgba(4,25,66,.08); }

/* Scroll cue no primeiro slide (agora aponta para baixo) */
.scroll-cue {
  position: absolute;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: grid;
  justify-items: center;
  gap: 14px;
  color: currentColor;
  font-size: var(--fs-caption);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  opacity: .75;
  text-align: center;
}
.scroll-cue__line {
  width: 1px;
  height: 44px;
  background: currentColor;
  position: relative;
  overflow: hidden;
  opacity: .4;
}
.scroll-cue__line::after {
  content: '';
  position: absolute;
  top: -44px; left: 0;
  width: 100%; height: 44px;
  background: var(--faj-orange);
  animation: cue-line 2.4s var(--ease-in-out) infinite;
}
.scroll-cue__arrow {
  display: inline-block;
  width: 12px; height: 12px;
  border-bottom: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-top: -6px;
}
.deck.is-past-first .scroll-cue {
  opacity: 0;
  transition: opacity .6s var(--ease-out);
  pointer-events: none;
}

@keyframes cue-line {
  0% { transform: translateY(0); }
  100% { transform: translateY(88px); }
}

/* ===== Seletor de idioma (topbar direita, ao lado do burger) ===== */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: currentColor;
}
.lang-btn {
  padding: 4px 1px;
  color: currentColor;
  opacity: .42;
  transition: opacity var(--dur-fast) var(--ease-out);
  letter-spacing: 0.22em;
}
.lang-btn:hover { opacity: .75; }
.lang-btn.is-active {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.lang-sep {
  opacity: .2;
  font-weight: 300;
  font-size: 9px;
  pointer-events: none;
}
body[data-tone="light"] .lang-btn { color: var(--faj-navy); }

/* ===== Botão voltar ao topo — setinha dentro de círculo ===== */
.back-to-top {
  position: fixed;
  left: clamp(20px, 3vw, 40px);
  bottom: 24px;
  z-index: 41;
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(13, 34, 187, 0.9);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  gap: 0;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-med) var(--ease-out), background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
body.is-past-first .back-to-top {
  opacity: 0.95;
  pointer-events: auto;
}
.back-to-top:hover {
  opacity: 1;
  background: rgba(13, 34, 187, 1);
  transform: translateY(-2px);
}
.back-to-top svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
}
body[data-tone="light"] .back-to-top {
  background: rgba(4, 25, 66, 0.9);
  color: #fff;
}
body[data-tone="light"] .back-to-top:hover {
  background: rgba(4, 25, 66, 1);
}
