/* ═══════════════════════════════════════════════════════════════
   PROMAKE ART · SISTEMA GLOBAL DE ACESSIBILIDADE (WCAG 2.1 AA)
   Visual discreto, moderno e perfeitamente integrado à identidade visual
════════════════════════════════════════════════════════════════ */

/* ── BOTÃO FLUTUANTE DE ACESSIBILIDADE (CANTO INFERIOR ESQUERDO) ── */
.pm-a11y-trigger {
  position: fixed;
  bottom: calc(clamp(16px, 3.5vh, 28px) + env(safe-area-inset-bottom, 0px));
  left: calc(clamp(16px, 3vw, 28px) + env(safe-area-inset-left, 0px));
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(17, 17, 17, .92);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, .25);
  box-shadow: 0 8px 24px rgba(17, 17, 17, .25), 0 0 16px rgba(123, 47, 247, .25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9998;
  outline: none;
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), background-color .2s ease, border-color .2s ease, box-shadow .25s ease;
  -webkit-tap-highlight-color: transparent;
}

/* Tooltip Informando "Acessibilidade" */
.pm-a11y-trigger::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) scale(.9);
  background: #111111;
  color: #ffffff;
  font: 600 12px/1 var(--upw-sans, system-ui);
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 9999;
}

.pm-a11y-trigger:hover::after,
.pm-a11y-trigger:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.pm-a11y-trigger svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  transition: transform .25s ease;
}

.pm-a11y-trigger:hover {
  transform: scale(1.08) translateY(-2px);
  background: #000000;
  border-color: var(--upw-accent, #ff3b1f);
  box-shadow: 0 12px 30px rgba(17, 17, 17, .35), 0 0 20px rgba(255, 59, 31, .4);
}

.pm-a11y-trigger:focus-visible {
  outline: 3px solid var(--upw-accent, #ff3b1f);
  outline-offset: 3px;
}

.pm-a11y-trigger.is-active {
  background: var(--upw-accent, #ff3b1f);
  color: #ffffff;
  border-color: #ffffff;
}

/* ── BOTÃO COMPACTO DE ACESSIBILIDADE NO HEADER ── */
.pm-a11y-header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: transparent;
  color: var(--upw-ink, #111111);
  border: 1px solid rgba(17, 17, 17, .2);
  cursor: pointer;
  outline: none;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}

.pm-a11y-header-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.pm-a11y-header-btn:hover {
  background: var(--upw-ink, #111111);
  color: #ffffff;
  border-color: var(--upw-ink, #111111);
  transform: scale(1.06);
}

.pm-a11y-header-btn:focus-visible {
  outline: 2px solid var(--upw-accent, #ff3b1f);
  outline-offset: 2px;
}

/* ── PAINEL / MENU DE ACESSIBILIDADE ── */
.pm-a11y-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 7, 20, .45);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s cubic-bezier(.2, .8, .2, 1);
}

.pm-a11y-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.pm-a11y-panel {
  position: fixed;
  bottom: clamp(20px, 4vh, 32px);
  left: clamp(16px, 3vw, 32px);
  width: min(390px, calc(100vw - 32px));
  max-height: min(620px, calc(100vh - 50px));
  background: #ffffff;
  border: 1.5px solid rgba(17, 17, 17, .14);
  border-radius: 24px;
  box-shadow: 0 24px 50px rgba(17, 17, 17, .25), 0 0 25px rgba(123, 47, 247, .12);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(.96);
  pointer-events: none;
  transition: opacity .3s cubic-bezier(.2, .8, .2, 1), transform .3s cubic-bezier(.2, .8, .2, 1);
}

.pm-a11y-backdrop.is-open .pm-a11y-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Cabeçalho do Painel */
.pm-a11y-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(17, 17, 17, .08);
  background: rgba(244, 241, 234, .5);
}

.pm-a11y-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pm-a11y-head-icon {
  width: 22px;
  height: 22px;
  color: var(--upw-accent, #ff3b1f);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pm-a11y-head-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.pm-a11y-title {
  margin: 0;
  font: 800 16px/1.2 var(--upw-sans, system-ui);
  letter-spacing: -.02em;
  color: var(--upw-ink, #111111);
}

.pm-a11y-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(17, 17, 17, .15);
  color: var(--upw-ink, #111111);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease;
  font-size: 16px;
  line-height: 1;
}

.pm-a11y-close:hover {
  background: rgba(17, 17, 17, .08);
  border-color: rgba(17, 17, 17, .4);
}

.pm-a11y-close:focus-visible {
  outline: 2px solid var(--upw-accent, #ff3b1f);
  outline-offset: 2px;
}

/* Corpo / Opções do Painel */
.pm-a11y-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Seção de Tamanho de Fonte */
.pm-a11y-group-title {
  font: 700 11px/1 var(--upw-mono, monospace);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--upw-muted, #4b4740);
  margin-bottom: 6px;
}

.pm-a11y-btn-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.pm-a11y-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 6px;
  border-radius: 12px;
  background: rgba(17, 17, 17, .04);
  border: 1px solid rgba(17, 17, 17, .14);
  color: var(--upw-ink, #111111);
  font: 600 clamp(11.5px, 2.5vw, 12.5px)/1 var(--upw-sans, system-ui);
  cursor: pointer;
  transition: all .2s ease;
  user-select: none;
  min-height: 40px;
}

.pm-a11y-btn:hover {
  background: rgba(17, 17, 17, .08);
  border-color: rgba(17, 17, 17, .3);
  transform: translateY(-1px);
}

.pm-a11y-btn:focus-visible {
  outline: 2px solid var(--upw-accent, #ff3b1f);
  outline-offset: 2px;
}

.pm-a11y-btn.is-active {
  background: var(--upw-ink, #111111);
  color: #ffffff;
  border-color: var(--upw-ink, #111111);
  box-shadow: 0 4px 12px rgba(17, 17, 17, .2);
}

/* Botões Alternadores (Grid 2 colunas) */
.pm-a11y-toggles-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pm-a11y-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(17, 17, 17, .04);
  border: 1px solid rgba(17, 17, 17, .14);
  color: var(--upw-ink, #111111);
  font: 600 12px/1.2 var(--upw-sans, system-ui);
  text-align: left;
  cursor: pointer;
  transition: all .2s ease;
  min-height: 44px;
}

.pm-a11y-toggle-btn:hover {
  background: rgba(17, 17, 17, .08);
  border-color: rgba(17, 17, 17, .3);
  transform: translateY(-1px);
}

.pm-a11y-toggle-btn:focus-visible {
  outline: 2px solid var(--upw-accent, #ff3b1f);
  outline-offset: 2px;
}

.pm-a11y-toggle-btn.is-active {
  background: rgba(255, 59, 31, .09);
  border-color: var(--upw-accent, #ff3b1f);
  color: var(--upw-accent, #ff3b1f);
  font-weight: 700;
}

.pm-a11y-toggle-icon {
  width: 16px;
  height: 16px;
  flex: none;
  opacity: .85;
}

.pm-a11y-toggle-btn.is-active .pm-a11y-toggle-icon {
  opacity: 1;
}

/* Botão Restaurar Tudo */
.pm-a11y-reset-btn {
  width: 100%;
  padding: 11px 16px;
  border-radius: 12px;
  background: transparent;
  border: 1px dashed rgba(17, 17, 17, .25);
  color: var(--upw-muted, #4b4740);
  font: 600 12px/1 var(--upw-mono, monospace);
  letter-spacing: .04em;
  cursor: pointer;
  transition: all .2s ease;
  margin-top: 4px;
}

.pm-a11y-reset-btn:hover {
  background: rgba(17, 17, 17, .06);
  border-color: var(--upw-ink, #111111);
  color: var(--upw-ink, #111111);
}

.pm-a11y-reset-btn:focus-visible {
  outline: 2px solid var(--upw-accent, #ff3b1f);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   CLASSES MODIFICADORAS GLOBAIS DE ACESSIBILIDADE
════════════════════════════════════════════════════════════════ */

/* ── ISOLAMENTO DO PAINEL DE ACESSIBILIDADE DE QUALQUER ZOOM OU FILTRO ── */
#pmA11yBackdrop,
#pmA11yBtn {
  zoom: 1 !important;
}

/* 1. Tamanhos de Texto - Escala Universal Perfeita & Proporcional */
html.a11y-text-large body {
  zoom: 1.16;
}
html.a11y-text-xlarge body {
  zoom: 1.30;
}
html.a11y-text-small body {
  zoom: 0.88;
}

html.a11y-text-large {
  font-size: 116% !important;
  --upw-fs: clamp(52px, 21.5vw, 128px) !important;
}
html.a11y-text-xlarge {
  font-size: 130% !important;
  --upw-fs: clamp(60px, 24vw, 145px) !important;
}
html.a11y-text-small {
  font-size: 88% !important;
  --upw-fs: clamp(40px, 16vw, 96px) !important;
}

/* Fallback tipográfico caso o navegador não suporte zoom no body */
@supports not (zoom: 1) {
  html.a11y-text-large body p,
  html.a11y-text-large body h1,
  html.a11y-text-large body h2,
  html.a11y-text-large body h3,
  html.a11y-text-large body h4,
  html.a11y-text-large body span,
  html.a11y-text-large body a,
  html.a11y-text-large body li,
  html.a11y-text-large body button:not(.pm-a11y-btn):not(.pm-a11y-toggle-btn) {
    font-size: 116% !important;
  }
  html.a11y-text-xlarge body p,
  html.a11y-text-xlarge body h1,
  html.a11y-text-xlarge body h2,
  html.a11y-text-xlarge body h3,
  html.a11y-text-xlarge body h4,
  html.a11y-text-xlarge body span,
  html.a11y-text-xlarge body a,
  html.a11y-text-xlarge body li,
  html.a11y-text-xlarge body button:not(.pm-a11y-btn):not(.pm-a11y-toggle-btn) {
    font-size: 130% !important;
  }
  html.a11y-text-small body p,
  html.a11y-text-small body h1,
  html.a11y-text-small body h2,
  html.a11y-text-small body h3,
  html.a11y-text-small body h4,
  html.a11y-text-small body span,
  html.a11y-text-small body a,
  html.a11y-text-small body li,
  html.a11y-text-small body button:not(.pm-a11y-btn):not(.pm-a11y-toggle-btn) {
    font-size: 88% !important;
  }
}

/* 2. Alto Contraste (Modo puro WCAG AAA de altíssima legibilidade) */
html.a11y-high-contrast {
  background: #000000 !important;
}
html.a11y-high-contrast body {
  background: #000000 !important;
  color: #ffffff !important;
}
html.a11y-high-contrast body *:not(svg):not(path) {
  border-color: rgba(255, 255, 255, .7) !important;
}
html.a11y-high-contrast .upw-sec-kinetic,
html.a11y-high-contrast .pm-sec-stats,
html.a11y-high-contrast .pm-sec-services,
html.a11y-high-contrast .pm-sec-portfolio,
html.a11y-high-contrast .pm-footer {
  background: #000000 !important;
  color: #ffffff !important;
}
html.a11y-high-contrast .pm-stat-card,
html.a11y-high-contrast .pm-serv-card,
html.a11y-high-contrast .pm-final-cta-card,
html.a11y-high-contrast .pm-portfolio-card {
  background: #08080c !important;
  border: 2px solid #ffffff !important;
  color: #ffffff !important;
}
html.a11y-high-contrast .pm-stat-desc,
html.a11y-high-contrast .pm-stats-lead,
html.a11y-high-contrast .pm-services-lead,
html.a11y-high-contrast .pm-serv-desc {
  color: #ffffff !important;
}
html.a11y-high-contrast .pm-a11y-panel {
  background: #0a0a0d !important;
  border: 2px solid #ffffff !important;
  color: #ffffff !important;
}
html.a11y-high-contrast .pm-a11y-head {
  background: #141418 !important;
  border-bottom: 1px solid #ffffff !important;
}
html.a11y-high-contrast .pm-a11y-title,
html.a11y-high-contrast .pm-a11y-btn,
html.a11y-high-contrast .pm-a11y-toggle-btn,
html.a11y-high-contrast .pm-a11y-close {
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, .6) !important;
  background: #111116 !important;
}
html.a11y-high-contrast .pm-a11y-btn.is-active,
html.a11y-high-contrast .pm-a11y-toggle-btn.is-active {
  background: #ffffff !important;
  color: #000000 !important;
  border-color: #ffffff !important;
}

/* 3. Aumentar Contraste */
html.a11y-contrast-boost body {
  filter: contrast(135%) !important;
}

/* 4. Escala de Cinza */
html.a11y-grayscale body {
  filter: grayscale(100%) !important;
}

/* Combinação de Escala de Cinza e Contraste */
html.a11y-grayscale.a11y-contrast-boost body {
  filter: grayscale(100%) contrast(135%) !important;
}

/* 5. Destacar Links */
html.a11y-highlight-links body a:not(.pm-a11y-close):not(.pm-a11y-btn):not(.pm-a11y-toggle-btn) {
  text-decoration: underline 2.5px #ff3b1f !important;
  text-underline-offset: 4px !important;
  background-color: rgba(255, 59, 31, .16) !important;
  border-radius: 4px !important;
  color: #d92407 !important;
}

/* 6. Fonte Mais Legível */
html.a11y-readable-font body,
html.a11y-readable-font body *:not(svg):not(path) {
  font-family: Arial, "Helvetica Neue", Helvetica, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  letter-spacing: .02em !important;
}

/* 7. Aumentar Espaçamento Entre Linhas (Escopado para leitura clara sem quebrar layout) */
html.a11y-line-height body p,
html.a11y-line-height body li,
html.a11y-line-height body blockquote,
html.a11y-line-height body dd,
html.a11y-line-height body .pm-stats-lead,
html.a11y-line-height body .pm-services-lead,
html.a11y-line-height body .pm-stat-desc,
html.a11y-line-height body .pm-serv-desc,
html.a11y-line-height body .upw-kn-sub {
  line-height: 1.95 !important;
}

/* 8. Aumentar Espaçamento Entre Letras */
html.a11y-letter-spacing body p,
html.a11y-letter-spacing body li,
html.a11y-letter-spacing body blockquote,
html.a11y-letter-spacing body dd,
html.a11y-letter-spacing body .pm-stats-lead,
html.a11y-letter-spacing body .pm-services-lead,
html.a11y-letter-spacing body .pm-stat-desc,
html.a11y-letter-spacing body .pm-serv-desc,
html.a11y-letter-spacing body .upw-kn-sub {
  letter-spacing: .10em !important;
  word-spacing: .15em !important;
}

/* 9. Pausar / Reduzir Animações */
html.a11y-pause-animations body *,
html.a11y-pause-animations body *::before,
html.a11y-pause-animations body *::after {
  animation-play-state: paused !important;
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

/* Preserva o painel de acessibilidade ágil e responsivo */
#pmA11yBackdrop,
#pmA11yBackdrop *,
#pmA11yBtn {
  animation-play-state: running !important;
}

/* ── RESPONSIVO CELULAR & TABLET (MOBILE FRIENDLY) ── */
@media (max-width: 600px) {
  .pm-a11y-trigger {
    bottom: max(16px, env(safe-area-inset-bottom, 16px));
    left: max(14px, env(safe-area-inset-left, 14px));
    width: 44px;
    height: 44px;
  }
  .pm-a11y-trigger::after {
    display: none;
  }
  .pm-a11y-panel {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    max-height: 86vh;
    border-radius: 24px 24px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    transform: translateY(100%);
  }
  .pm-a11y-backdrop.is-open .pm-a11y-panel {
    transform: translateY(0);
  }
  .pm-a11y-body {
    padding: 14px 16px calc(16px + env(safe-area-inset-bottom, 14px));
    gap: 12px;
  }
  .pm-a11y-btn-row {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }
  .pm-a11y-btn {
    min-height: 38px;
    padding: 7px 3px;
    font-size: 11px;
  }
  .pm-a11y-toggles-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .pm-a11y-toggle-btn {
    min-height: 40px;
    padding: 8px 8px;
    font-size: 11.5px;
    gap: 6px;
  }
}
