/* ===== أداة إمكانية الوصول ===== */
.a11y-root {
    --a11y-blue: #1d6fe0;
    --a11y-blue-dark: #1452b0;
    --a11y-ink: #0f1b2d;
    --a11y-muted: #5b6b80;
    --a11y-line: #e3e9f2;
    font-family: "Tajawal", "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
    line-height: 1.5;
    color: var(--a11y-ink);
}
.a11y-root *, .a11y-root *::before, .a11y-root *::after { box-sizing: border-box; }
.a11y-root svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.a11y-root [hidden] { display: none !important; }

.a11y-fab {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 10070;
    width: 58px;
    height: 58px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--a11y-blue), var(--a11y-blue-dark));
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 30px;
    cursor: pointer;
    box-shadow: 0 12px 28px -10px rgba(20, 82, 176, .7), 0 0 0 0 rgba(29, 111, 224, .45);
    transition: transform .2s ease, box-shadow .2s ease;
    animation: a11y-pulse 2.6s ease-out 1.2s 2;
}
.a11y-fab:hover { transform: scale(1.07); }
.a11y-fab:focus-visible { outline: 3px solid #ffbf00; outline-offset: 3px; }
.a11y-fab[aria-expanded="true"] { transform: scale(.94); }
@keyframes a11y-pulse {
    0% { box-shadow: 0 12px 28px -10px rgba(20, 82, 176, .7), 0 0 0 0 rgba(29, 111, 224, .45); }
    100% { box-shadow: 0 12px 28px -10px rgba(20, 82, 176, .7), 0 0 0 18px rgba(29, 111, 224, 0); }
}

.a11y-panel {
    position: fixed;
    right: 1.5rem;
    bottom: calc(1.5rem + 70px);
    z-index: 10071;
    width: 380px;
    max-width: calc(100vw - 2rem);
    max-height: calc(100vh - 7rem);
    max-height: calc(100dvh - 7rem);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 30px 70px -20px rgba(15, 27, 45, .45), 0 0 0 1px rgba(15, 27, 45, .06);
    transform-origin: bottom right;
    animation: a11y-in .22s ease-out;
}
@keyframes a11y-in { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }

.a11y-head {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1.1rem 1.15rem;
    background: linear-gradient(135deg, var(--a11y-blue) 0%, var(--a11y-blue-dark) 100%);
    color: #fff;
}
.a11y-head-icon {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .18);
    display: grid;
    place-items: center;
    font-size: 26px;
}
.a11y-head-text { flex: 1; min-width: 0; }
.a11y-head-text h2 { margin: 0; font-size: 1.15rem; font-weight: 800; color: #fff; line-height: 1.3; }
.a11y-head-text p { margin: .15rem 0 0; font-size: .8rem; color: rgba(255, 255, 255, .85); line-height: 1.5; }
.a11y-close {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 18px;
    cursor: pointer;
    transition: background .2s;
}
.a11y-close:hover { background: rgba(255, 255, 255, .3); }
.a11y-close:focus-visible { outline: 3px solid #ffbf00; outline-offset: 2px; }

.a11y-body { padding: 1rem; overflow-y: auto; overscroll-behavior: contain; }

.a11y-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.a11y-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .3rem;
    padding: .9rem .85rem;
    text-align: right;
    font: inherit;
    color: var(--a11y-ink);
    background: #f5f8fc;
    border: 2px solid transparent;
    border-radius: 16px;
    cursor: pointer;
    transition: border-color .2s, background .2s, transform .15s;
}
.a11y-card:hover { background: #edf3fb; }
.a11y-card:active { transform: scale(.98); }
.a11y-card:focus-visible { outline: 3px solid #ffbf00; outline-offset: 2px; }
.a11y-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: #fff;
    color: var(--a11y-blue);
    display: grid;
    place-items: center;
    font-size: 20px;
    box-shadow: 0 2px 6px -2px rgba(15, 27, 45, .15);
    margin-bottom: .15rem;
}
.a11y-card-title { font-size: .92rem; font-weight: 800; line-height: 1.35; }
.a11y-card-desc { font-size: .74rem; color: var(--a11y-muted); line-height: 1.5; }
.a11y-card-check {
    position: absolute;
    top: .65rem;
    left: .65rem;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #c9d4e3;
    display: grid;
    place-items: center;
    font-size: 13px;
    color: transparent;
    transition: all .2s;
}
.a11y-card[aria-pressed="true"] { background: #e8f1fe; border-color: var(--a11y-blue); }
.a11y-card[aria-pressed="true"] .a11y-card-icon { background: var(--a11y-blue); color: #fff; }
.a11y-card[aria-pressed="true"] .a11y-card-check { background: var(--a11y-blue); border-color: var(--a11y-blue); color: #fff; }
.a11y-card[disabled] { opacity: .5; cursor: not-allowed; }

.a11y-size {
    margin-top: .8rem;
    padding: .8rem .9rem;
    background: #f5f8fc;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}
.a11y-size-label { font-weight: 800; font-size: .92rem; }
.a11y-size-ctrl { display: flex; align-items: center; gap: .6rem; }
.a11y-size-btn {
    width: 42px;
    height: 36px;
    border: 0;
    border-radius: 11px;
    background: #fff;
    color: var(--a11y-blue);
    font: 800 .95rem/1 "Segoe UI", Tahoma, Arial, sans-serif;
    direction: ltr;
    cursor: pointer;
    box-shadow: 0 2px 6px -2px rgba(15, 27, 45, .18);
    transition: background .2s, color .2s;
}
.a11y-size-btn:hover:not([disabled]) { background: var(--a11y-blue); color: #fff; }
.a11y-size-btn[disabled] { opacity: .4; cursor: not-allowed; }
.a11y-size-btn:focus-visible { outline: 3px solid #ffbf00; outline-offset: 2px; }
.a11y-size-dots { display: flex; gap: 5px; direction: ltr; }
.a11y-dot { width: 8px; height: 8px; border-radius: 50%; background: #c9d4e3; transition: background .2s, transform .2s; }
.a11y-dot.on { background: var(--a11y-blue); }
.a11y-dot.current { transform: scale(1.35); }
.a11y-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.a11y-reset {
    margin-top: .8rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .8rem;
    font: inherit;
    font-weight: 800;
    font-size: .92rem;
    color: var(--a11y-ink);
    background: #fff;
    border: 2px solid var(--a11y-line);
    border-radius: 14px;
    cursor: pointer;
    transition: border-color .2s, color .2s;
}
.a11y-reset:hover { border-color: var(--a11y-blue); color: var(--a11y-blue); }
.a11y-reset:focus-visible { outline: 3px solid #ffbf00; outline-offset: 2px; }

@media (max-width: 768px) {
    .a11y-fab { right: 1rem; bottom: 1.5rem; width: 52px; height: 52px; font-size: 26px; }
    body.mobile-bottom-nav-on .a11y-fab { bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px) + 0.85rem); }
    .a11y-panel { right: .75rem; left: .75rem; width: auto; max-width: none; bottom: calc(1.5rem + 62px); }
    body.mobile-bottom-nav-on .a11y-panel { bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px) + 0.85rem + 62px); max-height: calc(100dvh - 10rem); }
    .a11y-card { padding: .8rem .7rem; }
    .a11y-card-desc { font-size: .7rem; }
}

/* ===== التأثيرات على الموقع ===== */

/* حجم النص */
html[data-a11y-size] body > *:not(.a11y-root) { zoom: var(--a11y-zoom, 1); }

/* خط عسر القراءة — بلا letter-spacing حتى لا تنقطع الحروف العربية */
html.a11y-dyslexia body *:not(.a11y-root):not(.a11y-root *):not(i):not(svg):not(svg *):not([class*="fa-"]):not([class^="fa"]):not(code):not(pre) {
    font-family: Tahoma, Verdana, "Segoe UI", Arial, sans-serif !important;
    word-spacing: .2em !important;
    line-height: 1.9 !important;
}
html.a11y-dyslexia body p:not(.a11y-root *),
html.a11y-dyslexia body li:not(.a11y-root *) { font-weight: 500 !important; }

/* تباين عالٍ */
html.a11y-contrast { background: #000 !important; }
html.a11y-contrast body *:not(.a11y-root):not(.a11y-root *) { -webkit-text-fill-color: currentColor !important; }
html.a11y-contrast body,
html.a11y-contrast body *:not(.a11y-root):not(.a11y-root *):not(img):not(video):not(iframe):not(svg):not(svg *) {
    background-color: #000 !important;
    background-image: none !important;
    color: #fff !important;
    border-color: #fff !important;
    text-shadow: none !important;
    box-shadow: none !important;
}
html.a11y-contrast body a:not(.a11y-root *),
html.a11y-contrast body a:not(.a11y-root *) * { color: #ffe14d !important; }
html.a11y-contrast body button:not(.a11y-root *),
html.a11y-contrast body .btn:not(.a11y-root *) { border: 2px solid #fff !important; }
html.a11y-contrast body input:not(.a11y-root *),
html.a11y-contrast body textarea:not(.a11y-root *),
html.a11y-contrast body select:not(.a11y-root *) { border: 2px solid #fff !important; }
html.a11y-contrast body *::before,
html.a11y-contrast body *::after { background-image: none !important; }
html.a11y-contrast body svg:not(.a11y-root svg) { color: #fff; }

/* إبراز الروابط */
html.a11y-links body a:not(.a11y-root *),
html.a11y-links body button:not(.a11y-root *),
html.a11y-links body [role="button"]:not(.a11y-root *),
html.a11y-links body .btn:not(.a11y-root *) {
    outline: 3px solid #ffbf00 !important;
    outline-offset: 2px !important;
    text-decoration: underline !important;
    text-underline-offset: 4px !important;
}
html.a11y-links body a:not(.a11y-root *):hover,
html.a11y-links body a:not(.a11y-root *):focus { background-color: #ffbf00 !important; color: #000 !important; }

/* إيقاف الحركة — مدة شبه صفرية بدل none حتى تصل العناصر لحالتها النهائية */
html.a11y-motion *,
html.a11y-motion *::before,
html.a11y-motion *::after {
    animation-duration: .001ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    transition-delay: 0s !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='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M6 3l34 17-14 4-6 16z' fill='%23000' stroke='%23fff' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") 6 3, auto !important;
}
html.a11y-cursor a, html.a11y-cursor a *,
html.a11y-cursor button, html.a11y-cursor button *,
html.a11y-cursor [role="button"], html.a11y-cursor label, html.a11y-cursor 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 3l34 17-14 4-6 16z' fill='%231d6fe0' stroke='%23fff' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") 6 3, pointer !important;
}

/* قارئ النصوص */
html.a11y-reader body *:not(.a11y-root *) { cursor: help; }
.a11y-reading {
    outline: 3px solid #1d6fe0 !important;
    outline-offset: 3px !important;
    background-color: rgba(29, 111, 224, .12) !important;
    border-radius: 4px;
}
html.a11y-contrast .a11y-reading { background-color: #1d3a66 !important; }
