/* Painel de acessibilidade (base: Uchiz Design & Lab) */
:root { --fg: #0E0E0E; --bg: #EEEEE8; --panel-bg: #F7F7F2; --panel-line: #D6D6CF; }
html[data-theme="dark"] { --fg: #EEEEE8; --bg: #141413; --panel-bg: #1B1B1A; --panel-line: #2F2F2C; }
html.theme-anim, html.theme-anim *, html.theme-anim *::before { transition: background-color .35s ease, color .35s ease, border-color .35s ease, fill .35s ease !important; }

/* Botão do topo */
.tool { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2); background: transparent; color: var(--ink); display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; transition: border-color .2s; }
.tool:hover { border-color: var(--ink); }
.case-page .tool { color: var(--paper); border-color: #3A3A38; }
.tools { display: flex; align-items: center; gap: 10px; }
@media (max-width: 900px) { .tools { margin-left: auto; } .menu-open .tools { visibility: hidden; } }

/* Painel */
.a11y {
  position: fixed; z-index: 85; top: calc(76px + 8px); right: max(16px, calc((100vw - 1320px) / 2 + 48px));
  width: min(380px, calc(100vw - 32px)); max-height: calc(100vh - 76px - 24px); max-height: calc(100dvh - 76px - 24px);
  padding: 0; gap: 0; overflow: hidden; border-radius: 16px;
  background: var(--panel-bg); color: var(--fg); border: 1px solid var(--panel-line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .18);
  display: flex; flex-direction: column;
  transform-origin: top right; animation: a11yIn .35s var(--ease);
}
.a11y[hidden] { display: none; }
@keyframes a11yIn { from { opacity: 0; transform: translateY(-8px) scale(.97); } }
.a11y__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 8px; }
.a11y__title { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.a11y__close { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--fg); cursor: pointer; display: flex; align-items: center; justify-content: center; margin: -8px -8px -8px 0; }
.a11y__close:hover { background: var(--panel-line); }
.a11y__group { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.a11y__group legend { padding: 0; margin-bottom: 10px; font-size: 15px; font-weight: 600; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg); border: 1px solid var(--panel-line); }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--muted); transition: background-color .2s, color .2s; }
.seg input:checked + span { background: var(--fg); color: var(--bg); }
.seg input:focus-visible + span { outline: 2px solid var(--figma); outline-offset: 2px; }
.seg--text span { font-weight: 700; font-family: var(--font); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.switch strong { display: block; font-size: 15px; }
.switch small { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { position: relative; flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--panel-line); transition: background-color .25s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; background: #FFFFFF; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .3s var(--ease); }
.switch input:checked + i { background: var(--green-dark); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--figma); outline-offset: 2px; }
.a11y__tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; margin: 0 12px; padding: 3px; border-radius: 10px; background: var(--bg); border: 1px solid var(--panel-line); }
.a11y__tabs button { min-height: 36px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: 600 12.5px/1 var(--font); cursor: pointer; }
.a11y__tabs button[aria-selected="true"] { background: var(--panel-bg); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.a11y__body { overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; overscroll-behavior: contain; }
.a11y__pane { display: flex; flex-direction: column; gap: 18px; }
.a11y__pane[hidden] { display: none; }
.a11y__intro { font-size: 13px; line-height: 1.5; color: var(--muted); }
.a11y__sub { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.a11y__list { display: flex; flex-direction: column; }
.a11y__list .switch { padding: 12px 0; border-top: 1px solid var(--panel-line); }
.a11y__list .switch:first-child { border-top: 0; padding-top: 0; }
.profiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.profile { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px; min-height: 124px; text-align: left; border: 1px solid var(--panel-line); border-radius: 12px; background: var(--bg); color: var(--fg); cursor: pointer; font-family: var(--font); transition: border-color .2s, background-color .2s; }
.profile svg { color: var(--muted); margin-bottom: 4px; }
.profile strong { font-size: 14px; }
.profile small { font-size: 12px; line-height: 1.4; color: var(--muted); }
.profile:hover { border-color: var(--fg); }
.profile[aria-pressed="true"] { border-color: var(--green-dark); background: rgba(140, 255, 74, .14); box-shadow: inset 0 0 0 1px var(--green-dark); }
.profile[aria-pressed="true"] svg { color: var(--green-dark); }
.listen { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; border-radius: 12px; border: 1px solid var(--panel-line); background: var(--bg); color: var(--fg); font: 600 14px var(--font); cursor: pointer; }
.listen[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.pmap { display: flex; flex-direction: column; }
.pmap a { display: flex; align-items: center; gap: 12px; min-height: 40px; border-top: 1px solid var(--panel-line); text-decoration: none; font-size: 14px; color: var(--fg); }
.pmap a span { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.pmap a:hover { color: var(--green-dark); }
.a11y__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px 20px 16px; border-top: 1px solid var(--panel-line); font-size: 12px; }
.a11y__reset { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--panel-line); background: transparent; color: var(--fg); font: 600 12.5px var(--font); cursor: pointer; }
.a11y__reset:hover { border-color: var(--fg); }
.a11y__kbd { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.a11y__kbd kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--panel-line); border-radius: 4px; font-family: inherit; }
html[data-theme="dark"] .a11y, .case-page .a11y { --muted: #9A9A94; }
.case-page .a11y { --fg: #EEEEE8; --bg: #141413; --panel-bg: #1B1B1A; --panel-line: #2F2F2C; }

/* Reduzir animações */
html.rm { scroll-behavior: auto; }
html.rm *, html.rm *::before, html.rm *::after { animation: none !important; transition: none !important; }
html.rm [data-reveal], html.rm [data-split] .w > span, html.rm .select__box, html.rm .select em,
html.rm .bigsym__clip, html.rm .bigsym__px rect { opacity: 1 !important; transform: none !important; }
html.rm .px rect { opacity: 1 !important; }
html.rm .cursor { display: none !important; }

/* Botão de pausa da faixa */
.band { position: relative; }
.band__pause { position: absolute; right: max(12px, env(safe-area-inset-right, 0px)); top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 50%; border: 0; background: #0E0E0E; color: var(--green); cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 6px var(--green); }
.band__pause .i-play { display: none; }
.band__pause[aria-pressed="true"] .i-play { display: block; }
.band__pause[aria-pressed="true"] .i-pause { display: none; }
html.a11y-band .band__track { animation-play-state: paused !important; }

/* Tamanho do texto */
html[data-text="lg"] :is(main, .foot) { zoom: 1.12; }
html[data-text="xl"] :is(main, .foot) { zoom: 1.25; }

/* Alto contraste */
html.a11y-contrast { --paper: #FFFFFF; --paper-2: #FFFFFF; --ink: #000000; --text-2: #000000; --muted: #1F1F1F; --line: #000000; --line-2: #000000; --muted-dark: #E6E6E6; --text-dark-2: #FFFFFF; --line-dark: #FFFFFF; --fg: #000; --bg: #FFF; --panel-bg: #FFFFFF; --panel-line: #000000; --green-dark: #1E6B00; }
html.a11y-contrast[data-theme="dark"] { --paper: #000000; --paper-2: #000000; --ink: #FFFFFF; --text-2: #FFFFFF; --muted: #E6E6E6; --line: #FFFFFF; --line-2: #FFFFFF; --fg: #FFF; --bg: #000; --panel-bg: #000000; --panel-line: #FFFFFF; --green-dark: #8CFF4A; }
html.a11y-contrast .section--dark, html.a11y-contrast .foot, html.a11y-contrast .foot__bottom, html.a11y-contrast .cp-hero, html.a11y-contrast.case-page, html.a11y-contrast .case-page { background: #000 !important; }
html.a11y-contrast .fig, html.a11y-contrast .case__img { border: 2px solid currentColor; }
html.a11y-contrast .btn--ghost, html.a11y-contrast .tool { border-width: 2px; }

/* Filtros de cor (aplicados ao conteúdo, sem afetar o painel) */
html[data-filter="gray"] main, html[data-filter="gray"] .foot, html[data-filter="gray"] .nav { filter: grayscale(1); }
html[data-filter="low"] main, html[data-filter="low"] .foot, html[data-filter="low"] .nav { filter: saturate(.4); }

/* Cursor grande */
html.a11y-cursor, html.a11y-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 d='M6 4l32 18-14 3-7 14z' fill='%23000' stroke='%23fff' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") 6 4, auto !important;
}
html.a11y-cursor .cursor { display: none !important; }

/* Foco reforçado */
html.a11y-focus :focus-visible { outline: 4px solid #FFB000 !important; outline-offset: 3px !important; box-shadow: 0 0 0 8px rgba(0, 0, 0, .7) !important; border-radius: 6px; }

/* Texto legível (WCAG 1.4.12) */
html.a11y-legible body, html.a11y-legible button, html.a11y-legible .h2, html.a11y-legible .h-display, html.a11y-legible .hero__title { font-family: 'Atkinson Hyperlegible', var(--font) !important; }
html.a11y-legible .h2, html.a11y-legible .h-display, html.a11y-legible .hero__title, html.a11y-legible .row__t, html.a11y-legible h3 { letter-spacing: 0 !important; }
html.a11y-legible main p, html.a11y-legible main li, html.a11y-legible summary, html.a11y-legible .row__d, html.a11y-legible .foot p { letter-spacing: .06em !important; word-spacing: .16em !important; line-height: 1.75 !important; }

/* Destacar links */
html.a11y-links a:not(.btn) { text-decoration: underline !important; text-decoration-thickness: 2px !important; text-underline-offset: 4px !important; }
html.a11y-links .btn, html.a11y-links .tab, html.a11y-links summary, html.a11y-links .tool, html.a11y-links .profile, html.a11y-links .filters button { outline: 2px dashed currentColor; outline-offset: 3px; }

/* Guia e máscara de leitura */
.rguide { position: fixed; inset: 0; z-index: 95; pointer-events: none; --gy: 50vh; }
.rguide i { position: absolute; left: 0; right: 0; display: none; }
html.a11y-guide .rguide__line { display: block; top: calc(var(--gy) + 14px); height: 4px; background: #FFB000; box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
html.a11y-mask .rguide__top { display: block; top: 0; height: max(0px, calc(var(--gy) - 60px)); background: rgba(0, 0, 0, .62); }
html.a11y-mask .rguide__bottom { display: block; top: calc(var(--gy) + 60px); bottom: 0; background: rgba(0, 0, 0, .62); }

/* Ocultar enfeites */
html.a11y-hideimg .hero::before, html.a11y-hideimg .px, html.a11y-hideimg .select__box, html.a11y-hideimg .fig__people, html.a11y-hideimg .cursor, html.a11y-hideimg .brand__av { background: none; }
html.a11y-hideimg .px, html.a11y-hideimg .select__box, html.a11y-hideimg .fig__people, html.a11y-hideimg .cursor { display: none !important; }

/* Modo leitura: só o texto */
html.a11y-reading .band, html.a11y-reading .panel__canvas, html.a11y-reading .px, html.a11y-reading .select__box, html.a11y-reading .cursor { display: none !important; }
html.a11y-reading .lead, html.a11y-reading main p { max-width: 68ch; }

/* VLibras */
[vw].enabled { z-index: 88 !important; }

/* Celular */
@media (max-width: 700px) {
  .a11y { left: 12px; right: 12px; width: auto; top: 80px; max-height: calc(100vh - 92px); max-height: calc(100dvh - 92px); }
  .a11y__head { padding: 14px 16px 8px; }
  .a11y__tabs { margin: 0 10px; }
  .a11y__tabs button { font-size: 12px; padding: 0 2px; }
  .a11y__body { padding: 14px 16px; }
  .a11y__foot { padding: 10px 16px 14px; }
  .profile { min-height: 0; padding: 12px; }
}
@media (hover: none) { .a11y__kbd { display: none; } }

/* Tela principal e ajustes avançados */
.a11y__view { display: flex; flex-direction: column; gap: 16px; min-height: 0; flex: 1 1 auto; }
.a11y__view[hidden] { display: none; }
.a11y__view[data-view="main"] { overflow-y: auto; overscroll-behavior: contain; padding: 8px 20px 16px; }
.a11y__view[data-view="adv"] { gap: 12px; padding-top: 4px; }
.a11y__view[data-view="adv"] .a11y__body { flex: 1 1 auto; min-height: 0; }
.a11y__lead { font-size: 15px; line-height: 1.45; font-weight: 500; }
.profiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.profile { min-height: 112px; gap: 4px; }
.profile svg { color: var(--fg); margin-bottom: 6px; }
.profile strong { font-size: 14.5px; line-height: 1.25; }
.profile small { font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; }
.a11y__status { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 12px; background: rgba(140, 255, 74, .14); border: 1px solid var(--green-dark); font-size: 13.5px; line-height: 1.5; }
.a11y__status[hidden] { display: none; }
.a11y__status .pmap a { min-height: 36px; }
.a11y__note { color: var(--fg); }
.a11y__undo { align-self: flex-start; min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--fg); background: transparent; color: var(--fg); font: 600 12.5px var(--font); cursor: pointer; }
.a11y__view .a11y__sub { margin: 4px 0 -4px; }
.a11y__more { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--panel-line); background: var(--bg); color: var(--fg); font: 600 14px var(--font); cursor: pointer; }
.a11y__more:hover, .a11y__back:hover { border-color: var(--fg); }
.a11y__back { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin: 0 12px; min-height: 34px; padding: 0 12px 0 8px; border-radius: 999px; border: 1px solid var(--panel-line); background: transparent; color: var(--fg); font: 600 12.5px var(--font); cursor: pointer; }
.a11y__tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ==========================================================================
   Componente: aba de acessibilidade (borda esquerda)
   ========================================================================== */
.a11y-tab {
  position: fixed; z-index: 80; left: 0; top: 50%; transform: translateY(-50%);
  padding: 1.5px 1.5px 1.5px 0; border: 0; border-radius: 0 16px 16px 0; cursor: pointer;
  background: conic-gradient(from 210deg, #8CFF4A, #3DDC84, #0D99FF, #8CFF4A);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .26); font-family: var(--font);
  transition: padding .3s var(--ease), box-shadow .3s;
}
.a11y-tab__in { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 10px 8px 14px 7px; border-radius: 0 14.5px 14.5px 0; background: #0E0E0E; color: #EEEEE8; }
.a11y-tab__ic { position: relative; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.a11y-tab__ic .a11y-ico { width: 38px; height: 38px; }
.a11y-tab__ic { width: 38px; height: 38px; }
/* versão clara (tema claro) */
.a11y-tab { --tab-bg: #FFFFFF; --tab-fg: #0E0E0E; --tab-k: #4CC21A; --i-ring: #0E0E0E; --i-body: #0E0E0E; --i-head: #0E0E0E; --i-dot: #4CC21A; }
/* versão escura (tema escuro e páginas de case) */
html[data-theme="dark"] .a11y-tab, .case-page .a11y-tab { --tab-bg: #0E0E0E; --tab-fg: #EEEEE8; --tab-k: #8CFF4A; --i-ring: #8CFF4A; --i-body: #FFFFFF; --i-head: #8CFF4A; --i-dot: #8CFF4A; }
.a11y-tab__in { background: var(--tab-bg) !important; color: var(--tab-fg) !important; }
.a11y-tab__k { color: var(--tab-k) !important; }
.i-ring { stroke: var(--i-ring); } .i-body { stroke: var(--i-body); } .i-head { fill: var(--i-head); } .i-dot { fill: var(--i-dot); }
.a11y-tab__dot { border-color: var(--tab-bg) !important; background: var(--i-dot) !important; box-shadow: 0 0 0 1.5px var(--i-dot) !important; }
.a11y-tab__dot { display: none; position: absolute; top: -2px; right: -2px; width: 11px; height: 11px; border-radius: 50%; background: #8CFF4A; border: 2px solid #0E0E0E; box-shadow: 0 0 0 1.5px #8CFF4A; }
html.a11y-on .a11y-tab__dot { display: block; }
.a11y-tab__t { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 13px; font-weight: 600; letter-spacing: .01em; }
.a11y-tab__k { writing-mode: vertical-rl; transform: rotate(180deg); font-family: var(--mono); font-size: 9px; letter-spacing: .14em; color: #8CFF4A; }

.a11y-tab:focus-visible { outline: 3px solid #8CFF4A; outline-offset: 3px; }
.a11y-tab[aria-expanded="true"] .a11y-tab__ic { box-shadow: 0 0 0 3px #0E0E0E, 0 0 0 5px #8CFF4A; }
.menu-open .a11y-tab { visibility: hidden; }
/* painel abre ao lado da aba */
@media (min-width: 701px) {
  .a11y { left: 66px; right: auto; top: 50%; translate: 0 -50%; transform-origin: left center; max-height: calc(100dvh - 120px); }
}
/* celular: só o ícone */
@media (max-width: 700px) {
  .a11y-tab { top: 58%; transform: none; border-radius: 0 14px 14px 0; }
  .a11y-tab__in { padding: 6px 6px 6px 5px; gap: 0; border-radius: 0 12.5px 12.5px 0; }
  .a11y-tab__t, .a11y-tab__k { display: none; }
  .a11y-tab__ic, .a11y-tab__ic .a11y-ico { width: 34px; height: 34px; }
}
html.a11y-contrast .a11y-tab { background: #FFFFFF; }

.seg--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
