/* أدوات الإتاحة — رياضيات مع خالد (mathbagrut.com) */

/* ---------- الواجهة ---------- */
.a11y-fab{position:fixed;bottom:18px;left:18px;z-index:2147483000;width:52px;height:52px;border-radius:50%;border:2px solid #fff;background:#143a50;color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 6px 18px rgba(20,58,80,.35);padding:0;margin:0}
.a11y-fab:hover{background:#0b7b6c}
.a11y-fab svg{width:28px;height:28px}
.a11y-fab:focus-visible,.a11y-panel :focus-visible{outline:3px solid #e6b354;outline-offset:2px}
html.full .a11y-fab,html:fullscreen .a11y-fab{opacity:.55}
html.full .a11y-fab:hover,html.full .a11y-fab:focus-visible{opacity:1}

.a11y-panel{position:fixed;top:88px;left:16px;z-index:2147483001;width:350px;max-width:calc(100vw - 20px);max-height:calc(100vh - 104px);overflow:auto;background:#fff;color:#19334b;border:1px solid #cbd7df;border-radius:16px;box-shadow:0 22px 48px rgba(20,58,80,.28);font:15px/1.5 Tajawal,Arial,sans-serif;direction:rtl;text-align:right;padding:0 0 12px}
.a11y-panel[hidden]{display:none}
.a11y-panel.a11y-bottom{top:auto;bottom:82px}
.a11y-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:14px 16px 10px;border-bottom:1px solid #dfe7ec;position:sticky;top:0;background:#fff}
.a11y-head h2{margin:0;font-size:17px;font-weight:800;color:#143a50;display:flex;align-items:center;gap:8px}
.a11y-head h2 svg{width:22px;height:22px}
.a11y-x{width:36px;height:36px;border-radius:10px;border:1px solid #cbd7df;background:#fff;color:#143a50;font-size:20px;line-height:1;cursor:pointer;margin:0;padding:0}
.a11y-x:hover{border-color:#0b7b6c;color:#0b7b6c}
.a11y-sec{padding:10px 16px 2px}
.a11y-sec h3{margin:0 0 7px;font-size:13.5px;font-weight:700;color:#4f6475}
.a11y-size{display:flex;align-items:center;gap:8px}
.a11y-size button{width:44px;height:40px;border-radius:10px;border:1px solid #cbd7df;background:#f3f6f8;color:#143a50;font-size:19px;font-weight:800;cursor:pointer;margin:0;padding:0}
.a11y-size button:disabled{opacity:.45;cursor:default}
.a11y-size output{flex:1;text-align:center;font-weight:800;font-size:16px}
.a11y-note{font-size:13px;color:#4f6475;margin:0}
.a11y-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.a11y-opt{display:flex;align-items:center;gap:8px;min-height:46px;width:100%;border-radius:11px;border:1px solid #cbd7df;background:#fff;color:#19334b;font:inherit;font-size:14px;font-weight:600;text-align:right;padding:7px 10px;cursor:pointer;margin:0}
.a11y-opt svg{width:20px;height:20px;flex-shrink:0}
.a11y-opt:hover{border-color:#0b7b6c}
.a11y-opt[aria-pressed=true]{background:#0b7b6c;border-color:#0b7b6c;color:#fff}
.a11y-foot{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;padding:12px 16px 0;margin-top:8px;border-top:1px solid #dfe7ec;font-size:13.5px}
.a11y-reset{border-radius:10px;border:1px solid #ad3030;background:#fff;color:#ad3030;font:inherit;font-size:14px;font-weight:700;padding:7px 14px;cursor:pointer;margin:0}
.a11y-reset:hover{background:#fbeeee}
.a11y-foot a{color:#0b6b5e;font-weight:700;text-decoration:underline;text-underline-offset:3px}
.a11y-sr{position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip:rect(0 0 0 0)!important;white-space:nowrap!important}
@media (max-width:560px){
  .a11y-panel{top:auto;bottom:10px;left:10px;right:10px;width:auto;max-height:calc(100vh - 80px)}
  .a11y-fab{bottom:12px;left:12px;width:48px;height:48px}
}

/* ---------- التأثيرات على الصفحة ---------- */
/* تمييز الروابط */
html.a11y-links a:not(.a11y-ui a){text-decoration:underline!important;text-decoration-thickness:2px!important;text-underline-offset:3px!important;outline:2px dashed currentColor!important;outline-offset:2px}

/* تمييز العناوين */
html.a11y-headings :is(h1,h2,h3,h4,h5,h6):not(.a11y-ui *){outline:2px solid #0b7b6c!important;outline-offset:4px;border-radius:3px}

/* خطّ مقروء (لا يمسّ الرموز الرياضيّة) */
html.a11y-font body :not(.katex):not(.katex *):not(.MathJax):not(.MathJax *):not(mjx-container *):not(code):not(pre):not(svg *):not(i):not(.material-icons){font-family:Arial,"Segoe UI",Tahoma,sans-serif!important}

/* تباعد النصّ — لا نزيد تباعد الحروف لأنّه يقطع الحروف العربيّة المتّصلة */
html.a11y-spacing :is(p,li,dd,dt,td,th,blockquote,figcaption,label,summary,h1,h2,h3,h4,h5,h6):not(.katex *):not(.a11y-ui *){line-height:2!important;word-spacing:.18em!important}
html.a11y-spacing p:not(.a11y-ui *){margin-bottom:1.1em!important}

/* إيقاف الحركة */
html.a11y-motion *,html.a11y-motion *::before,html.a11y-motion *::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}

/* مؤشّر كبير */
html.a11y-cursor,html.a11y-cursor *{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'%3E%3Cpath d='M4 3l0 33 9-8 6 13 6-3-6-13 12 0z' fill='%23000' stroke='%23fff' stroke-width='2.5' stroke-linejoin='round'/%3E%3C/svg%3E") 4 3,auto!important}

/* تدرّج رماديّ */
html[data-a11y-contrast=gray]{filter:grayscale(1)}

/* تباين داكن */
html[data-a11y-contrast=dark],html[data-a11y-contrast=dark] body{background:#000!important}
html[data-a11y-contrast=dark] body *:not(svg *):not(img):not(video):not(canvas):not(iframe):not([style*="background-image"]):not(.wm):not(.shield){background-color:#000!important;background-image:none!important;color:#fff!important;border-color:#c8c8c8!important;box-shadow:none!important;text-shadow:none!important}
html[data-a11y-contrast=dark] a,html[data-a11y-contrast=dark] a *:not(svg *){color:#ffe14d!important}
html[data-a11y-contrast=dark] :is(button,input,select,textarea):not(.a11y-ui *){border:1px solid #fff!important}
html[data-a11y-contrast=dark] svg:not(.lucide):not(.a11y-ui svg):not(a svg):not(button svg){background-color:#fff!important;border-radius:6px}
html[data-a11y-contrast=dark] .a11y-opt[aria-pressed=true]{background-color:#ffe14d!important;color:#000!important}

/* تباين فاتح */
html[data-a11y-contrast=light] body *:not(svg *):not(img):not(video):not(canvas):not(iframe):not([style*="background-image"]):not(.wm):not(.shield){background-image:none!important;color:#000!important;text-shadow:none!important}
html[data-a11y-contrast=light] body,html[data-a11y-contrast=light] body *:not(svg *):not(img):not(video):not(canvas):not(iframe):not([style*="background-image"]):not(.wm):not(.shield):not(svg){background-color:#fff!important;border-color:#000!important}
html[data-a11y-contrast=light] a,html[data-a11y-contrast=light] a *:not(svg *){color:#00009c!important;text-decoration:underline!important}
html[data-a11y-contrast=light] .a11y-opt[aria-pressed=true]{background-color:#000!important;color:#fff!important}
html[data-a11y-contrast=dark] .a11y-opt[aria-pressed=true] *{background-color:transparent!important;color:#000!important}
html[data-a11y-contrast=light] .a11y-opt[aria-pressed=true] *{background-color:transparent!important;color:#fff!important}
/* عارض الكرّاسات: طبقات الحماية الشفّافة فوق صورة الصفحة تبقى شفّافة */
html[data-a11y-contrast] #pages .pimg{background-color:transparent!important}
html[data-a11y-contrast=dark] #pages .ph{color:#fff!important}
