/* Central de Acessibilidade — EAD Mais Brasil
   Prefixo de controles: a11y-* | Classes globais no <html>: access-* */

:root {
  --a11y-fab-size: 56px;
  --a11y-fab-right: 22px;
  --a11y-fab-bottom: 100px;
  --a11y-fab-z: 1051;
  --a11y-vlibras-gap: 12px;
  /* Empilha VLibras acima do FAB (mesmo eixo direito) */
  --a11y-vlibras-bottom: calc(var(--a11y-fab-bottom) + var(--a11y-fab-size) + var(--a11y-vlibras-gap));
  --a11y-accent: #004295;
  --a11y-accent-dark: #07336d;
  --a11y-focus: #2154d9;
  --a11y-font-scale: 1;
}

html {
  font-size: calc(100% * var(--a11y-font-scale, 1));
}

/* ---------- Skip-link ---------- */
.a11y-skip-link {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 11000;
  padding: 0.75rem 1.1rem;
  background: var(--a11y-accent-dark);
  color: #fff;
  font-weight: 700;
  border-radius: 10px;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 0.2s ease;
}

.a11y-skip-link:focus,
.a11y-skip-link:focus-visible {
  transform: translateY(0);
  color: #fff;
  outline: 3px solid #ffbd1f;
  outline-offset: 3px;
}

html.access-reduce-motion .a11y-skip-link {
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  .a11y-skip-link {
    transition: none;
  }
}

/* ---------- Foco global (reforço; não remove outlines existentes) ---------- */
:focus-visible {
  outline: 3px solid var(--a11y-focus);
  outline-offset: 2px;
}

.a11y-panel :focus-visible,
.a11y-fab:focus-visible {
  outline: 3px solid #ffbd1f;
  outline-offset: 3px;
}

/* Alvo do skip-link: focável via tabindex=-1, sem outline agressivo em foco programático */
#main-content:focus {
  outline: none;
}

#main-content:focus-visible {
  outline: 3px solid var(--a11y-focus);
  outline-offset: 4px;
}

/* ---------- FAB ---------- */
.a11y-fab {
  position: fixed;
  right: var(--a11y-fab-right);
  bottom: var(--a11y-fab-bottom);
  z-index: var(--a11y-fab-z);
  width: var(--a11y-fab-size);
  height: var(--a11y-fab-size);
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--a11y-accent), #0a5ad6);
  color: #fff;
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(0, 66, 149, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.a11y-fab:hover {
  color: #fff;
  transform: translateY(-3px);
  box-shadow: 0 16px 32px rgba(0, 66, 149, 0.42);
}

.a11y-fab:active {
  transform: translateY(-1px);
}

.a11y-fab[aria-expanded="true"] {
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--a11y-accent);
}

/* Pulse leve no FAB durante o hint intro (respeita reduce-motion via JS/CSS) */
.a11y-fab.a11y-fab--intro-pulse {
  animation: a11y-fab-intro-pulse 1.4s ease-in-out 2;
}

@keyframes a11y-fab-intro-pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 12px 28px rgba(0, 66, 149, 0.35);
  }
  50% {
    transform: scale(1.06);
    box-shadow: 0 14px 34px rgba(0, 66, 149, 0.5), 0 0 0 6px rgba(0, 66, 149, 0.18);
  }
}

/* ---------- Hint intro (1× por visitante) ---------- */
.a11y-intro-hint {
  position: fixed;
  right: calc(var(--a11y-fab-right) + var(--a11y-fab-size) + 12px);
  bottom: calc(var(--a11y-fab-bottom) + (var(--a11y-fab-size) - 44px) / 2);
  z-index: calc(var(--a11y-fab-z) + 1);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  max-width: min(240px, calc(100vw - var(--a11y-fab-size) - var(--a11y-fab-right) - 28px));
  min-height: 44px;
  padding: 0.55rem 0.5rem 0.55rem 0.85rem;
  background: #17315b;
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(23, 49, 91, 0.35);
  opacity: 0;
  transform: translateX(10px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.a11y-intro-hint.is-visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

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

.a11y-intro-hint:not([hidden]) {
  display: flex;
}

.a11y-intro-hint__text {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
  color: #fff;
}

.a11y-intro-hint__close {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  opacity: 0.85;
}

.a11y-intro-hint__close:hover,
.a11y-intro-hint__close:focus-visible {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
}

/* Seta apontando para o FAB */
.a11y-intro-hint::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  width: 12px;
  height: 12px;
  background: #17315b;
  transform: translateY(-50%) rotate(45deg);
  border-radius: 2px;
}

/* Modo estático (reduce-motion): sem slide/fade/pulse */
.a11y-intro-hint.a11y-intro-hint--static,
.a11y-intro-hint.a11y-intro-hint--static.is-visible {
  transition: none;
  transform: none;
}

html.access-reduce-motion .a11y-fab.a11y-fab--intro-pulse,
html.access-reduce-motion .a11y-intro-hint {
  animation: none !important;
  transition: none !important;
  transform: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .a11y-fab.a11y-fab--intro-pulse {
    animation: none !important;
  }

  .a11y-intro-hint {
    transition: none;
    transform: none;
  }
}

@media (max-width: 991.98px) {
  body.is-course-page {
    --a11y-fab-bottom: 170px;
  }
}

/* ---------- Painel offcanvas ---------- */
.a11y-panel.offcanvas {
  --bs-offcanvas-width: min(100vw, 380px);
}

.a11y-panel .offcanvas-header {
  border-bottom: 1px solid #e8eaf1;
  background: linear-gradient(90deg, var(--a11y-accent-dark), var(--a11y-accent));
  color: #fff;
}

.a11y-panel .offcanvas-title {
  font-weight: 800;
  font-size: 1.1rem;
}

.a11y-panel .btn-close {
  filter: invert(1) grayscale(1) brightness(2);
}

.a11y-panel .offcanvas-body {
  padding: 1rem 1.15rem 1.5rem;
}

.a11y-section {
  margin-bottom: 1.35rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid #e8eaf1;
}

.a11y-section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.a11y-section__title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--a11y-accent);
  margin: 0 0 0.75rem;
}

.a11y-section__hint {
  font-size: 0.88rem;
  color: #66738a;
  line-height: 1.5;
  margin: 0.5rem 0 0;
}

.a11y-font-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.a11y-font-controls .btn {
  min-width: 44px;
  min-height: 44px;
  font-weight: 800;
}

.a11y-font-value {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  color: #17315b;
}

.a11y-toggle-grid {
  display: grid;
  gap: 0.5rem;
}

.a11y-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.65rem;
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.85rem;
  border: 1px solid #e8eaf1;
  border-radius: 12px;
  background: #fff;
  color: #39455c;
  font-weight: 600;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.a11y-toggle:hover {
  border-color: rgba(0, 66, 149, 0.35);
  background: rgba(0, 66, 149, 0.05);
}

.a11y-toggle[aria-pressed="true"] {
  border-color: var(--a11y-accent);
  background: rgba(0, 66, 149, 0.1);
  color: var(--a11y-accent-dark);
  box-shadow: inset 0 0 0 1px var(--a11y-accent);
}

.a11y-toggle .bi {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.a11y-speech-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}

.a11y-speech-controls .btn {
  min-height: 44px;
  font-weight: 600;
}

.a11y-speech-rate {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.a11y-speech-rate label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #53617a;
}

.a11y-speech-rate select {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid #e8eaf1;
  padding: 0.4rem 0.65rem;
  font-weight: 600;
}

.a11y-reset-btn {
  width: 100%;
  min-height: 44px;
  font-weight: 700;
}

/* ---------- Alto contraste ---------- */
html.access-high-contrast,
html.access-high-contrast body {
  background: #000 !important;
  color: #fff !important;
}

html.access-high-contrast a {
  color: #ffff00 !important;
}

html.access-high-contrast .navbar,
html.access-high-contrast .topbar,
html.access-high-contrast footer,
html.access-high-contrast .footer,
html.access-high-contrast .offcanvas,
html.access-high-contrast .card,
html.access-high-contrast .course-card,
html.access-high-contrast .category-card,
html.access-high-contrast .persona-card,
html.access-high-contrast .search-box,
html.access-high-contrast .search-panel,
html.access-high-contrast .hero,
html.access-high-contrast .site-header,
html.access-high-contrast .form-dialog,
html.access-high-contrast .ead-auth__card,
html.access-high-contrast .ead-auth__header,
html.access-high-contrast .ead-auth__welcome,
html.access-high-contrast .ead-auth__cta,
html.access-high-contrast .ead-auth__cta a,
html.access-high-contrast .ead-contact-form__login,
html.access-high-contrast .ead-contact-form__login a,
html.access-high-contrast .ead-form__link,
html.access-high-contrast .ead-form__control,
html.access-high-contrast .ead-form__toggle-senha,
html.access-high-contrast .ead-parceiro__header,
html.access-high-contrast .ead-parceiro-ok__card,
html.access-high-contrast .bp-auth__card,
html.access-high-contrast .bp-parceiro__header,
html.access-high-contrast .bp-parceiro__perks li,
html.access-high-contrast .ine-catalogo-tipo,
html.access-high-contrast .ine-catalogo-area,
html.access-high-contrast .ead-page__mast {
  background: #000 !important;
  color: #fff !important;
  border-color: #fff !important;
}

html.access-high-contrast .ead-page__mast .ead-page__title,
html.access-high-contrast .ead-page__mast .ead-page__menu,
html.access-high-contrast .ead-page__mast .ead-page__lead,
html.access-high-contrast .ead-page__mast .ead-page__breadcrumb,
html.access-high-contrast .ead-page__mast .ead-page__breadcrumb [aria-current="page"] {
  color: #fff !important;
  background: transparent !important;
}

html.access-high-contrast .ead-auth__title,
html.access-high-contrast .ead-auth__subtitle,
html.access-high-contrast .ead-auth__subtitle strong,
html.access-high-contrast .ead-form__label,
html.access-high-contrast .ead-auth__senha-regras li {
  color: #fff !important;
}

html.access-high-contrast .ead-auth__senha-regras li.is-ok {
  color: #ffff00 !important;
}

html.access-high-contrast .ead-auth__senha-regras li::before {
  border-color: #fff !important;
  background: transparent !important;
}

html.access-high-contrast .ead-auth__senha-regras li.is-ok::before {
  border-color: #ffff00 !important;
  background: #ffff00 !important;
}

html.access-high-contrast .btn-ine,
html.access-high-contrast .btn-brand,
html.access-high-contrast .a11y-fab {
  background: #ffff00 !important;
  color: #000 !important;
  box-shadow: none !important;
}

html.access-high-contrast .a11y-toggle[aria-pressed="true"] {
  background: #ffff00 !important;
  color: #000 !important;
  border-color: #fff !important;
}

html.access-high-contrast img:not([src*="logo"]):not(.navbar-brand img) {
  filter: grayscale(1) contrast(1.25);
}

/* ---------- Destacar links ---------- */
html.access-highlight-links a:not(.a11y-fab):not(.whatsapp-float):not(.btn) {
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 3px !important;
  font-weight: 700 !important;
  background-image: linear-gradient(transparent 60%, rgba(255, 189, 31, 0.55) 60%);
}

html.access-highlight-links a:not(.a11y-fab):not(.whatsapp-float):not(.btn):hover,
html.access-highlight-links a:not(.a11y-fab):not(.whatsapp-float):not(.btn):focus {
  outline: 2px solid var(--a11y-focus);
  outline-offset: 2px;
}

/* ---------- Espaçamento de texto ---------- */
html.access-text-spacing body,
html.access-text-spacing #main-content,
html.access-text-spacing #main-content p,
html.access-text-spacing #main-content li,
html.access-text-spacing #main-content td,
html.access-text-spacing #main-content th {
  letter-spacing: 0.12em !important;
  word-spacing: 0.16em !important;
  line-height: 1.9 !important;
}

/* ---------- Fonte legível ---------- */
html.access-readable-font,
html.access-readable-font body,
html.access-readable-font #main-content {
  font-family: "Comic Sans MS", "Chalkboard SE", "Segoe Print", Verdana, Geneva, sans-serif !important;
}

/* ---------- Cursor ampliado ---------- */
html.access-large-cursor,
html.access-large-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath fill='%23000' stroke='%23fff' stroke-width='2' d='M8 4v36l9.5-9.5 6.5 15.5 5-2-6.5-15.5H40z'/%3E%3C/svg%3E") 4 4, auto !important;
}

html.access-large-cursor a,
html.access-large-cursor button,
html.access-large-cursor [role="button"],
html.access-large-cursor input,
html.access-large-cursor select,
html.access-large-cursor label,
html.access-large-cursor .a11y-toggle,
html.access-large-cursor .a11y-fab {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath fill='%23004295' stroke='%23fff' stroke-width='2' d='M8 4v36l9.5-9.5 6.5 15.5 5-2-6.5-15.5H40z'/%3E%3C/svg%3E") 4 4, pointer !important;
}

/* ---------- Modo leitura ---------- */
html.access-reading-mode .hero:before,
html.access-reading-mode .hero:after,
html.access-reading-mode .hero-visual,
html.access-reading-mode .hero-photo,
html.access-reading-mode .hero-card,
html.access-reading-mode .hero-grid-layer,
html.access-reading-mode .hero-ring,
html.access-reading-mode .float-badge,
html.access-reading-mode .whatsapp-pulse,
html.access-reading-mode .reveal:not(.show) {
  display: none !important;
}

html.access-reading-mode .hero,
html.access-reading-mode .ead-page__mast {
  background: #f8f9fc !important;
  color: #17315b !important;
  padding-top: 2.5rem !important;
  padding-bottom: 2rem !important;
}

html.access-reading-mode .hero h1,
html.access-reading-mode .hero p,
html.access-reading-mode .hero .eyebrow {
  color: inherit !important;
}

html.access-reading-mode #main-content {
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}

html.access-reading-mode #main-content p,
html.access-reading-mode #main-content li,
html.access-reading-mode #main-content .section-sub {
  line-height: 1.85 !important;
  font-size: 1.05em;
}

/* Modo leitura: navbar, footer, FAB, WhatsApp e CTAs permanecem visíveis */

/* ---------- Reduzir animações ---------- */
html.access-reduce-motion *,
html.access-reduce-motion *::before,
html.access-reduce-motion *::after {
  animation: none !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

html.access-reduce-motion .whatsapp-pulse,
html.access-reduce-motion .a11y-fab:hover,
html.access-reduce-motion .whatsapp-float:hover,
html.access-reduce-motion .course-card:hover,
html.access-reduce-motion .ine-catalogo-tipo:hover,
html.access-reduce-motion .ine-catalogo-area:hover,
html.access-reduce-motion .btn-ine:hover {
  transform: none !important;
}

html.access-reduce-motion .whatsapp-pulse {
  display: none !important;
}

html.access-reduce-motion .reveal {
  opacity: 1 !important;
  transform: none !important;
}

@media (prefers-reduced-motion: reduce) {
  html:not(.access-reduce-motion) *,
  html:not(.access-reduce-motion) *::before,
  html:not(.access-reduce-motion) *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  html:not(.access-reduce-motion) .whatsapp-pulse {
    display: none !important;
  }

  html:not(.access-reduce-motion) .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ---------- Mobile ---------- */
@media (max-width: 575.98px) {
  :root {
    --a11y-fab-size: 52px;
    --a11y-fab-right: 16px;
    --a11y-fab-bottom: 96px;
  }

  .a11y-panel.offcanvas {
    --bs-offcanvas-width: 100vw;
  }

  .a11y-speech-controls .btn {
    flex: 1 1 calc(50% - 0.45rem);
  }
}
