/* ===================================================================
   תפריט נגישות — כל רעב ממנו יאכל
   ===================================================================
   נבנה לפי תקן ישראלי 5568, שמאמץ את WCAG 2.0 ברמה AA.
   הכפתור והפאנל חיים מחוץ לשאר התוכן (body > .a11y-root), ולכן
   מסנני הצבע שמופעלים כאן לא נוגעים בהם ולא שוברים אלמנטים
   קבועים כמו ההידר או הכפתור הצף. */

.a11y-root { position: fixed; z-index: 1000; bottom: 0; right: 0; }

/* ----------------------------- הכפתור ----------------------------- */
.a11y-toggle {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  /* 17.9.2026: הוקטן מ-52 ל-44 — עדיין מעל 44x44, המינימום הנגיש למגע */
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 253, 249, .28);
  border-radius: 50%;
  background: #431F10;
  color: #FFFDF9;
  box-shadow: 0 8px 22px rgba(67, 31, 16, .28);
  cursor: pointer;
  transition: transform .2s ease, background-color .2s ease;
}
.a11y-toggle:hover { transform: translateY(-2px); background: #5a2c17; }
.a11y-toggle svg { width: 22px; height: 22px; }
.a11y-toggle:focus-visible { outline: 3px solid #F16A2C; outline-offset: 3px; }

/* ------------------------------ הפאנל ------------------------------ */
.a11y-panel {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: calc(max(20px, env(safe-area-inset-bottom)) + 64px);
  width: min(310px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 120px));
  overflow-y: auto;
  padding: 16px;
  border: 1px solid #E4D8CC;
  border-radius: 18px;
  background: #FFFDF9;
  color: #431F10;
  box-shadow: 0 18px 50px rgba(67, 31, 16, .22);
  font-family: 'Afek', Arial, sans-serif;
  text-align: right;
}
.a11y-panel[hidden] { display: none; }

.a11y-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.a11y-head h2 { margin: 0; font-size: 17px; font-weight: 800; }
.a11y-close {
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 1px solid #E4D8CC; border-radius: 9px; background: #fff; color: #431F10; cursor: pointer;
}
.a11y-close:hover { background: #F7EFE6; }

.a11y-group { margin-bottom: 12px; }
.a11y-group h3 { margin: 0 0 7px; font-size: 13px; font-weight: 700; color: #7A6154; }

.a11y-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.a11y-list { display: grid; gap: 6px; }

.a11y-option {
  display: flex; align-items: center; gap: 9px;
  width: 100%; min-height: 42px; padding: 8px 11px;
  border: 1px solid #E4D8CC; border-radius: 11px;
  background: #fff; color: #431F10;
  font: 600 14px/1.25 'Afek', Arial, sans-serif;
  text-align: right; text-decoration: none; cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.a11y-option:hover { border-color: #C9A98F; background: #FBF5EE; }
.a11y-option svg { flex: none; width: 18px; height: 18px; }
.a11y-option[aria-pressed="true"] { border-color: #F16A2C; background: #FFF1E7; color: #A23F12; }
.a11y-row .a11y-option { justify-content: center; padding-inline: 4px; font-size: 13px; }
/* תצוגת האחוזים היא קריאה בלבד, ולכן היא לא נראית ככפתור. */
.a11y-zoom-value {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 42px;
  color: #431F10; font: 700 13px/1.25 'Afek', Arial, sans-serif;
}

.a11y-panel :is(button, a):focus-visible { outline: 3px solid #F16A2C; outline-offset: 2px; }
.a11y-note { margin: 10px 0 0; font-size: 12px; line-height: 1.45; color: #7A6154; }
.a11y-note a { color: #A23F12; }

/* ===================================================================
   ההגדרות עצמן — חלות על התוכן, לא על התפריט
   =================================================================== */

/* --- גווני אפור / היפוך צבעים ---
   המסנן מוחל על ילדי body ולא על html, כדי ש-position:fixed
   לא יאבד את נקודת הייחוס שלו וההידר הדביק ימשיך לעבוד. */
html.a11y-grayscale body > *:not(.a11y-root) { filter: grayscale(1); }
html.a11y-invert body > *:not(.a11y-root) { filter: invert(1) hue-rotate(180deg); }

/* --- ניגודיות גבוהה: כהה --- */
html.a11y-contrast body > *:not(.a11y-root),
html.a11y-contrast body > *:not(.a11y-root) * {
  background-color: #000 !important;
  background-image: none !important;
  color: #FFF !important;
  border-color: #FFF !important;
  text-shadow: none !important;
  box-shadow: none !important;
  /* הכותרות הכתומות צבועות בגרדיאנט שנחתך לטקסט, ולכן צבע הטקסט שלהן
     שקוף. בלי האיפוס הזה הן היו נעלמות לגמרי במצב ניגודיות גבוהה. */
  -webkit-text-fill-color: currentColor !important;
  background-clip: border-box !important;
}
html.a11y-contrast body > *:not(.a11y-root) :is(a, a *) { color: #FFE500 !important; }
html.a11y-contrast body > *:not(.a11y-root) :is(button, .cta-btn, .ft-btn, .donate-pill) { border: 2px solid #FFF !important; }
html.a11y-contrast body > *:not(.a11y-root) :is(img, video, iframe) { filter: grayscale(1) contrast(1.1); }
html.a11y-contrast body > *:not(.a11y-root) svg { fill: none !important; stroke: #FFF !important; }

/* --- ניגודיות גבוהה: בהיר --- */
html.a11y-contrast-light body > *:not(.a11y-root),
html.a11y-contrast-light body > *:not(.a11y-root) * {
  background-color: #FFF !important;
  background-image: none !important;
  color: #000 !important;
  border-color: #000 !important;
  text-shadow: none !important;
  box-shadow: none !important;
  -webkit-text-fill-color: currentColor !important;
  background-clip: border-box !important;
}
html.a11y-contrast-light body > *:not(.a11y-root) :is(a, a *) { color: #00307A !important; }
html.a11y-contrast-light body > *:not(.a11y-root) svg { fill: none !important; stroke: #000 !important; }

/* --- הדגשת קישורים --- */
html.a11y-links body > *:not(.a11y-root) a {
  text-decoration: underline !important;
  text-underline-offset: 3px;
  outline: 1px dashed currentColor;
  outline-offset: 2px;
}

/* כפתור התפריט בעמודים הפנימיים מצויר כתמונת רקע, ושתי מצבי הניגודיות
   מבטלים תמונות רקע. כאן מוחזר ה-path המקורי שבתוך ה-SVG. */
html.a11y-contrast .nav-toggle-icon path,
html.a11y-contrast-light .nav-toggle-icon path { display: inline !important; }

/* --- גופן קריא --- */
html.a11y-readable body > *:not(.a11y-root),
html.a11y-readable body > *:not(.a11y-root) * {
  font-family: Arial, 'Assistant', sans-serif !important;
  letter-spacing: normal !important;
}
/* הכותרות בגרדיאנט חוזרות לצבע הטקסט של ההורה שלהן: לבן על רקע כהה,
   חום על הקרם. כך הן נשארות קריאות גם במצב גופן קריא, בלי לקבע צבע
   אחד שלא מתאים לכל הרקעים. */
html.a11y-readable body > *:not(.a11y-root) :is(
  .is-accent, .accent, .grad, .deco-script, .ft-btn-label,
  .about-first-new__caption h2, .act-stat b, .act-note h2,
  .dj-intro-headline em, .dj-headline em, .dj-impact strong,
  .dj-headline .dj-final-mark, .dj-stop.is-current .dj-stop-label, .dj-donate strong,
  .donation-title > span:last-child, .roei-story-title, .give-title .is-blue,
  .faq-group-heading h2, .transparency-documents h2
) {
  background: none !important;
  background-clip: border-box !important;
  -webkit-background-clip: border-box !important;
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
}

/* --- ריווח שורות מוגדל --- */
html.a11y-spacing body > *:not(.a11y-root) :is(p, li, span, small, td, th, dd, dt, figcaption) {
  line-height: 1.8 !important;
  letter-spacing: .06em !important;
  word-spacing: .14em !important;
}

/* --- עצירת אנימציות --- */
html.a11y-still body > *:not(.a11y-root),
html.a11y-still body > *:not(.a11y-root) * {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
html.a11y-still .hero-pointer-art { display: none !important; }
/* הסרטונים נעצרים ב-a11y.js ולא מוסתרים כאן: הסתרה הייתה מוחקת תוכן. */

/* --- סמן גדול --- */
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='M8 4 8 38 16 30 21 43 28 40 23 27 34 27z' fill='%23fff' stroke='%23000' stroke-width='2.5' stroke-linejoin='round'/%3E%3C/svg%3E") 6 3, auto !important;
}

/* --- מיקוד מודגש בניווט מקלדת --- */
html.a11y-focus body > *:not(.a11y-root) :is(a, button, input, textarea, select, [tabindex]):focus {
  outline: 4px solid #F16A2C !important;
  outline-offset: 3px !important;
}

/* הכפתור הצף של פאנל העריכה מפנה מקום לכפתור הנגישות */
.editor-toggle { bottom: 86px !important; }

@media (max-width: 600px) {
  .a11y-toggle { width: 44px; height: 44px; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); }
  .a11y-toggle svg { width: 21px; height: 21px; }
  .a11y-panel { right: max(14px, env(safe-area-inset-right)); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 56px); }
}

@media print { .a11y-root { display: none; } }
