/* 22.11.2026 Ułatwienia dostępu madd.im (js/madd-a11y.js).
   Ustawienia trzymane w localStorage 'madd-a11y' i nakładane jako klasy na <html> jeszcze w <head>
   (blok <!--a11y--> z build.py), więc strona nie mruga przy wczytaniu. */

/* ── zawsze: widoczny fokus z klawiatury i ukrywanie dla czytników ── */
:where(a,button,input,select,textarea,summary,[tabindex]):focus-visible{
  outline:3px solid #1A5FD6 !important; outline-offset:3px !important; border-radius:6px }
html[data-wh-theme="dark"] :where(a,button,input,select,textarea,summary,[tabindex]):focus-visible{ outline-color:#8AB4FF !important }
.a11y-sr{ position:absolute !important; width:1px; height:1px; margin:-1px; padding:0; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0 }

/* ── przycisk w pasku (wygląd jak przełącznik motywu) ── */
.nav .nav-cta .a11y-btn{ order:-3 }
.a11y-btn svg{ width:19px !important; height:19px !important; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round }
.a11y-btn[aria-expanded="true"]{ border-color:var(--nav-fg,#111) !important }
.a11y-fab{ position:fixed; left:16px; bottom:16px; z-index:2147483000; width:48px; height:48px; border-radius:50%; border:0;
  background:#111; color:#fff; display:flex; align-items:center; justify-content:center; cursor:pointer; box-shadow:0 8px 24px -8px rgba(0,0,0,.5) }

/* ── panel ── */
.a11y-panel{ --a-bg:#FFFFFF; --a-fg:#111111; --a-mute:#55534E; --a-line:#DEDCD6; --a-on:#111111; --a-onfg:#FFFFFF;
  position:fixed; z-index:2147483647; top:76px; right:16px; width:min(380px,calc(100vw - 32px)); max-height:calc(100vh - 96px); overflow:auto;
  background:var(--a-bg); color:var(--a-fg); border:1px solid var(--a-line); border-radius:18px; padding:18px;
  box-shadow:0 24px 60px -20px rgba(0,0,0,.35); font:15px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; letter-spacing:0; text-align:left }
html[data-wh-theme="dark"] .a11y-panel{ --a-bg:#1B1A17; --a-fg:#F4F2ED; --a-mute:#BDBAB2; --a-line:#36342F; --a-on:#F4F2ED; --a-onfg:#141311 }
.a11y-panel[hidden]{ display:none }
.a11y-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:4px }
.a11y-head h2{ margin:0; font:600 18px/1.25 inherit; font-family:inherit; color:var(--a-fg) }
.a11y-x{ width:36px; height:36px; border-radius:10px; border:1px solid var(--a-line); background:transparent; color:var(--a-fg); cursor:pointer; display:flex; align-items:center; justify-content:center }
.a11y-x svg{ width:16px; height:16px; stroke:currentColor; stroke-width:2; fill:none }
.a11y-lead{ margin:0 0 14px; color:var(--a-mute); font-size:13.5px }
.a11y-sec{ margin:14px 0 8px; font-size:12.5px; font-weight:600; text-transform:uppercase; letter-spacing:.04em; color:var(--a-mute) }
.a11y-size{ display:grid; grid-template-columns:repeat(4,1fr); gap:6px }
.a11y-size button{ height:44px; border-radius:10px; border:1px solid var(--a-line); background:transparent; color:var(--a-fg); cursor:pointer; font-family:inherit; font-weight:600 }
.a11y-size button:nth-child(1){ font-size:14px } .a11y-size button:nth-child(2){ font-size:16px } .a11y-size button:nth-child(3){ font-size:18px } .a11y-size button:nth-child(4){ font-size:20px }
.a11y-size button[aria-pressed="true"]{ background:var(--a-on); color:var(--a-onfg); border-color:var(--a-on) }
.a11y-grid{ display:grid; grid-template-columns:1fr 1fr; gap:6px }
.a11y-opt{ display:flex; align-items:center; gap:10px; min-height:52px; padding:10px 12px; border-radius:12px; border:1px solid var(--a-line);
  background:transparent; color:var(--a-fg); cursor:pointer; text-align:left; font:500 14px/1.25 inherit; font-family:inherit }
.a11y-opt svg{ flex:none; width:20px; height:20px; stroke:currentColor; stroke-width:1.6; fill:none; stroke-linecap:round; stroke-linejoin:round }
.a11y-opt[aria-pressed="true"]{ background:var(--a-on); color:var(--a-onfg); border-color:var(--a-on) }
.a11y-read{ display:grid; grid-template-columns:1fr 1fr 52px; gap:6px; margin-top:6px }
.a11y-read .a11y-opt{ min-width:0; padding:10px; gap:8px }
.a11y-read .a11y-opt span{ min-width:0 }
@media (max-width:460px){ .a11y-read .a11y-opt:not([data-read="stop"]) svg{ display:none } .a11y-read .a11y-opt{ justify-content:center; text-align:center } }
.a11y-read [data-read="stop"]{ justify-content:center; padding:0 }
.a11y-foot{ display:flex; justify-content:space-between; align-items:center; gap:10px; margin-top:16px; padding-top:14px; border-top:1px solid var(--a-line); font-size:13px; color:var(--a-mute) }
.a11y-reset{ height:40px; padding:0 14px; border-radius:10px; border:1px solid var(--a-line); background:transparent; color:var(--a-fg); cursor:pointer; font:500 14px inherit; font-family:inherit }
@media (max-width:820px){ .a11y-panel{ top:auto; bottom:12px; right:12px; left:12px; width:auto; max-height:calc(100vh - 80px) } }

/* ── ustawienia ── */
/* wielkość: zoom skaluje też teksty w px i układ (jak powiększenie przeglądarki); pasek zostaje w zwykłym
   rozmiarze, bo jego przełączanie na wersję mobilną zależy od szerokości ekranu, nie od powiększenia */
html.a11y-z1 body > :not(.a11y-panel):not(.a11y-fab):not(.nav):not(.skip-link){ zoom:1.15 }
html.a11y-z2 body > :not(.a11y-panel):not(.a11y-fab):not(.nav):not(.skip-link){ zoom:1.3 }
html.a11y-z3 body > :not(.a11y-panel):not(.a11y-fab):not(.nav):not(.skip-link){ zoom:1.5 }

/* wysoki kontrast: czysta biel i czerń, wyszarzone teksty pełnym kolorem, wyraźne krawędzie */
html.a11y-contrast,html.a11y-contrast :is(body,.pg-x,.section-dark,.section-tint,.pg-doc){ --x-bg:#FFFFFF; --x-bg-2:#FFFFFF; --x-bg-3:#F2F2F2; --x-fg:#000000; --x-fg-2:#000000; --x-fg-3:#1A1A1A; --x-line:#000000;
  --bg:#FFFFFF; --bg-2:#FFFFFF; --bg-3:#F2F2F2; --fg:#000000; --fg-2:#000000; --fg-3:#1A1A1A; --line:#000000; --line-2:#000000; --nav-fg:#000000; --nav-line:#000000 }
html.a11y-contrast[data-wh-theme="dark"],html.a11y-contrast[data-wh-theme="dark"] :is(body,.pg-x,.section-dark,.section-tint,.pg-doc){ --x-bg:#000000; --x-bg-2:#000000; --x-bg-3:#151515; --x-fg:#FFFFFF; --x-fg-2:#FFFFFF; --x-fg-3:#EDEDED; --x-line:#FFFFFF;
  --bg:#000000; --bg-2:#000000; --bg-3:#151515; --fg:#FFFFFF; --fg-2:#FFFFFF; --fg-3:#EDEDED; --line:#FFFFFF; --line-2:#FFFFFF; --nav-fg:#FFFFFF; --nav-line:#FFFFFF }
html.a11y-contrast body{ background:var(--bg) !important }
html.a11y-contrast :is(p,li,small,span,dd,td,th,label,figcaption){ text-shadow:none !important }
html.a11y-contrast :is(.x-tile,.plat,.card,.x-card){ box-shadow:0 0 0 2px var(--fg) !important }
html.a11y-contrast :is(input,select,textarea){ border:2px solid var(--fg) !important }

/* bez kolorów (np. dla osób z zaburzeniami widzenia barw lub wrażliwych na kolor) */
html.a11y-gray body > :not(.a11y-panel):not(.a11y-fab){ filter:grayscale(1) }

/* podkreślone linki */
html.a11y-links body a:not(.btn):not(.x-btn):not(.nav-brand){ text-decoration:underline !important; text-decoration-thickness:2px !important; text-underline-offset:3px !important }
html.a11y-links body a:is(.btn,.x-btn){ outline:2px solid currentColor; outline-offset:2px }

/* czytelna czcionka i odstępy */
html.a11y-font body :not(code):not(pre):not(kbd):not(samp):not(svg):not(svg *):not([class*="mono"]):not([class*="term"]):not([class*="log"]){
  font-family:Verdana,"Atkinson Hyperlegible",Tahoma,system-ui,sans-serif !important; font-style:normal !important; letter-spacing:.01em !important }
html.a11y-space body :is(p,li,dd,td,small,label,blockquote){ line-height:1.85 !important; letter-spacing:.03em !important; word-spacing:.12em !important }
html.a11y-space body :is(p,li){ margin-bottom:.6em }
html.a11y-space body :is(h1,h2,h3){ line-height:1.3 !important }

/* bez animacji: wszystko widoczne od razu, nic się nie rusza */
html.a11y-still *,html.a11y-still *::before,html.a11y-still *::after{ animation:none !important; transition:none !important; scroll-behavior:auto !important }
html.a11y-still [data-rv],html.a11y-still .rv{ opacity:1 !important; transform:none !important; filter:none !important }

/* duży kursor */
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 4l30 18-13 3-7 13z' fill='%23000' stroke='%23fff' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") 6 4,auto !important }
html.a11y-cursor :is(a,button,[role="button"],label,summary),html.a11y-cursor :is(a,button,[role="button"],label,summary) *{ 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 4l30 18-13 3-7 13z' fill='%231A5FD6' stroke='%23fff' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") 6 4,pointer !important }

/* czytanie: podświetlenie czytanego fragmentu */
.a11y-reading{ background:#FFE45C !important; color:#000 !important; box-shadow:0 0 0 4px #FFE45C !important; border-radius:4px }

/* Przy powiększeniu rośnie przede wszystkim zwykły tekst; wielkie nagłówki (już duże) rosną mniej,
   a długie słowa dzielą się zamiast wychodzić poza ekran. */
html.a11y-z1 :is(h1,.x-h1){ zoom:.9 } html.a11y-z2 :is(h1,.x-h1){ zoom:.8 } html.a11y-z3 :is(h1,.x-h1){ zoom:.7 }
html.a11y-z2 :is(.x-h2,.h-sec){ zoom:.88 } html.a11y-z3 :is(.x-h2,.h-sec){ zoom:.8 }
html[class*="a11y-z"] :is(h1,h2,h3,.x-h1,.x-h2){ overflow-wrap:break-word; hyphens:auto; -webkit-hyphens:auto }
html[class*="a11y-z"] .x-pill img{ display:none }
html[class*="a11y-z"] .x-pill{ max-width:100% }
html[class*="a11y-z"] .x-pill .ar{ display:none }
