/* PATCH V144 FIX33.9 — Acessibilidade eMAG + contraste global */
:root {
  --emag-focus: #f5d90a;
  --emag-link: #fff333;
  --emag-black: #000000;
  --emag-white: #ffffff;
}

/* Garante que o atributo hidden continue soberano. */
[hidden] { display: none !important; }

/* Links de atalho adicionados à barra superior. */
.emag-shortcut-link {
  white-space: nowrap;
}

/* Modal acessível. */
.emag-a11y-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 12, 30, .74);
  backdrop-filter: blur(4px);
}

.emag-a11y-dialog {
  width: min(920px, 100%);
  max-height: min(88vh, 860px);
  overflow: auto;
  border: 1px solid #cbd8e8;
  border-radius: 20px;
  background: #ffffff;
  color: #12213b;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .34);
}

.emag-a11y-dialog__head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid #dce5f0;
  background: #ffffff;
}

.emag-a11y-dialog__head h2 {
  margin: 0;
  color: #0b3975;
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  line-height: 1.2;
}

.emag-a11y-dialog__head p {
  margin: 7px 0 0;
  color: #52637d;
  line-height: 1.55;
}

.emag-a11y-close {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid #b9c9dc;
  border-radius: 999px;
  background: #f4f7fb;
  color: #102f5c;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 900;
  cursor: pointer;
}

.emag-a11y-dialog__body {
  padding: 22px 24px 26px;
}

.emag-a11y-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.emag-a11y-section {
  min-width: 0;
  padding: 18px;
  border: 1px solid #d9e3ef;
  border-radius: 16px;
  background: #f9fbfd;
}

.emag-a11y-section--wide {
  grid-column: 1 / -1;
}

.emag-a11y-section h3 {
  margin: 0 0 10px;
  color: #0c3f82;
  font-size: 1.05rem;
}

.emag-a11y-section p,
.emag-a11y-section li {
  color: #31435f;
  line-height: 1.65;
}

.emag-a11y-section ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.emag-shortcuts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.emag-shortcuts kbd {
  display: inline-flex;
  min-width: 72px;
  justify-content: center;
  margin-right: 7px;
  padding: 5px 8px;
  border: 1px solid #aabbd0;
  border-bottom-width: 3px;
  border-radius: 7px;
  background: #ffffff;
  color: #0d315f;
  font: 800 .82rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.emag-a11y-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 14px;
}

.emag-a11y-actions button,
.emag-a11y-actions a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 13px;
  border: 1px solid #aebfd3;
  border-radius: 10px;
  background: #ffffff;
  color: #103e78;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.emag-a11y-actions button:hover,
.emag-a11y-actions a:hover {
  background: #edf4fc;
}

.emag-a11y-status {
  margin: 16px 0 0;
  padding: 10px 12px;
  border-left: 4px solid #1a6bca;
  border-radius: 6px;
  background: #eef6ff;
  color: #173f70;
  font-weight: 700;
}

.emag-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;
}

body.emag-modal-open {
  overflow: hidden !important;
}

/* Foco visível e consistente em todo o portal. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--emag-focus) !important;
  outline-offset: 3px !important;
}

/* =============================================================
   FOLHA GLOBAL DE ALTO CONTRASTE — eMAG, contraste otimizado.
   Fundo preto, texto branco, links amarelos e contornos brancos.
   ============================================================= */
html.a11y-contrast,
html.a11y-contrast body,
body.a11y-contrast {
  background: var(--emag-black) !important;
  color: var(--emag-white) !important;
  color-scheme: dark;
}

html.a11y-contrast body,
html.a11y-contrast body :where(
  header, nav, main, section, article, aside, footer, div, form,
  fieldset, figure, figcaption, details, summary, dialog,
  table, thead, tbody, tfoot, tr, th, td, caption,
  ul, ol, li, dl, dt, dd, pre, code, blockquote
),
body.a11y-contrast :where(
  header, nav, main, section, article, aside, footer, div, form,
  fieldset, figure, figcaption, details, summary, dialog,
  table, thead, tbody, tfoot, tr, th, td, caption,
  ul, ol, li, dl, dt, dd, pre, code, blockquote
) {
  background-color: var(--emag-black) !important;
  background-image: none !important;
  color: var(--emag-white) !important;
  border-color: var(--emag-white) !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

html.a11y-contrast body *::before,
html.a11y-contrast body *::after,
body.a11y-contrast *::before,
body.a11y-contrast *::after {
  background-color: transparent !important;
  background-image: none !important;
  border-color: var(--emag-white) !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

html.a11y-contrast body :where(
  h1, h2, h3, h4, h5, h6, p, span, small, strong, em, b, i,
  label, legend, time, address, cite, abbr, mark, output
),
body.a11y-contrast :where(
  h1, h2, h3, h4, h5, h6, p, span, small, strong, em, b, i,
  label, legend, time, address, cite, abbr, mark, output
) {
  color: var(--emag-white) !important;
  text-shadow: none !important;
}

html.a11y-contrast body a,
html.a11y-contrast body a:visited,
html.a11y-contrast body a:hover,
html.a11y-contrast body a:active,
body.a11y-contrast a,
body.a11y-contrast a:visited,
body.a11y-contrast a:hover,
body.a11y-contrast a:active {
  color: var(--emag-link) !important;
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 3px !important;
  background-color: var(--emag-black) !important;
}

html.a11y-contrast body :where(button, .btn, [role="button"], input[type="button"], input[type="submit"], input[type="reset"]),
body.a11y-contrast :where(button, .btn, [role="button"], input[type="button"], input[type="submit"], input[type="reset"]) {
  background: var(--emag-black) !important;
  color: var(--emag-link) !important;
  border: 2px solid var(--emag-white) !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

html.a11y-contrast body :where(button, .btn, [role="button"]):hover,
body.a11y-contrast :where(button, .btn, [role="button"]):hover {
  background: var(--emag-link) !important;
  color: var(--emag-black) !important;
  border-color: var(--emag-link) !important;
}

html.a11y-contrast body :where(#a11yContrast, #btn-contrast, [data-a11y="contrast"], [data-action="contrast"], .btn-contraste, .contrast-toggle)[aria-pressed="true"],
body.a11y-contrast :where(#a11yContrast, #btn-contrast, [data-a11y="contrast"], [data-action="contrast"], .btn-contraste, .contrast-toggle)[aria-pressed="true"] {
  background: var(--emag-link) !important;
  color: var(--emag-black) !important;
  border-color: var(--emag-white) !important;
}

html.a11y-contrast body :where(input, select, textarea),
body.a11y-contrast :where(input, select, textarea) {
  background: var(--emag-black) !important;
  color: var(--emag-white) !important;
  border: 2px solid var(--emag-white) !important;
  caret-color: var(--emag-link) !important;
  box-shadow: none !important;
}

html.a11y-contrast body :where(input, textarea)::placeholder,
body.a11y-contrast :where(input, textarea)::placeholder {
  color: var(--emag-white) !important;
  opacity: .9 !important;
}

html.a11y-contrast body :where(hr, table, th, td, fieldset),
body.a11y-contrast :where(hr, table, th, td, fieldset) {
  border-color: var(--emag-white) !important;
}

html.a11y-contrast body :where(svg),
body.a11y-contrast :where(svg) {
  color: var(--emag-white) !important;
}

html.a11y-contrast body svg :where(path, circle, rect, line, polyline, polygon, ellipse),
body.a11y-contrast svg :where(path, circle, rect, line, polyline, polygon, ellipse) {
  stroke: var(--emag-white) !important;
}

html.a11y-contrast body svg [fill]:not([fill="none"]),
body.a11y-contrast svg [fill]:not([fill="none"]) {
  fill: var(--emag-white) !important;
}

/* Fotografias e ilustrações complexas permanecem reconhecíveis, com contorno. */
html.a11y-contrast body :where(img, picture, video, canvas, iframe),
body.a11y-contrast :where(img, picture, video, canvas, iframe) {
  border-color: var(--emag-white) !important;
  outline-color: var(--emag-white) !important;
  box-shadow: none !important;
}

html.a11y-contrast body :where(.portal-logo-img, .portal-footer-logo-img, .brand-logo-img, .pntp-radar-link img),
body.a11y-contrast :where(.portal-logo-img, .portal-footer-logo-img, .brand-logo-img, .pntp-radar-link img) {
  background: var(--emag-white) !important;
  border: 2px solid var(--emag-white) !important;
}

html.a11y-contrast body :where(.badge, .pill, .tag, .status, .alert, .ok),
body.a11y-contrast :where(.badge, .pill, .tag, .status, .alert, .ok) {
  background: var(--emag-black) !important;
  color: var(--emag-white) !important;
  border: 1px solid var(--emag-white) !important;
}

html.a11y-contrast body :where(.emag-a11y-backdrop),
body.a11y-contrast :where(.emag-a11y-backdrop) {
  background: rgba(0, 0, 0, .94) !important;
}

html.a11y-contrast body ::selection,
body.a11y-contrast ::selection {
  background: var(--emag-link) !important;
  color: var(--emag-black) !important;
}

@media (max-width: 760px) {
  .emag-a11y-backdrop { padding: 8px; }
  .emag-a11y-dialog { max-height: 94vh; border-radius: 14px; }
  .emag-a11y-dialog__head,
  .emag-a11y-dialog__body { padding-left: 16px; padding-right: 16px; }
  .emag-a11y-grid,
  .emag-shortcuts { grid-template-columns: 1fr; }
}

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