/* Rede Rota — acessibilidade (TTS + layout junto ao VLibras) */

.rota-a11y {
  --a11y-green: #21843d;
  --a11y-orange: #df6320;
  --a11y-ink: #1b252f;
  --a11y-cream: #fbf8f0;
  --a11y-line: #e2ddd0;
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 58;
  font-family: "Manrope", sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.rota-a11y[hidden] {
  display: none !important;
}

.rota-a11y-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 11px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--a11y-green);
  color: #fff;
  font: 700 13px/1 "Manrope", sans-serif;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(33, 132, 61, 0.32);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.rota-a11y-toggle:hover,
.rota-a11y-toggle:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.05);
  outline: none;
}

.rota-a11y-toggle[aria-expanded="true"] {
  background: #176832;
}

.rota-a11y-toggle-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.rota-a11y-panel {
  width: min(280px, calc(100vw - 32px));
  background: #fff;
  border: 1px solid var(--a11y-line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 18px 40px rgba(27, 37, 47, 0.18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.rota-a11y.is-open .rota-a11y-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.rota-a11y-panel-title {
  margin: 0 0 10px;
  font: 700 13px/1.3 "Chakra Petch", sans-serif;
  color: var(--a11y-ink);
  letter-spacing: -0.2px;
}

.rota-a11y-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.rota-a11y-controls button {
  border: 1px solid var(--a11y-line);
  border-radius: 10px;
  background: var(--a11y-cream);
  color: var(--a11y-ink);
  font: 700 12px/1 "Manrope", sans-serif;
  padding: 10px 6px;
  cursor: pointer;
}

.rota-a11y-controls button:hover,
.rota-a11y-controls button:focus-visible {
  border-color: var(--a11y-green);
  color: var(--a11y-green);
  outline: none;
}

.rota-a11y-controls button.is-active {
  background: var(--a11y-green);
  border-color: var(--a11y-green);
  color: #fff;
}

.rota-a11y-rate {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.rota-a11y-rate label {
  font: 600 11px/1 "Manrope", sans-serif;
  color: #5c656c;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.rota-a11y-rate input[type="range"] {
  width: 100%;
  accent-color: var(--a11y-green);
}

.rota-a11y-status {
  margin: 10px 0 0;
  min-height: 1.2em;
  font: 500 12px/1.35 "Manrope", sans-serif;
  color: #5c656c;
}

.rota-a11y-unsupported {
  margin: 0;
  font: 500 12px/1.4 "Manrope", sans-serif;
  color: #5c656c;
}

/* Empurra o botão oficial do VLibras para não colidir com o TTS */
body.rota-a11y-tts-on [vw-access-button] {
  bottom: 88px !important;
}

@media (max-width: 720px) {
  .rota-a11y {
    bottom: calc(72px + max(10px, env(safe-area-inset-bottom)));
    left: max(10px, env(safe-area-inset-left));
    gap: 8px;
  }

  .rota-a11y-toggle {
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(33, 132, 61, 0.3);
  }

  .rota-a11y-toggle span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .rota-a11y-toggle-icon {
    width: 20px;
    height: 20px;
  }

  .rota-a11y-panel {
    width: min(260px, calc(100vw - 20px));
    padding: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rota-a11y-toggle,
  .rota-a11y-panel {
    transition: none !important;
  }
}
