:root {
  --cor-principal: #771bac;
  --cor-secundaria: #d46bcf;
  --cor-destaque: #8d3b1b;
  --cor-fundo: #f4f8fb;
  --cor-branco: #ffffff;
  --cor-texto: #222222;
  --cor-texto-secundario: #555555;
  --cor-borda: #d9e2ec;
  --cor-sombra: rgba(0, 0, 0, 0.10);

  --espacamento: 20px;
  --raio: 12px;

  --fonte-principal:
    Arial,
    Helvetica,
    sans-serif;
}


/* ==========================================
   CONFIGURAÇÃO GERAL
   ========================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}


html {
  scroll-behavior: smooth;
  font-size: 100%;
}


body {
  font-family: var(--fonte-principal);
  background: var(--cor-fundo);
  color: var(--cor-texto);
  line-height: 1.7;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}


/* ==========================================
   ACESSIBILIDADE
   ========================================== */

.accessibility-bar {
  width: 100%;
  background: #881ab4;
  color: white;

  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;

  gap: 10px;
  padding: 12px 20px;

  font-weight: bold;
}


.accessibility-bar span {
  margin-right: 5px;
}


.accessibility-bar button {
  background: white;
  color: #7212b3;

  border: 2px solid white;
  border-radius: 6px;

  padding: 8px 14px;

  font-size: 0.95rem;
  font-weight: bold;

  cursor: pointer;

  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}


.accessibility-bar button:hover {
  background: #e3f2fd;
  transform: translateY(-2px);
}


.accessibility-bar button:focus {
  outline: 3px solid #ffeb3b;
  outline-offset: 2px;
}


.accessibility-bar button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}


/* ==========================================
   MENU PRINCIPAL
   ========================================== */

nav {
  background: #ffffff;

  border-bottom: 1px solid var(--cor-borda);

  position: sticky;
  top: 0;
  z-index: 1000;

  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}


nav ul {
  list-style: none;

  max-width: 1250px;
  margin: auto;

  display: flex;
  justify-content: center;
  align-items: center;

  flex-wrap: wrap;

  padding: 10px 15px;

  gap: 5px;
}


nav a {
  display: block;

  color: rgb(64, 26, 92);
  text-decoration: none;

  padding: 10px 13px;

  border-radius: 7px;

  font-weight: bold;

  transition:
    background 0.2s ease,
    color 0.2s ease;
}


nav a:hover {
  background: #e3f2fd;
  color: var(--cor-principal);
}


nav a.ativo {
  background: var(--cor-principal);
  color: white;
}


nav a:focus {
  outline: 3px solid #ff9800;
  outline-offset: 2px;
}


/* ==========================================
   CONTEÚDO PRINCIPAL
   ========================================== */

main {
  width: min(1200px, 94%);
  margin: 40px auto;
}


section {
  background: var(--cor-branco);

  margin-bottom: 30px;

  padding: 35px;

  border-radius: var(--raio);

  border: 1px solid var(--cor-borda);

  box-shadow: 0 5px 20px var(--cor-sombra);

  scroll-margin-top: 90px;
}


/* ==========================================
   TÍTULOS
   ========================================== */

h1 {
  color: #660da1;

  font-size: 2.4rem;

  line-height: 1.2;

  margin-bottom: 25px;

  text-align: center;
}


h2 {
  color: var(--cor-principal);

  font-size: 1.9rem;

  line-height: 1.3;

  margin-bottom: 22px;

  border-left: 6px solid var(--cor-destaque);

  padding-left: 14px;
}


h3 {
  color: #621486;

  font-size: 1.4rem;

  margin-top: 30px;
  margin-bottom: 12px;
}


h4 {
  color: #7417aa;

  font-size: 1.15rem;

  margin-top: 22px;
  margin-bottom: 8px;
}


/* ==========================================
   TEXTOS
   ========================================== */

p {
  margin-bottom: 16px;
  color: var(--cor-texto);
}


strong {
  color: #610c64;
}


ul,
ol {
  margin: 15px 0 20px 30px;
}


li {
  margin-bottom: 10px;
}


li::marker {
  color: var(--cor-principal);
  font-weight: bold;
}


/* ==========================================
   LISTA DE REFERÊNCIAS
   ========================================== */

.referencias {
  padding-left: 25px;
}


.referencias li {
  margin-bottom: 18px;

  overflow-wrap: anywhere;
}


/* ==========================================
   IMAGENS / ESPAÇOS PARA IMAGENS
   ========================================== */

.atividade-imagem {
  margin: 25px 0;
}


.imagem-placeholder {
  min-height: 180px;

  display: flex;
  flex-direction: column;

  align-items: center;
  justify-content: center;

  text-align: center;

  padding: 30px;

  border: 3px dashed #90caf9;

  border-radius: 12px;

  background:
    linear-gradient(
      135deg,
      #e3f2fd,
      #f5fbff
    );

  color: rgb(77, 23, 90);

  margin: 25px 0;
}


.imagem-placeholder p {
  max-width: 700px;
}


/* ==========================================
   FLUXOS DE TECNOLOGIA
   ========================================== */

.fluxo-tecnologia {
  background:
    linear-gradient(
      135deg,
      #e3f2fd,
      #e8f5e9
    );

  border-left: 6px solid var(--cor-destaque);

  border-radius: 10px;

  padding: 22px;

  margin: 25px 0;

  text-align: center;

  font-size: 1.1rem;
}


.fluxo-tecnologia p {
  margin: 0;
}


/* ==========================================
   TABELA
   ========================================== */

table {
  width: 100%;

  border-collapse: collapse;

  margin: 25px 0;

  background: white;
}


th,
td {
  border: 1px solid #b7c9d6;

  padding: 14px;

  text-align: left;

  vertical-align: top;
}


th {
  background: var(--cor-principal);

  color: white;

  font-weight: bold;
}


tr:nth-child(even) {
  background: #f1f7fb;
}


tr:hover {
  background: #e3f2fd;
}


/* ==========================================
   LINKS
   ========================================== */

a {
  color: #6411b1;
}


a:hover {
  color: #7b1688;
}


/* ==========================================
   ANIMAÇÃO DAS SEÇÕES
   ========================================== */

.animar {
  opacity: 0;

  transform: translateY(25px);

  transition:
    opacity 0.7s ease,
    transform 0.7s ease;
}


.animar.visivel {
  opacity: 1;

  transform: translateY(0);
}


/* ==========================================
   BOTÃO VOLTAR AO TOPO
   ========================================== */

#btn-topo {
  position: fixed;

  right: 25px;
  bottom: 25px;

  width: 50px;
  height: 50px;

  border: none;

  border-radius: 50%;

  background: var(--cor-principal);

  color: white;

  font-size: 1.6rem;

  font-weight: bold;

  cursor: pointer;

  box-shadow:
    0 5px 15px rgba(0, 0, 0, 0.25);

  opacity: 0;

  visibility: hidden;

  transform: translateY(15px);

  transition:
    opacity 0.3s ease,
    visibility 0.3s ease,
    transform 0.3s ease,
    background 0.2s ease;

  z-index: 2000;
}


#btn-topo.mostrar {
  opacity: 1;

  visibility: visible;

  transform: translateY(0);
}


#btn-topo:hover {
  background: #660da1;

  transform: translateY(-4px);
}


#btn-topo:focus {
  outline: 3px solid #ffeb3b;
  outline-offset: 3px;
}


/* ==========================================
   RODAPÉ
   ========================================== */

footer {
  background: #720da1;

  color: white;

  text-align: center;

  padding: 30px 20px;

  margin-top: 40px;
}


footer p {
  color: white;

  margin-bottom: 8px;
}


/* ==========================================
   ALTO CONTRASTE
   ========================================== */

body.alto-contraste {
  background: #000000;

  color: #ffffff;
}


body.alto-contraste section {
  background: #000000;

  color: #ffffff;

  border: 2px solid #ffffff;

  box-shadow: none;
}


body.alto-contraste p,
body.alto-contraste li,
body.alto-contraste td {
  color: #ffffff;
}


body.alto-contraste h1,
body.alto-contraste h2,
body.alto-contraste h3,
body.alto-contraste h4 {
  color: #ffff00;
}


body.alto-contraste strong,
body.alto-contraste b {
  color: #ffffff !important;
}


body.alto-contraste nav {
  background: #000000;

  border-bottom: 2px solid white;
}


body.alto-contraste nav a {
  color: white;
}


body.alto-contraste nav a:hover,
body.alto-contraste nav a.ativo {
  background: #ffff00;

  color: #000000;
}


body.alto-contraste .imagem-placeholder,
body.alto-contraste .fluxo-tecnologia {
  background: #000000;

  color: white;

  border-color: #ffff00;
}


body.alto-contraste .imagem-placeholder p {
  color: white;
}


body.alto-contraste table {
  background: #000000;

  color: white;
}


body.alto-contraste th {
  background: #ffff00;

  color: #000000;
}


body.alto-contraste td {
  border-color: white;

  color: white;
}


body.alto-contraste tr:nth-child(even),
body.alto-contraste tr:hover {
  background: #222222;
}


body.alto-contraste a {
  color: #00ffff;
}


body.alto-contraste footer {
  background: #000000;

  border-top: 2px solid white;
}


body.alto-contraste #btn-topo {
  background: #ffff00;

  color: #000000;
}


/* ==========================================
   RESPONSIVIDADE - TABLET
   ========================================== */

@media (max-width: 900px) {

  nav ul {
    justify-content: flex-start;

    overflow-x: auto;

    flex-wrap: nowrap;

    scrollbar-width: thin;
  }


  nav a {
    white-space: nowrap;
  }


  main {
    width: 94%;
  }


  section {
    padding: 28px;
  }


  h1 {
    font-size: 2rem;
  }


  h2 {
    font-size: 1.65rem;
  }

}


/* ==========================================
   RESPONSIVIDADE - CELULAR
   ========================================== */

@media (max-width: 600px) {

  body {
    line-height: 1.6;
  }


  .accessibility-bar {
    flex-direction: column;

    padding: 15px 10px;
  }


  .accessibility-bar span {
    margin-bottom: 5px;
  }


  .accessibility-bar button {
    width: 90%;

    max-width: 300px;
  }


  nav {
    position: relative;
  }


  nav ul {
    justify-content: flex-start;

    padding: 8px;

    gap: 3px;
  }


  nav a {
    padding: 9px 11px;

    font-size: 0.9rem;
  }


  main {
    width: 96%;

    margin: 20px auto;
  }


  section {
    padding: 20px;

    margin-bottom: 20px;

    border-radius: 9px;
  }


  h1 {
    font-size: 1.8rem;
  }


  h2 {
    font-size: 1.45rem;

    border-left-width: 4px;
  }


  h3 {
    font-size: 1.25rem;
  }


  h4 {
    font-size: 1.05rem;
  }


  p {
    font-size: 1rem;
  }


  ul,
  ol {
    margin-left: 22px;
  }


  table {
    display: block;

    overflow-x: auto;

    white-space: normal;
  }


  th,
  td {
    min-width: 150px;

    padding: 10px;
  }


  .imagem-placeholder {
    min-height: 150px;

    padding: 20px;
  }


  .fluxo-tecnologia {
    padding: 18px;

    overflow-wrap: anywhere;
  }


  #btn-topo {
    width: 45px;
    height: 45px;

    right: 15px;
    bottom: 15px;
  }

}


/* ==========================================
   REDUZIR ANIMAÇÕES
   RESPEITA PREFERÊNCIA DO USUÁRIO
   ========================================== */

@media (prefers-reduced-motion: reduce) {

  html {
    scroll-behavior: auto;
  }


  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;

    animation-iteration-count: 1 !important;

    transition-duration: 0.01ms !important;

    scroll-behavior: auto !important;
  }


  .animar {
    opacity: 1;

    transform: none;
  }

}


/* =========================================================
   ♿ ACESSIBILIDADE AVANÇADA — VERSÃO CORRIGIDA
   ========================================================= */

/* Leitor de tela: conteúdo visualmente oculto, mas acessível */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Link para pular diretamente ao conteúdo */
.skip-link {
  position: fixed;
  top: -100px;
  left: 15px;
  z-index: 100000;
  padding: 12px 18px;
  border-radius: 8px;
  background: #000;
  color: #fff !important;
  border: 3px solid #fff;
  font-weight: 800;
  text-decoration: none !important;
  transition: top .2s ease;
}

.skip-link:focus {
  top: 15px;
  outline: 4px solid #ffff00;
  outline-offset: 3px;
}

/* Foco consistente para teclado */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 4px solid #ff9800;
  outline-offset: 3px;
}

/* Novos controles criados pelo script.js */
.accessibility-bar button[aria-pressed="true"] {
  box-shadow: 0 0 0 3px rgba(255,255,255,.65);
}

#btn-reader,
#btn-stop-reader,
#btn-reading-mode,
#btn-cursor,
#btn-line {
  min-height: 40px;
}

#btn-stop-reader:disabled {
  opacity: .5;
}

/* Modo de leitura */
body.modo-leitura {
  letter-spacing: .045em;
  word-spacing: .12em;
  line-height: 2 !important;
}

body.modo-leitura p,
body.modo-leitura li {
  max-width: 78ch;
}

body.modo-leitura h1,
body.modo-leitura h2,
body.modo-leitura h3,
body.modo-leitura h4 {
  line-height: 1.5;
}

/* ==========================================
   🖱 CURSOR GRANDE
   ========================================== */

body.cursor-grande,
body.cursor-grande * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cpath d='M5 2 L5 31 L13 23 L19 37 L24 35 L18 21 L30 21 Z' fill='white' stroke='black' stroke-width='3'/%3E%3C/svg%3E") 5 2, auto !important;
}


body.cursor-grande button,
body.cursor-grande a,
body.cursor-grande select,
body.cursor-grande input,
body.cursor-grande textarea {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cpath d='M5 2 L5 31 L13 23 L19 37 L24 35 L18 21 L30 21 Z' fill='white' stroke='black' stroke-width='3'/%3E%3C/svg%3E") 5 2, pointer !important;
}

/* Guia de leitura */
#linha-leitura {
  position: fixed;
  left: 0;
  width: 100vw;
  height: 4px;
  display: none;
  background: #ffeb3b;
  box-shadow: 0 0 8px rgba(0,0,0,.7);
  pointer-events: none;
  z-index: 99999;
}

/* =========================================================
   ALTO CONTRASTE — CORREÇÃO COMPLETA
   ========================================================= */

body.alto-contraste {
  background: #000000 !important;
  color: #ffffff !important;
}

body.alto-contraste header,
body.alto-contraste main,
body.alto-contraste footer,
body.alto-contraste section,
body.alto-contraste article,
body.alto-contraste div,
body.alto-contraste figure,
body.alto-contraste figcaption {
  color: #ffffff !important;
}

body.alto-contraste section {
  background: #000000 !important;
  border: 2px solid #ffffff !important;
  box-shadow: none !important;
}

/* Todo texto comum fica branco */
body.alto-contraste p,
body.alto-contraste li,
body.alto-contraste td,
body.alto-contraste span,
body.alto-contraste label,
body.alto-contraste small,
body.alto-contraste figcaption,
body.alto-contraste .imagem-placeholder p,
body.alto-contraste .atividade-imagem p,
body.alto-contraste footer p {
  color: #ffffff !important;
}

/* Títulos ficam amarelos para destaque */
body.alto-contraste h1,
body.alto-contraste h2,
body.alto-contraste h3,
body.alto-contraste h4,
body.alto-contraste h5,
body.alto-contraste h6 {
  color: #ffff00 !important;
}

/* Negrito não usa mais roxo */
body.alto-contraste strong,
body.alto-contraste b {
  color: #ffffff !important;
}

/* Links */
body.alto-contraste a {
  color: #00ffff !important;
  text-decoration: underline !important;
}

body.alto-contraste a:hover,
body.alto-contraste a:focus-visible {
  color: #ffff00 !important;
}

/* Menu */
body.alto-contraste nav {
  background: #000000 !important;
  border-bottom: 2px solid #ffffff !important;
  box-shadow: none !important;
}

body.alto-contraste nav a {
  background: transparent !important;
  color: #ffffff !important;
  text-decoration: none !important;
}

body.alto-contraste nav a:hover,
body.alto-contraste nav a.ativo,
body.alto-contraste nav a:focus-visible {
  background: #ffff00 !important;
  color: #000000 !important;
  text-decoration: none !important;
}

/* Barra de acessibilidade */
body.alto-contraste .accessibility-bar {
  background: #000000 !important;
  color: #ffffff !important;
  border-bottom: 2px solid #ffffff !important;
  box-shadow: none !important;
}

body.alto-contraste .accessibility-bar span {
  color: #ffff00 !important;
}

body.alto-contraste .accessibility-bar button {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}

body.alto-contraste .accessibility-bar button:hover,
body.alto-contraste .accessibility-bar button:focus-visible,
body.alto-contraste .accessibility-bar button[aria-pressed="true"] {
  background: #ffff00 !important;
  color: #000000 !important;
  border-color: #ffff00 !important;
}

body.alto-contraste .accessibility-bar button:disabled {
  background: #222222 !important;
  color: #aaaaaa !important;
  border-color: #aaaaaa !important;
}

/* Caixas de imagens e fluxos */
body.alto-contraste .imagem-placeholder,
body.alto-contraste .fluxo-tecnologia,
body.alto-contraste .atividade-imagem .imagem-placeholder {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffff00 !important;
  box-shadow: none !important;
}

/* Imagens continuam visíveis */
body.alto-contraste img {
  opacity: 1 !important;
  filter: none !important;
}

/* Tabelas */
body.alto-contraste table {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}

body.alto-contraste th {
  background: #ffff00 !important;
  color: #000000 !important;
  border: 2px solid #ffffff !important;
}

body.alto-contraste td {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}

body.alto-contraste tr:nth-child(even) td,
body.alto-contraste tr:hover td {
  background: #222222 !important;
  color: #ffffff !important;
}

/* Rodapé */
body.alto-contraste footer {
  background: #000000 !important;
  color: #ffffff !important;
  border-top: 2px solid #ffffff !important;
}

/* Botão voltar ao topo */
body.alto-contraste #btn-topo {
  background: #ffff00 !important;
  color: #000000 !important;
  border: 3px solid #ffffff !important;
  box-shadow: none !important;
}

body.alto-contraste #btn-topo:hover,
body.alto-contraste #btn-topo:focus-visible {
  background: #ffffff !important;
  color: #000000 !important;
}

/* Guia no alto contraste */
body.alto-contraste #linha-leitura {
  background: #ffff00 !important;
  box-shadow: 0 0 10px #ffff00 !important;
}

/* Inputs, se existirem no futuro */
body.alto-contraste input,
body.alto-contraste textarea,
body.alto-contraste select {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}

/* Evita que cores inline do tema visual deixem o texto ilegível */
body.alto-contraste [style*="color"] {
  color: #ffffff !important;
}

/* =========================================================
   MODO LEITURA + ALTO CONTRASTE
   ========================================================= */

body.alto-contraste.modo-leitura {
  background: #000000 !important;
  color: #ffffff !important;
}

body.alto-contraste.modo-leitura p,
body.alto-contraste.modo-leitura li {
  color: #ffffff !important;
}

/* =========================================================
   REDUZIR ANIMAÇÕES
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  .animar,
  .animar.visivel {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* =========================================================
   ACESSIBILIDADE EM TELAS PEQUENAS
   ========================================================= */

@media (max-width: 600px) {
  .accessibility-bar {
    gap: 8px !important;
  }

  .accessibility-bar button {
    min-height: 44px;
  }

  #btn-topo {
    right: 12px;
    bottom: 12px;
  }
}
